function createBlankGobtpac($pidm = '', $source = 'Script', $role = '') { $pin = PSU::password(); $hashed_pin = $this->encryptPin($pin); if ($pidm) { //generate gobtpac records for population $sql = "INSERT INTO gobtpac (\n\t\t\t\tgobtpac_pidm,\n\t\t\t\tgobtpac_pin_disabled_ind,\n\t\t\t\tgobtpac_usage_accept_ind,\n\t\t\t\tgobtpac_activity_date,\n\t\t\t\tgobtpac_user,\n\t\t\t\tgobtpac_pin,\n\t\t\t\tgobtpac_salt\n\t\t\t) VALUES (\n\t\t\t\t{$pidm},\n\t\t\t\t'N',\n\t\t\t\t'Y',\n\t\t\t\tsysdate,\n\t\t\t\t'{$source}',\n\t\t\t\t'" . $hashed_pin['hash'] . "',\n\t\t\t\t'" . $hashed_pin['salt'] . "'\n\t\t\t)"; $this->db->Execute($sql); } else { //generate gobtpac records for population $sql = "INSERT INTO gobtpac (\n\t\t\t\tgobtpac_pidm,\n\t\t\t\tgobtpac_pin_disabled_ind,\n\t\t\t\tgobtpac_usage_accept_ind,\n\t\t\t\tgobtpac_activity_date,\n\t\t\t\tgobtpac_user,\n\t\t\t\tgobtpac_pin,\n\t\t\t\tgobtpac_salt\n\t\t\t) (\n\t\t\t\tSELECT gorirol_pidm,\n\t\t\t\t'N',\n\t\t\t\t'Y',\n\t\t\t\tsysdate,\n\t\t\t\t'{$source}',\n\t\t\t\t'" . $hashed_pin['hash'] . "',\n\t\t\t\t'" . $hashed_pin['salt'] . "'\n\t\t\t\tFROM gorirol\n\t\t\t\tWHERE gorirol_role='{$role}'\n\t\t\t\t\tAND not exists(SELECT 1 FROM gobtpac WHERE gobtpac_pidm = gorirol_pidm)\n\t\t\t)"; $this->db->Execute($sql); } //end else }