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