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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 373-378 sub GetFullSubscription { Link Here
373
            serial.serialseq,
373
            serial.serialseq,
374
            serial.planneddate, 
374
            serial.planneddate, 
375
            serial.publisheddate, 
375
            serial.publisheddate, 
376
            serial.publisheddatetext,
376
            serial.status, 
377
            serial.status, 
377
            serial.notes as notes,
378
            serial.notes as notes,
378
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
379
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 529-534 sub GetFullSubscriptionsFromBiblionumber { Link Here
529
            serial.serialseq,
530
            serial.serialseq,
530
            serial.planneddate, 
531
            serial.planneddate, 
531
            serial.publisheddate, 
532
            serial.publisheddate, 
533
            serial.publisheddatetext,
532
            serial.status, 
534
            serial.status, 
533
            serial.notes as notes,
535
            serial.notes as notes,
534
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
536
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 772-778 sub GetSerials { Link Here
772
    my $counter = 0;
774
    my $counter = 0;
773
    $count = 5 unless ($count);
775
    $count = 5 unless ($count);
774
    my @serials;
776
    my @serials;
775
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
777
    my $query = "SELECT serialid,serialseq, status, publisheddate,
778
        publisheddatetext, planneddate,notes, routingnotes
776
                        FROM   serial
779
                        FROM   serial
777
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
780
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
778
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
781
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 792-798 sub GetSerials { Link Here
792
    }
795
    }
793
796
794
    # OK, now add the last 5 issues arrives/missing
797
    # OK, now add the last 5 issues arrives/missing
795
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
798
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
799
        publisheddatetext, notes, routingnotes
796
       FROM     serial
800
       FROM     serial
797
       WHERE    subscriptionid = ?
801
       WHERE    subscriptionid = ?
798
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
802
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
Lines 837-843 sub GetSerials2 { Link Here
837
841
838
    my $dbh   = C4::Context->dbh;
842
    my $dbh   = C4::Context->dbh;
839
    my $query = qq|
843
    my $query = qq|
840
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
844
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
845
                    publisheddatetext, notes, routingnotes
841
                 FROM     serial 
846
                 FROM     serial 
842
                 WHERE    subscriptionid=$subscription AND status IN ($status)
847
                 WHERE    subscriptionid=$subscription AND status IN ($status)
843
                 ORDER BY publisheddate,serialid DESC
848
                 ORDER BY publisheddate,serialid DESC
Lines 1163-1169 sub ModSubscriptionHistory { Link Here
1163
1168
1164
=head2 ModSerialStatus
1169
=head2 ModSerialStatus
1165
1170
1166
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1171
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1172
        $publisheddatetext, $status, $notes);
1167
1173
1168
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1174
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1169
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1175
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1171-1177 Note : if we change from "waited" to something else,then we will have to create Link Here
1171
=cut
1177
=cut
1172
1178
1173
sub ModSerialStatus {
1179
sub ModSerialStatus {
1174
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1180
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1181
        $status, $notes) = @_;
1175
1182
1176
    return unless ($serialid);
1183
    return unless ($serialid);
1177
1184
Lines 1193-1201 sub ModSerialStatus { Link Here
1193
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1200
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1194
    } else {
1201
    } else {
1195
1202
1196
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1203
        my $query = '
1204
            UPDATE serial
1205
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1206
                planneddate = ?, status = ?, notes = ?
1207
            WHERE  serialid = ?
1208
        ';
1197
        $sth = $dbh->prepare($query);
1209
        $sth = $dbh->prepare($query);
1198
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1210
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1211
            $planneddate, $status, $notes, $serialid );
1199
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1212
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1200
        $sth   = $dbh->prepare($query);
1213
        $sth   = $dbh->prepare($query);
1201
        $sth->execute($subscriptionid);
1214
        $sth->execute($subscriptionid);
Lines 1600-1618 returns the serial id Link Here
1600
=cut
1613
=cut
1601
1614
1602
sub NewIssue {
1615
sub NewIssue {
1603
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1616
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1617
        $publisheddate, $publisheddatetext, $notes ) = @_;
1604
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1618
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1605
1619
1606
    return unless ($subscriptionid);
1620
    return unless ($subscriptionid);
1607
1621
1608
    my $dbh   = C4::Context->dbh;
1622
    my $dbh   = C4::Context->dbh;
1609
    my $query = qq|
1623
    my $query = qq|
1610
        INSERT INTO serial
1624
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1611
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1625
            publisheddate, publisheddatetext, planneddate, notes)
1612
        VALUES (?,?,?,?,?,?,?)
1626
        VALUES (?,?,?,?,?,?,?,?)
1613
    |;
1627
    |;
1614
    my $sth = $dbh->prepare($query);
1628
    my $sth = $dbh->prepare($query);
1615
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1629
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1630
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1616
    my $serialid = $dbh->{'mysql_insertid'};
1631
    my $serialid = $dbh->{'mysql_insertid'};
1617
    $query = qq|
1632
    $query = qq|
1618
        SELECT missinglist,recievedlist
1633
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1939-1944 CREATE TABLE `serial` ( Link Here
1939
  `planneddate` date default NULL,
1939
  `planneddate` date default NULL,
1940
  `notes` text,
1940
  `notes` text,
1941
  `publisheddate` date default NULL,
1941
  `publisheddate` date default NULL,
1942
  publisheddatetext varchar(100) default NULL,
1942
  `claimdate` date default NULL,
1943
  `claimdate` date default NULL,
1943
  claims_count int(11) default 0,
1944
  claims_count int(11) default 0,
1944
  `routingnotes` text,
1945
  `routingnotes` text,
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 8891-8896 if ( CheckVersion($DBversion) ) { Link Here
8891
    SetVersion($DBversion);
8891
    SetVersion($DBversion);
8892
}
8892
}
8893
8893
8894
$DBversion = "XXX";
8895
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
8896
    $dbh->do("
8897
        ALTER TABLE serial
8898
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
8899
          AFTER publisheddate
8900
    ");
8901
8902
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
8903
    SetVersion($DBversion);
8904
}
8905
8906
8894
=head1 FUNCTIONS
8907
=head1 FUNCTIONS
8895
8908
8896
=head2 TableExists($table)
8909
=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 145-150 $(document).ready(function() { Link Here
145
	<tr>
145
	<tr>
146
		<th>Numbered</th>
146
		<th>Numbered</th>
147
		<th>Published on</th>
147
		<th>Published on</th>
148
        <th>Published on (text)</th>
148
		<th>Expected on</th>
149
		<th>Expected on</th>
149
		<th>Status</th>
150
		<th>Status</th>
150
		<th>Notes</th>
151
		<th>Notes</th>
Lines 166-171 $(document).ready(function() { Link Here
166
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" class="datepicker" />
167
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" class="datepicker" />
167
        </td>
168
        </td>
168
        <td>
169
        <td>
170
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
171
        </td>
172
        <td>
169
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" class="datepicker" />
173
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" class="datepicker" />
170
        </td>
174
        </td>
171
        <td>
175
        <td>
Lines 320-325 $(document).ready(function() { Link Here
320
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15"  class="datepicker" />
324
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15"  class="datepicker" />
321
        </td>
325
        </td>
322
        <td>
326
        <td>
327
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
328
        </td>
329
        <td>
323
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" class="datepicker" />
330
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" class="datepicker" />
324
        </td>
331
        </td>
325
        <td>
332
        <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