public function esmateriallibrecentro($centro) { $inventario = new Alinventario(); if (!$this->isNewRecord) { if ($inventario->getstockTotalmaterialCentro($this->codigo, $centro) == 0 and $this->tienecompras == 0 and $this->tienecomprasd == 0 and $this->tienesolpe == 0) { return TRUE; } else { return FALSE; } } else { return true; } }