Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/browser.py	(revision 12803)
@@ -20,6 +20,7 @@
 from zope.component import getUtility
 from waeup.ikoba.interfaces import IIkobaUtils, IExtFileStore
+from waeup.ikoba.browser.layout import action
 from waeup.ikoba.customers.browser import (
-    PDFContractSlipPage, CustomerBaseEditFormPage)
+    PDFContractSlipPage, CustomerBaseEditFormPage, ContractSelectProductPage, msave)
 from ikobacustom.pcn.interfaces import MessageFactory as _
 from ikobacustom.pcn.customers.interfaces import (
@@ -88,2 +89,25 @@
             return error
         return
+
+
+class ContractSelectProductPage(ContractSelectProductPage):
+    """ Page to select a contract product
+
+    This page is for both customers and officers.
+    """
+
+    @action(_('Save and proceed'), style='primary')
+    def save(self, **data):
+        msave(self, **data)
+        self.context.contract_year = self.context.product_object.contract_year
+        self.context.title = self.context.product_object.contract_autotitle
+        self.context.tc_dict = self.context.product_object.tc_dict
+        self.context.valid_from = self.context.product_object.valid_from
+        self.context.valid_to = self.context.product_object.valid_to
+        isCustomer = getattr(
+            self.request.principal, 'user_type', None) == 'customer'
+        if isCustomer:
+            self.redirect(self.url(self.context, 'edit'))
+        else:
+            self.redirect(self.url(self.context, 'manage'))
+        return
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/contracts.py	(revision 12803)
@@ -67,5 +67,16 @@
 
 
-class RONContract(ContractBase):
+class PCNContract(ContractBase):
+    """This is a sample contract.
+    """
+
+    def __init__(self):
+        super(PCNContract, self).__init__()
+        # The site doesn't exist in unit tests
+        self.contract_year = None
+        return
+
+
+class RONContract(PCNContract):
     """This is a sample contract.
     """
@@ -105,5 +116,5 @@
 
 
-class ROPContract(ContractBase):
+class ROPContract(PCNContract):
     """This is a sample contract.
     """
@@ -143,5 +154,5 @@
 
 
-class RPRContract(ContractBase):
+class RPRContract(PCNContract):
     """Registration in the Provisional Register contract.
     """
@@ -181,5 +192,5 @@
 
 
-class RPCContract(ContractBase):
+class RPCContract(PCNContract):
     """Registration as Pharmaceutical Chemist contract.
     """
@@ -219,5 +230,5 @@
 
 
-class IPPMVLContract(ContractBase):
+class IPPMVLContract(PCNContract):
     """Issuance of Patent and Proprietary Medicines Vendors License contract.
     """
@@ -257,5 +268,5 @@
 
 
-class RPPMVLContract(ContractBase):
+class RPPMVLContract(PCNContract):
     """Renewal of Patent and Proprietary Medicines Vendors License contract.
     """
@@ -295,5 +306,5 @@
 
 
-class APPITContract(ContractBase):
+class APPITContract(PCNContract):
     """Accepting Pupil Pharmacist for Internship Training contract.
     """
@@ -333,5 +344,5 @@
 
 
-class RPTContract(ContractBase):
+class RPTContract(PCNContract):
     """Registration as a Pharmacy Technician contract.
     """
@@ -371,5 +382,5 @@
 
 
-class APPTContract(ContractBase):
+class APPTContract(PCNContract):
     """Annual Permit for Pharmacy Technician contract.
     """
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/export.py	(revision 12803)
@@ -35,4 +35,5 @@
 from ikobacustom.pcn.interfaces import MessageFactory as _
 
+
 class PCNCustomerExporter(CustomerExporter):
     """Exporter for Customers.
@@ -49,4 +50,5 @@
     title = _(u'PCN Customer JPG Documents')
     class_name = 'PCNCustomerJPGDocument'
+
 
 class PCNCustomerPDFDocumentExporter(CustomerDocumentExporterBase):
@@ -76,4 +78,5 @@
     class_name = 'ROPContract'
 
+
 class RPRContractExporter(ContractExporterBase):
     """Exporter for Contract instances.
@@ -83,4 +86,5 @@
     title = _(u'Licenses: Registration in the Provisional Register')
     class_name = 'RPRContract'
+
 
 class RPCContractExporter(ContractExporterBase):
@@ -92,4 +96,5 @@
     class_name = 'RPCContract'
 
+
 class IPPMVLContractExporter(ContractExporterBase):
     """Exporter for Contract instances.
@@ -99,4 +104,5 @@
     title = _(u'Licenses: Issuance of Patent and Proprietary Medicines Vendors')
     class_name = 'IPPMVLContract'
+
 
 class RPPMVLContractExporter(ContractExporterBase):
@@ -108,4 +114,5 @@
     class_name = 'RPPMVLContract'
 
+
 class APPITContractExporter(ContractExporterBase):
     """Exporter for Contract instances.
@@ -115,4 +122,5 @@
     title = _(u'Licenses: Accepting Pupil Pharmacist for Internship Training')
     class_name = 'APPITContract'
+
 
 class RPTContractExporter(ContractExporterBase):
@@ -124,4 +132,5 @@
     class_name = 'RPTContract'
 
+
 class APPTContractExporter(ContractExporterBase):
     """Exporter for Contract instances.
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py	(revision 12803)
@@ -19,4 +19,5 @@
 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
@@ -38,5 +39,5 @@
 def year_range():
     curr_year = datetime.now().year
-    return range(curr_year - 2, curr_year + 5)
+    return range(curr_year - 20, curr_year + 2)
 
 class PracticeSource(BasicSourceFactory):
@@ -86,7 +87,14 @@
     """
 
+class IPCNContract(IContract):
+    """A Retention of Name contract.
+
+    """
+    contract_year = Attribute('Year of License')
+
+
 # Customer contract interfaces
 
-class IRONContract(IContract):
+class IRONContract(IPCNContract):
     """A Retention of Name contract.
 
@@ -105,5 +113,5 @@
         )
 
-    year_qualification = schema.Choice(
+    qualification_year = schema.Choice(
         title = _(u'Year of Qualification'),
         required = True,
@@ -182,5 +190,5 @@
 
 
-class IROPContract(IContract):
+class IROPContract(IPCNContract):
     """A Registration of Premises contract.
 
@@ -291,5 +299,5 @@
     #    )
 
-class IRPRContract(IContract):
+class IRPRContract(IPCNContract):
     """A Registration in the Provisional Register contract.
 
@@ -425,5 +433,5 @@
 
 
-class IRPCContract(IContract):
+class IRPCContract(IPCNContract):
     """A Registration as Pharmaceutical Chemist contract.
 
@@ -570,5 +578,5 @@
     'certificates_object'].order
 
-class IIPPMVLContract(IContract):
+class IIPPMVLContract(IPCNContract):
     """A Issuance of Patent and Proprietary Medicines Vendors License.
 
@@ -744,5 +752,5 @@
     'incometax_object'].order
 
-class IRPPMVLContract(IContract):
+class IRPPMVLContract(IPCNContract):
     """A Renewal of Patent and Proprietary Medicines Vendors License.
 
@@ -876,5 +884,5 @@
     """
 
-class IAPPITContract(IContract):
+class IAPPITContract(IPCNContract):
     """A Accepting Pupil Pharmacist for Internship Training contract.
 
@@ -1020,5 +1028,5 @@
     """
 
-class IRPTContract(IContract):
+class IRPTContract(IPCNContract):
     """A Registration as a Pharmacy Technician contract.
 
@@ -1130,5 +1138,5 @@
     """
 
-class IAPPTContract(IContract):
+class IAPPTContract(IPCNContract):
     """An Annual Permit for Pharmacy Technician contract.
 
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/tests/test_browser.py	(revision 12803)
@@ -224,12 +224,13 @@
         result = open(self.outfile, 'rb').read()
         self.assertMatches(result,
-            'categories_practice,class_name,comment,contract_category,contract_id,'
-            'fee_based,history,last_product_id,lga,nationality,product_object,'
-            'product_options,state,superintendent,'
-            'tc_dict,title,user_id,valid_from,valid_to,work_address,work_email,work_phone,'
-            'year_qualification\r\n'
-            '[],RONContract,,ron,%s,0,'
-            '[u\'2015-01-18 16:40:01 WAT - License created by system\'],,,,,'
-            '[],created,,{\'en\': u\'Hello World\'},,K1000000,,,,,,\r\n'
+            'categories_practice,class_name,comment,contract_category,'
+            'contract_id,contract_year,fee_based,history,last_product_id,'
+            'lga,nationality,product_object,product_options,'
+            'qualification_year,state,superintendent,tc_dict,'
+            'title,user_id,valid_from,valid_to,work_address,'
+            'work_email,work_phone\r\n'
+            '[],RONContract,,ron,%s,,0,'
+            '[u\'2015-03-20 19:13:53 WAT - License created by system\']'
+            ',,,,,[],,created,,{\'en\': u\'Hello World\'},,K1000000,,,,,\r\n'
             % self.contract1.contract_id)
         # We can reimport the file if we change the header
@@ -283,14 +284,15 @@
         result = open(self.outfile, 'rb').read()
         self.assertMatches(result,
-            'categories_practice,class_name,contract_category,contract_id,'
-            'date_of_qualification,fee_based,history,inspected,last_license_number,'
+            'categories_practice,class_name,contract_category,'
+            'contract_id,contract_year,date_of_qualification,'
+            'fee_based,history,inspected,last_license_number,'
             'last_product_id,official_in_state,other_directors,'
             'pharmacists_directors,premises_address,premises_certificate,'
-            'product_object,product_options,recommended,'
-            'state,superintendent,tc_dict,title,user_id,valid_from,valid_to,'
-            'work_address\r\n'
-
-            '[],ROPContract,rop,%s,,0,'
-            '[u\'2015-01-20 18:51:03 WAT - License created by system\']'
+            'product_object,product_options,recommended,state,'
+            'superintendent,tc_dict,title,user_id,valid_from,'
+            'valid_to,work_address\r\n'
+
+            '[],ROPContract,rop,%s,,,0,'
+            '[u\'2015-03-20 19:18:30 WAT - License created by system\']'
             ',,,,,,,,,,[],,created,,{\'en\': u\'Hello World\'},,K1000000,,,\r\n'
             % self.contract2.contract_id)
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/interfaces.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/interfaces.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/interfaces.py	(revision 12803)
@@ -16,4 +16,5 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 ##
+from zope import schema
 from waeup.ikoba.products.interfaces import IProduct
 from ikobacustom.pcn.interfaces import MessageFactory as _
@@ -24,2 +25,12 @@
 
     """
+
+    contract_year = schema.Int(
+        title=u'Year of License',
+        description=_(u'Enter 4-digit license year.'),
+        required=False,
+        min=1990,
+        max=2050,
+        )
+
+IPCNProduct['contract_year'].order = IPCNProduct['valid_from'].order
Index: /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/tests/test_browser.py
===================================================================
--- /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/tests/test_browser.py	(revision 12802)
+++ /main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/products/tests/test_browser.py	(revision 12803)
@@ -54,8 +54,8 @@
         result = open(self.outfile, 'rb').read()
         self.assertEqual(result,
-            'contract_category,contract_title,description,options,'
+            'contract_category,contract_title,contract_year,description,options,'
             'product_id,terms_and_conditions,title,valid_from,valid_to,'
             'users_with_local_roles\r\n'
-            'ron,,,[],RON,,Unnamed,2015-12-04#,,[]\r\n')
+            'ron,,,,[],RON,,Unnamed,2015-12-04#,,[]\r\n')
         # We can import the same file.
         processor = PCNProductProcessor()
@@ -74,6 +74,8 @@
         result = processor.doImport(
             self.outfile,
-            ['contract_category','contract_title', 'description', 'options',
-            'product_id', 'terms_and_conditions','title','valid_from','valid_to',
+            ['contract_category','contract_title','contract_year',
+            'description', 'options',
+            'product_id', 'terms_and_conditions',
+            'title','valid_from','valid_to',
             'users_with_local_roles'],
             mode='create')
@@ -84,6 +86,8 @@
         result = processor.doImport(
             self.outfile,
-            ['contract_category','contract_title', 'description', 'options',
-            'product_id', 'terms_and_conditions','title','valid_from','valid_to',
+            ['contract_category','contract_title', 'contract_year',
+            'description', 'options',
+            'product_id', 'terms_and_conditions',
+            'title','valid_from','valid_to',
             'users_with_local_roles'],
             mode='update')
