## $Id: interfaces.py 12803 2015-03-20 18:51:29Z henrik $ ## ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## from zope import schema from datetime import datetime from zope.interface import Attribute, Interface from zc.sourcefactory.basic import BasicSourceFactory from waeup.ikoba.interfaces import IIkobaObject from waeup.ikoba.customers.interfaces import ( ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract, validate_email) from waeup.ikoba.customers.vocabularies import ( ConCatProductSource, CustomerDocumentSource, RefereeSourceFactory, nats_vocab, ) from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber from waeup.ikoba.products.productoptions import ProductOptionField from ikobacustom.pcn.interfaces import MessageFactory as _ from ikobacustom.pcn.interfaces import LGASource from ikobacustom.pcn.customers.schoolgrades import ResultEntryField def year_range(): curr_year = datetime.now().year return range(curr_year - 20, curr_year + 2) class PracticeSource(BasicSourceFactory): """A source for categories of practice. """ def getValues(self): return [ 'academic', 'administrative', 'distribution', 'importation', 'manufacturing', 'retail and dispensing', 'research and training', 'hospital practice', 'wholesale', ] class IPCNCustomer(ICustomer): """Representation of a customer. """ date_of_birth = FormattedDate( title = _(u'Date of Birth'), required = True, show_year = True, ) res_address = schema.Text( title = _(u'Residential Address'), required = True, ) # Customer document interfaces class IPCNCustomerJPGDocument(ICustomerDocument): """A customer jpg document. """ class IPCNCustomerPDFDocument(ICustomerPDFDocument): """A customer pdf document. """ class IPCNContract(IContract): """A Retention of Name contract. """ contract_year = Attribute('Year of License') # Customer contract interfaces class IRONContract(IPCNContract): """A Retention of Name contract. """ nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = False, ) qualification_year = schema.Choice( title = _(u'Year of Qualification'), required = True, values = year_range(), ) work_address = schema.Text( title = _(u'Work Address'), required = False, ) work_email = schema.TextLine( title = _(u'Work Email Address'), required = False, constraint=validate_email, ) work_phone = PhoneNumber( title = _(u'Work Phone'), description = u'', required = False, ) categories_practice = schema.List( title = _(u'Categories of Practice'), value_type = schema.Choice(source=PracticeSource()), required = False, default = [], ) superintendent = schema.Bool( title= _('Superintendent'), description= _('Tick box if you are a superintendent pharamcist.'), required = False, ) #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = False, # ) class IRONContractOfficialUse(IIkobaObject): """Interface for editing RON official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRONContractProcess(IRONContract, IRONContractOfficialUse): """Interface for processing RON data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRONContractEdit(IRONContract): """Interface for editing RON data by customers. """ #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = True, # ) class IROPContract(IPCNContract): """A Registration of Premises contract. """ premises_address = schema.Text( title = _(u'Name and Address of Pharmaceutical Premises'), required = True, ) categories_practice = schema.List( title = _(u'Categories of Practice'), value_type = schema.Choice(source=PracticeSource()), required = False, default = [], ) premises_certificate = schema.TextLine( title = _(u'Last Premises Certificate'), description= _('If an old premises, state the last premises certificate number issued with date.'), required = False, ) date_of_qualification = FormattedDate( title = _(u'Date of Qualification'), required = False, show_year = True, ) last_license_number = schema.TextLine( title = _(u'Last Annual License Number'), required = False, ) superintendent = schema.Bool( title= _('Superintendent'), description= _('Tick box if you were a superintendent pharamcist last year.'), required = False, ) work_address = schema.Text( title = _(u'Full Time Employment Address'), description= _('Enter work address if you were not a superintendent pharamcist last year.'), required = False, ) pharmacists_directors= schema.TextLine( title = _(u'Pharmacist Directors'), description = _(u'Full name of directors and their profession as in Form C.O.7'), required = False, ) other_directors= schema.TextLine( title = _(u'Other Directors'), description = _(u'Full name of directors and their profession as in Form C.O.7'), required = False, ) #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = False, # ) class IROPContractOfficialUse(IIkobaObject): """Interface for editing ROP official use data. """ inspected = schema.Bool( title = _('Inspected'), description = _('Has the premises been duly inspected?'), required = False, ) recommended = schema.Bool( title = _('Recommended'), description= _('Is the premises recommended?'), required = False, ) official_in_state = schema.TextLine( title = _(u'Name of Official in the State'), required = False, ) class IROPContractProcess(IROPContract, IROPContractOfficialUse): """Interface for processing RON data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IROPContractEdit(IROPContract): """Interface for editing RON data by customers. """ #document_object = schema.Choice( # title = _(u'Document'), # source = CustomerDocumentSource(), # required = True, # ) class IRPRContract(IPCNContract): """A Registration in the Provisional Register contract. """ nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) pharmacies_addresses = schema.Text( title = _(u'Pharmacies Attended'), description = u'Enter the addresses of pharmacies and periods of attendance.', required = False, readonly = False, ) qualifications = schema.Text( title = _(u'Qualifications'), description = u'Enter a list of certificates obtained.', required = False, readonly = False, ) certificates_object = schema.Choice( title = _(u'Certificates'), description = u'Select the document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = False, ) referees = schema.List( title = _(u'Referees'), value_type = schema.Choice( source=RefereeSourceFactory(), required = True, ), description = u'Add at least two referees from the PCN database.', required = False, readonly = False, default = [], ) referee1_name = schema.TextLine( title = _(u'First Referee Name'), description= _('This referee must be a pharmacist.'), required = False, readonly = False, ) referee1_address = schema.Text( title = _(u'First Referee Address'), required = False, readonly = False, ) referee1_license = schema.TextLine( title = _(u'First Referee License Number'), required = False, readonly = False, ) referee2_name = schema.TextLine( title = _(u'Second Referee Name'), required = False, readonly = False, ) referee2_address = schema.Text( title = _(u'Second Referee Address'), required = False, readonly = False, ) referee2_license = schema.TextLine( title = _(u'Second Referee License Number'), required = False, readonly = False, ) internship_address = schema.Text( title = _(u'Internship'), description = _('Enter name and address of company where you want to ' 'serve your internship.'), required = False, readonly = False, ) class IRPRContractOfficialUse(IIkobaObject): """Interface for editing RPR official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRPRContractProcess(IRPRContract, IRPRContractOfficialUse): """Interface for processing RPR data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRPRContractEdit(IRPRContract): """Interface for editing RPR data by customers. """ certificates_object = schema.Choice( title = _(u'Certificates'), description = u'Select the document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = True, ) IRPRContractEdit['certificates_object'].order = IRPRContract[ 'certificates_object'].order class IRPCContract(IPCNContract): """A Registration as Pharmaceutical Chemist contract. """ nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) nationality_aquired = schema.Choice( values=[_(u'birth'), _(u'naturalization'), _(u'marriage')], title = _(u'Nationality acquired by'), required = False, ) qualifications = schema.Text( title = _(u'Qualifications'), description = u'Enter a list of certificates obtained.', required = False, readonly = False, ) certificates_object = schema.Choice( title = _(u'Certificates'), description = u'Select the document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = False, ) referees = schema.List( title = _(u'Referees'), value_type = schema.Choice( source=RefereeSourceFactory(), required = True, ), description = u'Add at least two referees from the PCN database.', required = False, readonly = False, default = [], ) referee1_name = schema.TextLine( title = _(u'First Referee Name'), required = False, readonly = False, ) referee1_address = schema.Text( title = _(u'First Referee Address'), required = False, readonly = False, ) referee1_license = schema.TextLine( title = _(u'First Referee License Number'), required = False, readonly = False, ) referee2_name = schema.TextLine( title = _(u'Second Referee Name'), required = False, readonly = False, ) referee2_address = schema.Text( title = _(u'Second Referee Address'), required = False, readonly = False, ) referee2_license = schema.TextLine( title = _(u'Second Referee License Number'), required = False, readonly = False, ) internship = schema.Text( title = _(u'Internship'), description = u'Enter name and address of the company where you ' u'served your internship, the name of the approved ' u'registered pharmacist and the period of your service.', required = False, readonly = False, ) nigerian_residence = FormattedDate( title = _(u'Residence in Nigeria'), description = u'Enter the date since when you have continously ' u'resided in Nigeria.', required = False, show_year = True, ) witness = schema.Text( title = _(u'Witness'), description = u'Enter name and adress of witness.', required = False, ) class IRPCContractOfficialUse(IIkobaObject): """Interface for editing RPC official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRPCContractProcess(IRPCContract, IRPCContractOfficialUse): """Interface for processing RPC data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRPCContractEdit(IRPCContract): """Interface for editing RPC data by customers. """ certificates_object = schema.Choice( title = _(u'Certificates'), description = u'Select the document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = True, ) IRPCContractEdit['certificates_object'].order = IRPCContract[ 'certificates_object'].order class IIPPMVLContract(IPCNContract): """A Issuance of Patent and Proprietary Medicines Vendors License. """ occupation = schema.TextLine( title = _(u'Occupation'), required = False, readonly = False, ) qualifications = schema.Text( title = _(u'Educational Qualifications'), description = u'Enter a list of certificates obtained.', required = False, readonly = False, ) certificates_object = schema.Choice( title = _(u'Certificates/Credentials'), description = u'Select the pdf document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = False, ) incometax_object = schema.Choice( title = _(u'Income Tax Clearance'), description = u'Select the pdf document which contains scanned copies ' u'of your income tax clearance for the past three years. ' u'You must create such a document first.', source = CustomerDocumentSource(), required = False, ) shop_address = schema.Text( title = _(u'Patent Vendor\'s Shop'), description = u'Enter name and address of patent vendor\'s shop.', required = False, ) shop_lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = False, ) shop_email = schema.TextLine( title = _(u'Shop Email Address'), required = False, constraint=validate_email, ) shop_phone = PhoneNumber( title = _(u'Shop Phone'), description = u'', required = False, ) old_or_new = schema.Choice( values=[_(u'old'), _(u'new')], title = _(u'Old or New Shop'), required = False, ) PPMVL_number = schema.TextLine( title = _(u'PPMVL Data'), description = u'If an old store, state PPMVL number and date of issue.', required = False, readonly = False, ) referee1_name = schema.TextLine( title = _(u'First Referee Name'), required = False, readonly = False, ) referee1_address = schema.Text( title = _(u'First Referee Address'), required = False, readonly = False, ) referee1_license = schema.TextLine( title = _(u'First Referee License Number'), required = False, readonly = False, ) referee1_occupation = schema.TextLine( title = _(u'First Referee Occupation'), required = False, readonly = False, ) referee2_name = schema.TextLine( title = _(u'Second Referee Name'), required = False, readonly = False, ) referee2_address = schema.Text( title = _(u'Second Referee Address'), required = False, readonly = False, ) referee2_license = schema.TextLine( title = _(u'Second Referee License Number'), required = False, readonly = False, ) referee2_occupation = schema.TextLine( title = _(u'Second Referee Occupation'), required = False, readonly = False, ) class IIPPMVLContractOfficialUse(IIkobaObject): """Interface for editing IPPMVL official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IIPPMVLContractProcess(IIPPMVLContract, IIPPMVLContractOfficialUse): """Interface for processing IPPMVL data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IIPPMVLContractEdit(IIPPMVLContract): """Interface for editing IPPMVL data by customers. """ certificates_object = schema.Choice( title = _(u'Certificates'), description = u'Select the document which contains scanned copies ' u'of your certificates. You must create such a ' u'document first.', source = CustomerDocumentSource(), required = True, ) incometax_object = schema.Choice( title = _(u'Income Tax Clearance'), description = u'Select the pdf document which contains scanned copies ' u'of your income tax clearance for the past three years. ' u'You must create such a document first.', source = CustomerDocumentSource(), required = True, ) IIPPMVLContractEdit['certificates_object'].order = IIPPMVLContract[ 'certificates_object'].order IIPPMVLContractEdit['incometax_object'].order = IIPPMVLContract[ 'incometax_object'].order class IRPPMVLContract(IPCNContract): """A Renewal of Patent and Proprietary Medicines Vendors License. """ occupation = schema.TextLine( title = _(u'Occupation'), required = False, readonly = False, ) qualifications = schema.Text( title = _(u'Educational Qualifications'), description = u'Enter a list of certificates obtained.', required = False, readonly = False, ) shop_address = schema.Text( title = _(u'Patent Vendor\'s Shop'), description = u'Enter name and address of patent vendor\'s shop.', required = False, ) ppmv_signpost = schema.TextLine( title = _(u'PPMV Sign-post Number'), required = False, readonly = False, ) shop_lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = False, ) shop_email = schema.TextLine( title = _(u'Shop Email Address'), required = False, constraint=validate_email, ) shop_phone = PhoneNumber( title = _(u'Shop Phone'), description = u'', required = False, ) PPMVL_number = schema.TextLine( title = _(u'PPMVL Data'), description = u'State PPMVL number and date of issue of last license.', required = False, readonly = False, ) referee1_name = schema.TextLine( title = _(u'First Referee Name'), required = False, readonly = False, ) referee1_address = schema.Text( title = _(u'First Referee Address'), required = False, readonly = False, ) referee1_license = schema.TextLine( title = _(u'First Referee License Number'), required = False, readonly = False, ) referee1_occupation = schema.TextLine( title = _(u'First Referee Occupation'), required = False, readonly = False, ) referee2_name = schema.TextLine( title = _(u'Second Referee Name'), required = False, readonly = False, ) referee2_address = schema.Text( title = _(u'Second Referee Address'), required = False, readonly = False, ) referee2_license = schema.TextLine( title = _(u'Second Referee License Number'), required = False, readonly = False, ) referee2_occupation = schema.TextLine( title = _(u'Second Referee Occupation'), required = False, readonly = False, ) class IRPPMVLContractOfficialUse(IIkobaObject): """Interface for editing RPPMVL official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRPPMVLContractProcess(IRPPMVLContract, IRPPMVLContractOfficialUse): """Interface for processing RPPMVL data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRPPMVLContractEdit(IRPPMVLContract): """Interface for editing RPPMVL data by customers. """ class IAPPITContract(IPCNContract): """A Accepting Pupil Pharmacist for Internship Training contract. """ institution_address = schema.Text( title = _(u'Institution'), description= _('Enter name and address of institution ' 'where internee will serve.'), required = False, ) approved = schema.Bool( title= _('Institution Approved'), description= _('Tick box if the institution is approved for internship.'), required = False, ) inst_certificate = schema.TextLine( title = _(u'Institution Certificate'), description= _('Enter the institutions certificate number and date.'), required = False, readonly = False, ) employer_address = schema.Text( title = _(u'Employer'), description= _('Enter name and address of employer.'), required = False, ) internee_name = schema.TextLine( title = _(u'Internee Name'), required = False, readonly = False, ) internee_address = schema.Text( title = _(u'Internee Address'), required = False, ) provisional_registration = schema.TextLine( title = _(u'Provisional Registration'), description= _('Enter number and date of certificate of ' 'provisional regsitration of the internee.'), required = False, readonly = False, ) educational_institution = schema.Text( title = _(u'Educational Institution Attended'), description= _('Enter name, address of institution and period of attendance.'), required = False, readonly = False, ) educational_qualification = schema.TextLine( title = _(u'Qualification'), description= _('Enter qualification obtained.'), required = False, readonly = False, ) supervisor = schema.TextLine( title = _(u'Supervising Pharmacist (Preceptor)'), required = False, readonly = False, ) supervisor_designation = schema.TextLine( title = _(u'Designation'), description= _('Enter designation of supervisor.'), required = False, readonly = False, ) supervisor_year = schema.TextLine( title = _(u'Year of Qualification'), description= _('Enter year of qualification of supervisor.'), required = False, readonly = False, ) supervisor_regnumber = schema.TextLine( title = _(u'Registration Number'), description= _('Enter registration number of supervisor.'), required = False, readonly = False, ) license_regnumber = schema.TextLine( title = _(u'Annual License to Practice'), description= _('Enter number and date of annual license to practice ' 'of supervisor.'), required = False, readonly = False, ) scope_practice = schema.List( title = _(u'Scope of Practice'), value_type = schema.Choice(source=PracticeSource()), description= _('Select scopes of pharmaceutical practice currently ' 'undertaken at the institution.'), required = False, default = [], ) date_of_commencement = FormattedDate( title = _(u'Date of Commencement'), description = _(u'Enter date of commencement of internship.'), required = False, show_year = True, ) class IAPPITContractOfficialUse(IIkobaObject): """Interface for editing APPIT official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IAPPITContractProcess(IAPPITContract, IAPPITContractOfficialUse): """Interface for processing APPIT data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IAPPITContractEdit(IAPPITContract): """Interface for editing APPIT data by customers. """ class IRPTContract(IPCNContract): """A Registration as a Pharmacy Technician contract. """ nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) nationality_aquired = schema.Choice( values=[_(u'birth'), _(u'naturalization'), _(u'marriage')], title = _(u'Nationality acquired by'), required = False, ) lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = False, ) office_address = schema.Text( title = _(u'Offices or Business Address'), required = False, ) home_address = schema.Text( title = _(u'Permanent Home Address'), required = False, ) schools_attended = schema.Text( title = _(u'Schools Attended'), description = _('Enter:
' '(1) name of primary school, period of attendance
' '(2) name of secondary school, period of attendance
' '(3) name of post-secondary school, period of attendance'), required = False, ) subjects = schema.List( title = _(u'Subjects'), value_type = ResultEntryField(), required = False, readonly = False, default = [], ) referee1_name = schema.TextLine( title = _(u'First Referee Name'), description= _('This referee must be a pharmacist.'), required = False, readonly = False, ) referee1_address = schema.Text( title = _(u'First Referee Address'), required = False, readonly = False, ) referee2_name = schema.TextLine( title = _(u'Second Referee Name'), required = False, readonly = False, ) referee2_address = schema.Text( title = _(u'Second Referee Address'), required = False, readonly = False, ) class IRPTContractOfficialUse(IIkobaObject): """Interface for editing RPT official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IRPTContractProcess(IRPTContract, IRPTContractOfficialUse): """Interface for processing RPT data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IRPTContractEdit(IRPTContract): """Interface for editing RPT data by customers. """ class IAPPTContract(IPCNContract): """An Annual Permit for Pharmacy Technician contract. """ nationality = schema.Choice( vocabulary = nats_vocab, title = _(u'Nationality'), required = False, ) lga = schema.Choice( source = LGASource(), title = _(u'State / LGA'), required = False, ) office_address = schema.Text( title = _(u'Offices or Business Address'), required = False, ) employment = schema.Text( title = _('Employment'), description = _('Enter the name and address of where you ' 'was employed last year.'), required = False, ) supervisor = schema.TextLine( title = _(u'Supervisor'), description= _('Who was your supervisor?'), required = False, readonly = False, ) supervisor_licensenumber = schema.TextLine( title = _(u'Supervisor License Number'), required = False, readonly = False, ) reason_leaving = schema.Text( title = _(u'Reason for Leaving'), description= _('Tell the reason for leaving employment last ' 'year (if applicable).'), required = False, readonly = False, ) courses_attended = schema.Text( title = _(u'Courses, Workshops etc. Attended'), required = False, readonly = False, ) class IAPPTContractOfficialUse(IIkobaObject): """Interface for editing APPT official use data. """ comment = schema.Text( title= _('Reason for rejection'), required = False, ) class IAPPTContractProcess(IAPPTContract, IAPPTContractOfficialUse): """Interface for processing APPT data. """ product_options = schema.List( title = _(u'Options/Fees'), value_type = ProductOptionField(), required = False, readonly = False, default = [], ) class IAPPTContractEdit(IAPPTContract): """Interface for editing APPT data by customers. """