/** * */ public function addStop($ps_name, $pn_type_id, $pn_locale_id, $ps_idno, $ps_color = '000000') { if (!$this->getPrimaryKey()) { return false; } $t_stop = new ca_tour_stops(); if ($this->inTransaction()) { $t_stop->setTransaction($this->getTransaction()); } $t_stop->setMode(ACCESS_WRITE); $t_stop->set('idno', $ps_idno); $t_stop->set('type_id', $pn_type_id); $t_stop->set('tour_id', $this->getPrimaryKey()); $t_stop->set('color', $ps_color); $t_stop->insert(); if ($t_stop->numErrors()) { $this->errors = $t_stop->errors; return false; } $t_stop->addLabel(array('name' => $ps_name), $pn_locale_id, null, true); if ($t_stop->numErrors()) { $this->errors = $t_stop->errors; $t_stop->delete(true); return false; } return $t_stop; }