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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 315-320 sub GetFullSubscription { Link Here
315
            serial.serialseq,
315
            serial.serialseq,
316
            serial.planneddate, 
316
            serial.planneddate, 
317
            serial.publisheddate, 
317
            serial.publisheddate, 
318
            serial.publisheddatetext,
318
            serial.status, 
319
            serial.status, 
319
            serial.notes as notes,
320
            serial.notes as notes,
320
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
321
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 471-476 sub GetFullSubscriptionsFromBiblionumber { Link Here
471
            serial.serialseq,
472
            serial.serialseq,
472
            serial.planneddate, 
473
            serial.planneddate, 
473
            serial.publisheddate, 
474
            serial.publisheddate, 
475
            serial.publisheddatetext,
474
            serial.status, 
476
            serial.status, 
475
            serial.notes as notes,
477
            serial.notes as notes,
476
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
478
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 714-720 sub GetSerials { Link Here
714
    my $counter = 0;
716
    my $counter = 0;
715
    $count = 5 unless ($count);
717
    $count = 5 unless ($count);
716
    my @serials;
718
    my @serials;
717
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
719
    my $query = "SELECT serialid,serialseq, status, publisheddate,
720
        publisheddatetext, planneddate,notes, routingnotes
718
                        FROM   serial
721
                        FROM   serial
719
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
722
                        WHERE  subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5)
720
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
723
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 734-740 sub GetSerials { Link Here
734
    }
737
    }
735
738
736
    # OK, now add the last 5 issues arrives/missing
739
    # OK, now add the last 5 issues arrives/missing
737
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
740
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
741
        publisheddatetext, notes, routingnotes
738
       FROM     serial
742
       FROM     serial
739
       WHERE    subscriptionid = ?
743
       WHERE    subscriptionid = ?
740
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
744
       AND      (status in (2, 4, 41, 42, 43, 44, 5))
Lines 779-785 sub GetSerials2 { Link Here
779
783
780
    my $dbh   = C4::Context->dbh;
784
    my $dbh   = C4::Context->dbh;
781
    my $query = qq|
785
    my $query = qq|
782
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
786
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
787
                    publisheddatetext, notes, routingnotes
783
                 FROM     serial 
788
                 FROM     serial 
784
                 WHERE    subscriptionid=$subscription AND status IN ($status)
789
                 WHERE    subscriptionid=$subscription AND status IN ($status)
785
                 ORDER BY publisheddate,serialid DESC
790
                 ORDER BY publisheddate,serialid DESC
Lines 1105-1111 sub ModSubscriptionHistory { Link Here
1105
1110
1106
=head2 ModSerialStatus
1111
=head2 ModSerialStatus
1107
1112
1108
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1113
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1114
        $publisheddatetext, $status, $notes);
1109
1115
1110
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1116
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1111
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1117
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1113-1119 Note : if we change from "waited" to something else,then we will have to create Link Here
1113
=cut
1119
=cut
1114
1120
1115
sub ModSerialStatus {
1121
sub ModSerialStatus {
1116
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1122
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1123
        $status, $notes) = @_;
1117
1124
1118
    return unless ($serialid);
1125
    return unless ($serialid);
1119
1126
Lines 1135-1143 sub ModSerialStatus { Link Here
1135
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1142
        DelIssue( { 'serialid' => $serialid, 'subscriptionid' => $subscriptionid, 'serialseq' => $serialseq } );
1136
    } else {
1143
    } else {
1137
1144
1138
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1145
        my $query = '
1146
            UPDATE serial
1147
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1148
                planneddate = ?, status = ?, notes = ?
1149
            WHERE  serialid = ?
1150
        ';
1139
        $sth = $dbh->prepare($query);
1151
        $sth = $dbh->prepare($query);
1140
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1152
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1153
            $planneddate, $status, $notes, $serialid );
1141
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1154
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1142
        $sth   = $dbh->prepare($query);
1155
        $sth   = $dbh->prepare($query);
1143
        $sth->execute($subscriptionid);
1156
        $sth->execute($subscriptionid);
Lines 1542-1560 returns the serial id Link Here
1542
=cut
1555
=cut
1543
1556
1544
sub NewIssue {
1557
sub NewIssue {
1545
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1558
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1559
        $publisheddate, $publisheddatetext, $notes ) = @_;
1546
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1560
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1547
1561
1548
    return unless ($subscriptionid);
1562
    return unless ($subscriptionid);
1549
1563
1550
    my $dbh   = C4::Context->dbh;
1564
    my $dbh   = C4::Context->dbh;
1551
    my $query = qq|
1565
    my $query = qq|
1552
        INSERT INTO serial
1566
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1553
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1567
            publisheddate, publisheddatetext, planneddate, notes)
1554
        VALUES (?,?,?,?,?,?,?)
1568
        VALUES (?,?,?,?,?,?,?,?)
1555
    |;
1569
    |;
1556
    my $sth = $dbh->prepare($query);
1570
    my $sth = $dbh->prepare($query);
1557
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1571
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1572
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1558
    my $serialid = $dbh->{'mysql_insertid'};
1573
    my $serialid = $dbh->{'mysql_insertid'};
1559
    $query = qq|
1574
    $query = qq|
1560
        SELECT missinglist,recievedlist
1575
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1965-1970 CREATE TABLE `serial` ( Link Here
1965
  `planneddate` date default NULL,
1965
  `planneddate` date default NULL,
1966
  `notes` text,
1966
  `notes` text,
1967
  `publisheddate` date default NULL,
1967
  `publisheddate` date default NULL,
1968
  publisheddatetext varchar(100) default NULL,
1968
  `claimdate` date default NULL,
1969
  `claimdate` date default NULL,
1969
  claims_count int(11) default 0,
1970
  claims_count int(11) default 0,
1970
  `routingnotes` text,
1971
  `routingnotes` text,
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 9759-9764 if ( CheckVersion($DBversion) ) { Link Here
9759
    SetVersion ($DBversion);
9759
    SetVersion ($DBversion);
9760
}
9760
}
9761
9761
9762
$DBversion = "XXX";
9763
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
9764
    $dbh->do("
9765
        ALTER TABLE serial
9766
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
9767
          AFTER publisheddate
9768
    ");
9769
9770
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
9771
    SetVersion($DBversion);
9772
}
9773
9774
9762
=head1 FUNCTIONS
9775
=head1 FUNCTIONS
9763
9776
9764
=head2 TableExists($table)
9777
=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/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 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 229-234 if ( $op and $op eq 'serialchangestatus' ) { Link Here
229
                    $status[$i],
231
                    $status[$i],
230
                    $plan_date,
232
                    $plan_date,
231
                    $pub_date,
233
                    $pub_date,
234
                    $publisheddatetexts[$i],
232
                    $notes[$i]
235
                    $notes[$i]
233
                );
236
                );
234
            }
237
            }
Lines 239-244 if ( $op and $op eq 'serialchangestatus' ) { Link Here
239
                $serialseqs[$i],
242
                $serialseqs[$i],
240
                $plan_date,
243
                $plan_date,
241
                $pub_date,
244
                $pub_date,
245
                $publisheddatetexts[$i],
242
                $status[$i],
246
                $status[$i],
243
                $notes[$i]
247
                $notes[$i]
244
            );
248
            );
245
- 

Return to bug 8296