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

(-)a/C4/Serials.pm (-13 / +27 lines)
Lines 354-359 sub GetFullSubscription { Link Here
354
            serial.serialseq,
354
            serial.serialseq,
355
            serial.planneddate, 
355
            serial.planneddate, 
356
            serial.publisheddate, 
356
            serial.publisheddate, 
357
            serial.publisheddatetext,
357
            serial.status, 
358
            serial.status, 
358
            serial.notes as notes,
359
            serial.notes as notes,
359
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
360
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 515-520 sub GetFullSubscriptionsFromBiblionumber { Link Here
515
            serial.serialseq,
516
            serial.serialseq,
516
            serial.planneddate, 
517
            serial.planneddate, 
517
            serial.publisheddate, 
518
            serial.publisheddate, 
519
            serial.publisheddatetext,
518
            serial.status, 
520
            serial.status, 
519
            serial.notes as notes,
521
            serial.notes as notes,
520
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
522
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 719-725 sub GetSerials { Link Here
719
    my $counter = 0;
721
    my $counter = 0;
720
    $count = 5 unless ($count);
722
    $count = 5 unless ($count);
721
    my @serials;
723
    my @serials;
722
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
724
    my $query = "SELECT serialid,serialseq, status, publisheddate,
725
        publisheddatetext, planneddate,notes, routingnotes
723
                        FROM   serial
726
                        FROM   serial
724
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
727
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
725
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
728
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 739-745 sub GetSerials { Link Here
739
    }
742
    }
740
743
741
    # OK, now add the last 5 issues arrives/missing
744
    # OK, now add the last 5 issues arrives/missing
742
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
745
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
746
        publisheddatetext, notes, routingnotes
743
       FROM     serial
747
       FROM     serial
744
       WHERE    subscriptionid = ?
748
       WHERE    subscriptionid = ?
745
       AND      (status in (2,4,5))
749
       AND      (status in (2,4,5))
Lines 781-787 sub GetSerials2 { Link Here
781
    my ( $subscription, $status ) = @_;
785
    my ( $subscription, $status ) = @_;
782
    my $dbh   = C4::Context->dbh;
786
    my $dbh   = C4::Context->dbh;
783
    my $query = qq|
787
    my $query = qq|
784
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
788
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
789
                    publisheddatetext, notes, routingnotes
785
                 FROM     serial 
790
                 FROM     serial 
786
                 WHERE    subscriptionid=$subscription AND status IN ($status)
791
                 WHERE    subscriptionid=$subscription AND status IN ($status)
787
                 ORDER BY publisheddate,serialid DESC
792
                 ORDER BY publisheddate,serialid DESC
Lines 1076-1082 sub ModSubscriptionHistory { Link Here
1076
1081
1077
=head2 ModSerialStatus
1082
=head2 ModSerialStatus
1078
1083
1079
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1084
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1085
        $publisheddatetext, $status, $notes);
1080
1086
1081
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1087
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1082
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1088
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1084-1090 Note : if we change from "waited" to something else,then we will have to create Link Here
1084
=cut
1090
=cut
1085
1091
1086
sub ModSerialStatus {
1092
sub ModSerialStatus {
1087
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1093
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1094
        $status, $notes) = @_;
1088
1095
1089
    #It is a usual serial
1096
    #It is a usual serial
1090
    # 1st, get previous status :
1097
    # 1st, get previous status :
Lines 1100-1109 sub ModSerialStatus { Link Here
1100
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1107
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1101
    }
1108
    }
1102
    else {
1109
    else {
1103
        my $query =
1110
        my $query = '
1104
'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1111
            UPDATE serial
1112
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1113
                planneddate = ?, status = ?, notes = ?
1114
            WHERE  serialid = ?
1115
        ';
1105
        $sth = $dbh->prepare($query);
1116
        $sth = $dbh->prepare($query);
1106
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1117
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1118
            $planneddate, $status, $notes, $serialid );
1107
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1119
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1108
        $sth   = $dbh->prepare($query);
1120
        $sth   = $dbh->prepare($query);
1109
        $sth->execute($subscriptionid);
1121
        $sth->execute($subscriptionid);
Lines 1459-1475 returns the serial id Link Here
1459
=cut
1471
=cut
1460
1472
1461
sub NewIssue {
1473
sub NewIssue {
1462
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1474
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1475
        $publisheddate, $publisheddatetext, $notes ) = @_;
1463
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1476
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1464
1477
1465
    my $dbh   = C4::Context->dbh;
1478
    my $dbh   = C4::Context->dbh;
1466
    my $query = qq|
1479
    my $query = qq|
1467
        INSERT INTO serial
1480
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1468
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1481
            publisheddate, publisheddatetext, planneddate, notes)
1469
        VALUES (?,?,?,?,?,?,?)
1482
        VALUES (?,?,?,?,?,?,?,?)
1470
    |;
1483
    |;
1471
    my $sth = $dbh->prepare($query);
1484
    my $sth = $dbh->prepare($query);
1472
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1485
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1486
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1473
    my $serialid = $dbh->{'mysql_insertid'};
1487
    my $serialid = $dbh->{'mysql_insertid'};
1474
    $query = qq|
1488
    $query = qq|
1475
        SELECT missinglist,recievedlist
1489
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1797-1802 CREATE TABLE `serial` ( Link Here
1797
  `planneddate` date default NULL,
1797
  `planneddate` date default NULL,
1798
  `notes` text,
1798
  `notes` text,
1799
  `publisheddate` date default NULL,
1799
  `publisheddate` date default NULL,
1800
  publisheddatetext varchar(100) default NULL,
1800
  `itemnumber` text default NULL,
1801
  `itemnumber` text default NULL,
1801
  `claimdate` date default NULL,
1802
  `claimdate` date default NULL,
1802
  `routingnotes` text,
1803
  `routingnotes` text,
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 6019-6024 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6019
   SetVersion ($DBversion);
6019
   SetVersion ($DBversion);
6020
}
6020
}
6021
6021
6022
$DBversion = "XXX";
6023
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6024
    $dbh->do("
6025
        ALTER TABLE serial
6026
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
6027
          AFTER publisheddate
6028
    ");
6029
6030
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
6031
    SetVersion($DBversion);
6032
}
6033
6022
=head1 FUNCTIONS
6034
=head1 FUNCTIONS
6023
6035
6024
=head2 TableExists($table)
6036
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+4 lines)
Lines 206-211 $(document).ready(function() { Link Here
206
[% END %]
206
[% END %]
207
                <th>Date published
207
                <th>Date published
208
                </th>
208
                </th>
209
                <th>Date published (text)</th>
209
                <th>Date received
210
                <th>Date received
210
                </th>
211
                </th>
211
                <th>Number
212
                <th>Number
Lines 228-233 $(document).ready(function() { Link Here
228
                    [% serial.publisheddate %]
229
                    [% serial.publisheddate %]
229
                </td>
230
                </td>
230
                <td>
231
                <td>
232
                    [% serial.publisheddatetext || serial.publisheddate %]
233
                </td>
234
                <td>
231
                    [% serial.planneddate %]
235
                    [% serial.planneddate %]
232
                </td>
236
                </td>
233
                <td>
237
                <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+7 lines)
Lines 205-210 $(document).ready(function() { Link Here
205
	<tr>
205
	<tr>
206
		<th>Numbered</th>
206
		<th>Numbered</th>
207
		<th>Published on</th>
207
		<th>Published on</th>
208
        <th>Published on (text)</th>
208
		<th>Expected on</th>
209
		<th>Expected on</th>
209
		<th>Status</th>
210
		<th>Status</th>
210
		<th>Notes</th>
211
		<th>Notes</th>
Lines 226-231 $(document).ready(function() { Link Here
226
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
227
            <input type="text" name="publisheddate" value="[% serialslis.publisheddate %]" size="10" maxlength="15" />
227
        </td>
228
        </td>
228
        <td>
229
        <td>
230
            <input type="text" name="publisheddatetext" value="[% serialslis.publisheddatetext || serialslis.publisheddate %]" size="10" maxlength="15" />
231
        </td>
232
        <td>
229
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
233
            <input type="text" id="expecteddate" name="planneddate" value="[% serialslis.planneddate %]" size="10" maxlength="15" />
230
        </td>
234
        </td>
231
        <td>
235
        <td>
Lines 338-343 $(document).ready(function() { Link Here
338
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
342
            <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
339
        </td>
343
        </td>
340
        <td>
344
        <td>
345
            <input type="text" name="publisheddatetext" value="[% newserialloo.publisheddatetext || newserialloo.publisheddate %]" size="10" maxlength="15" />
346
        </td>
347
        <td>
341
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
348
            <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
342
        </td>
349
        </td>
343
        <td>
350
        <td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+6 lines)
Lines 360-365 $(document).ready(function() { Link Here
360
            <th>Issue number</th>
360
            <th>Issue number</th>
361
            <th>Planned date</th>
361
            <th>Planned date</th>
362
            <th>Published date</th>
362
            <th>Published date</th>
363
            <th>Published date (text)</th>
363
            <th>Status</th>
364
            <th>Status</th>
364
        </tr>
365
        </tr>
365
        [% FOREACH serialslis IN serialslist %]
366
        [% FOREACH serialslis IN serialslist %]
Lines 374-379 $(document).ready(function() { Link Here
374
                    [% serialslis.publisheddate %]
375
                    [% serialslis.publisheddate %]
375
                </td>
376
                </td>
376
                <td>
377
                <td>
378
                    [% serialslis.publisheddatetext
379
                        || serialslis.publisheddate
380
                    %]
381
                </td>
382
                <td>
377
                        [% IF ( serialslis.status1 ) %]
383
                        [% IF ( serialslis.status1 ) %]
378
                            Expected
384
                            Expected
379
                        [% END %]
385
                        [% 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 (-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 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