Permalink
Browse files

LLK #16897163, #16897227 dropbox at checkin, &c.

- pass the backdate for dropbox
- make any of the 3 options sticky: exemptfine, backdate, dropbox
- minor in about.pl: plack cookie expand raw HASH; also find
  app version for hand-compiled apache and mysql
  • Loading branch information...
1 parent c349c16 commit 39323d5a3d6ecfa25e791befc4338d7867677721 ha committed Sep 21, 2011
Showing with 44 additions and 68 deletions.
  1. +5 −14 C4/Circulation.pm
  2. +13 −6 about.pl
  3. +22 −20 circ/returns.pl
  4. +4 −28 koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl
View
@@ -1514,6 +1514,7 @@ patron who last borrowed the book.
=cut
sub AddReturn {
+ ## dropbox is for backwards compatibility: use returndate instead
my ($barcode, $branch, $exemptfine, $dropbox, $returndate, $tolost) = @_;
my $today = C4::Dates->new();
$returndate ||= $today->output('iso');
@@ -1698,7 +1699,6 @@ sub AddReturn {
_FixAccountOverdues(
$issue, {
exemptfine => $exemptfine,
- dropbox => $dropbox,
returndate => $returndate,
branch => $branch,
today => $today,
@@ -1980,20 +1980,11 @@ sub _FixAccountOverdues {
my $item = C4::Items::GetItem($$issue{itemnumber});
my $borrower = C4::Members::GetMember($$issue{borrowernumber});
my ($accounttype, $amount, $msg, $ismax) = ('F', $$row{amount}, undef, 0);
- if ($flags->{dropbox} || $flags->{returndate}) {
- my $branchcode = _GetCircControlBranch($item, $borrower,$$issue{branchcode});
- my $cal = C4::Calendar->new(branchcode => $branchcode);
- my $enddateObj;
- if ($$flags{returndateObj}) {
- $enddateObj = $$flags{returndateObj};
- }
- else {
- $enddateObj = ($flags->{dropbox})
- ? $cal->addDate(C4::Dates->new(), -2) # why doesn't -1 work?
- : C4::Dates->new($flags->{returndate}, 'iso');
- }
+ if ($flags->{returndate}) {
+ my $cal = C4::Calendar->new(branchcode => $$flags{branch});
+ my $enddateObj = $$flags{returndateObj};
($amount, undef, undef, undef, $ismax)
- = C4::Overdues::CalcFine($item, $borrower->{categorycode}, $branchcode,
+ = C4::Overdues::CalcFine($item, $borrower->{categorycode}, $$flags{branch},
undef, undef, $start_date, $enddateObj);
$msg = "adjusted backdate $verbiage item $$issue{itemnumber} $checkindate";
}
View
@@ -45,10 +45,12 @@
$perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
}
my $perlVersion = $];
-my $mysqlVersion = `mysql -V`;
-my $apacheVersion = `httpd -v`;
-$apacheVersion = `httpd2 -v` unless $apacheVersion;
-$apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
+my $mysqlVersion = '';
+my $apacheVersion = ''; # [-1] paths below: compiled from source
+my @spaths = ('mysql','/usr/local/mysql/bin/mysql');
+foreach(@spaths) { if (`which $_`) { $mysqlVersion = `$_ -V`; last } }
+@spaths = ('httpd','httpd2','/usr/sbin/apache2', '/usr/local/apache2/bin/httpd');
+foreach(@spaths) { if (`which $_`) { $apacheVersion = (`$_ -V`)[0]; last; } }
my $zebraVersion = `zebraidx -V`;
$template->param(
@@ -168,10 +170,15 @@
);
}
+use Data::Dumper;
$template->param( components => \@components );
$template->param( localtime => scalar localtime() );
-
-my @environment = map { {variable => $_, value => $ENV{$_}} } sort keys %ENV;
+my @environment = map {{
+ variable => $_,
+ value => ref($ENV{$_})
+ ? Dumper $ENV{$_}
+ : $ENV{$_}
+}} sort keys %ENV;
$template->param( environment => \@environment);
output_html_with_http_headers $query, $cookie, $template->output;
View
@@ -49,10 +49,10 @@ =head1 returns.pl
use C4::ReceiptTemplates;
my $query = CGI->new();
+my $sessionID = $query->cookie("CGISESSID");
+my $session = get_session($sessionID);
if (!C4::Context->userenv){
- my $sessionID = $query->cookie("CGISESSID");
- my $session = get_session($sessionID);
if ($session->param('branch') eq 'NO_LIBRARY_SET'){
# no branch set we can't return
print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
@@ -109,26 +109,12 @@ =head1 returns.pl
my $printers = GetPrinters();
#my $branch = C4::Context->userenv?C4::Context->userenv->{'branch'}:"";
-my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : "";
+my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : '';
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
my $HoldButtonConfirm = (C4::Context->preference('HoldButtonConfirm'));
my $HoldButtonIgnore = (C4::Context->preference('HoldButtonIgnore'));
my $HoldButtonPrintConfirm = (C4::Context->preference('HoldButtonPrintConfirm'));
-
my $userenv_branch = C4::Context->userenv->{'branch'} || '';
-#
-# Some code to handle the error if there is no branch or printer setting.....
-#
-my $checkin_override_date;
-if (C4::Context->preference('AllowCheckInDateChange')) {
- my $tempdate = $query->param('checkin_override_date');
- $tempdate ||= $query->cookie('checkin_override_date') || '';
- if ($tempdate && $tempdate =~ C4::Dates->regexp('syspref')) {
- $checkin_override_date = C4::Dates->new($tempdate);
- $template->param( checkin_override_date => $tempdate);
- }
-}
-
# Set up the item stack ....
my %returneditems;
@@ -225,13 +211,26 @@ =head1 returns.pl
my $exemptfine = $query->param('exemptfine');
my $dropboxmode = $query->param('dropboxmode');
my $dotransfer = $query->param('dotransfer');
+my $checkin_override_date = $query->param('checkin_override_date');
my $calendar = C4::Calendar->new( branchcode => $userenv_branch );
#dropbox: get last open day (today - 1)
my $today = C4::Dates->new();
my $today_iso = $today->output('iso');
my $dropboxdate = $calendar->addDate($today, -1);
$barcode =~ s/^\s*|\s+//g;
+if ($ENV{HTTP_REFERER} =~ /$ENV{SCRIPT_NAME}/) { # get/post to self
+ if ($dropboxmode) { $checkin_override_date = $dropboxdate->output(); }
+ $session->param('circ_ci_exemptfine', $exemptfine);
+ $session->param('circ_ci_dropboxmode',$dropboxmode);
+ $session->param('circ_ci_backdate', $checkin_override_date);
+}
+else { # initial page load
+ $exemptfine = $session->param('circ_ci_exemptfine');
+ $dropboxmode = $session->param('circ_ci_dropboxmode');
+ $checkin_override_date = $session->param('circ_ci_backdate');
+}
+
if ($dotransfer && ($notransfer==0)){
# An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
my $transferitem = $query->param('transferitem');
@@ -275,9 +274,11 @@ =head1 returns.pl
#
# save the return
#
+
if ($checkin_override_date ) {
+ my $backdateObj = C4::Dates->new($checkin_override_date);
( $returned, $messages, $issueinformation, $borrower ) =
- C4::Circulation::AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode, $checkin_override_date->output('iso'));
+ C4::Circulation::AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode, $backdateObj->output('iso'));
} else {
( $returned, $messages, $issueinformation, $borrower ) =
C4::Circulation::AddReturn( $barcode, C4::Context->userenv->{'branch'}, $exemptfine, $dropboxmode);
@@ -711,8 +712,9 @@ =head1 returns.pl
errmsgloop => \@errmsgloop,
exemptfine => $exemptfine,
dropboxmode => $dropboxmode,
- dropboxdate => $dropboxdate->output(),
- overduecharges => $overduecharges,
+ checkin_override_date => $dropboxmode? '' : $checkin_override_date,
+ dropboxdate => $dropboxdate->output(),
+ overduecharges => $overduecharges,
soundon => C4::Context->preference("SoundOn"),
DHTMLcalendar_dateformat=> C4::Dates->DHTMLcalendar(),
AllowCheckInDateChange => C4::Context->preference('AllowCheckInDateChange'),
@@ -35,9 +35,11 @@ function Dopop(link) {
if (this.checked == true) {
$("#barcode").addClass("alert");
$("#dropboxmode").show();
+ document.cookie = 'dropboxmode=dropboxmode; path=/';
} else {
$("#barcode").removeClass("alert");
$("#dropboxmode").hide();
+ document.cookie = 'dropboxmode=; path=/';
}
$("#barcode").focus();
});
@@ -667,13 +669,11 @@ function HaltReturns() {
<!-- TMPL_ELSE -->
<input name="barcode" id="barcode" size="14" class="focus"/>
<!-- /TMPL_IF -->
- <input id="barcode_submit" type="submit" class="submit" value="Submit" onclick="
- setOverrideDate();"/>
+ <input id="barcode_submit" type="submit" class="submit" value="Submit"/>
<script>
$('barcode').keypress(function(e) {
// if the key pressed is the enter key
if (e.which == 13) {
- setOverrideDate();
document.myf.submit();
return;
}
@@ -738,7 +738,7 @@ function HaltReturns() {
<script>
var odate = document.myf.f_checkin_override_date.value;
if (odate != '') {
- document.write('<input type=button value="Clear Date" onclick="clearOverrideDate()">');
+ document.write('<input type=button value="Clear Date" onclick="$(\'#f_checkin_override_date\').val(\'\');">');
}
</script>
</label>
@@ -748,30 +748,6 @@ function HaltReturns() {
</fieldset>
</div>
</form>
-
- <script>
- function getCookie(cname) {
- var i,x,y,ARRcookies = document.cookie.split(';');
- for(i=0;i<ARRcookies.length;i++) {
- x=ARRcookies[i].substr(0,ARRcookies[i].indexOf('='));
- y=ARRcookies[i].substr(ARRcookies[i].indexOf('=')+1);
- x=x.replace(/^\s+|\s+$/g,'');
- if(x==cname) {
- return unescapce(y);
- }
- }
- }
- function clearOverrideDate() {
- document.myf.f_checkin_override_date.value='';
- document.cookie = 'checkin_override_date=; path=/';
- }
- function setOverrideDate() {
- var odate = document.myf.f_checkin_override_date.value;
- if (odate != '') {
- document.cookie = 'checkin_override_date='+odate+'; path=/';
- }
- }
- </script>
</div>
<!-- TMPL_IF Name="returned" -->

0 comments on commit 39323d5

Please sign in to comment.