From 60ab3bc778cfb9d4d5a4e6dbc4f823ab4bc338fb Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 29 Apr 2020 06:27:10 -0400 Subject: [PATCH] Bug 15253: Convert all tabs into 4 spaces in affected files Signed-off-by: Jonathan Druart --- C4/SIP/ILS/Transaction/Checkout.pm | 48 ++++++------- C4/SIP/SIPServer.pm | 112 ++++++++++++++--------------- C4/SIP/Sip.pm | 16 ++--- 3 files changed, 88 insertions(+), 88 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index 6b1f867298..daa43e9c4e 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -28,34 +28,34 @@ our $debug; # Most fields are handled by the Transaction superclass my %fields = ( - security_inhibit => 0, - due => undef, - renew_ok => 0, - ); + security_inhibit => 0, + due => undef, + renew_ok => 0, + ); sub new { my $class = shift;; my $self = $class->SUPER::new(); foreach my $element (keys %fields) { - $self->{_permitted}->{$element} = $fields{$element}; + $self->{_permitted}->{$element} = $fields{$element}; } @{$self}{keys %fields} = values %fields; # $self->{'due'} = time() + (60*60*24*14); # two weeks hence - $debug and warn "new ILS::Transaction::Checkout : " . Dumper $self; + $debug and warn "new ILS::Transaction::Checkout : " . Dumper $self; return bless $self, $class; } sub do_checkout { - my $self = shift; - siplog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout..."); - my $shelf = $self->{item}->hold_shelf; - my $barcode = $self->{item}->id; - my $patron_barcode = $self->{patron}->id; + my $self = shift; + siplog('LOG_DEBUG', "ILS::Transaction::Checkout performing checkout..."); + my $shelf = $self->{item}->hold_shelf; + my $barcode = $self->{item}->id; + my $patron_barcode = $self->{patron}->id; my $overridden_duedate; # usually passed as undef to AddIssue - $debug and warn "do_checkout: patron (" . $patron_barcode . ")"; + $debug and warn "do_checkout: patron (" . $patron_barcode . ")"; my $patron = Koha::Patrons->find( { cardnumber => $patron_barcode } ); my $borrower = $patron->unblessed; - $debug and warn "do_checkout borrower: . " . Dumper $borrower; + $debug and warn "do_checkout borrower: . " . Dumper $borrower; my ($issuingimpossible, $needsconfirmation) = _can_we_issue($patron, $barcode, C4::Context->preference("AllowItemsOnHoldCheckoutSIP") ); @@ -126,20 +126,20 @@ sub do_checkout { $noerror = 0; } } - unless ($noerror) { - $debug and warn "cannot issue: " . Dumper($issuingimpossible) . "\n" . Dumper($needsconfirmation); - $self->ok(0); - return $self; - } - # can issue - $debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n" - # . "w/ \$borrower: " . Dumper($borrower) - . "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); + unless ($noerror) { + $debug and warn "cannot issue: " . Dumper($issuingimpossible) . "\n" . Dumper($needsconfirmation); + $self->ok(0); + return $self; + } + # can issue + $debug and warn "do_checkout: calling AddIssue(\$borrower,$barcode, $overridden_duedate, 0)\n" + # . "w/ \$borrower: " . Dumper($borrower) + . "w/ C4::Context->userenv: " . Dumper(C4::Context->userenv); my $issue = AddIssue( $borrower, $barcode, $overridden_duedate, 0 ); $self->{due} = $self->duedatefromissue($issue, $itemnumber); - $self->ok(1); - return $self; + $self->ok(1); + return $self; } sub _can_we_issue { diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm index 8a208dde88..b14aaa9862 100755 --- a/C4/SIP/SIPServer.pm +++ b/C4/SIP/SIPServer.pm @@ -30,7 +30,7 @@ use base qw(Net::Server::PreFork); use constant LOG_SIP => "local6"; # Local alias for the logging facility # -# Main # not really, since package SIPServer +# Main # not really, since package SIPServer # # FIXME: Is this a module or a script? # A script with no MAIN namespace? @@ -75,7 +75,7 @@ foreach my $svc (keys %{$config->{listeners}}) { # if (defined($config->{'server-params'})) { while (my ($key, $val) = each %{$config->{'server-params'}}) { - push @parms, $key . '=' . $val; + push @parms, $key . '=' . $val; } } @@ -125,17 +125,17 @@ sub process_request { $self->{service} = $config->find_service($sockaddr, $port, $proto); if (!defined($self->{service})) { - siplog("LOG_ERR", "process_request: Unknown recognized server connection: %s:%s/%s", $sockaddr, $port, $proto); - die "process_request: Bad server connection"; + siplog("LOG_ERR", "process_request: Unknown recognized server connection: %s:%s/%s", $sockaddr, $port, $proto); + die "process_request: Bad server connection"; } $transport = $transports{$self->{service}->{transport}}; if (!defined($transport)) { - siplog("LOG_WARNING", "Unknown transport '%s', dropping", $service->{transport}); - return; + siplog("LOG_WARNING", "Unknown transport '%s', dropping", $service->{transport}); + return; } else { - &$transport($self); + &$transport($self); } return; } @@ -201,27 +201,27 @@ sub raw_transport { } sub get_clean_string { - my $string = shift; - if (defined $string) { - siplog("LOG_DEBUG", "get_clean_string pre-clean(length %s): %s", length($string), $string); - chomp($string); - $string =~ s/^[^A-z0-9]+//; - $string =~ s/[^A-z0-9]+$//; - siplog("LOG_DEBUG", "get_clean_string post-clean(length %s): %s", length($string), $string); - } else { - siplog("LOG_INFO", "get_clean_string called on undefined"); - } - return $string; + my $string = shift; + if (defined $string) { + siplog("LOG_DEBUG", "get_clean_string pre-clean(length %s): %s", length($string), $string); + chomp($string); + $string =~ s/^[^A-z0-9]+//; + $string =~ s/[^A-z0-9]+$//; + siplog("LOG_DEBUG", "get_clean_string post-clean(length %s): %s", length($string), $string); + } else { + siplog("LOG_INFO", "get_clean_string called on undefined"); + } + return $string; } sub get_clean_input { - local $/ = "\012"; - my $in = ; - $in = get_clean_string($in); - while (my $extra = ){ - siplog("LOG_ERR", "get_clean_input got extra lines: %s", $extra); - } - return $in; + local $/ = "\012"; + my $in = ; + $in = get_clean_string($in); + while (my $extra = ){ + siplog("LOG_ERR", "get_clean_input got extra lines: %s", $extra); + } + return $in; } sub telnet_transport { @@ -235,47 +235,47 @@ sub telnet_transport { siplog("LOG_DEBUG", "telnet_transport: timeout is $timeout"); eval { - local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; - local $| = 1; # Unbuffered output - $/ = "\015"; # Internet Record Separator (lax version) + local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; + local $| = 1; # Unbuffered output + $/ = "\015"; # Internet Record Separator (lax version) # Until the terminal has logged in, we don't trust it # so use a timeout to protect ourselves from hanging. - while ($strikes--) { - print "login: "; - alarm $timeout; - # $uid = &get_clean_input; - $uid = ; - print "password: "; - # $pwd = &get_clean_input || ''; - $pwd = ; - alarm 0; - - siplog("LOG_DEBUG", "telnet_transport 1: uid length %s, pwd length %s", length($uid), length($pwd)); - $uid = get_clean_string ($uid); - $pwd = get_clean_string ($pwd); - siplog("LOG_DEBUG", "telnet_transport 2: uid length %s, pwd length %s", length($uid), length($pwd)); - - if (exists ($config->{accounts}->{$uid}) - && ($pwd eq $config->{accounts}->{$uid}->{password})) { - $account = $config->{accounts}->{$uid}; - if ( C4::SIP::Sip::MsgType::login_core($self,$uid,$pwd) ) { + while ($strikes--) { + print "login: "; + alarm $timeout; + # $uid = &get_clean_input; + $uid = ; + print "password: "; + # $pwd = &get_clean_input || ''; + $pwd = ; + alarm 0; + + siplog("LOG_DEBUG", "telnet_transport 1: uid length %s, pwd length %s", length($uid), length($pwd)); + $uid = get_clean_string ($uid); + $pwd = get_clean_string ($pwd); + siplog("LOG_DEBUG", "telnet_transport 2: uid length %s, pwd length %s", length($uid), length($pwd)); + + if (exists ($config->{accounts}->{$uid}) + && ($pwd eq $config->{accounts}->{$uid}->{password})) { + $account = $config->{accounts}->{$uid}; + if ( C4::SIP::Sip::MsgType::login_core($self,$uid,$pwd) ) { last; } - } - siplog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); - print("Invalid login$CRLF"); - } + } + siplog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); + print("Invalid login$CRLF"); + } }; # End of eval if ($@) { - siplog("LOG_ERR", "telnet_transport: Login timed out"); - die "Telnet Login Timed out"; + siplog("LOG_ERR", "telnet_transport: Login timed out"); + die "Telnet Login Timed out"; } elsif (!defined($account)) { - siplog("LOG_ERR", "telnet_transport: Login Failed"); - die "Login Failure"; + siplog("LOG_ERR", "telnet_transport: Login Failed"); + die "Login Failure"; } else { - print "Login OK. Initiating SIP$CRLF"; + print "Login OK. Initiating SIP$CRLF"; } $self->{account} = $account; diff --git a/C4/SIP/Sip.pm b/C4/SIP/Sip.pm index 1d9d9bf1cd..3d68f9765c 100644 --- a/C4/SIP/Sip.pm +++ b/C4/SIP/Sip.pm @@ -68,9 +68,9 @@ sub add_field { my ($i, $ent); if (!defined($value)) { - siplog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", - $field_id); - $value = ''; + siplog("LOG_DEBUG", "add_field: Undefined value being added to '%s'", + $field_id); + $value = ''; } $value=~s/\r/ /g; # CR terminates a sip message # Protect against them in sip text fields @@ -80,7 +80,7 @@ sub add_field { $ent = sprintf("&#%d;", ord($field_delimiter)); while (($i = index($value, $field_delimiter)) != ($[-1)) { - substr($value, $i, 1) = $ent; + substr($value, $i, 1) = $ent; } return $field_id . $value . $field_delimiter; @@ -122,14 +122,14 @@ sub add_count { # If the field is unsupported, it will be undef, return blanks # as per the spec. if (!defined($count)) { - return ' ' x 4; + return ' ' x 4; } $count = sprintf("%04d", $count); if (length($count) != 4) { - siplog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", - $label, $count); - $count = ' ' x 4; + siplog("LOG_WARNING", "handle_patron_info: %s wrong size: '%s'", + $label, $count); + $count = ' ' x 4; } return $count; } -- 2.20.1