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

(-)a/C4/Serials.pm (-13 / +27 lines)
Lines 353-358 sub GetFullSubscription { Link Here
353
            serial.serialseq,
353
            serial.serialseq,
354
            serial.planneddate, 
354
            serial.planneddate, 
355
            serial.publisheddate, 
355
            serial.publisheddate, 
356
            serial.publisheddatetext,
356
            serial.status, 
357
            serial.status, 
357
            serial.notes as notes,
358
            serial.notes as notes,
358
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
359
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 514-519 sub GetFullSubscriptionsFromBiblionumber { Link Here
514
            serial.serialseq,
515
            serial.serialseq,
515
            serial.planneddate, 
516
            serial.planneddate, 
516
            serial.publisheddate, 
517
            serial.publisheddate, 
518
            serial.publisheddatetext,
517
            serial.status, 
519
            serial.status, 
518
            serial.notes as notes,
520
            serial.notes as notes,
519
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
521
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 650-656 sub GetSerials { Link Here
650
    my $counter = 0;
652
    my $counter = 0;
651
    $count = 5 unless ($count);
653
    $count = 5 unless ($count);
652
    my @serials;
654
    my @serials;
653
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
655
    my $query = "SELECT serialid,serialseq, status, publisheddate,
656
        publisheddatetext, planneddate,notes, routingnotes
654
                        FROM   serial
657
                        FROM   serial
655
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
658
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
656
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
659
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 670-676 sub GetSerials { Link Here
670
    }
673
    }
671
674
672
    # OK, now add the last 5 issues arrives/missing
675
    # OK, now add the last 5 issues arrives/missing
673
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
676
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
677
        publisheddatetext, notes, routingnotes
674
       FROM     serial
678
       FROM     serial
675
       WHERE    subscriptionid = ?
679
       WHERE    subscriptionid = ?
676
       AND      (status in (2,4,5))
680
       AND      (status in (2,4,5))
Lines 712-718 sub GetSerials2 { Link Here
712
    my ( $subscription, $status ) = @_;
716
    my ( $subscription, $status ) = @_;
713
    my $dbh   = C4::Context->dbh;
717
    my $dbh   = C4::Context->dbh;
714
    my $query = qq|
718
    my $query = qq|
715
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
719
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
720
                    publisheddatetext, notes, routingnotes
716
                 FROM     serial 
721
                 FROM     serial 
717
                 WHERE    subscriptionid=$subscription AND status IN ($status)
722
                 WHERE    subscriptionid=$subscription AND status IN ($status)
718
                 ORDER BY publisheddate,serialid DESC
723
                 ORDER BY publisheddate,serialid DESC
Lines 1007-1013 sub ModSubscriptionHistory { Link Here
1007
1012
1008
=head2 ModSerialStatus
1013
=head2 ModSerialStatus
1009
1014
1010
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1015
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1016
        $publisheddatetext, $status, $notes);
1011
1017
1012
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1018
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1013
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1019
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1015-1021 Note : if we change from "waited" to something else,then we will have to create Link Here
1015
=cut
1021
=cut
1016
1022
1017
sub ModSerialStatus {
1023
sub ModSerialStatus {
1018
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1024
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1025
        $status, $notes) = @_;
1019
1026
1020
    #It is a usual serial
1027
    #It is a usual serial
1021
    # 1st, get previous status :
1028
    # 1st, get previous status :
Lines 1031-1040 sub ModSerialStatus { Link Here
1031
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1038
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1032
    }
1039
    }
1033
    else {
1040
    else {
1034
        my $query =
1041
        my $query = '
1035
'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1042
            UPDATE serial
1043
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1044
                planneddate = ?, status = ?, notes = ?
1045
            WHERE  serialid = ?
1046
        ';
1036
        $sth = $dbh->prepare($query);
1047
        $sth = $dbh->prepare($query);
1037
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1048
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1049
            $planneddate, $status, $notes, $serialid );
1038
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1050
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1039
        $sth   = $dbh->prepare($query);
1051
        $sth   = $dbh->prepare($query);
1040
        $sth->execute($subscriptionid);
1052
        $sth->execute($subscriptionid);
Lines 1390-1406 returns the serial id Link Here
1390
=cut
1402
=cut
1391
1403
1392
sub NewIssue {
1404
sub NewIssue {
1393
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1405
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1406
        $publisheddate, $publisheddatetext, $notes ) = @_;
1394
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1407
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1395
1408
1396
    my $dbh   = C4::Context->dbh;
1409
    my $dbh   = C4::Context->dbh;
1397
    my $query = qq|
1410
    my $query = qq|
1398
        INSERT INTO serial
1411
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1399
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1412
            publisheddate, publisheddatetext, planneddate, notes)
1400
        VALUES (?,?,?,?,?,?,?)
1413
        VALUES (?,?,?,?,?,?,?,?)
1401
    |;
1414
    |;
1402
    my $sth = $dbh->prepare($query);
1415
    my $sth = $dbh->prepare($query);
1403
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1416
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1417
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1404
    my $serialid = $dbh->{'mysql_insertid'};
1418
    my $serialid = $dbh->{'mysql_insertid'};
1405
    $query = qq|
1419
    $query = qq|
1406
        SELECT missinglist,recievedlist
1420
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1775-1780 CREATE TABLE `serial` ( Link Here
1775
  `planneddate` date default NULL,
1775
  `planneddate` date default NULL,
1776
  `notes` text,
1776
  `notes` text,
1777
  `publisheddate` date default NULL,
1777
  `publisheddate` date default NULL,
1778
  publisheddatetext varchar(100) default NULL,
1778
  `itemnumber` text default NULL,
1779
  `itemnumber` text default NULL,
1779
  `claimdate` date default NULL,
1780
  `claimdate` date default NULL,
1780
  `routingnotes` text,
1781
  `routingnotes` text,
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 5781-5786 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5781
    SetVersion ($DBversion);
5781
    SetVersion ($DBversion);
5782
}
5782
}
5783
5783
5784
$DBversion = "XXX";
5785
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5786
    $dbh->do("
5787
        ALTER TABLE serial
5788
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
5789
          AFTER publisheddate
5790
    ");
5791
5792
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
5793
    SetVersion($DBversion);
5794
}
5795
5784
=head1 FUNCTIONS
5796
=head1 FUNCTIONS
5785
5797
5786
=head2 TableExists($table)
5798
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+4 lines)
Lines 200-205 $(document).ready(function() { Link Here
200
[% END %]
200
[% END %]
201
                <th>Date published
201
                <th>Date published
202
                </th>
202
                </th>
203
                <th>Date published (text)</th>
203
                <th>Date received
204
                <th>Date received
204
                </th>
205
                </th>
205
                <th>Number
206
                <th>Number
Lines 222-227 $(document).ready(function() { Link Here
222
                    [% serial.publisheddate %]
223
                    [% serial.publisheddate %]
223
                </td>
224
                </td>
224
                <td>
225
                <td>
226
                    [% serial.publisheddatetext || serial.publisheddate %]
227
                </td>
228
                <td>
225
                    [% serial.planneddate %]
229
                    [% serial.planneddate %]
226
                </td>
230
                </td>
227
                <td>
231
                <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 199-204 $(document).ready(function() { Link Here
199
	<tr>
199
	<tr>
200
		<th>Numbered</th>
200
		<th>Numbered</th>
201
		<th>Published on</th>
201
		<th>Published on</th>
202
        <th>Published on (text)</th>
202
		<th>Expected on</th>
203
		<th>Expected on</th>
203
		<th>Status</th>
204
		<th>Status</th>
204
		<th>Notes</th>
205
		<th>Notes</th>
Lines 220-225 $(document).ready(function() { Link Here
220
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
221
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
221
        </td>
222
        </td>
222
        <td>
223
        <td>
224
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
225
        </td>
226
        <td>
223
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
227
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
224
        </td>
228
        </td>
225
        <td>
229
        <td>
Lines 332-337 $(document).ready(function() { Link Here
332
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
336
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
333
        </td>
337
        </td>
334
        <td>
338
        <td>
339
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
340
        </td>
341
        <td>
335
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
342
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
336
        </td>
343
        </td>
337
        <td>
344
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+6 lines)
Lines 326-331 $(document).ready(function() { Link Here
326
            <th>Issue number</th>
326
            <th>Issue number</th>
327
            <th>Planned date</th>
327
            <th>Planned date</th>
328
            <th>Published date</th>
328
            <th>Published date</th>
329
            <th>Published date (text)</th>
329
            <th>Status</th>
330
            <th>Status</th>
330
        </tr>
331
        </tr>
331
        [% FOREACH serialslis IN serialslist %]
332
        [% FOREACH serialslis IN serialslist %]
Lines 340-345 $(document).ready(function() { Link Here
340
                    [% serialslis.publisheddate %]
341
                    [% serialslis.publisheddate %]
341
                </td>
342
                </td>
342
                <td>
343
                <td>
344
                    [% serialslis.publisheddatetext
345
                        || serialslis.publisheddate
346
                    %]
347
                </td>
348
                <td>
343
                        [% IF ( serialslis.status1 ) %]
349
                        [% IF ( serialslis.status1 ) %]
344
                            Expected
350
                            Expected
345
                        [% END %]
351
                        [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt (+2 lines)
Lines 179-184 function showlayer(numlayer){ Link Here
179
	    <thead>
179
	    <thead>
180
		<tr>
180
		<tr>
181
		    <th>Date</th>
181
		    <th>Date</th>
182
		    <th>Date (text)</th>
182
		    <th>Library</th>
183
		    <th>Library</th>
183
		    <th>Notes</th>
184
		    <th>Notes</th>
184
		    <th>Date received</th>
185
		    <th>Date received</th>
Lines 192-197 function showlayer(numlayer){ Link Here
192
		<tr>
193
		<tr>
193
		    <td>    [% serial.publisheddate %]
194
		    <td>    [% serial.publisheddate %]
194
		    </td>
195
		    </td>
196
            <td>[% serial.publisheddatetext || serial.publisheddate %]</td>
195
            <td class="libraryfilterclass">    [% serial.branchcode %]
197
            <td class="libraryfilterclass">    [% serial.branchcode %]
196
		    </td>
198
		    </td>
197
		    <td>    [% serial.notes %]
199
		    <td>    [% serial.notes %]
(-)a/misc/cronjobs/serialsUpdate.pl (-1 / +1 lines)
Lines 82-88 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
82
            {
82
            {
83
        
83
        
84
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
84
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
85
                $issue->{planneddate}, $issue->{publisheddate},
85
                $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
86
                3, "Automatically set to late" );
86
                3, "Automatically set to late" );
87
            print $issue->{serialid}." update\n";
87
            print $issue->{serialid}." update\n";
88
            }
88
            }
(-)a/serials/serials-collection.pl (-4 / +8 lines)
Lines 57-71 if($op eq 'gennext' && @subscriptionid){ Link Here
57
    my $subscriptionid = $subscriptionid[0];
57
    my $subscriptionid = $subscriptionid[0];
58
    my $subscription = GetSubscription($subscriptionid);
58
    my $subscription = GetSubscription($subscriptionid);
59
59
60
	my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
60
	my $sth = $dbh->prepare("
61
							FROM serial WHERE status = 1 AND subscriptionid = ?");
61
        SELECT publisheddate, publisheddatetext, serialid, serialseq,
62
            planneddate
63
        FROM serial
64
        WHERE status = 1 AND subscriptionid = ?
65
    ");
62
	$sth->execute($subscriptionid);
66
	$sth->execute($subscriptionid);
63
67
64
	# modify actual expected issue, to generate the next
68
	# modify actual expected issue, to generate the next
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
                3, "" );
72
            $issue->{publisheddatetext}, 3, "" );
69
	}else{
73
	}else{
70
		my $expected = GetNextExpected($subscriptionid);
74
		my $expected = GetNextExpected($subscriptionid);
71
	    my (
75
	    my (
(-)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 226-231 if ( $op and $op eq 'serialchangestatus' ) { Link Here
226
                    $status[$i],
228
                    $status[$i],
227
                    $plan_date,
229
                    $plan_date,
228
                    $pub_date,
230
                    $pub_date,
231
                    $publisheddatetexts[$i],
229
                    $notes[$i]
232
                    $notes[$i]
230
                );
233
                );
231
            }
234
            }
Lines 236-241 if ( $op and $op eq 'serialchangestatus' ) { Link Here
236
                $serialseqs[$i],
239
                $serialseqs[$i],
237
                $plan_date,
240
                $plan_date,
238
                $pub_date,
241
                $pub_date,
242
                $publisheddatetexts[$i],
239
                $status[$i],
243
                $status[$i],
240
                $notes[$i]
244
                $notes[$i]
241
            );
245
            );
242
- 

Return to bug 8296