By AstaC on
I have installed the recipe module. In this module there is a control that makes it impossible to write the same ingredient two times. I want to get rid of this control. The code is down here. Anyone who can tell me how to change the code to take away that control?
function recipe_ingredients_diff($a1,$a2) {
$return->add = array();
$return->remove = array();
$return->update = array();
foreach ($a1 as $pl) {
$pl = (object)$pl;
$pl->name = trim($pl->name);
if ($pl->name) {
if (!_in_array($pl,$return->add)) {
// Duplicate entries for the same ingredient are ignored.
if (!_in_array($pl, $a2))
$return->add[] = $pl;
else
if (!_in_array($pl,$return->update))
$return->update[] = $pl;
}
}
}
foreach ($a2 as $k => $pl) {
if (!_in_array($pl, $a1)) {
$return->remove[] = $pl->id;
}
}
return $return;
}
Comments
If I understand the code
Changing
to
will do the trick