function pre_delete($input_data) { if (!$this->id) { return 1; } if (!$this->exists()) { return 2; } if ($lang_del = $this->translations_delete($this->id)) { return $lang_del; } $stock = new stock_object(); if ($stock_id = $stock->find_external($this->id, TYPE_DISH)) { $stock = new stock_object($stock_id); $stock->silent = true; if ($err = $stock->delete()) { return $err; } } return $input_data; }