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

(-)a/C4/Serials.pm (-13 / +27 lines)
Lines 362-367 sub GetFullSubscription { Link Here
362
            serial.serialseq,
362
            serial.serialseq,
363
            serial.planneddate, 
363
            serial.planneddate, 
364
            serial.publisheddate, 
364
            serial.publisheddate, 
365
            serial.publisheddatetext,
365
            serial.status, 
366
            serial.status, 
366
            serial.notes as notes,
367
            serial.notes as notes,
367
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
368
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 523-528 sub GetFullSubscriptionsFromBiblionumber { Link Here
523
            serial.serialseq,
524
            serial.serialseq,
524
            serial.planneddate, 
525
            serial.planneddate, 
525
            serial.publisheddate, 
526
            serial.publisheddate, 
527
            serial.publisheddatetext,
526
            serial.status, 
528
            serial.status, 
527
            serial.notes as notes,
529
            serial.notes as notes,
528
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
530
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 738-744 sub GetSerials { Link Here
738
    my $counter = 0;
740
    my $counter = 0;
739
    $count = 5 unless ($count);
741
    $count = 5 unless ($count);
740
    my @serials;
742
    my @serials;
741
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
743
    my $query = "SELECT serialid,serialseq, status, publisheddate,
744
        publisheddatetext, planneddate,notes, routingnotes
742
                        FROM   serial
745
                        FROM   serial
743
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
746
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
744
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
747
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 758-764 sub GetSerials { Link Here
758
    }
761
    }
759
762
760
    # OK, now add the last 5 issues arrives/missing
763
    # OK, now add the last 5 issues arrives/missing
761
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
764
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
765
        publisheddatetext, notes, routingnotes
762
       FROM     serial
766
       FROM     serial
763
       WHERE    subscriptionid = ?
767
       WHERE    subscriptionid = ?
764
       AND      (status in (2,4,5))
768
       AND      (status in (2,4,5))
Lines 800-806 sub GetSerials2 { Link Here
800
    my ( $subscription, $status ) = @_;
804
    my ( $subscription, $status ) = @_;
801
    my $dbh   = C4::Context->dbh;
805
    my $dbh   = C4::Context->dbh;
802
    my $query = qq|
806
    my $query = qq|
803
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
807
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
808
                    publisheddatetext, notes, routingnotes
804
                 FROM     serial 
809
                 FROM     serial 
805
                 WHERE    subscriptionid=$subscription AND status IN ($status)
810
                 WHERE    subscriptionid=$subscription AND status IN ($status)
806
                 ORDER BY publisheddate,serialid DESC
811
                 ORDER BY publisheddate,serialid DESC
Lines 1095-1101 sub ModSubscriptionHistory { Link Here
1095
1100
1096
=head2 ModSerialStatus
1101
=head2 ModSerialStatus
1097
1102
1098
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1103
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1104
        $publisheddatetext, $status, $notes);
1099
1105
1100
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1106
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1101
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1107
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1103-1109 Note : if we change from "waited" to something else,then we will have to create Link Here
1103
=cut
1109
=cut
1104
1110
1105
sub ModSerialStatus {
1111
sub ModSerialStatus {
1106
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1112
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1113
        $status, $notes) = @_;
1107
1114
1108
    #It is a usual serial
1115
    #It is a usual serial
1109
    # 1st, get previous status :
1116
    # 1st, get previous status :
Lines 1119-1128 sub ModSerialStatus { Link Here
1119
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1126
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1120
    }
1127
    }
1121
    else {
1128
    else {
1122
        my $query =
1129
        my $query = '
1123
'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1130
            UPDATE serial
1131
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1132
                planneddate = ?, status = ?, notes = ?
1133
            WHERE  serialid = ?
1134
        ';
1124
        $sth = $dbh->prepare($query);
1135
        $sth = $dbh->prepare($query);
1125
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1136
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1137
            $planneddate, $status, $notes, $serialid );
1126
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1138
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1127
        $sth   = $dbh->prepare($query);
1139
        $sth   = $dbh->prepare($query);
1128
        $sth->execute($subscriptionid);
1140
        $sth->execute($subscriptionid);
Lines 1478-1494 returns the serial id Link Here
1478
=cut
1490
=cut
1479
1491
1480
sub NewIssue {
1492
sub NewIssue {
1481
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1493
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1494
        $publisheddate, $publisheddatetext, $notes ) = @_;
1482
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1495
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1483
1496
1484
    my $dbh   = C4::Context->dbh;
1497
    my $dbh   = C4::Context->dbh;
1485
    my $query = qq|
1498
    my $query = qq|
1486
        INSERT INTO serial
1499
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1487
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1500
            publisheddate, publisheddatetext, planneddate, notes)
1488
        VALUES (?,?,?,?,?,?,?)
1501
        VALUES (?,?,?,?,?,?,?,?)
1489
    |;
1502
    |;
1490
    my $sth = $dbh->prepare($query);
1503
    my $sth = $dbh->prepare($query);
1491
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1504
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1505
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1492
    my $serialid = $dbh->{'mysql_insertid'};
1506
    my $serialid = $dbh->{'mysql_insertid'};
1493
    $query = qq|
1507
    $query = qq|
1494
        SELECT missinglist,recievedlist
1508
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1800-1805 CREATE TABLE `serial` ( Link Here
1800
  `planneddate` date default NULL,
1800
  `planneddate` date default NULL,
1801
  `notes` text,
1801
  `notes` text,
1802
  `publisheddate` date default NULL,
1802
  `publisheddate` date default NULL,
1803
  publisheddatetext varchar(100) default NULL,
1803
  `itemnumber` text default NULL,
1804
  `itemnumber` text default NULL,
1804
  `claimdate` date default NULL,
1805
  `claimdate` date default NULL,
1805
  `routingnotes` text,
1806
  `routingnotes` text,
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 6532-6537 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6532
    SetVersion ($DBversion);
6532
    SetVersion ($DBversion);
6533
}
6533
}
6534
6534
6535
$DBversion = "XXX";
6536
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6537
    $dbh->do("
6538
        ALTER TABLE serial
6539
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
6540
          AFTER publisheddate
6541
    ");
6542
6543
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
6544
    SetVersion($DBversion);
6545
}
6546
6535
=head1 FUNCTIONS
6547
=head1 FUNCTIONS
6536
6548
6537
=head2 TableExists($table)
6549
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+4 lines)
Lines 251-256 $(document).ready(function() { Link Here
251
[% END %]
251
[% END %]
252
                <th>Date published
252
                <th>Date published
253
                </th>
253
                </th>
254
                <th>Date published (text)</th>
254
                <th>Date received
255
                <th>Date received
255
                </th>
256
                </th>
256
                <th>Number
257
                <th>Number
Lines 291-296 $(document).ready(function() { Link Here
291
                    [% serial.publisheddate %]
292
                    [% serial.publisheddate %]
292
                </td>
293
                </td>
293
                <td>
294
                <td>
295
                    [% serial.publisheddatetext || serial.publisheddate %]
296
                </td>
297
                <td>
294
                    [% serial.planneddate %]
298
                    [% serial.planneddate %]
295
                </td>
299
                </td>
296
                <td>
300
                <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 161-166 $(document).ready(function() { Link Here
161
	<tr>
161
	<tr>
162
		<th>Numbered</th>
162
		<th>Numbered</th>
163
		<th>Published on</th>
163
		<th>Published on</th>
164
        <th>Published on (text)</th>
164
		<th>Expected on</th>
165
		<th>Expected on</th>
165
		<th>Status</th>
166
		<th>Status</th>
166
		<th>Notes</th>
167
		<th>Notes</th>
Lines 182-187 $(document).ready(function() { Link Here
182
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
183
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
183
        </td>
184
        </td>
184
        <td>
185
        <td>
186
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
187
        </td>
188
        <td>
185
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
189
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
186
        </td>
190
        </td>
187
        <td>
191
        <td>
Lines 299-304 $(document).ready(function() { Link Here
299
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
303
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
300
        </td>
304
        </td>
301
        <td>
305
        <td>
306
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
307
        </td>
308
        <td>
302
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
309
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
303
        </td>
310
        </td>
304
        <td>
311
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+4 lines)
Lines 365-370 $(document).ready(function() { Link Here
365
            <th>Issue number</th>
365
            <th>Issue number</th>
366
            <th>Planned date</th>
366
            <th>Planned date</th>
367
            <th>Published date</th>
367
            <th>Published date</th>
368
            <th>Published date (text)</th>
368
            <th>Status</th>
369
            <th>Status</th>
369
        </tr>
370
        </tr>
370
        [% FOREACH serialslis IN serialslist %]
371
        [% FOREACH serialslis IN serialslist %]
Lines 379-384 $(document).ready(function() { Link Here
379
                    [% serialslis.publisheddate %]
380
                    [% serialslis.publisheddate %]
380
                </td>
381
                </td>
381
                <td>
382
                <td>
383
                    [% serialslis.publisheddatetext || serialslis.publisheddate %]
384
                </td>
385
                <td>
382
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
386
                    [% IF ( serialslis.status1 ) %]Expected[% END %]
383
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
387
                    [% IF ( serialslis.status2 ) %]Arrived[% END %]
384
                    [% IF ( serialslis.status3 ) %]Late[% END %]
388
                    [% 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