Bug 23883: sip_cli_emulator.pl should display real parameter names
For creating this patch I looked at all parameters defined in the
handler mapping, removed duplicated ones and tracked down which ones
really were parameters in `GetOptions`. This included tracking down
variables that were later assigned other values and things like that.
The mapping is used to display the right parameter name if missing a
mandatory one.
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 46cc88acc3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
5ffdf17098
commit
ec396bfdd4
|
|
@ -306,6 +306,31 @@ my $handlers = {
|
|||
},
|
||||
};
|
||||
|
||||
my $param_to_cli = {
|
||||
currency_type => 'currency-type',
|
||||
current_location => 'location',
|
||||
end_item => 'end-item',
|
||||
fee_acknowledged => 'fee-acknowledged',
|
||||
fee_amount => 'fee-amount',
|
||||
fee_identifier => 'fee-identifier',
|
||||
fee_type => 'fee-type',
|
||||
hold_mode => 'hold-mode',
|
||||
institution_id => 'location',
|
||||
item_identifier => 'item',
|
||||
location_code => 'location',
|
||||
login_password => 'sip_pass',
|
||||
login_user_id => 'sip_user',
|
||||
no_block => 'no-block',
|
||||
patron_identifier => 'patron',
|
||||
patron_password => 'password',
|
||||
payment_type => 'payment-type',
|
||||
pickup_location => 'pickup-location',
|
||||
start_item => 'start-item',
|
||||
summary => 'summary',
|
||||
terminal_password => 'sip_pass',
|
||||
transaction_id => 'transaction-id',
|
||||
};
|
||||
|
||||
my $data = run_command_message('login');
|
||||
|
||||
if ( $data =~ '^941' ) { ## we are logged in
|
||||
|
|
@ -335,7 +360,8 @@ sub build_command_message {
|
|||
foreach my $key ( keys %$parameters ) {
|
||||
unless ( $parameters->{$key} ) {
|
||||
unless ( $optional{$key} ) {
|
||||
say "$key is required for $message";
|
||||
my $param_name = $param_to_cli->{$key} // $key;
|
||||
say "$param_name is required for $message";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue