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

(-)a/C4/Serials.pm (-12 / +27 lines)
Lines 368-373 sub GetFullSubscription { Link Here
368
            serial.serialseq,
368
            serial.serialseq,
369
            serial.planneddate, 
369
            serial.planneddate, 
370
            serial.publisheddate, 
370
            serial.publisheddate, 
371
            serial.publisheddatetext,
371
            serial.status, 
372
            serial.status, 
372
            serial.notes as notes,
373
            serial.notes as notes,
373
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
374
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 522-527 sub GetFullSubscriptionsFromBiblionumber { Link Here
522
            serial.serialseq,
523
            serial.serialseq,
523
            serial.planneddate, 
524
            serial.planneddate, 
524
            serial.publisheddate, 
525
            serial.publisheddate, 
526
            serial.publisheddatetext,
525
            serial.status, 
527
            serial.status, 
526
            serial.notes as notes,
528
            serial.notes as notes,
527
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
529
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 742-748 sub GetSerials { Link Here
742
    my $counter = 0;
744
    my $counter = 0;
743
    $count = 5 unless ($count);
745
    $count = 5 unless ($count);
744
    my @serials;
746
    my @serials;
745
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
747
    my $query = "SELECT serialid,serialseq, status, publisheddate,
748
        publisheddatetext, planneddate,notes, routingnotes
746
                        FROM   serial
749
                        FROM   serial
747
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
750
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
748
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
751
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 762-768 sub GetSerials { Link Here
762
    }
765
    }
763
766
764
    # OK, now add the last 5 issues arrives/missing
767
    # OK, now add the last 5 issues arrives/missing
765
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
768
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
769
        publisheddatetext, notes, routingnotes
766
       FROM     serial
770
       FROM     serial
767
       WHERE    subscriptionid = ?
771
       WHERE    subscriptionid = ?
768
       AND      (status in (2,4,5))
772
       AND      (status in (2,4,5))
Lines 807-813 sub GetSerials2 { Link Here
807
811
808
    my $dbh   = C4::Context->dbh;
812
    my $dbh   = C4::Context->dbh;
809
    my $query = qq|
813
    my $query = qq|
810
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
814
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
815
                    publisheddatetext, notes, routingnotes
811
                 FROM     serial 
816
                 FROM     serial 
812
                 WHERE    subscriptionid=$subscription AND status IN ($status)
817
                 WHERE    subscriptionid=$subscription AND status IN ($status)
813
                 ORDER BY publisheddate,serialid DESC
818
                 ORDER BY publisheddate,serialid DESC
Lines 1177-1183 sub _update_receivedlist { Link Here
1177
1182
1178
=head2 ModSerialStatus
1183
=head2 ModSerialStatus
1179
1184
1180
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1185
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1186
        $publisheddatetext, $status, $notes);
1181
1187
1182
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1188
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1183
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1189
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1185-1191 Note : if we change from "waited" to something else,then we will have to create Link Here
1185
=cut
1191
=cut
1186
1192
1187
sub ModSerialStatus {
1193
sub ModSerialStatus {
1188
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1194
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1195
        $status, $notes) = @_;
1189
1196
1190
    return unless ($serialid);
1197
    return unless ($serialid);
1191
1198
Lines 1211-1219 sub ModSerialStatus { Link Here
1211
            if ( not $planneddate or $planneddate eq '0000-00-00' ) { $planneddate = C4::Dates->new()->output('iso') };
1218
            if ( not $planneddate or $planneddate eq '0000-00-00' ) { $planneddate = C4::Dates->new()->output('iso') };
1212
            if ( not $publisheddate or $publisheddate eq '0000-00-00' ) { $publisheddate = C4::Dates->new()->output('iso') };
1219
            if ( not $publisheddate or $publisheddate eq '0000-00-00' ) { $publisheddate = C4::Dates->new()->output('iso') };
1213
        }
1220
        }
1214
        my $query = 'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1221
        my $query = '
1222
            UPDATE serial
1223
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1224
                planneddate = ?, status = ?, notes = ?
1225
            WHERE  serialid = ?
1226
        ';
1215
        $sth = $dbh->prepare($query);
1227
        $sth = $dbh->prepare($query);
1216
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1228
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1229
            $planneddate, $status, $notes, $serialid );
1217
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1230
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1218
        $sth   = $dbh->prepare($query);
1231
        $sth   = $dbh->prepare($query);
1219
        $sth->execute($subscriptionid);
1232
        $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 1926-1931 CREATE TABLE `serial` ( Link Here
1926
  `planneddate` date default NULL,
1926
  `planneddate` date default NULL,
1927
  `notes` text,
1927
  `notes` text,
1928
  `publisheddate` date default NULL,
1928
  `publisheddate` date default NULL,
1929
  publisheddatetext varchar(100) default NULL,
1929
  `claimdate` date default NULL,
1930
  `claimdate` date default NULL,
1930
  `routingnotes` text,
1931
  `routingnotes` text,
1931
  PRIMARY KEY  (`serialid`)
1932
  PRIMARY KEY  (`serialid`)
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 7743-7748 if(CheckVersion($DBversion)) { Link Here
7743
    SetVersion($DBversion);
7743
    SetVersion($DBversion);
7744
}
7744
}
7745
7745
7746
$DBversion = "XXX";
7747
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
7748
    $dbh->do("
7749
        ALTER TABLE serial
7750
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
7751
          AFTER publisheddate
7752
    ");
7753
7754
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
7755
    SetVersion($DBversion);
7756
}
7757
7758
7746
=head1 FUNCTIONS
7759
=head1 FUNCTIONS
7747
7760
7748
=head2 TableExists($table)
7761
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+6 lines)
Lines 203-208 $(document).ready(function() { Link Here
203
[% END %]
203
[% END %]
204
                <th class="title-string">Date published
204
                <th class="title-string">Date published
205
                </th>
205
                </th>
206
                <th class="title-string">Date published (text)
207
                </th>
206
                <th class="title-string">Date received
208
                <th class="title-string">Date received
207
                </th>
209
                </th>
208
                <th>Number
210
                <th>Number
Lines 243-248 $(document).ready(function() { Link Here
243
                    <span title="[% serial.publisheddate %]">[% serial.publisheddate | $KohaDates %]</span>
245
                    <span title="[% serial.publisheddate %]">[% serial.publisheddate | $KohaDates %]</span>
244
                </td>
246
                </td>
245
                <td>
247
                <td>
248
                    [% publisheddatetext = serial.publisheddatetext || serial.publisheddate %]
249
                    <span title="[% publisheddatetext %]">[% publisheddatetext | $KohaDates %]</span>
250
                </td>
251
                <td>
246
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
252
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
247
                </td>
253
                </td>
248
                <td>
254
                <td>
(-)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 282-287 $(document).ready(function() { Link Here
282
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
286
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
283
        </td>
287
        </td>
284
        <td>
288
        <td>
289
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
290
        </td>
291
        <td>
285
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
292
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
286
        </td>
293
        </td>
287
        <td>
294
        <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 265-270 $(document).ready(function() { Link Here
265
                    [% serialslis.publisheddate %]
266
                    [% serialslis.publisheddate %]
266
                </td>
267
                </td>
267
                <td>
268
                <td>
269
                    [% serialslis.publisheddatetext || serialslis.publisheddate %]
270
                </td>
271
                <td>
268
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
272
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
269
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
273
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
270
                    [% IF ( serialslis.status3 ) %]Late[% END %]
274
                    [% 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 126-132 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
126
            {
126
            {
127
                $confirm
127
                $confirm
128
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
128
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
129
                    $issue->{planneddate}, $issue->{publisheddate},
129
                    $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
130
                    3, $note );
130
                    3, $note );
131
                $verbose
131
                $verbose
132
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
132
                  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