-2

I'm new to Solidity. I've got an error from compiling the above code. "Udeclared identifer"

Can you help me for this?

function addNewRecord(
    uint256 _clinicId,
    uint256 _patientId,
    string memory _condition,
    string memory _description,
    string memory _allergies,
    string memory _document
) public onlyClinic {   --> error is here "onlyClinic"
    require(patients[_patientId].id != 0, "The patient does not exist");
    Record memory rec = Record(
        recordId,
        _hospitalId,
        _patientId,
        _condition,
        _description,
        _allergies,
        _document
    );
    records[recordId] = rec;
    patients[_patientId].records.push(recordId);
    recordId++;
}

modifier onlyClinic() {
    uint256 _id = clinicToId[msg.sender];
    require(
        _id != 0 && clinics[_id].id != 0,
        "Only clinics are allowed"
    );
    _;
}
Ryan M
  • 18,333
  • 31
  • 67
  • 74
MaybeExpertDBA
  • 345
  • 6
  • 15

1 Answers1

1

Is the modifier written before or after the function the modifier need to be created before the function