Bugzilla – Attachment 14651 Details for
Bug 9412
add optional_params to C4::Service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug 9412 Add optional_params sub to C4::Service
bug-9412-Add-optionalparams-sub-to-C4Service.patch (text/plain), 1.27 KB, created by
Hugh Davenport
on 2013-01-17 05:17:22 UTC
(
hide
)
Description:
bug 9412 Add optional_params sub to C4::Service
Filename:
MIME Type:
Creator:
Hugh Davenport
Created:
2013-01-17 05:17:22 UTC
Size:
1.27 KB
patch
obsolete
>From 3ec0af6bd055f49d2b6a4dff6cf7cc21e3718f79 Mon Sep 17 00:00:00 2001 >From: Hugh Davenport <hugh@davenport.net.nz> >Date: Thu, 17 Jan 2013 18:15:43 +1300 >Subject: [PATCH] bug 9412 Add optional_params sub to C4::Service > >Similar to require_params, but just returns undef for any param that >wasn't sent by request > >Signed-off-by: Hugh Davenport <hugh@davenport.net.nz> >--- > C4/Service.pm | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > >diff --git a/C4/Service.pm b/C4/Service.pm >index d9990ff..82604f1 100644 >--- a/C4/Service.pm >+++ b/C4/Service.pm >@@ -204,6 +204,32 @@ sub require_params { > return @values; > } > >+=head2 optional_params >+ >+ my @values = C4::Service->optional_params( @params ); >+ >+Check that each of of the parameters specified in @params was sent in the >+request, then return their values in that order. If any were not sent in >+the request, undef is returned for that value. >+ >+=cut >+ >+sub optional_params { >+ my ( $class, @params ) = @_; >+ >+ my @values; >+ >+ for my $param ( @params ) { >+ if ( !defined( $query->param( $param ) ) ) { >+ push @values, undef; >+ } else { >+ push @values, $query->param( $param ); >+ } >+ } >+ >+ return @values; >+} >+ > =head2 dispatch > > C4::Service->dispatch( >-- >1.7.10.4
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 9412
: 14651