Synchronizing with lab book

From CTRNet Wiki
Jump to: navigation, search

To synchronize an item with a lab book, you need to make a call to the function syncData under the LabBookMaster (model) class. It takes 4 parameters

  • array data - The data to synchronize. It will be done directly within that array
  • array models - The models to look up for synchronization
  • string lab_book_code - The lab book code to synchronize with
  • int expected_ctrl_id (optional) - The control id the lab book code should have. Used for validation.

The function returns either a string when there is an error or an int with the lab book id when all went as expected.

If all you want to do is validate your lab book against your current element, you can call the function with an empty data array, an empty model array, the right code and the expected control id. If you receive an id as a result, your lab book has been validated against the expected control id.