Skip unit and prep relations when they are set to 'None'
This commit is contained in:
parent
98d1647cea
commit
a711d247f6
@ -657,7 +657,7 @@ sub _add_ingredients {
|
|||||||
my ($unitid, $prepid);
|
my ($unitid, $prepid);
|
||||||
|
|
||||||
# Set the units, if appropriate (ignore the "None" unit)
|
# Set the units, if appropriate (ignore the "None" unit)
|
||||||
if($ingred -> {"units"} && $ingred -> {"units"} ne "None") {
|
if($ingred -> {"units"} && lc($ingred -> {"units"}) ne "none") {
|
||||||
$unitid = $self -> {"entities"} -> {"units"} -> get_id($ingred -> {"units"})
|
$unitid = $self -> {"entities"} -> {"units"} -> get_id($ingred -> {"units"})
|
||||||
or return $self -> self_error("Unable to get unit ID for '".$ingred -> {"units"}."': ".$self -> {"entities"} -> {"units"} -> errstr());
|
or return $self -> self_error("Unable to get unit ID for '".$ingred -> {"units"}."': ".$self -> {"entities"} -> {"units"} -> errstr());
|
||||||
|
|
||||||
@ -665,7 +665,8 @@ sub _add_ingredients {
|
|||||||
or return $self -> self_error("Unit refcount error: ".$self -> {"entities"} -> {"ingredients"} -> errstr());
|
or return $self -> self_error("Unit refcount error: ".$self -> {"entities"} -> {"ingredients"} -> errstr());
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ingred -> {"prep"}) {
|
# Likewise for preparation methods
|
||||||
|
if($ingred -> {"prep"} && lc($ingred -> {"units"}) ne "none") {
|
||||||
$prepid = $self -> {"entities"} -> {"prep"} -> get_id($ingred -> {"prep"})
|
$prepid = $self -> {"entities"} -> {"prep"} -> get_id($ingred -> {"prep"})
|
||||||
or return $self -> self_error("Unable to get preparation method ID for '".$ingred -> {"prep"}."': ".$self -> {"entities"} -> {"prep"} -> errstr());
|
or return $self -> self_error("Unable to get preparation method ID for '".$ingred -> {"prep"}."': ".$self -> {"entities"} -> {"prep"} -> errstr());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user