person_has_restriction ()

Checks if a person has an active restriction with 99 severity.

Return: (mixed)

Source file: app/functions/person-function.php

View source


Used by


Source

function person_has_restriction()
{
    $app = \Liten\Liten::getInstance();
    try {
        $rest = $app->db->query("SELECT
        				GROUP_CONCAT(DISTINCT c.deptName SEPARATOR ',') AS 'Restriction'
    				FROM perc 
					LEFT JOIN rest b ON perc.code = b.code
					LEFT JOIN department c ON b.deptCode = c.deptCode
					WHERE perc.severity = '99'
                    AND perc.personID = ?
					AND perc.endDate IS NULL
					OR perc.endDate <= '0000-00-00'
					GROUP BY perc.personID
					HAVING perc.personID = ?", [
            get_persondata('personID'),
            get_persondata('personID')
        ]);
        $q = $rest->find(function ($data) {
            $array = [];
            foreach ($data as $d) {
                $array[] = $d;
            }
            return $array;
        });
        if (count($q[0]['Restriction']) > 0) {
            foreach ($q as $r) {
                return '<strong>' . _h($r['Restriction']) . '</strong>';
            }
        } else {
            return false;
        }
    } catch (NotFoundException $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    } catch (ORMException $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    } catch (Exception $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    }
}


Changelog

  • Since: eduTrac SIS 6.3.0

User Contributed Notes

You must log in before being able to contribute a note.