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 521-526 sub GetFullSubscriptionsFromBiblionumber { Link Here
521
            serial.serialseq,
522
            serial.serialseq,
522
            serial.planneddate, 
523
            serial.planneddate, 
523
            serial.publisheddate, 
524
            serial.publisheddate, 
525
            serial.publisheddatetext,
524
            serial.status, 
526
            serial.status, 
525
            serial.notes as notes,
527
            serial.notes as notes,
526
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
528
            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
Lines 736-742 sub GetSerials { Link Here
736
    my $counter = 0;
738
    my $counter = 0;
737
    $count = 5 unless ($count);
739
    $count = 5 unless ($count);
738
    my @serials;
740
    my @serials;
739
    my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes
741
    my $query = "SELECT serialid,serialseq, status, publisheddate,
742
        publisheddatetext, planneddate,notes, routingnotes
740
                        FROM   serial
743
                        FROM   serial
741
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
744
                        WHERE  subscriptionid = ? AND status NOT IN (2,4,5) 
742
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
745
                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
Lines 756-762 sub GetSerials { Link Here
756
    }
759
    }
757
760
758
    # OK, now add the last 5 issues arrives/missing
761
    # OK, now add the last 5 issues arrives/missing
759
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
762
    $query = "SELECT   serialid,serialseq, status, planneddate, publisheddate,
763
        publisheddatetext, notes, routingnotes
760
       FROM     serial
764
       FROM     serial
761
       WHERE    subscriptionid = ?
765
       WHERE    subscriptionid = ?
762
       AND      (status in (2,4,5))
766
       AND      (status in (2,4,5))
Lines 798-804 sub GetSerials2 { Link Here
798
    my ( $subscription, $status ) = @_;
802
    my ( $subscription, $status ) = @_;
799
    my $dbh   = C4::Context->dbh;
803
    my $dbh   = C4::Context->dbh;
800
    my $query = qq|
804
    my $query = qq|
801
                 SELECT   serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes
805
                 SELECT serialid,serialseq, status, planneddate, publisheddate,
806
                    publisheddatetext, notes, routingnotes
802
                 FROM     serial 
807
                 FROM     serial 
803
                 WHERE    subscriptionid=$subscription AND status IN ($status)
808
                 WHERE    subscriptionid=$subscription AND status IN ($status)
804
                 ORDER BY publisheddate,serialid DESC
809
                 ORDER BY publisheddate,serialid DESC
Lines 1094-1100 sub ModSubscriptionHistory { Link Here
1094
1099
1095
=head2 ModSerialStatus
1100
=head2 ModSerialStatus
1096
1101
1097
ModSerialStatus($serialid,$serialseq, $planneddate,$publisheddate,$status,$notes)
1102
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1103
        $publisheddatetext, $status, $notes);
1098
1104
1099
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1105
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1100
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1106
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1102-1108 Note : if we change from "waited" to something else,then we will have to create Link Here
1102
=cut
1108
=cut
1103
1109
1104
sub ModSerialStatus {
1110
sub ModSerialStatus {
1105
    my ( $serialid, $serialseq, $planneddate, $publisheddate, $status, $notes ) = @_;
1111
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1112
        $status, $notes) = @_;
1106
1113
1107
    #It is a usual serial
1114
    #It is a usual serial
1108
    # 1st, get previous status :
1115
    # 1st, get previous status :
Lines 1118-1127 sub ModSerialStatus { Link Here
1118
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1125
        DelIssue( {'serialid'=>$serialid, 'subscriptionid'=>$subscriptionid,'serialseq'=>$serialseq} );
1119
    }
1126
    }
1120
    else {
1127
    else {
1121
        my $query =
1128
        my $query = '
1122
'UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?';
1129
            UPDATE serial
1130
            SET serialseq = ?, publisheddate = ?, publisheddatetext = ?,
1131
                planneddate = ?, status = ?, notes = ?
1132
            WHERE  serialid = ?
1133
        ';
1123
        $sth = $dbh->prepare($query);
1134
        $sth = $dbh->prepare($query);
1124
        $sth->execute( $serialseq, $publisheddate, $planneddate, $status, $notes, $serialid );
1135
        $sth->execute( $serialseq, $publisheddate, $publisheddatetext,
1136
            $planneddate, $status, $notes, $serialid );
1125
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1137
        $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
1126
        $sth   = $dbh->prepare($query);
1138
        $sth   = $dbh->prepare($query);
1127
        $sth->execute($subscriptionid);
1139
        $sth->execute($subscriptionid);
Lines 1477-1493 returns the serial id Link Here
1477
=cut
1489
=cut
1478
1490
1479
sub NewIssue {
1491
sub NewIssue {
1480
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_;
1492
    my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate,
1493
        $publisheddate, $publisheddatetext, $notes ) = @_;
1481
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1494
    ### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ?
1482
1495
1483
    my $dbh   = C4::Context->dbh;
1496
    my $dbh   = C4::Context->dbh;
1484
    my $query = qq|
1497
    my $query = qq|
1485
        INSERT INTO serial
1498
        INSERT INTO serial (serialseq, subscriptionid, biblionumber, status,
1486
            (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes)
1499
            publisheddate, publisheddatetext, planneddate, notes)
1487
        VALUES (?,?,?,?,?,?,?)
1500
        VALUES (?,?,?,?,?,?,?,?)
1488
    |;
1501
    |;
1489
    my $sth = $dbh->prepare($query);
1502
    my $sth = $dbh->prepare($query);
1490
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes );
1503
    $sth->execute( $serialseq, $subscriptionid, $biblionumber, $status,
1504
        $publisheddate, $publisheddatetext, $planneddate, $notes );
1491
    my $serialid = $dbh->{'mysql_insertid'};
1505
    my $serialid = $dbh->{'mysql_insertid'};
1492
    $query = qq|
1506
    $query = qq|
1493
        SELECT missinglist,recievedlist
1507
        SELECT missinglist,recievedlist
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1902-1907 CREATE TABLE `serial` ( Link Here
1902
  `planneddate` date default NULL,
1902
  `planneddate` date default NULL,
1903
  `notes` text,
1903
  `notes` text,
1904
  `publisheddate` date default NULL,
1904
  `publisheddate` date default NULL,
1905
  publisheddatetext varchar(100) default NULL,
1905
  `claimdate` date default NULL,
1906
  `claimdate` date default NULL,
1906
  `routingnotes` text,
1907
  `routingnotes` text,
1907
  PRIMARY KEY  (`serialid`)
1908
  PRIMARY KEY  (`serialid`)
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 7139-7144 if ( CheckVersion($DBversion) ) { Link Here
7139
    SetVersion ($DBversion);
7139
    SetVersion ($DBversion);
7140
}
7140
}
7141
7141
7142
$DBversion = "XXX";
7143
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
7144
    $dbh->do("
7145
        ALTER TABLE serial
7146
        ADD COLUMN publisheddatetext VARCHAR(100) DEFAULT NULL
7147
          AFTER publisheddate
7148
    ");
7149
7150
    print "Upgrade to $DBversion done (Add serial.publisheddatetext)\n";
7151
    SetVersion($DBversion);
7152
}
7153
7154
7142
=head1 FUNCTIONS
7155
=head1 FUNCTIONS
7143
7156
7144
=head2 TableExists($table)
7157
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+6 lines)
Lines 256-261 $(document).ready(function() { Link Here
256
[% END %]
256
[% END %]
257
                <th class="title-string">Date published
257
                <th class="title-string">Date published
258
                </th>
258
                </th>
259
                <th class="title-string">Date published (text)
260
                </th>
259
                <th class="title-string">Date received
261
                <th class="title-string">Date received
260
                </th>
262
                </th>
261
                <th>Number
263
                <th>Number
Lines 296-301 $(document).ready(function() { Link Here
296
                    <span title="[% serial.publisheddate %]">[% serial.publisheddate | $KohaDates %]</span>
298
                    <span title="[% serial.publisheddate %]">[% serial.publisheddate | $KohaDates %]</span>
297
                </td>
299
                </td>
298
                <td>
300
                <td>
301
                    [% publisheddatetext = serial.publisheddatetext || serial.publisheddate %]
302
                    <span title="[% publisheddatetext %]">[% publisheddatetext | $KohaDates %]</span>
303
                </td>
304
                <td>
299
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
305
                    <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
300
                </td>
306
                </td>
301
                <td>
307
                <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 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 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 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