@@ 892-922 (lines=31) @@ | ||
889 | notify(ObjectInitializedEvent(obj)) |
|
890 | ||
891 | ||
892 | class Instrument_Calibrations(WorksheetImporter): |
|
893 | ||
894 | def Import(self): |
|
895 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
896 | for row in self.get_rows(3): |
|
897 | if not row.get('instrument', None) or not row.get('title', None): |
|
898 | continue |
|
899 | ||
900 | folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
|
901 | if folder: |
|
902 | obj = _createObjectByType("InstrumentCalibration", folder, tmpID()) |
|
903 | obj.edit( |
|
904 | title=row['title'], |
|
905 | DownFrom=row.get('downfrom', ''), |
|
906 | DownTo=row.get('downto', ''), |
|
907 | Calibrator=row.get('calibrator', ''), |
|
908 | Considerations=row.get('considerations', ''), |
|
909 | WorkPerformed=row.get('workperformed', ''), |
|
910 | Remarks=row.get('remarks', ''), |
|
911 | DateIssued=row.get('DateIssued', ''), |
|
912 | ReportID=row.get('ReportID', '') |
|
913 | ) |
|
914 | # Gettinginstrument lab contacts |
|
915 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
916 | lab_contacts = [o.getObject() for o in bsc(portal_type="LabContact", nactive_state='active')] |
|
917 | for contact in lab_contacts: |
|
918 | if contact.getFullname() == row.get('Worker', ''): |
|
919 | obj.setWorker(contact.UID()) |
|
920 | obj.unmarkCreationFlag() |
|
921 | renameAfterCreation(obj) |
|
922 | notify(ObjectInitializedEvent(obj)) |
|
923 | ||
924 | ||
925 | class Instrument_Certifications(WorksheetImporter): |
|
@@ 859-889 (lines=31) @@ | ||
856 | notify(ObjectInitializedEvent(obj)) |
|
857 | ||
858 | ||
859 | class Instrument_Validations(WorksheetImporter): |
|
860 | ||
861 | def Import(self): |
|
862 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
863 | for row in self.get_rows(3): |
|
864 | if not row.get('instrument', None) or not row.get('title', None): |
|
865 | continue |
|
866 | ||
867 | folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
|
868 | if folder: |
|
869 | obj = _createObjectByType("InstrumentValidation", folder, tmpID()) |
|
870 | obj.edit( |
|
871 | title=row['title'], |
|
872 | DownFrom=row.get('downfrom', ''), |
|
873 | DownTo=row.get('downto', ''), |
|
874 | Validator=row.get('validator', ''), |
|
875 | Considerations=row.get('considerations', ''), |
|
876 | WorkPerformed=row.get('workperformed', ''), |
|
877 | Remarks=row.get('remarks', ''), |
|
878 | DateIssued=row.get('DateIssued', ''), |
|
879 | ReportID=row.get('ReportID', '') |
|
880 | ) |
|
881 | # Getting lab contacts |
|
882 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
883 | lab_contacts = [o.getObject() for o in bsc(portal_type="LabContact", is_active=True)] |
|
884 | for contact in lab_contacts: |
|
885 | if contact.getFullname() == row.get('Worker', ''): |
|
886 | obj.setWorker(contact.UID()) |
|
887 | obj.unmarkCreationFlag() |
|
888 | renameAfterCreation(obj) |
|
889 | notify(ObjectInitializedEvent(obj)) |
|
890 | ||
891 | ||
892 | class Instrument_Calibrations(WorksheetImporter): |