/** * * Cambiamos el comportamiento al borrar una factura. * Hay que borrar también todos sus Items asociados * */ function mark_deleted($id) { // Obtenemos la lista de Items, y los marcamos como borrados. $bean = new reg_invoices(); $bean->retrieve($id); $items = $bean->get_linked_beans('items', 'reg_items'); foreach ($items as $item) { $item->mark_deleted($item->id); } // Después ejecutamos el borrado normal. parent::mark_deleted($id); }