MT#8309 remove usage of JSON::Types::bool

agranig/pbx-dev-map
Gerhard Jungwirth 11 years ago
parent 3c0dd86c81
commit 752b972e07

@ -2,11 +2,9 @@ package NGCP::Panel::Role::API;
use Moose::Role;
use Sipwise::Base;
use boolean;
use Storable qw();
use JSON qw();
use JSON::Pointer;
use JSON::Types qw(bool);
use HTTP::Status qw(:constants);
use Safe::Isa qw($_isa);
use TryCatch;
@ -170,8 +168,7 @@ sub validate_fields {
# only do this for converting back from obj to hal
# otherwise it breaks db fields with the \0 and \1 notation
unless($run) {
#$resource->{$k} = $resource->{$k} ? true : false
$resource->{$k} = JSON::Types::bool($resource->{$k})
$resource->{$k} = $resource->{$k} ? JSON::true : JSON::false
if(defined $resource->{$k} &&
$fields->{$k}->$_isa('HTML::FormHandler::Field::Boolean'));
}

@ -11,7 +11,7 @@ use TryCatch;
use Data::HAL qw();
use Data::HAL::Link qw();
use HTTP::Status qw(:constants);
use JSON::Types;
use JSON qw();
use NGCP::Panel::Form::Device::ModelAPI;
sub get_form {
@ -71,7 +71,7 @@ sub resource_from_item {
$r->{id} = int($r->{id});
$r->{num_lines} = int($r->{num_lines});
foreach my $f(qw/can_private can_shared can_blf/) {
$r->{$f} = JSON::Types::bool($r->{$f});
$r->{$f} = $r->{$f} ? JSON::true : JSON::false;
}
push @{ $resource{linerange} }, $r;

Loading…
Cancel
Save