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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 348-353 sub GetFullSubscription { Link Here
348
            serial.serialseq,
348
            serial.serialseq,
349
            serial.planneddate, 
349
            serial.planneddate, 
350
            serial.publisheddate, 
350
            serial.publisheddate, 
351
            serial.publisheddatetext,
351
            serial.status, 
352
            serial.status, 
352
            serial.notes as notes,
353
            serial.notes as notes,
353
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
354
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 504-509 sub GetFullSubscriptionsFromBiblionumber { Link Here
504
            serial.serialseq,
505
            serial.serialseq,
505
            serial.planneddate, 
506
            serial.planneddate, 
506
            serial.publisheddate, 
507
            serial.publisheddate, 
508
            serial.publisheddatetext,
507
            serial.status, 
509
            serial.status, 
508
            serial.notes as notes,
510
            serial.notes as notes,
509
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
511
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 696-702 sub GetSerials { Link Here
696
    $count = 5 unless ($count);
698
    $count = 5 unless ($count);
697
    my @serials;
699
    my @serials;
698
    my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES, NOT_ISSUED ) );
700
    my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES, NOT_ISSUED ) );
699
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
701
    my $query = "SELECT serialid,serialseq, status, publisheddate,
702
        publisheddatetext, planneddate,notes, routingnotes
700
                        FROM   serial
703
                        FROM   serial
701
                        WHERE  subscriptionid = ? AND status NOT IN ( $statuses )
704
                        WHERE  subscriptionid = ? AND status NOT IN ( $statuses )
702
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
705
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 716-722 sub GetSerials { Link Here
716
    }
719
    }
717
720
718
    # OK, now add the last 5 issues arrives/missing
721
    # OK, now add the last 5 issues arrives/missing
719
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
722
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
723
        publisheddatetext, notes, routingnotes
720
       FROM     serial
724
       FROM     serial
721
       WHERE    subscriptionid = ?
725
       WHERE    subscriptionid = ?
722
       AND      status IN ( $statuses )
726
       AND      status IN ( $statuses )
Lines 765-771 sub GetSerials2 { Link Here
765
769
766
    my $dbh   = C4::Context->dbh;
770
    my $dbh   = C4::Context->dbh;
767
    my $query = qq|
771
    my $query = qq|
768
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
772
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
773
                    publisheddatetext, notes, routingnotes
769
                 FROM     serial 
774
                 FROM     serial 
770
                 WHERE    subscriptionid=$subscription AND status IN ($statuses_string)
775
                 WHERE    subscriptionid=$subscription AND status IN ($statuses_string)
771
                 ORDER BY publisheddate,serialid DESC
776
                 ORDER BY publisheddate,serialid DESC
Lines 1093-1099 sub ModSubscriptionHistory { Link Here
1093
1098
1094
=head2 ModSerialStatus
1099
=head2 ModSerialStatus
1095
1100
1096
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1101
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1102
        $publisheddatetext, $status, $notes);
1097
1103
1098
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1104
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1099
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1105
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1101-1107 Note : if we change from "waited" to something else,then we will have to create Link Here
1101
=cut
1107
=cut
1102
1108
1103
sub ModSerialStatus {
1109
sub ModSerialStatus {
1104
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1110
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1111
        $status, $notes) = @_;
1105
1112
1106
    return unless ($serialid);
1113
    return unless ($serialid);
1107
1114
Lines 1123-1131 sub ModSerialStatus { Link Here
1123
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1130
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1124
    } else {
1131
    } else {
1125
1132
1126
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1133
        my $query = '
1134
            UPDATE serial
1135
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1136
                planneddate = ?, status = ?, notes = ?
1137
            WHERE  serialid = ?
1138
        ';
1127
        $sth = $dbh->prepare($query);
1139
        $sth = $dbh->prepare($query);
1128
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1140
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1141
            $planneddate, $status, $notes, $serialid );
1129
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1142
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1130
        $sth   = $dbh->prepare($query);
1143
        $sth   = $dbh->prepare($query);
1131
        $sth->execute($subscriptionid);
1144
        $sth->execute($subscriptionid);
Lines 1529-1547 returns the serial id Link Here
1529
=cut
1542
=cut
1530
1543
1531
sub NewIssue {
1544
sub NewIssue {
1532
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1545
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1546
        $publisheddate, $publisheddatetext, $notes ) = @_;
1533
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1547
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1534
1548
1535
    return unless ($subscriptionid);
1549
    return unless ($subscriptionid);
1536
1550
1537
    my $dbh   = C4::Context->dbh;
1551
    my $dbh   = C4::Context->dbh;
1538
    my $query = qq|
1552
    my $query = qq|
1539
        INSERT INTO serial
1553
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1540
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1554
            publisheddate, publisheddatetext, planneddate, notes)
1541
        VALUES (?,?,?,?,?,?,?)
1555
        VALUES (?,?,?,?,?,?,?,?)
1542
    |;
1556
    |;
1543
    my $sth = $dbh->prepare($query);
1557
    my $sth = $dbh->prepare($query);
1544
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1558
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1559
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1545
    my $serialid = $dbh->{'mysql_insertid'};
1560
    my $serialid = $dbh->{'mysql_insertid'};
1546
    $query = qq|
1561
    $query = qq|
1547
        SELECT missinglist,recievedlist
1562
        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 1934-1939 CREATE TABLE `serial` ( -- issues related to subscriptions Link Here
1934
  `planneddate` date default NULL, -- date expected
1934
  `planneddate` date default NULL, -- date expected
1935
  `notes` text, -- notes
1935
  `notes` text, -- notes
1936
  `publisheddate` date default NULL, -- date published
1936
  `publisheddate` date default NULL, -- date published
1937
  publisheddatetext varchar(100) default NULL, -- date published (descriptive)
1937
  `claimdate` date default NULL, -- date claimed
1938
  `claimdate` date default NULL, -- date claimed
1938
  claims_count int(11) default 0, -- number of claims made related to this issue
1939
  claims_count int(11) default 0, -- number of claims made related to this issue
1939
  `routingnotes` text, -- notes from the routing list
1940
  `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 274-279 $(document).ready(function() { Link Here
274
            <th>Issue number</th>
274
            <th>Issue number</th>
275
            <th>Planned date</th>
275
            <th>Planned date</th>
276
            <th>Published date</th>
276
            <th>Published date</th>
277
            <th>Published date (text)</th>
277
            <th>Status</th>
278
            <th>Status</th>
278
        </tr>
279
        </tr>
279
        [% FOREACH serialslis IN serialslist %]
280
        [% FOREACH serialslis IN serialslist %]
Lines 296-301 $(document).ready(function() { Link Here
296
                    [% END %]
297
                    [% END %]
297
                </td>
298
                </td>
298
                <td>
299
                <td>
300
                    [% serialslis.publisheddatetext || serialslis.publisheddate %]
301
                </td>
302
                <td>
299
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
303
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
300
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
304
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
301
                    [% IF ( serialslis.status3 ) %]Late[% END %]
305
                    [% 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