TT#37325 Make lines not mandatory for /api/pbxdevices

Change-Id: I42947ad31a00cd7b7020575db82e575894413f55
changes/30/21630/4
Irina Peshinskaya 8 years ago
parent 78b75e7d9f
commit 323d12bd8a

@ -140,6 +140,10 @@ sub POST :Allow {
resource => $resource,
form => $form,
);
if (defined $resource->{lines} && ref $resource->{lines} ne 'ARRAY') {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, 'Invalid "lines" value. Must be an array.');
last;
}
my $iden_device = $schema->resultset('autoprov_field_devices')->find({identifier => $resource->{identifier}});
if ($iden_device) {

@ -39,7 +39,8 @@ has_field 'lines' => (
setup_for_js => 1,
do_wrapper => 1,
do_label => 1,
required => 1,
required => 0,
validate_when_empty => 1,
tags => {
controls_div => 1,
},

@ -121,6 +121,10 @@ sub update_item {
form => $form,
resource => $resource,
);
if (defined $resource->{lines} && ref $resource->{lines} ne 'ARRAY') {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, 'Invalid "lines" value. Must be an array.');
last;
}
my $iden_device = $schema->resultset('autoprov_field_devices')->find({identifier => $resource->{identifier}});
if($iden_device && $iden_device->id != $item->id) {

Loading…
Cancel
Save