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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 369-374 sub GetFullSubscription { Link Here
369
            serial.serialseq,
369
            serial.serialseq,
370
            serial.planneddate, 
370
            serial.planneddate, 
371
            serial.publisheddate, 
371
            serial.publisheddate, 
372
            serial.publisheddatetext,
372
            serial.status, 
373
            serial.status, 
373
            serial.notes as notes,
374
            serial.notes as notes,
374
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
375
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 525-530 sub GetFullSubscriptionsFromBiblionumber { Link Here
525
            serial.serialseq,
526
            serial.serialseq,
526
            serial.planneddate, 
527
            serial.planneddate, 
527
            serial.publisheddate, 
528
            serial.publisheddate, 
529
            serial.publisheddatetext,
528
            serial.status, 
530
            serial.status, 
529
            serial.notes as notes,
531
            serial.notes as notes,
530
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
532
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 768-774 sub GetSerials { Link Here
768
    my $counter = 0;
770
    my $counter = 0;
769
    $count = 5 unless ($count);
771
    $count = 5 unless ($count);
770
    my @serials;
772
    my @serials;
771
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
773
    my $query = "SELECT serialid,serialseq, status, publisheddate,
774
        publisheddatetext, planneddate,notes, routingnotes
772
                        FROM   serial
775
                        FROM   serial
773
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
776
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
774
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
777
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 788-794 sub GetSerials { Link Here
788
    }
791
    }
789
792
790
    # OK, now add the last 5 issues arrives/missing
793
    # OK, now add the last 5 issues arrives/missing
791
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
794
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
795
        publisheddatetext, notes, routingnotes
792
       FROM     serial
796
       FROM     serial
793
       WHERE    subscriptionid = ?
797
       WHERE    subscriptionid = ?
794
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
798
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
Lines 833-839 sub GetSerials2 { Link Here
833
837
834
    my $dbh   = C4::Context->dbh;
838
    my $dbh   = C4::Context->dbh;
835
    my $query = qq|
839
    my $query = qq|
836
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
840
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
841
                    publisheddatetext, notes, routingnotes
837
                 FROM     serial 
842
                 FROM     serial 
838
                 WHERE    subscriptionid=$subscription AND status IN ($status)
843
                 WHERE    subscriptionid=$subscription AND status IN ($status)
839
                 ORDER BY publisheddate,serialid DESC
844
                 ORDER BY publisheddate,serialid DESC
Lines 1159-1165 sub ModSubscriptionHistory { Link Here
1159
1164
1160
=head2 ModSerialStatus
1165
=head2 ModSerialStatus
1161
1166
1162
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1167
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1168
        $publisheddatetext, $status, $notes);
1163
1169
1164
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1170
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1165
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1171
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1167-1173 Note : if we change from "waited" to something else,then we will have to create Link Here
1167
=cut
1173
=cut
1168
1174
1169
sub ModSerialStatus {
1175
sub ModSerialStatus {
1170
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1176
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1177
        $status, $notes) = @_;
1171
1178
1172
    return unless ($serialid);
1179
    return unless ($serialid);
1173
1180
Lines 1189-1197 sub ModSerialStatus { Link Here
1189
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1196
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1190
    } else {
1197
    } else {
1191
1198
1192
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1199
        my $query = '
1200
            UPDATE serial
1201
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1202
                planneddate = ?, status = ?, notes = ?
1203
            WHERE  serialid = ?
1204
        ';
1193
        $sth = $dbh->prepare($query);
1205
        $sth = $dbh->prepare($query);
1194
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1206
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1207
            $planneddate, $status, $notes, $serialid );
1195
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1208
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1196
        $sth   = $dbh->prepare($query);
1209
        $sth   = $dbh->prepare($query);
1197
        $sth->execute($subscriptionid);
1210
        $sth->execute($subscriptionid);
Lines 1596-1614 returns the serial id Link Here
1596
=cut
1609
=cut
1597
1610
1598
sub NewIssue {
1611
sub NewIssue {
1599
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1612
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1613
        $publisheddate, $publisheddatetext, $notes ) = @_;
1600
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1614
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1601
1615
1602
    return unless ($subscriptionid);
1616
    return unless ($subscriptionid);
1603
1617
1604
    my $dbh   = C4::Context->dbh;
1618
    my $dbh   = C4::Context->dbh;
1605
    my $query = qq|
1619
    my $query = qq|
1606
        INSERT INTO serial
1620
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1607
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1621
            publisheddate, publisheddatetext, planneddate, notes)
1608
        VALUES (?,?,?,?,?,?,?)
1622
        VALUES (?,?,?,?,?,?,?,?)
1609
    |;
1623
    |;
1610
    my $sth = $dbh->prepare($query);
1624
    my $sth = $dbh->prepare($query);
1611
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1625
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1626
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1612
    my $serialid = $dbh->{'mysql_insertid'};
1627
    my $serialid = $dbh->{'mysql_insertid'};
1613
    $query = qq|
1628
    $query = qq|
1614
        SELECT missinglist,recievedlist
1629
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1934-1939 CREATE TABLE `serial` ( Link Here
1934
  `planneddate` date default NULL,
1934
  `planneddate` date default NULL,
1935
  `notes` text,
1935
  `notes` text,
1936
  `publisheddate` date default NULL,
1936
  `publisheddate` date default NULL,
1937
  publisheddatetext varchar(100) default NULL,
1937
  `claimdate` date default NULL,
1938
  `claimdate` date default NULL,
1938
  `routingnotes` text,
1939
  `routingnotes` text,
1939
  PRIMARY KEY  (`serialid`)
1940
  PRIMARY KEY  (`serialid`)
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 8560-8565 if ( CheckVersion($DBversion) ) { Link Here
8560
    SetVersion($DBversion);
8560
    SetVersion($DBversion);
8561
}
8561
}
8562
8562
8563
$DBversion = "XXX";
8564
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
8565
    $dbh->do("
8566
        ALTER TABLE serial
8567
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
8568
          AFTER publisheddate
8569
    ");
8570
8571
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
8572
    SetVersion($DBversion);
8573
}
8574
8575
8563
=head1 FUNCTIONS
8576
=head1 FUNCTIONS
8564
8577
8565
=head2 TableExists($table)
8578
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+14 lines)
Lines 201-206 $(document).ready(function() { Link Here
201
[% END %]
201
[% END %]
202
                <th class="title-string">Date published
202
                <th class="title-string">Date published
203
                </th>
203
                </th>
204
                <th class="title-string">Date published (text)
205
                </th>
204
                <th class="title-string">Date received
206
                <th class="title-string">Date received
205
                </th>
207
                </th>
206
                <th>Number
208
                <th>Number
Lines 247-252 $(document).ready(function() { Link Here
247
                    </span>
249
                    </span>
248
                </td>
250
                </td>
249
                <td>
251
                <td>
252
                    [% publisheddatetext = serial.publisheddatetext || serial.publisheddate %]
253
                    <span title="[% publisheddatetext %]">
254
                      [% IF serial.publisheddatetext %]
255
                        [% publisheddatetext %]
256
                      [% ELSIF serial.publisheddate %]
257
                        [% serial.publisheddate | $KohaDates %]
258
                      [% ELSE %]
259
                        Unknown
260
                      [% END %]
261
                    </span>
262
                </td>
263
                <td>
250
                    <span title="[% serial.planneddate %]">
264
                    <span title="[% serial.planneddate %]">
251
                      [% IF serial.planneddate %]
265
                      [% IF serial.planneddate %]
252
                        [% serial.planneddate | $KohaDates %]
266
                        [% serial.planneddate | $KohaDates %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 142-147 $(document).ready(function() { Link Here
142
	<tr>
142
	<tr>
143
		<th>Numbered</th>
143
		<th>Numbered</th>
144
		<th>Published on</th>
144
		<th>Published on</th>
145
        <th>Published on (text)</th>
145
		<th>Expected on</th>
146
		<th>Expected on</th>
146
		<th>Status</th>
147
		<th>Status</th>
147
		<th>Notes</th>
148
		<th>Notes</th>
Lines 163-168 $(document).ready(function() { Link Here
163
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
164
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
164
        </td>
165
        </td>
165
        <td>
166
        <td>
167
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
168
        </td>
169
        <td>
166
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
170
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
167
        </td>
171
        </td>
168
        <td>
172
        <td>
Lines 305-310 $(document).ready(function() { Link Here
305
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
309
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
306
        </td>
310
        </td>
307
        <td>
311
        <td>
312
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
313
        </td>
314
        <td>
308
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
315
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
309
        </td>
316
        </td>
310
        <td>
317
        <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/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt (+2 lines)
Lines 188-193 function showlayer(numlayer){ Link Here
188
	    <thead>
188
	    <thead>
189
		<tr>
189
		<tr>
190
		    <th>Date</th>
190
		    <th>Date</th>
191
		    <th>Date (text)</th>
191
		    <th>Library</th>
192
		    <th>Library</th>
192
		    <th>Notes</th>
193
		    <th>Notes</th>
193
		    <th>Date received</th>
194
		    <th>Date received</th>
Lines 206-211 function showlayer(numlayer){ Link Here
206
                    &nbsp;
207
                    &nbsp;
207
                [% END %]
208
                [% END %]
208
            </td>
209
            </td>
210
            <td>[% serial.publisheddatetext || serial.publisheddate %]</td>
209
            <td class="libraryfilterclass">    [% serial.branchcode %]
211
            <td class="libraryfilterclass">    [% serial.branchcode %]
210
		    </td>
212
		    </td>
211
		    <td>    [% serial.notes %]
213
		    <td>    [% serial.notes %]
(-)a/misc/cronjobs/serialsUpdate.pl (-1 / +1 lines)
Lines 128-134 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
128
            {
128
            {
129
                $confirm
129
                $confirm
130
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
130
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
131
                    $issue->{planneddate}, $issue->{publisheddate},
131
                    $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
132
                    3, $note );
132
                    3, $note );
133
                $verbose
133
                $verbose
134
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
134
                  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 81-86 my @serialids = $query->param('serialid'); Link Here
81
my @serialseqs      = $query->param('serialseq');
81
my @serialseqs      = $query->param('serialseq');
82
my @planneddates    = $query->param('planneddate');
82
my @planneddates    = $query->param('planneddate');
83
my @publisheddates  = $query->param('publisheddate');
83
my @publisheddates  = $query->param('publisheddate');
84
my @publisheddates  = $query->param('publisheddate');
85
my @publisheddatetexts = $query->param('publisheddatetext');
84
my @status          = $query->param('status');
86
my @status          = $query->param('status');
85
my @notes           = $query->param('notes');
87
my @notes           = $query->param('notes');
86
my @subscriptionids = $query->param('subscriptionid');
88
my @subscriptionids = $query->param('subscriptionid');
Lines 228-233 if ( $op and $op eq 'serialchangestatus' ) { Link Here
228
                    $status[$i],
230
                    $status[$i],
229
                    $plan_date,
231
                    $plan_date,
230
                    $pub_date,
232
                    $pub_date,
233
                    $publisheddatetexts[$i],
231
                    $notes[$i]
234
                    $notes[$i]
232
                );
235
                );
233
            }
236
            }
Lines 238-243 if ( $op and $op eq 'serialchangestatus' ) { Link Here
238
                $serialseqs[$i],
241
                $serialseqs[$i],
239
                $plan_date,
242
                $plan_date,
240
                $pub_date,
243
                $pub_date,
244
                $publisheddatetexts[$i],
241
                $status[$i],
245
                $status[$i],
242
                $notes[$i]
246
                $notes[$i]
243
            );
247
            );
244
- 

Return to bug 8296