@@ 925-955 (lines=31) @@ | ||
922 | notify(ObjectInitializedEvent(obj)) |
|
923 | ||
924 | ||
925 | class Instrument_Calibrations(WorksheetImporter): |
|
926 | ||
927 | def Import(self): |
|
928 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
929 | for row in self.get_rows(3): |
|
930 | if not row.get('instrument', None) or not row.get('title', None): |
|
931 | continue |
|
932 | ||
933 | folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
|
934 | if folder: |
|
935 | obj = _createObjectByType( |
|
936 | "InstrumentCalibration", folder, tmpID()) |
|
937 | obj.edit( |
|
938 | title=row['title'], |
|
939 | DownFrom=row.get('downfrom', ''), |
|
940 | DownTo=row.get('downto', ''), |
|
941 | Calibrator=row.get('calibrator', ''), |
|
942 | Considerations=row.get('considerations', ''), |
|
943 | WorkPerformed=row.get('workperformed', ''), |
|
944 | Remarks=row.get('remarks', ''), |
|
945 | DateIssued=row.get('DateIssued', ''), |
|
946 | ReportID=row.get('ReportID', '') |
|
947 | ) |
|
948 | # Gettinginstrument lab contacts |
|
949 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
950 | lab_contacts = [o.getObject() for o in bsc( |
|
951 | portal_type="LabContact", nactive_state='active')] |
|
952 | for contact in lab_contacts: |
|
953 | if contact.getFullname() == row.get('Worker', ''): |
|
954 | obj.setWorker(contact.UID()) |
|
955 | obj.unmarkCreationFlag() |
|
956 | renameAfterCreation(obj) |
|
957 | notify(ObjectInitializedEvent(obj)) |
|
958 | ||
@@ 890-920 (lines=31) @@ | ||
887 | notify(ObjectInitializedEvent(obj)) |
|
888 | ||
889 | ||
890 | class Instrument_Validations(WorksheetImporter): |
|
891 | ||
892 | def Import(self): |
|
893 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
894 | for row in self.get_rows(3): |
|
895 | if not row.get('instrument', None) or not row.get('title', None): |
|
896 | continue |
|
897 | ||
898 | folder = self.get_object(bsc, 'Instrument', row.get('instrument')) |
|
899 | if folder: |
|
900 | obj = _createObjectByType( |
|
901 | "InstrumentValidation", folder, tmpID()) |
|
902 | obj.edit( |
|
903 | title=row['title'], |
|
904 | DownFrom=row.get('downfrom', ''), |
|
905 | DownTo=row.get('downto', ''), |
|
906 | Validator=row.get('validator', ''), |
|
907 | Considerations=row.get('considerations', ''), |
|
908 | WorkPerformed=row.get('workperformed', ''), |
|
909 | Remarks=row.get('remarks', ''), |
|
910 | DateIssued=row.get('DateIssued', ''), |
|
911 | ReportID=row.get('ReportID', '') |
|
912 | ) |
|
913 | # Getting lab contacts |
|
914 | bsc = getToolByName(self.context, SETUP_CATALOG) |
|
915 | lab_contacts = [o.getObject() for o in bsc( |
|
916 | portal_type="LabContact", is_active=True)] |
|
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 |