Bug 21605: (follow-up) Simple ternary boolean to number conversion
Imo it is much easier to do just "$a ? 1 : 0" than testing defined($a) etc. in the additional loop. Less code, more readable? Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> (cherry picked from commit482b323da1) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commitfee85191b0) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commite1050653fb) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
fc39a7a801
commit
a6af3f6317
|
|
@ -82,17 +82,14 @@ else {
|
|||
download_directory => scalar $input->param('download_directory'),
|
||||
san => scalar $input->param('san'),
|
||||
transport => scalar $input->param('transport'),
|
||||
quotes_enabled => $input->param('quotes_enabled') ? 1 : 0,
|
||||
invoices_enabled => $input->param('invoices_enabled') ? 1 : 0,
|
||||
orders_enabled => $input->param('orders_enabled') ? 1 : 0,
|
||||
responses_enabled => $input->param('responses_enabled') ? 1 : 0,
|
||||
auto_orders => $input->param('auto_orders') ? 1 : 0,
|
||||
id_code_qualifier => scalar $input->param('id_code_qualifier'),
|
||||
plugin => scalar $input->param('plugin'),
|
||||
};
|
||||
# ensure all capability fields set to binary 0 or 1
|
||||
foreach my $capability
|
||||
(qw( quotes_enabled invoices_enabled orders_enabled responses_enabled auto_orders)) {
|
||||
$fields->{$capability} = defined $input->param($capability);
|
||||
if ($fields->{$capability} != 1) {
|
||||
$fields->{$capability} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$schema->resultset('VendorEdiAccount')->search(
|
||||
|
|
|
|||
Loading…
Reference in New Issue