MT#7271 API: Explicitely set cf pref on update

Make sure that if we have a mapping, that we also set or update
the preference to the mapping id.
mr3.3.1
Andreas Granig 12 years ago
parent 9eda12c6fc
commit 5471f9115b

@ -149,7 +149,6 @@ sub update_item {
type => $type,
});
$mapping->discard_changes; # get our row
$cf_preference->create({ value => $mapping->id });
} elsif ($mapping_count > 1) {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Not a simple cf. Multiple $type-s configured.");
return;
@ -160,6 +159,12 @@ sub update_item {
}
try {
if($cf_preference->first) {
$cf_preference->first->update({ value => $mapping->id });
} else {
$cf_preference->create({ value => $mapping->id });
}
my $primary_nr_rs = $item->primary_number;
my $number;
if ($primary_nr_rs) {

Loading…
Cancel
Save