From a711d247f6ddba81f36e48e3e3dfe30dd7ac1e51 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 27 Jul 2018 12:24:13 +0100 Subject: [PATCH] Skip unit and prep relations when they are set to 'None' --- modules/ORB/System/Recipe.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ORB/System/Recipe.pm b/modules/ORB/System/Recipe.pm index 55093d0..5005591 100644 --- a/modules/ORB/System/Recipe.pm +++ b/modules/ORB/System/Recipe.pm @@ -657,7 +657,7 @@ sub _add_ingredients { my ($unitid, $prepid); # 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"}) 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()); } - if($ingred -> {"prep"}) { + # Likewise for preparation methods + if($ingred -> {"prep"} && lc($ingred -> {"units"}) ne "none") { $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());