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

(-)a/C4/Reserves.pm (-8 / +109 lines)
Lines 113-131 BEGIN { Link Here
113
        &CancelReserve
113
        &CancelReserve
114
114
115
        &IsAvailableForItemLevelRequest
115
        &IsAvailableForItemLevelRequest
116
        
117
        &AlterPriority
118
        &ToggleLowestPriority
116
    );
119
    );
117
}    
120
}    
118
121
119
=item AddReserve
122
=item AddReserve
120
123
121
    AddReserve($branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$notes,$title,$checkitem,$found)
124
    AddReserve($branch,$borrowernumber,$biblionumber,$constraint,$bibitems,$priority,$resdate,$expdate,$notes,$title,$checkitem,$found)
122
125
123
=cut
126
=cut
124
127
125
sub AddReserve {
128
sub AddReserve {
126
    my (
129
    my (
127
        $branch,    $borrowernumber, $biblionumber,
130
        $branch,    $borrowernumber, $biblionumber,
128
        $constraint, $bibitems,  $priority, $resdate,  $notes,
131
        $constraint, $bibitems,  $priority, $resdate, $expdate, $notes,
129
        $title,      $checkitem, $found
132
        $title,      $checkitem, $found
130
    ) = @_;
133
    ) = @_;
131
    my $fee =
134
    my $fee =
Lines 135-140 sub AddReserve { Link Here
135
    my $const   = lc substr( $constraint, 0, 1 );
138
    my $const   = lc substr( $constraint, 0, 1 );
136
    $resdate = format_date_in_iso( $resdate ) if ( $resdate );
139
    $resdate = format_date_in_iso( $resdate ) if ( $resdate );
137
    $resdate = C4::Dates->today( 'iso' ) unless ( $resdate );
140
    $resdate = C4::Dates->today( 'iso' ) unless ( $resdate );
141
    $expdate = format_date_in_iso( $expdate ) if ( $expdate );
138
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
142
    if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
139
	# Make room in reserves for this before those of a later reserve date
143
	# Make room in reserves for this before those of a later reserve date
140
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
144
	$priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority );
Lines 165-180 sub AddReserve { Link Here
165
    my $query = qq/
169
    my $query = qq/
166
        INSERT INTO reserves
170
        INSERT INTO reserves
167
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
171
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
168
            priority,reservenotes,itemnumber,found,waitingdate)
172
            priority,reservenotes,itemnumber,found,waitingdate,expirationdate)
169
        VALUES
173
        VALUES
170
             (?,?,?,?,?,
174
             (?,?,?,?,?,
171
             ?,?,?,?,?)
175
             ?,?,?,?,?,?)
172
    /;
176
    /;
173
    my $sth = $dbh->prepare($query);
177
    my $sth = $dbh->prepare($query);
174
    $sth->execute(
178
    $sth->execute(
175
        $borrowernumber, $biblionumber, $resdate, $branch,
179
        $borrowernumber, $biblionumber, $resdate, $branch,
176
        $const,          $priority,     $notes,   $checkitem,
180
        $const,          $priority,     $notes,   $checkitem,
177
        $found,          $waitingdate
181
        $found,          $waitingdate,	$expdate
178
    );
182
    );
179
183
180
    #}
184
    #}
Lines 217-223 sub GetReservesFromBiblionumber { Link Here
217
                constrainttype,
221
                constrainttype,
218
                found,
222
                found,
219
                itemnumber,
223
                itemnumber,
220
                reservenotes
224
                reservenotes,
225
                expirationdate,
226
                lowestPriority
221
        FROM     reserves
227
        FROM     reserves
222
        WHERE biblionumber = ? ";
228
        WHERE biblionumber = ? ";
223
    unless ( $all_dates ) {
229
    unless ( $all_dates ) {
Lines 660-665 sub CheckReserves { Link Here
660
    }
666
    }
661
}
667
}
662
668
669
=item CancelExpiredReserves
670
671
  CancelExpiredReserves();
672
  
673
  Cancels all reserves with an expiration date from before today.
674
  
675
=cut
676
677
sub CancelExpiredReserves {
678
679
  my $dbh = C4::Context->dbh;
680
  my $sth = $dbh->prepare( "SELECT * FROM reserves WHERE DATE(expirationdate) < DATE( CURDATE() ) AND expirationdate != '0000-00-00'" );
681
  $sth->execute();
682
683
  while ( my $res = $sth->fetchrow_hashref() ) {
684
    CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
685
  }
686
  
687
}
688
663
=item CancelReserve
689
=item CancelReserve
664
690
665
  &CancelReserve($biblionumber, $itemnumber, $borrowernumber);
691
  &CancelReserve($biblionumber, $itemnumber, $borrowernumber);
Lines 1165-1173 sub IsAvailableForItemLevelRequest { Link Here
1165
    }
1191
    }
1166
}
1192
}
1167
1193
1194
=item AlterPriority
1195
AlterPriority( $where, $borrowernumber, $biblionumber, $reservedate );
1196
1197
This function changes a reserve's priority up, down, to the top, or to the bottom.
1198
Input: $where is 'up', 'down', 'top' or 'bottom'. Biblionumber, Date reserve was placed
1199
Output: None on success, -1 on failure
1200
1201
=cut
1202
sub AlterPriority {
1203
    my ( $where, $borrowernumber, $biblionumber ) = @_;
1204
1205
    my $newPriority = -1;
1206
1207
    my $dbh = C4::Context->dbh;
1208
1209
    ## Find this reserve
1210
    my $sth = $dbh->prepare('SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ? AND cancellationdate IS NULL');
1211
    $sth->execute( $biblionumber, $borrowernumber );
1212
    my $reserve = $sth->fetchrow_hashref();
1213
    $sth->finish();
1214
1215
    if ( $where eq 'up' || $where eq 'down' ) {
1216
    
1217
      my $priority = $reserve->{'priority'};        
1218
      $priority = $where eq 'up' ? $priority - 1 : $priority + 1;
1219
      _FixPriority( $biblionumber, $borrowernumber, $priority )
1220
1221
    } elsif ( $where eq 'top' ) {
1222
1223
      _FixPriority( $biblionumber, $borrowernumber, '1' )
1224
1225
    } elsif ( $where eq 'bottom' ) {
1226
1227
      _FixPriority( $biblionumber, $borrowernumber, '999999' )
1228
1229
    }
1230
1231
    return $newPriority;
1232
1233
}
1234
1235
=item ToggleLowestPriority
1236
ToggleLowestPriority( $borrowernumber, $biblionumber );
1237
1238
This function sets the lowestPriority field to true if is false, and false if it is true.
1239
=cut
1240
1241
sub ToggleLowestPriority {
1242
    my ( $borrowernumber, $biblionumber ) = @_;
1243
1244
    my $dbh = C4::Context->dbh;
1245
1246
    my $sth = $dbh->prepare(
1247
        "UPDATE reserves SET lowestPriority = NOT lowestPriority
1248
         WHERE biblionumber = ?
1249
         AND borrowernumber = ?"
1250
    );
1251
    $sth->execute(
1252
        $biblionumber,
1253
        $borrowernumber,
1254
    );
1255
    $sth->finish;
1256
    
1257
    _FixPriority( $biblionumber, $borrowernumber, '999999' );
1258
}
1259
1168
=item _FixPriority
1260
=item _FixPriority
1169
1261
1170
&_FixPriority($biblio,$borrowernumber,$rank);
1262
&_FixPriority($biblio,$borrowernumber,$rank,$ignoreSetLowestRank);
1171
1263
1172
 Only used internally (so don't export it)
1264
 Only used internally (so don't export it)
1173
 Changed how this functions works #
1265
 Changed how this functions works #
Lines 1179-1185 sub IsAvailableForItemLevelRequest { Link Here
1179
=cut 
1271
=cut 
1180
1272
1181
sub _FixPriority {
1273
sub _FixPriority {
1182
    my ( $biblio, $borrowernumber, $rank ) = @_;
1274
    my ( $biblio, $borrowernumber, $rank, $ignoreSetLowestRank ) = @_;
1183
    my $dbh = C4::Context->dbh;
1275
    my $dbh = C4::Context->dbh;
1184
     if ( $rank eq "del" ) {
1276
     if ( $rank eq "del" ) {
1185
         CancelReserve( $biblio, undef, $borrowernumber );
1277
         CancelReserve( $biblio, undef, $borrowernumber );
Lines 1255-1260 sub _FixPriority { Link Here
1255
        );
1347
        );
1256
        $sth->finish;
1348
        $sth->finish;
1257
    }
1349
    }
1350
    
1351
    $sth = $dbh->prepare( "SELECT borrowernumber FROM reserves WHERE lowestPriority = 1 ORDER BY priority" );
1352
    $sth->execute();
1353
    
1354
    unless ( $ignoreSetLowestRank ) {
1355
      while ( my $res = $sth->fetchrow_hashref() ) {
1356
        _FixPriority( $biblio, $res->{'borrowernumber'}, '999999', 1 );
1357
      }
1358
    }
1258
}
1359
}
1259
1360
1260
=item _Findgroupreserve
1361
=item _Findgroupreserve
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 2675-2680 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2675
    SetVersion ($DBversion);
2675
    SetVersion ($DBversion);
2676
}
2676
}
2677
2677
2678
$DBversion = '3.01.00.061';
2679
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
2680
    $dbh->do("ALTER TABLE `reserves` ADD `expirationdate` DATE NOT NULL");
2681
    $dbh->do("ALTER TABLE `reserves` ADD `lowestPriority` BOOL NOT NULL");
2682
    $dbh->do("ALTER TABLE `old_reserves` ADD `expirationdate` DATE NOT NULL");
2683
    $dbh->do("ALTER TABLE `old_reserves` ADD `lowestPriority` BOOL NOT NULL");
2684
    print "Upgrade to $DBversion done ( Added Additional Fields to Reserves tables )\n";
2685
    SetVersion ($DBversion);
2686
}
2687
2678
=item DropAllForeignKeys($table)
2688
=item DropAllForeignKeys($table)
2679
2689
2680
  Drop all foreign keys of the table $table
2690
  Drop all foreign keys of the table $table
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl (+74 lines)
Lines 282-287 function checkMultiHold() { Link Here
282
            <label for="pickup">Pickup at:</label>
282
            <label for="pickup">Pickup at:</label>
283
            <!-- TMPL_VAR NAME="CGIbranch" -->
283
            <!-- TMPL_VAR NAME="CGIbranch" -->
284
        </li>
284
        </li>
285
285
	<!-- TMPL_IF NAME="reserve_in_future" -->
286
	<!-- TMPL_IF NAME="reserve_in_future" -->
286
	<li>
287
	<li>
287
	    <label for="reserve_date">Hold starts on date:</label>
288
	    <label for="reserve_date">Hold starts on date:</label>
Lines 314-319 function checkMultiHold() { Link Here
314
	</li>
315
	</li>
315
	<!-- /TMPL_IF -->
316
	<!-- /TMPL_IF -->
316
317
318
	<li>
319
	    <label for="expiration_date">Hold expires on date:</label>
320
	    <input name="expiration_date" id="expiration_date" size="10" readonly="readonly">
321
	    <img src="<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate" style="cursor: pointer;" />
322
	    <script language="JavaScript" type="text/javascript">
323
		//<![CDATA[
324
		function validate1(date) {
325
			var today = new Date();
326
			if ( (date > today) ||
327
                    ( date.getDate() == today.getDate() &&
328
                      date.getMonth() == today.getMonth() &&
329
                      date.getFullYear() == today.getFullYear() ) ) {
330
				return false;
331
			} else {
332
				return true;
333
			}
334
		};
335
		Calendar.setup(
336
			{
337
				inputField : "expiration_date",
338
				ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
339
				button : "CalendarExpirationDate",
340
				disableFunc : validate1,
341
				dateStatusFunc : validate1,
342
			}
343
		);
344
		//]]>
345
	    </script>
346
		<a href='#' onClick="document.getElementById('expiration_date').value='';">Clear Date</a>
347
	</li>
348
317
        <!-- TMPL_UNLESS NAME="multi_hold" -->
349
        <!-- TMPL_UNLESS NAME="multi_hold" -->
318
          <li> <label for="requestany">Place a hold on the next available copy </label>
350
          <li> <label for="requestany">Place a hold on the next available copy </label>
319
               <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
351
               <input type="checkbox" id="requestany" name="request" checked="checked" value="Any" />
Lines 530-540 function checkMultiHold() { Link Here
530
      <!-- /TMPL_IF -->
562
      <!-- /TMPL_IF -->
531
      <tr>
563
      <tr>
532
        <th>Priority</th>
564
        <th>Priority</th>
565
	<th>&nbsp</th>
533
        <th>Patron</th>
566
        <th>Patron</th>
534
        <th>Notes</th>
567
        <th>Notes</th>
535
        <th>Date</th>
568
        <th>Date</th>
569
	<th>Expiration</th>
536
        <th>Pick up Library</th>
570
        <th>Pick up Library</th>
537
        <th>Details</th>
571
        <th>Details</th>
572
        <th><img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-bottom.png" border="0" title="Toggle Set to Lowest Priority"></th>
573
	<th>&nbsp;</th>
538
      </tr>
574
      </tr>
539
  <!-- TMPL_LOOP Name="reserveloop" -->
575
  <!-- TMPL_LOOP Name="reserveloop" -->
540
  <!-- TMPL_UNLESS Name="__odd__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_UNLESS -->
576
  <!-- TMPL_UNLESS Name="__odd__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_UNLESS -->
Lines 551-556 function checkMultiHold() { Link Here
551
            <option value="del">del</option>
587
            <option value="del">del</option>
552
          </select>
588
          </select>
553
        </td>
589
        </td>
590
591
        <td style="white-space:nowrap;">
592
	        <a title="Move Reserve Up" href="request.pl?action=move&where=up&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
593
			<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-up.png" border="0" />
594
                </a>
595
596
		<a title="Move Reserve To Top" href="request.pl?action=move&where=top&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
597
                	<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-top.png" border="0" />
598
                </a>
599
600
                <a title="Move Reserve To Bottom" href="request.pl?action=move&where=bottom&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
601
                	<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-bottom.png" border="0" />
602
                </a>
603
604
                <a title="Move Reserve Down" href="request.pl?action=move&where=down&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
605
                	<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img//go-down.png" border="0" />
606
                </a>
607
        </td>
608
554
        <td>
609
        <td>
555
          <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" >
610
          <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" >
556
	  <!-- TMPL_IF NAME="hidename" -->
611
	  <!-- TMPL_IF NAME="hidename" -->
Lines 562-567 function checkMultiHold() { Link Here
562
        </td>
617
        </td>
563
        <td><!-- TMPL_VAR NAME="notes" --></td>
618
        <td><!-- TMPL_VAR NAME="notes" --></td>
564
        <td><!-- TMPL_VAR NAME="date" --></td>
619
        <td><!-- TMPL_VAR NAME="date" --></td>
620
	<td><!-- TMPL_VAR NAME="expirationdate" --></td>
565
        <td>
621
        <td>
566
    <!-- TMPL_IF Name="wait" -->
622
    <!-- TMPL_IF Name="wait" -->
567
    	<!-- TMPL_IF NAME="atdestination" -->
623
    	<!-- TMPL_IF NAME="atdestination" -->
Lines 621-627 function checkMultiHold() { Link Here
621
      <!-- /TMPL_IF -->
677
      <!-- /TMPL_IF -->
622
    <!-- /TMPL_IF -->
678
    <!-- /TMPL_IF -->
623
        </td>
679
        </td>
680
681
	<td>
682
		<a title="Toggle Lowest Priority" href="request.pl?action=setLowestPriority&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->"> 
683
			<!-- TMPL_IF NAME="lowestPriority" -->
684
	                	<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-bottom.png" border="0"/ title="Unset Lowest Priority" />
685
		        <!-- TMPL_ELSE -->
686
		                <img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/go-down.png" border="0"/ title="Set To Lowest Priority" />
687
		        <!-- /TMPL_IF -->
688
		</a>
689
	</td> 
690
691
	<td>
692
		<a title="Cancel Reserve" href="request.pl?action=cancel&borrowernumber=<!-- TMPL_VAR Name="borrowernumber" -->&biblionumber=<!-- TMPL_VAR Name="biblionumber" -->&date=<!-- TMPL_VAR Name="date" -->">
693
                	<img src="/intranet-tmpl/<!-- TMPL_VAR NAME='theme' -->/img/x.png" border="0" />
694
                </a>
695
	</td>
696
624
      </tr>
697
      </tr>
698
625
  <!-- /TMPL_LOOP --> <!-- existing reserveloop -->
699
  <!-- /TMPL_LOOP --> <!-- existing reserveloop -->
626
     </table>
700
     </table>
627
  <!-- /TMPL_IF --><!-- /reserveloop -->
701
  <!-- /TMPL_IF --><!-- /reserveloop -->
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl (+33 lines)
Lines 242-247 Link Here
242
		  <!-- TMPL_IF NAME="reserve_in_future" -->
242
		  <!-- TMPL_IF NAME="reserve_in_future" -->
243
		  <th>Hold Starts on Date</th>
243
		  <th>Hold Starts on Date</th>
244
		  <!-- /TMPL_IF -->
244
		  <!-- /TMPL_IF -->
245
		  <th>Hold Not Needed After</th>
245
                  <!-- TMPL_IF NAME="OPACItemHolds" -->
246
                  <!-- TMPL_IF NAME="OPACItemHolds" -->
246
                    <th id="place_on_hdr" style="display:none">Place On:</th>
247
                    <th id="place_on_hdr" style="display:none">Place On:</th>
247
                  <!-- /TMPL_IF -->
248
                  <!-- /TMPL_IF -->
Lines 337-343 Link Here
337
			//]]>
338
			//]]>
338
			</script>
339
			</script>
339
		    </td>
340
		    </td>
341
340
		    <!-- /TMPL_IF -->
342
		    <!-- /TMPL_IF -->
343
	<td>
344
	    <input name="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" id="expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->" size="10" readonly="readonly">
345
	    <img src="<!-- TMPL_VAR NAME="themelang" -->/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="CalendarExpirationDate" style="cursor: pointer;" />
346
	    <script language="JavaScript" type="text/javascript">
347
		//<![CDATA[
348
		function validate1(date) {
349
			var today = new Date();
350
			if ( (date > today) ||
351
                    ( date.getDate() == today.getDate() &&
352
                      date.getMonth() == today.getMonth() &&
353
                      date.getFullYear() == today.getFullYear() ) ) {
354
				return false;
355
			} else {
356
				return true;
357
			}
358
		};
359
		Calendar.setup(
360
			{
361
				inputField : "expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->",
362
				ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
363
				button : "CalendarExpirationDate",
364
				disableFunc : validate1,
365
				dateStatusFunc : validate1,
366
			}
367
		);
368
		//]]>
369
	    </script>
370
		<br/>
371
		<a href='#' onClick="document.getElementById('expiration_date_<!-- TMPL_VAR NAME="biblionumber" -->').value='';">Clear Date</a>
372
	</td>
373
341
                    <!-- TMPL_IF NAME="OPACItemHolds" -->
374
                    <!-- TMPL_IF NAME="OPACItemHolds" -->
342
                      <td class="place_on_type" style="display:none">
375
                      <td class="place_on_type" style="display:none">
343
                        <table>
376
                        <table>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl (-3 / +5 lines)
Lines 323-332 $.tablesorter.addParser({ Link Here
323
            <thead><tr>
323
            <thead><tr>
324
                <th>Title</th>
324
                <th>Title</th>
325
                <th>Placed On</th>
325
                <th>Placed On</th>
326
		<th>Expires On</th>
326
                <th>Pick Up Location</th>
327
                <th>Pick Up Location</th>
327
				<!-- TMPL_IF NAME="showpriority" -->
328
		<!-- TMPL_IF NAME="showpriority" -->
328
				<th>Priority</th>
329
			<th>Priority</th>
329
				<!-- /TMPL_IF -->
330
		<!-- /TMPL_IF -->
330
                <th>Status</th>
331
                <th>Status</th>
331
		<th>Modify</th>
332
		<th>Modify</th>
332
            </tr></thead>
333
            </tr></thead>
Lines 349-354 $.tablesorter.addParser({ Link Here
349
                    <!-- TMPL_VAR NAME="author" -->
350
                    <!-- TMPL_VAR NAME="author" -->
350
                </td>
351
                </td>
351
                <td><!-- TMPL_VAR NAME="reservedate" --></td>
352
                <td><!-- TMPL_VAR NAME="reservedate" --></td>
353
		<td><!-- TMPL_IF NAME="expirationdate" --><!-- TMPL_VAR NAME="expirationdate" --><!-- TMPL_ELSE -->Never Expires<!-- /TMPL_IF --></td>
352
                <td><!-- TMPL_VAR NAME="branch" --></td>
354
                <td><!-- TMPL_VAR NAME="branch" --></td>
353
				<!-- TMPL_IF NAME="showpriority" -->
355
				<!-- TMPL_IF NAME="showpriority" -->
354
				<td><!-- TMPL_VAR NAME="priority" --> </td>
356
				<td><!-- TMPL_VAR NAME="priority" --> </td>
(-)a/misc/cronjobs/cancel_expired_reserves.pl (+39 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#  This script loops through each overdue item, determines the fine,
4
#  and updates the total amount of fines due by each user.  It relies on
5
#  the existence of /tmp/fines, which is created by ???
6
# Doesnt really rely on it, it relys on being able to write to /tmp/
7
# It creates the fines file
8
#
9
#  This script is meant to be run nightly out of cron.
10
11
# Copyright 2000-2002 Katipo Communications
12
#
13
# This file is part of Koha.
14
#
15
# Koha is free software; you can redistribute it and/or modify it under the
16
# terms of the GNU General Public License as published by the Free Software
17
# Foundation; either version 2 of the License, or (at your option) any later
18
# version.
19
#
20
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
21
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
22
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
23
#
24
# You should have received a copy of the GNU General Public License along with
25
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
26
# Suite 330, Boston, MA  02111-1307 USA
27
28
# $Id: sendoverdues.pl,v 1.1.2.1 2007/03/26 22:38:09 tgarip1957 Exp $
29
30
BEGIN {
31
    # find Koha's Perl modules
32
    # test carefully before changing this
33
    use FindBin;
34
    eval { require "$FindBin::Bin/../kohalib.pl" };
35
}
36
37
use C4::Reserves;
38
39
CancelExpiredReserves();
(-)a/opac/opac-reserve.pl (-9 / +9 lines)
Lines 199-204 if ( $query->param('place_reserve') ) { Link Here
199
	    ) {
199
	    ) {
200
	    $startdate = $query->param("reserve_date_$biblioNum");
200
	    $startdate = $query->param("reserve_date_$biblioNum");
201
	}
201
	}
202
	
203
	my $expiration_date = $query->param("expiration_date_$biblioNum");
202
204
203
        # If a specific item was selected and the pickup branch is the same as the
205
        # If a specific item was selected and the pickup branch is the same as the
204
        # holdingbranch, force the value $rank and $found.
206
        # holdingbranch, force the value $rank and $found.
Lines 216-222 if ( $query->param('place_reserve') ) { Link Here
216
        }
218
        }
217
        
219
        
218
        # Here we actually do the reserveration. Stage 3.
220
        # Here we actually do the reserveration. Stage 3.
219
        AddReserve($branch, $borrowernumber, $biblioNum, 'a', [$biblioNum], $rank, $startdate, $notes,
221
        AddReserve($branch, $borrowernumber, $biblioNum, 'a', [$biblioNum], $rank, $startdate, $expiration_date, $notes,
220
                   $biblioData->{'title'}, $itemNum, $found);
222
                   $biblioData->{'title'}, $itemNum, $found);
221
    }
223
    }
222
224
Lines 475-489 $template->param(itemtable_colspan => $itemTableColspan); Link Here
475
# display infos
477
# display infos
476
$template->param(bibitemloop => $biblioLoop);
478
$template->param(bibitemloop => $biblioLoop);
477
479
478
# can set reserve date in future
480
$template->param(
479
if (
480
    C4::Context->preference( 'AllowHoldDateInFuture' ) &&
481
    C4::Context->preference( 'OPACAllowHoldDateInFuture' )
482
    ) {
483
    $template->param(
484
	reserve_in_future         => 1,
485
	DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar(),
481
	DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar(),
486
	);
482
);
483
484
# can set reserve date in future
485
if ( C4::Context->preference( 'AllowHoldDateInFuture' ) && C4::Context->preference( 'OPACAllowHoldDateInFuture' ) ) {
486
    $template->param( reserve_in_future => 1 );
487
}
487
}
488
488
489
output_html_with_http_headers $query, $cookie, $template->output;
489
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/opac/opac-user.pl (+7 lines)
Lines 184-189 $template->param( branchloop => \@branch_loop ); Link Here
184
my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
184
my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
185
foreach my $res (@reserves) {
185
foreach my $res (@reserves) {
186
    $res->{'reservedate'} = format_date( $res->{'reservedate'} );
186
    $res->{'reservedate'} = format_date( $res->{'reservedate'} );
187
188
    if ( $res->{'expirationdate'} ne '0000-00-00' ) {
189
      $res->{'expirationdate'} = format_date( $res->{'expirationdate'} ) 
190
    } else {
191
      $res->{'expirationdate'} = '';
192
    }
193
    
187
    my $publictype = $res->{'publictype'};
194
    my $publictype = $res->{'publictype'};
188
    $res->{$publictype} = 1;
195
    $res->{$publictype} = 1;
189
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
196
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
(-)a/reserve/placerequest.pl (-4 / +5 lines)
Lines 51-56 my $type=$input->param('type'); Link Here
51
my $title=$input->param('title');
51
my $title=$input->param('title');
52
my $borrowernumber=GetMember($borrower,'cardnumber');
52
my $borrowernumber=GetMember($borrower,'cardnumber');
53
my $checkitem=$input->param('checkitem');
53
my $checkitem=$input->param('checkitem');
54
my $expirationdate = $input->param('expiration_date');
54
55
55
my $multi_hold = $input->param('multi_hold');
56
my $multi_hold = $input->param('multi_hold');
56
my $biblionumbers = $multi_hold ? $input->param('biblionumbers') : ($biblionumber . '/');
57
my $biblionumbers = $multi_hold ? $input->param('biblionumbers') : ($biblionumber . '/');
Lines 98-114 if ($type eq 'str8' && $borrowernumber ne ''){ Link Here
98
        if ($multi_hold) {
99
        if ($multi_hold) {
99
            my $bibinfo = $bibinfos{$biblionumber};
100
            my $bibinfo = $bibinfos{$biblionumber};
100
            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
101
            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
101
                       $bibinfo->{rank},$startdate,$notes,$bibinfo->{title},$checkitem,$found);
102
                       $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
102
        } else {
103
        } else {
103
            if ($input->param('request') eq 'any'){
104
            if ($input->param('request') eq 'any'){
104
                # place a request on 1st available
105
                # place a request on 1st available
105
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$notes,$title,$checkitem,$found);
106
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
106
            } elsif ($reqbib[0] ne ''){
107
            } elsif ($reqbib[0] ne ''){
107
                # FIXME : elsif probably never reached, (see top of the script)
108
                # FIXME : elsif probably never reached, (see top of the script)
108
                # place a request on a given item
109
                # place a request on a given item
109
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$startdate,$notes,$title,$checkitem, $found);
110
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
110
            } else {
111
            } else {
111
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$notes,$title,$checkitem, $found);
112
                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
112
            }
113
            }
113
        }
114
        }
114
    }
115
    }
(-)a/reserve/request.pl (-5 / +22 lines)
Lines 91-96 my $warnings; Link Here
91
my $messages;
91
my $messages;
92
92
93
my $date = C4::Dates->today('iso');
93
my $date = C4::Dates->today('iso');
94
my $action = $input->param('action');
95
96
if ( $action eq 'move' ) {
97
  my $where = $input->param('where');
98
  my $borrowernumber = $input->param('borrowernumber');
99
  my $biblionumber = $input->param('biblionumber');
100
                     
101
  AlterPriority( $where, $borrowernumber, $biblionumber );
102
103
} elsif ( $action eq 'cancel' ) {
104
  my $borrowernumber = $input->param('borrowernumber');
105
  my $biblionumber = $input->param('biblionumber');
106
  CancelReserve( $biblionumber, '', $borrowernumber );
107
} elsif ( $action eq 'setLowestPriority' ) {
108
  my $borrowernumber = $input->param('borrowernumber');
109
  my $biblionumber   = $input->param('biblionumber');
110
  ToggleLowestPriority( $borrowernumber, $biblionumber );
111
}
94
112
95
if ($findborrower) {
113
if ($findborrower) {
96
    my ( $count, $borrowers ) =
114
    my ( $count, $borrowers ) =
Lines 482-487 foreach my $biblionumber (@biblionumbers) { Link Here
482
	    $reserve{'hidename'} = 1;
500
	    $reserve{'hidename'} = 1;
483
	    $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'};
501
	    $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'};
484
	}
502
	}
503
        $reserve{'expirationdate'} = format_date( $res->{'expirationdate'} ) unless ( $res->{'expirationdate'} eq '0000-00-00' );
485
        $reserve{'date'}           = format_date( $res->{'reservedate'} );
504
        $reserve{'date'}           = format_date( $res->{'reservedate'} );
486
        $reserve{'borrowernumber'} = $res->{'borrowernumber'};
505
        $reserve{'borrowernumber'} = $res->{'borrowernumber'};
487
        $reserve{'biblionumber'}   = $res->{'biblionumber'};
506
        $reserve{'biblionumber'}   = $res->{'biblionumber'};
Lines 497-502 foreach my $biblionumber (@biblionumbers) { Link Here
497
        $reserve{'ccode'}           = $res->{'ccode'};
516
        $reserve{'ccode'}           = $res->{'ccode'};
498
        $reserve{'barcode'}         = $res->{'barcode'};
517
        $reserve{'barcode'}         = $res->{'barcode'};
499
        $reserve{'priority'}    = $res->{'priority'};
518
        $reserve{'priority'}    = $res->{'priority'};
519
        $reserve{'lowestPriority'}    = $res->{'lowestPriority'};
500
        $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
520
        $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
501
        $reserve{'optionloop'} = \@optionloop;
521
        $reserve{'optionloop'} = \@optionloop;
502
        
522
        
Lines 549-564 foreach my $biblionumber (@biblionumbers) { Link Here
549
569
550
$template->param( biblioloop => \@biblioloop );
570
$template->param( biblioloop => \@biblioloop );
551
$template->param( biblionumbers => $biblionumbers );
571
$template->param( biblionumbers => $biblionumbers );
572
$template->param( DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar() );
552
573
553
if ($multihold) {
574
if ($multihold) {
554
    $template->param( multi_hold => 1 );
575
    $template->param( multi_hold => 1 );
555
}
576
}
556
577
557
if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
578
if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
558
    $template->param(
579
  template->param( reserve_in_future => 1 );
559
	reserve_in_future         => 1,
560
	DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar(),
561
	);
562
}
580
}
563
    
581
    
564
# printout the page
582
# printout the page
565
- 

Return to bug 1532