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

(-)a/C4/Serials.pm (-13 / +27 lines)
Lines 363-368 sub GetFullSubscription { Link Here
363
            serial.serialseq,
363
            serial.serialseq,
364
            serial.planneddate, 
364
            serial.planneddate, 
365
            serial.publisheddate, 
365
            serial.publisheddate, 
366
            serial.publisheddatetext,
366
            serial.status, 
367
            serial.status, 
367
            serial.notes as notes,
368
            serial.notes as notes,
368
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
369
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 524-529 sub GetFullSubscriptionsFromBiblionumber { Link Here
524
            serial.serialseq,
525
            serial.serialseq,
525
            serial.planneddate, 
526
            serial.planneddate, 
526
            serial.publisheddate, 
527
            serial.publisheddate, 
528
            serial.publisheddatetext,
527
            serial.status, 
529
            serial.status, 
528
            serial.notes as notes,
530
            serial.notes as notes,
529
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
531
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 739-745 sub GetSerials { Link Here
739
    my $counter = 0;
741
    my $counter = 0;
740
    $count = 5 unless ($count);
742
    $count = 5 unless ($count);
741
    my @serials;
743
    my @serials;
742
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
744
    my $query = "SELECT serialid,serialseq, status, publisheddate,
745
        publisheddatetext, planneddate,notes, routingnotes
743
                        FROM   serial
746
                        FROM   serial
744
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
747
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
745
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
748
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 759-765 sub GetSerials { Link Here
759
    }
762
    }
760
763
761
    # OK, now add the last 5 issues arrives/missing
764
    # OK, now add the last 5 issues arrives/missing
762
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
765
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
766
        publisheddatetext, notes, routingnotes
763
       FROM     serial
767
       FROM     serial
764
       WHERE    subscriptionid = ?
768
       WHERE    subscriptionid = ?
765
       AND      (status in (2,4,5))
769
       AND      (status in (2,4,5))
Lines 801-807 sub GetSerials2 { Link Here
801
    my ( $subscription, $status ) = @_;
805
    my ( $subscription, $status ) = @_;
802
    my $dbh   = C4::Context->dbh;
806
    my $dbh   = C4::Context->dbh;
803
    my $query = qq|
807
    my $query = qq|
804
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
808
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
809
                    publisheddatetext, notes, routingnotes
805
                 FROM     serial 
810
                 FROM     serial 
806
                 WHERE    subscriptionid=$subscription AND status IN ($status)
811
                 WHERE    subscriptionid=$subscription AND status IN ($status)
807
                 ORDER BY publisheddate,serialid DESC
812
                 ORDER BY publisheddate,serialid DESC
Lines 1096-1102 sub ModSubscriptionHistory { Link Here
1096
1101
1097
=head2 ModSerialStatus
1102
=head2 ModSerialStatus
1098
1103
1099
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1104
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1105
        $publisheddatetext, $status, $notes);
1100
1106
1101
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1107
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1102
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1108
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1104-1110 Note : if we change from "waited" to something else,then we will have to create Link Here
1104
=cut
1110
=cut
1105
1111
1106
sub ModSerialStatus {
1112
sub ModSerialStatus {
1107
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1113
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1114
        $status, $notes) = @_;
1108
1115
1109
    #It is a usual serial
1116
    #It is a usual serial
1110
    # 1st, get previous status :
1117
    # 1st, get previous status :
Lines 1120-1129 sub ModSerialStatus { Link Here
1120
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1127
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1121
    }
1128
    }
1122
    else {
1129
    else {
1123
        my $query =
1130
        my $query = '
1124
'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1131
            UPDATE serial
1132
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1133
                planneddate = ?, status = ?, notes = ?
1134
            WHERE  serialid = ?
1135
        ';
1125
        $sth = $dbh->prepare($query);
1136
        $sth = $dbh->prepare($query);
1126
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1137
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1138
            $planneddate, $status, $notes, $serialid );
1127
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1139
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1128
        $sth   = $dbh->prepare($query);
1140
        $sth   = $dbh->prepare($query);
1129
        $sth->execute($subscriptionid);
1141
        $sth->execute($subscriptionid);
Lines 1479-1495 returns the serial id Link Here
1479
=cut
1491
=cut
1480
1492
1481
sub NewIssue {
1493
sub NewIssue {
1482
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1494
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1495
        $publisheddate, $publisheddatetext, $notes ) = @_;
1483
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1496
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1484
1497
1485
    my $dbh   = C4::Context->dbh;
1498
    my $dbh   = C4::Context->dbh;
1486
    my $query = qq|
1499
    my $query = qq|
1487
        INSERT INTO serial
1500
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1488
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1501
            publisheddate, publisheddatetext, planneddate, notes)
1489
        VALUES (?,?,?,?,?,?,?)
1502
        VALUES (?,?,?,?,?,?,?,?)
1490
    |;
1503
    |;
1491
    my $sth = $dbh->prepare($query);
1504
    my $sth = $dbh->prepare($query);
1492
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1505
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1506
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1493
    my $serialid = $dbh->{'mysql_insertid'};
1507
    my $serialid = $dbh->{'mysql_insertid'};
1494
    $query = qq|
1508
    $query = qq|
1495
        SELECT missinglist,recievedlist
1509
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1900-1905 CREATE TABLE `serial` ( Link Here
1900
  `planneddate` date default NULL,
1900
  `planneddate` date default NULL,
1901
  `notes` text,
1901
  `notes` text,
1902
  `publisheddate` date default NULL,
1902
  `publisheddate` date default NULL,
1903
  publisheddatetext varchar(100) default NULL,
1903
  `claimdate` date default NULL,
1904
  `claimdate` date default NULL,
1904
  `routingnotes` text,
1905
  `routingnotes` text,
1905
  PRIMARY KEY  (`serialid`)
1906
  PRIMARY KEY  (`serialid`)
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 6990-6995 if ( CheckVersion($DBversion) ) { Link Here
6990
    SetVersion($DBversion);
6990
    SetVersion($DBversion);
6991
}
6991
}
6992
6992
6993
$DBversion = "XXX";
6994
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6995
    $dbh->do("
6996
        ALTER TABLE serial
6997
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
6998
          AFTER publisheddate
6999
    ");
7000
7001
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
7002
    SetVersion($DBversion);
7003
}
7004
6993
7005
6994
=head1 FUNCTIONS
7006
=head1 FUNCTIONS
6995
7007
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+4 lines)
Lines 252-257 $(document).ready(function() { Link Here
252
[% END %]
252
[% END %]
253
                <th>Date published
253
                <th>Date published
254
                </th>
254
                </th>
255
                <th>Date published (text)</th>
255
                <th>Date received
256
                <th>Date received
256
                </th>
257
                </th>
257
                <th>Number
258
                <th>Number
Lines 292-297 $(document).ready(function() { Link Here
292
                    [% serial.publisheddate %]
293
                    [% serial.publisheddate %]
293
                </td>
294
                </td>
294
                <td>
295
                <td>
296
                    [% serial.publisheddatetext || serial.publisheddate %]
297
                </td>
298
                <td>
295
                    [% serial.planneddate %]
299
                    [% serial.planneddate %]
296
                </td>
300
                </td>
297
                <td>
301
                <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 144-149 $(document).ready(function() { Link Here
144
	<tr>
144
	<tr>
145
		<th>Numbered</th>
145
		<th>Numbered</th>
146
		<th>Published on</th>
146
		<th>Published on</th>
147
        <th>Published on (text)</th>
147
		<th>Expected on</th>
148
		<th>Expected on</th>
148
		<th>Status</th>
149
		<th>Status</th>
149
		<th>Notes</th>
150
		<th>Notes</th>
Lines 165-170 $(document).ready(function() { Link Here
165
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
166
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
166
        </td>
167
        </td>
167
        <td>
168
        <td>
169
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
170
        </td>
171
        <td>
168
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
172
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
169
        </td>
173
        </td>
170
        <td>
174
        <td>
Lines 284-289 $(document).ready(function() { Link Here
284
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
288
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
285
        </td>
289
        </td>
286
        <td>
290
        <td>
291
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
292
        </td>
293
        <td>
287
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
294
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
288
        </td>
295
        </td>
289
        <td>
296
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+4 lines)
Lines 332-337 $(document).ready(function() { Link Here
332
            <th>Issue number</th>
332
            <th>Issue number</th>
333
            <th>Planned date</th>
333
            <th>Planned date</th>
334
            <th>Published date</th>
334
            <th>Published date</th>
335
            <th>Published date (text)</th>
335
            <th>Status</th>
336
            <th>Status</th>
336
        </tr>
337
        </tr>
337
        [% FOREACH serialslis IN serialslist %]
338
        [% FOREACH serialslis IN serialslist %]
Lines 346-351 $(document).ready(function() { Link Here
346
                    [% serialslis.publisheddate %]
347
                    [% serialslis.publisheddate %]
347
                </td>
348
                </td>
348
                <td>
349
                <td>
350
                    [% serialslis.publisheddatetext || serialslis.publisheddate %]
351
                </td>
352
                <td>
349
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
353
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
350
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
354
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
351
                    [% IF ( serialslis.status3 ) %]Late[% END %]
355
                    [% IF ( serialslis.status3 ) %]Late[% 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 83-89 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
83
            {
83
            {
84
        
84
        
85
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
85
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
86
                $issue->{planneddate}, $issue->{publisheddate},
86
                $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
87
                3, "Automatically set to late" );
87
                3, "Automatically set to late" );
88
            print $issue->{serialid}." update\n";
88
            print $issue->{serialid}." update\n";
89
            }
89
            }
(-)a/serials/serials-collection.pl (-3 / +7 lines)
Lines 56-63 my $subscriptions; Link Here
56
56
57
if($op eq 'gennext' && @subscriptionid){
57
if($op eq 'gennext' && @subscriptionid){
58
    my $subscriptionid = $subscriptionid[0];
58
    my $subscriptionid = $subscriptionid[0];
59
    my $sth = $dbh->prepare("SELECT publisheddate, serialid, serialseq, planneddate
59
    my $sth = $dbh->prepare("
60
							FROM serial WHERE status = 1 AND subscriptionid = ?");
60
        SELECT publisheddate, publisheddatetext, serialid, serialseq,
61
            planneddate
62
        FROM serial
63
        WHERE status = 1 AND subscriptionid = ?
64
    ");
61
    my $status = defined( $nbissues ) ? 2 : 3;
65
    my $status = defined( $nbissues ) ? 2 : 3;
62
    $nbissues ||= 1;
66
    $nbissues ||= 1;
63
    for ( my $i = 0; $i < $nbissues; $i++ ){
67
    for ( my $i = 0; $i < $nbissues; $i++ ){
Lines 66-72 if($op eq 'gennext' && @subscriptionid){ Link Here
66
	if ( my $issue = $sth->fetchrow_hashref ) {
70
	if ( my $issue = $sth->fetchrow_hashref ) {
67
		ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
71
		ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
68
                $issue->{planneddate}, $issue->{publisheddate},
72
                $issue->{planneddate}, $issue->{publisheddate},
69
                $status, "" );
73
                $issue->{publisheddatetext}, $status, "" );
70
	}else{
74
	}else{
71
            my $subscription = GetSubscription($subscriptionid);
75
            my $subscription = GetSubscription($subscriptionid);
72
            my $expected = GetNextExpected($subscriptionid);
76
            my $expected = GetNextExpected($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 227-232 if ( $op and $op eq 'serialchangestatus' ) { Link Here
227
                    $status[$i],
229
                    $status[$i],
228
                    $plan_date,
230
                    $plan_date,
229
                    $pub_date,
231
                    $pub_date,
232
                    $publisheddatetexts[$i],
230
                    $notes[$i]
233
                    $notes[$i]
231
                );
234
                );
232
            }
235
            }
Lines 237-242 if ( $op and $op eq 'serialchangestatus' ) { Link Here
237
                $serialseqs[$i],
240
                $serialseqs[$i],
238
                $plan_date,
241
                $plan_date,
239
                $pub_date,
242
                $pub_date,
243
                $publisheddatetexts[$i],
240
                $status[$i],
244
                $status[$i],
241
                $notes[$i]
245
                $notes[$i]
242
            );
246
            );
243
- 

Return to bug 8296