You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
<?php |
|
|
|
/** |
|
* OnsiteDocument.php |
|
* |
|
* @package OpenEMR |
|
* @link https://www.open-emr.org |
|
* @author Jerry Padgett <sjpadgett@gmail.com> |
|
* @copyright Copyright (c) 2016-2017 Jerry Padgett <sjpadgett@gmail.com> |
|
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 |
|
*/ |
|
|
|
/** import supporting libraries */ |
|
require_once("DAO/OnsiteDocumentDAO.php"); |
|
require_once("OnsiteDocumentCriteria.php"); |
|
|
|
/** |
|
* The OnsiteDocument class extends OnsiteDocumentDAO which provides the access |
|
* to the datastore. |
|
* |
|
* @package Openemr::Model |
|
* @author ClassBuilder |
|
* @version 1.0 |
|
*/ |
|
class OnsiteDocument extends OnsiteDocumentDAO |
|
{ |
|
/** |
|
* Override default validation |
|
* @see Phreezable::Validate() |
|
*/ |
|
public function Validate() |
|
{ |
|
// example of custom validation |
|
// $this->ResetValidationErrors(); |
|
// $errors = $this->GetValidationErrors(); |
|
// if ($error == true) $this->AddValidationError('FieldName', 'Error Information'); |
|
// return !$this->HasValidationErrors(); |
|
|
|
return parent::Validate(); |
|
} |
|
|
|
/** |
|
* @see Phreezable::OnSave() |
|
*/ |
|
public function OnSave($insert) |
|
{ |
|
// the controller create/update methods validate before saving. this will be a |
|
// redundant validation check, however it will ensure data integrity at the model |
|
// level based on validation rules. comment this line out if this is not desired |
|
if (!$this->Validate()) { |
|
throw new Exception('Unable to Save OnsiteDocument: ' . implode(', ', $this->GetValidationErrors())); |
|
} |
|
|
|
// OnSave must return true or Phreeze will cancel the save operation |
|
return true; |
|
} |
|
}
|
|
|