コード例 #1
0
 function Validate()
 {
     if ($this->getDeleted() == TRUE) {
         //CHeck to make sure currency isnt in-use by paystubs/employees/wages, if so, don't delete.
         $invalid = FALSE;
         $pslf = new PayStubListFactory();
         $pslf->getByCurrencyId($this->getId());
         if ($pslf->getRecordCount() > 0) {
             $invalid = TRUE;
         }
         if ($invalid == FALSE) {
             $ulf = new UserListFactory();
             $ulf->getByCurrencyId($this->getId());
             if ($ulf->getRecordCount() > 0) {
                 $invalid = TRUE;
             }
         }
         if ($invalid == TRUE) {
             $this->Validator->isTRUE('in_use', FALSE, TTi18n::gettext('This currency is in use'));
         }
     }
     return TRUE;
 }