Bugzilla – Attachment 104672 Details for
Bug 15253
Add Koha::Logger based logging for SIP2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15253: Convert all tabs into 4 spaces in affected files
Bug-15253-Convert-all-tabs-into-4-spaces-in-affect.patch (text/plain), 11.03 KB, created by
Jonathan Druart
on 2020-05-11 10:12:58 UTC
(
hide
)
Description:
Bug 15253: Convert all tabs into 4 spaces in affected files
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-05-11 10:12:58 UTC
Size:
11.03 KB
patch
obsolete
>From 60ab3bc778cfb9d4d5a4e6dbc4f823ab4bc338fb Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >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 <jonathan.druart@bugs.koha-community.org> >--- > 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 = <STDIN>; >- $in = get_clean_string($in); >- while (my $extra = <STDIN>){ >- siplog("LOG_ERR", "get_clean_input got extra lines: %s", $extra); >- } >- return $in; >+ local $/ = "\012"; >+ my $in = <STDIN>; >+ $in = get_clean_string($in); >+ while (my $extra = <STDIN>){ >+ 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 = <STDIN>; >- print "password: "; >- # $pwd = &get_clean_input || ''; >- $pwd = <STDIN>; >- 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 = <STDIN>; >+ print "password: "; >+ # $pwd = &get_clean_input || ''; >+ $pwd = <STDIN>; >+ 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15253
:
45824
|
45825
|
45826
|
58570
|
58571
|
58572
|
58573
|
58582
|
60872
|
65219
|
65220
|
65221
|
65222
|
65223
|
65224
|
65225
|
65226
|
65227
|
65228
|
71702
|
71703
|
74947
|
86573
|
86574
|
87993
|
88383
|
100062
|
100063
|
100379
|
102216
|
102217
|
102218
|
102219
|
103456
|
103457
|
103458
|
103459
|
103462
|
103499
|
103500
|
103501
|
103502
|
103503
|
103599
|
103915
|
103916
|
103917
|
103918
|
103919
|
103920
|
103921
|
104016
|
104667
|
104668
|
104669
|
104670
|
104671
| 104672 |
104673
|
104674
|
111169