Changeset 742


Ignore:
Timestamp:
24 Oct 2006, 16:32:10 (18 years ago)
Author:
joachim
Message:

added pay-hostel-maintainance fee

Location:
WAeUP_SRP/trunk
Files:
4 added
10 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r727 r742  
    125125                student_obj = getattr(self,sid)
    126126                access_code = "%d" % random.randint(1000000000,9999999999)
    127                 self.portal_registration.addMember(sid,
    128                                                    access_code ,
    129                                                    roles=('Member',
    130                                                           'Student',))
     127                student_obj.getContent().addMember(sid,access_code ,)
    131128                pwl_dict = {'student_id': sid,'access_code':access_code}
    132129                student_obj.invokeFactory('StudentApplication','application')
     
    220217            pwlist.append(pwl_template.substitute(pwl_dict))
    221218            wftool.doActionFor(student_obj,'clear_and_validate')
     219            student_obj.manage_setLocalRoles(sid, ['Owner',])
    222220            wftool.doActionFor(application,'close')
     221            application.manage_setLocalRoles(sid, ['Owner',])
    223222            wftool.doActionFor(clearance,'close')
     223            clearance.manage_setLocalRoles(sid, ['Owner',])
    224224            wftool.doActionFor(personal,'close')
     225            personal.manage_setLocalRoles(sid, ['Owner',])
    225226            wftool.doActionFor(studycourse,'close_for_edit')
     227            studycourse.manage_setLocalRoles(sid, ['Owner',])
     228        open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
     229        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
     230    ###)
     231
     232    security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###(
     233    def loadPumeResultsFromCSV(self):
     234        """load Fulltime Studentdata from CSV values"""
     235        import transaction
     236        import random
     237        tr_count = 0
     238        name = 'pume_results'
     239        no_import = False
     240        if not no_import:
     241            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
     242            no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n')
     243        logger = logging.getLogger('%s_import' % name)
     244        logger.info('Start loading from %s.csv' % name)
     245        pwlist  = []
     246        pwlist.append('"student_id","firstname","middlename","lastname","jamb_reg_no","access_code"')
     247        pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$jamb_reg_no","$access_code"')
     248        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
     249        try:
     250            students = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
     251        except:
     252            logger.error('Error reading %s.csv' % name)
     253            return
     254        l = self.portal_catalog({'meta_type': "StudentClearance",})
     255        matrics = []
     256        for s in l:
     257            matrics.append(s.getObject().getContent().matric_no)
     258        print matrics
     259        l = self.portal_catalog({'meta_type': "Certificate"})
     260        certs = {}
     261        for c in l:
     262            ca,ac,fa,dep_id,co,certcode = c.relative_path.split('/')
     263            cid = "%(dep_id)s_%(certcode)s" % vars()
     264            certs[cid] = c.getObject()
     265        for student in students:
     266            logger.info('processing "%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     267            sid = student.get('MatricNo')
     268            if sid == "":
     269                em = 'Empty MatricNo\n'
     270                logger.info(em)
     271                no_import.write(em)
     272                no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     273                continue
     274            certcode = makeCertificateCode(student.get('CourseMajor'))
     275            dep_id = student.get('Dept')
     276            fac_id = student.get('Faculty')
     277            cid = "%(dep_id)s_%(certcode)s" % vars()
     278            if cid not in certs.keys():
     279                em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor'))
     280                logger.info(em)
     281                no_import.write(em)
     282                no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     283                continue
     284            certificate_doc = certs[cid].getContent()
     285            level = student.get('StudentLevel')
     286            try:
     287                int(level)
     288            except:
     289                em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student
     290                logger.info(em)
     291                no_import.write(em)
     292                no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     293                continue
     294            matric_no = student.get('MatricNo')
     295            if matric_no not in matrics:
     296                matrics.append(matric_no)
     297                sid = self.generateStudentId(student.get('Lastname')[0])
     298                #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
     299                students_folder.invokeFactory('Student', sid)
     300                logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars())
     301                student_obj = getattr(self,sid)
     302                access_code = "%d" % random.randint(1000000000,9999999999)
     303                student_obj.getContent().addMember(sid,access_code ,)
     304                pwl_dict = {'student_id': sid,'access_code':access_code}
     305                student_obj.invokeFactory('StudentApplication','application')
     306                application = student_obj.application
     307                da = {'Title': 'Application Data'}
     308                student_obj.invokeFactory('StudentPersonal','personal')
     309                da['jamb_reg_no'] = student.get('EntryRegNo')
     310                personal = student_obj.personal
     311                dp = {'Title': 'Personal Data'}
     312                student_obj.invokeFactory('StudentClearance','clearance')
     313                clearance = student_obj.clearance
     314                dc = {'Title': 'Clearance Data'}
     315                dc['matric_no'] = matric_no
     316                state = student.get('State')
     317                lga = student.get('LGA')
     318                if state and lga:
     319                    lga =  state + ' / ' + lga
     320                else:
     321                    lga = "None"
     322                dc['lga'] = lga
     323                dc['nationality'] = student.get('Nationality')
     324                dc['email'] = student.get('Emailaddress')
     325                dp['firstname'] = student.get('FirstName')
     326                dp['middlename'] = student.get('MiddleName')
     327                dp['lastname'] = student.get('Lastname')
     328                dp['former_surname'] = student.get('FormerSurname')
     329                dp['sex'] = student.get('Sex') == 'F'
     330                dp['perm_address'] = student.get('PermanentAddress')
     331                dp['perm_city'] = student.get('PermanentAddressCity')
     332                dp['campus_address'] = student.get('CampusAddress')
     333                dp['phone'] = student.get('PhoneNumber')
     334                application.getContent().edit(mapping=da)
     335                personal.getContent().edit(mapping=dp)
     336                clearance.getContent().edit(mapping=dc)
     337                #
     338                # Study Course
     339                #
     340                student_obj.invokeFactory('StudentStudyCourse','study_course')
     341                studycourse = student_obj.study_course
     342                dsc = {}
     343                from_certificate = ['title',
     344                                   'max_elect',
     345                                   'max_pass',
     346                                   'n_core',
     347                                   'nr_years',
     348                                   'probation_credits',
     349                                   'promotion_credits',
     350                                   'start_level',
     351                                  ]
     352                for f in from_certificate:
     353                    dsc[f] = getattr(certificate_doc,f)
     354                dsc['faculty'] = fac_id
     355                dsc['department'] = dep_id
     356                dsc['study_course'] = certcode
     357                css = student.get('CurrentSession') or '2004-2005'
     358                cs = int(css.split('-')[0]) - 2000
     359                cl = int(student.get('StudentLevel') or '100')/100
     360                dsc['entry_session'] = "200%s" % (cs - cl)
     361                dsc['clr_ac_pin'] = access_code
     362                studycourse.getContent().edit(mapping=dsc)
     363                #
     364                # Level
     365                #
     366##                l = getattr(studycourse,level,None)
     367##                if 0 and l is None:
     368##                    #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
     369##                    logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student)
     370##                    studycourse.invokeFactory('StudentStudyLevel', level)
     371##                    l = getattr(studycourse, level)
     372##                    certificate = certs[certcode]
     373##                    cert_level = getattr(certificate,level,None)
     374##                    if cert_level is None:
     375##                        logger.info('Level %(level)s not in %(certcode)s' % vars())
     376##                    l.getContent().edit(mapping={'Title': "Level %s" % level})
     377            else:
     378                em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student
     379                logger.info(em)
     380                no_import.write(em)
     381                no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
     382                continue
     383            if tr_count > MAX_TRANS:
     384                transaction.commit()
     385                em = 'Transaction commited\n' % student
     386                logger.info(em)
     387                tr_count = 0
     388            tr_count += 1
     389            pwl_dict.update(dc)
     390            pwl_dict.update(da)
     391            pwl_dict.update(dp)
     392            wftool = self.portal_workflow
     393            pwlist.append(pwl_template.substitute(pwl_dict))
     394            wftool.doActionFor(student_obj,'clear_and_validate')
     395            student_obj.manage_setLocalRoles(sid, ['Owner',])
     396            wftool.doActionFor(application,'close')
     397            application.manage_setLocalRoles(sid, ['Owner',])
     398            wftool.doActionFor(clearance,'close')
     399            clearance.manage_setLocalRoles(sid, ['Owner',])
     400            wftool.doActionFor(personal,'close')
     401            personal.manage_setLocalRoles(sid, ['Owner',])
     402            wftool.doActionFor(studycourse,'close_for_edit')
     403            studycourse.manage_setLocalRoles(sid, ['Owner',])
    226404        open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
    227405        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
     
    294472            course_doc = courses[course].getContent()
    295473            temp_level = result.get('Level')
    296             result['StudentId'] = sf.getId()
     474            student_id = sf.getId()
     475            result['StudentId'] = student_id
    297476            if temp_level != level:
    298477                try:
     
    313492                    sc.invokeFactory('StudentStudyLevel', level)
    314493                    l = getattr(sc, level)
     494                    l.manage_setLocalRoles(student_id, ['Owner',])
    315495            else:
    316496                level_changed = False
     
    341521            dlev['imported_gpa'] = getFloat(gpa)
    342522            cr.getContent().edit(mapping = dcr)
     523            cr.manage_setLocalRoles(student_id, ['Owner',])
    343524            l.getContent().edit(mapping = dlev)
    344525            if tr_count > MAX_TRANS:
  • WAeUP_SRP/trunk/Widgets.py

    r714 r742  
    340340    prefix = ''
    341341    reference = ''
    342    
    343342    def prepare(self, datastructure, **kw): ###(
    344343        """Prepare datastructure from datamodel."""
     
    346345        v = datamodel[self.fields[0]]
    347346        widget_id = self.getWidgetId()
    348         if v and type(v) is StringType:
    349             p,b,n = v.split('-')
    350             v = ScratchCardPin(v,b,n)
     347        #import pdb;pdb.set_trace()
     348##        if v and type(v) is StringType:
     349##            p,b,n = v.split('-')
     350##            v = ScratchCardPin(v,b,n)
    351351        if v:
     352            p = '%s' % v.p
    352353            b = '%s' % v.b
    353354            n = '%s' % v.n
    354355        else:
     356            p = self.prefix
     357            if p.startswith('@'):
     358                p = getattr(self,self.prefix[1:])()
    355359            b = n = ''
     360            v = ScratchCardPin(p,b,n)
    356361        datastructure[widget_id] = v
     362        datastructure[widget_id+'_p'] = p
    357363        datastructure[widget_id+'_b'] = b
    358364        datastructure[widget_id+'_n'] = n
     
    362368    def validate(self, datastructure, **kw):
    363369        """Validate datastructure and update datamodel."""
     370        #import pdb;pdb.set_trace()
    364371        widget_id = self.getWidgetId()
    365372        v = datastructure[widget_id]
    366373        err = 0
    367         p = self.prefix
     374        prefix= self.prefix
     375        if prefix.startswith('@'):
     376            prefix= getattr(self,self.prefix[1:])()
    368377        b = datastructure[widget_id+'_b'].strip()
    369378        n = datastructure[widget_id+'_n'].strip()
    370379        pins = self.portal_pins
    371         pin = "%(p)s%(b)s%(n)s" % vars()
     380        pin = "%(prefix)s%(b)s%(n)s" % vars()
    372381        if self.reference == "":
    373382            ref = str(self.portal_membership.getAuthenticatedMember())
    374383        else:
    375384            ref = datastructure[self.reference]
    376         #import pdb;pdb.set_trace()
    377         ok = pins.searchAndSetRecord(pin,ref,self.prefix)
     385        ok = pins.searchAndSetRecord(pin,ref,prefix)
    378386        while 1:
    379387            if ok == -2:
     
    406414        else:
    407415            datamodel = datastructure.getDataModel()
    408             datamodel[self.fields[0]] = ScratchCardPin(self.prefix,b,n)
    409             datastructure[widget_id] = ScratchCardPin(self.prefix,b,n)
     416            datamodel[self.fields[0]] = ScratchCardPin(prefix,b,n)
     417            datastructure[widget_id] = ScratchCardPin(prefix,b,n)
     418            datastructure[widget_id+'_p'] = prefix
    410419            datastructure[widget_id+'_b'] = b
    411420            datastructure[widget_id+'_n'] = n
    412421            datastructure['s_id'] = s_id
    413         #import pdb;pdb.set_trace()
    414422        return not err
    415423
     
    428436        v = datamodel[self.fields[0]]
    429437        if v and type(v) is StringType:
    430             p,b,n = v.split('-')
    431             v = ScratchCardPin(p,b,n)
     438            prefix,b,n = v.split('-')
     439            v = ScratchCardPin(prefix,b,n)
    432440        if v:
     441            prefix= '%s' % v.p
    433442            b = '%s' % v.b
    434443            n = '%s' % v.n
    435444        else:
     445            prefix= self.prefix
     446            if prefix.startswith('@'):
     447                prefix= getattr(self,self.prefix[1:])()
    436448            b = n = ''
    437         if mode in ['edit', 'create']:
    438             widget_id = self.getWidgetId()
    439             datastructure[widget_id] = v
    440             datastructure[widget_id+'_b'] = b
    441             datastructure[widget_id+'_n'] = n
     449            v = ScratchCardPin(prefix,b,n)
     450        widget_id = self.getWidgetId()
     451        datastructure[widget_id] = v
     452        datastructure[widget_id+'_p'] = prefix
     453        datastructure[widget_id+'_b'] = b
     454        datastructure[widget_id+'_n'] = n
    442455        return meth(mode=mode,
    443456                    datastructure=datastructure,
    444                     prefix=self.prefix,
    445457                    )
    446458    ###)
  • WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation_fe.xml

    r694 r742  
    44 <property name="layout_edit_method"></property>
    55 <property name="layout_view_method"></property>
    6  <property name="style_prefix">layout_accommodation_</property>
     6 <property name="style_prefix">layout_student_acco_</property>
    77 <property name="flexible_widgets"/>
    88 <property name="validate_values_expr"></property>
    9  <widget name="acco_res_sc_pin" meta_type="Scratchcard Pin Widget">
    10   <property name="title">Hostel Application PIN</property>
    11   <property name="fields">
    12    <element value="acco_res_sc_pin"/>
    13   </property>
    14   <property name="is_required">True</property>
    15   <property name="label">Hostel Application PIN</property>
    16   <property name="label_edit">Hostel Application PIN</property>
    17   <property name="readonly_layout_modes"/>
    18   <property name="hidden_layout_modes"/>
    19   <property name="hidden_readonly_layout_modes"/>
    20   <property name="prefix">HOS</property>
    21  </widget>
    22  <widget name="student_status" meta_type="Select Widget">
    23   <property name="title">Status</property>
    24   <property name="fields">
    25    <element value="student_status"/>
    26   </property>
    27   <property name="label">Status</property>
    28   <property name="label_edit">Status</property>
    29   <property name="readonly_layout_modes"/>
    30   <property name="hidden_layout_modes"/>
    31   <property name="hidden_readonly_layout_modes"/>
    32   <property name="vocabulary">student_status_voc</property>
    33  </widget>
    34 
    359 <widget name="acco_maint_date" meta_type="DateTime Widget">
    3610  <property name="title">Maintainance Payment Date</property>
     
    4115  <property name="label_edit">Maintainance Payment Date</property>
    4216  <property name="readonly_layout_modes"/>
    43   <property name="hidden_layout_modes"/>
     17  <property name="hidden_layout_modes">
     18   <element value="create"/>
     19   <element value="edit"/>
     20  </property>
    4421  <property name="hidden_readonly_layout_modes"/>
    4522  <property name="view_format">iso8601_medium_easy</property>
    46 <property name="hidden_empty"></property>
    4723 </widget>
    4824 <widget name="acco_maint_sc_pin" meta_type="Scratchcard Pin Widget">
     
    5430  <property name="label_edit">Maintainance Payment PIN</property>
    5531  <property name="readonly_layout_modes"/>
    56   <property name="hidden_layout_modes"/>
     32  <property name="hidden_layout_modes">
     33   <element value="create"/>
     34  </property>
    5735  <property name="hidden_readonly_layout_modes"/>
    58 <property name="hidden_empty"></property>
     36  <property name="prefix">@getMaintainancePrefix</property>
    5937 </widget>
    60 
    61 
    6238 <widget name="acco_res_date" meta_type="DateTime Widget">
    6339  <property name="title">Hostel Application Date</property>
     
    6743  <property name="label">Hostel Application Date</property>
    6844  <property name="label_edit">Hostel Application Date</property>
    69   <property name="readonly_layout_modes"/>
    70   <property name="hidden_layout_modes"/>
     45  <property name="readonly_layout_modes">
     46   <element value="edit"/>
     47  </property>
     48  <property name="hidden_layout_modes">
     49   <element value="create"/>
     50  </property>
    7151  <property name="hidden_readonly_layout_modes"/>
    7252  <property name="view_format">iso8601_medium_easy</property>
    7353 </widget>
    74 
     54 <widget name="acco_res_sc_pin" meta_type="Scratchcard Pin Widget">
     55  <property name="title">Hostel Application PIN</property>
     56  <property name="fields">
     57   <element value="acco_res_sc_pin"/>
     58  </property>
     59  <property name="is_required">True</property>
     60  <property name="label">Hostel Application PIN</property>
     61  <property name="label_edit">Hostel Application PIN</property>
     62  <property name="readonly_layout_modes">
     63   <element value="edit"/>
     64  </property>
     65  <property name="hidden_layout_modes"/>
     66  <property name="hidden_readonly_layout_modes"/>
     67  <property name="prefix">HOS</property>
     68 </widget>
    7569 <widget name="bed" meta_type="Method Widget">
    76  <property name="title">Bed</property>
    77  <property name="fields">
    78   <element value="bed"/>
    79  </property>
    80  <property name="label">Bed</property>
    81  <property name="label_edit">Bed</property>
    82  <property name="readonly_layout_modes"/>
    83  <property name="hidden_layout_modes"/>
    84  <property name="hidden_readonly_layout_modes"/>
    85  <property name="render_method">formatBed</property>
    86 </widget>
     70  <property name="title">Bed</property>
     71  <property name="fields">
     72   <element value="bed"/>
     73  </property>
     74  <property name="label">Bed</property>
     75  <property name="label_edit">Bed</property>
     76  <property name="readonly_layout_modes">
     77   <element value="edit"/>
     78  </property>
     79  <property name="hidden_layout_modes"/>
     80  <property name="hidden_readonly_layout_modes"/>
     81  <property name="render_method">formatBed</property>
     82 </widget>
    8783 <widget name="session" meta_type="String Widget">
    8884  <property name="title">Session</property>
     
    9288  <property name="label">Session</property>
    9389  <property name="label_edit">Session</property>
    94   <property name="readonly_layout_modes">edit</property>
     90  <property name="readonly_layout_modes">
     91   <element value="edit"/>
     92   <element value="create"/>
     93  </property>
    9594  <property name="hidden_layout_modes"/>
    9695  <property name="hidden_readonly_layout_modes"/>
    9796 </widget>
    98 
    99 
     97 <widget name="student_status" meta_type="Select Widget">
     98  <property name="title">Status</property>
     99  <property name="fields">
     100   <element value="student_status"/>
     101  </property>
     102  <property name="label">Status</property>
     103  <property name="label_edit">Status</property>
     104  <property name="readonly_layout_modes">
     105   <element value="edit"/>
     106  </property>
     107  <property name="hidden_layout_modes"/>
     108  <property name="hidden_readonly_layout_modes"/>
     109  <property name="vocabulary">student_status_voc</property>
     110 </widget>
    100111 <table>
    101112  <row>
  • WAeUP_SRP/trunk/profiles/default/workflows.xml

    r723 r742  
    1515 <object name="waeup_section_wf" meta_type="CPS Workflow"/>
    1616 <object name="waeup_student_wf" meta_type="CPS Workflow"/>
     17 <object name="waeup_student_accommodation_wf" meta_type="CPS Workflow"/>
    1718 <object name="waeup_student_subobject_wf" meta_type="CPS Workflow"/>
    1819 <object name="waeup_workspace_wf" meta_type="CPS Workflow"/>
     
    6263  </type>
    6364  <type type_id="StudentAccommodation">
    64    <bound-workflow workflow_id="waeup_student_subobject_wf"/>
     65   <bound-workflow workflow_id="waeup_student_accommodation_wf"/>
    6566  </type>
    6667  <type type_id="StudentApplication">
  • WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml

    r723 r742  
    3030 </state>
    3131 <state state_id="cleared_and_validated" title="">
     32  <exit-transition transition_id="create_content"/>
    3233 </state>
    3334 <state state_id="clearence_requested" title="">
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py

    r659 r742  
    8080    member.setProperties(last_login_time=current,login_time=current)
    8181    if info['review_state'] == "application_pin_entered":
    82 
    8382        return response.redirect("%s/passport_entry_view" % student.absolute_url())
    84     return response.redirect("%s" % student.absolute_url())
     83    return response.redirect("%s/student_index" % info['url'])
    8584
    8685elif to_member_home:
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py

    r741 r742  
    2828    if context.isManager() and 'students' in path_info:
    2929        student_id = path_info[path_info.index('students')+1]
    30 ##        if context.portal_type == 'Student':
    31 ##            student_id = context.getId()
    32 ##        elif context.aq_parent.portal_type == 'Student':
    33 ##            student_id = context.aq_parent.getId()
    34 ##        elif context.aq_parent.aq_parent.portal_type == 'Student':
    35 ##            student_id = context.aq_parent.aq_parent.getId()
    36 ##        elif context.aq_parent.aq_parent.aq_parent.portal_type == 'Student':
    37 ##            student_id = context.aq_parent.aq_parent.aq_parent.getId()
    38 ##        else:
    39 ##            student_id = member_id
    4030    else:
    41         student_id = member_id
     31        student_id = member_id 
    4232else:
    4333    student_id = student.getId()
    4434res = context.portal_catalog(id = student_id,portal_type='Student')
    45 if not res or len(res) > 1:
     35if not res:# or len(res) > 1:
    4636    return None
    4737brain = res[-1]
    4838student = brain.getObject()
    4939student_path = brain.getPath()
    50 info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
     40info['review_state'] = wf.getInfoFor(student,'review_state',None)
    5141info['student'] = student
    5242info['id'] = student.getId()
     
    6656    info['acco'] = acco
    6757    info['acco_doc'] = acco.getContent()
     58    info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None)
    6859else:
    6960    info['acco'] = None
     
    9687        row['s_edit_link'] = "%s/%s" % (student.absolute_url(),se_link)
    9788    row['review_state'] = so.review_state
    98     row['display'] = so.review_state in ('opened','closed')
     89    row['display'] = so.review_state in ('opened','closed',) or so.portal_type == "StudentAccommodation"
    9990    items.append(row)
    10091info['items'] = items
     92request.set('student_id',student_id)
     93request.set('student_url',info['url'])
    10194return info
  • WAeUP_SRP/trunk/skins/waeup_student/layout_student_acco_edit.pt

    r741 r742  
    1 <tal:block define="global creation python:1;
     1<tal:block define="global creation python:0;
    22                   global formaction string:apply_admission" />
    33<!-- a layout_lib macro -->
  • WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py

    r701 r742  
    1111
    1212info = context.getStudentInfo()
    13 validate = REQUEST.has_key("cpsdocument_create_button")
     13validate = REQUEST.has_key("cpsdocument_create_button") or\
     14           REQUEST.has_key("cpsdocument_edit_button")
    1415
    1516lt = context.portal_layouts
     
    1920info = context.getStudentInfo()
    2021student = info['student']
    21 if info['acco']:
    22     return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url())
    23 res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation',
     22mode = 'create'
     23if info.has_key('acco') and info['acco']:
     24    if info['acco_review_state'] == "maintainance_fee_payed":
     25        return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url())
     26    else:
     27        mode = 'edit'
     28d = {}
     29if mode == 'edit':
     30    info = context.getStudentInfo()
     31    d['acco_res_date'] = info['acco_doc'].acco_res_date
     32    d['acco_res_sc_pin'] = info['acco_doc'].acco_res_sc_pin
     33    d['bed'] = info['acco_doc'].bed
     34    d['session'] = info['acco_doc'].session
     35res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation_fe',
    2436                      schema_id= 'student_accommodation',
    2537                      context=context,
    2638                      mapping=validate and REQUEST,
    27                       ob={},
    28                       layout_mode='create',
     39                      ob=d,
     40                      layout_mode=mode,
    2941                      formaction = "reserve_accommodation",
    3042                      button = "Book",
     
    4759elif psm == 'valid':
    4860    s_id = ds.get('s_id')
    49     pin = str(ds.get('acco_res_ac_pin'))
    50 
    51     pa = context.portal_accommodation
    52     code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
    53     if code < 0:
    54         return context.accommodation_pin_form(rendered = res,
     61    if mode == 'create':
     62        pin = str(ds.get('acco_res_sc_pin'))
     63        pa = context.portal_accommodation
     64        code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
     65        if code < 0:
     66            return context.accommodation_pin_form(rendered = res,
    5567                                 psm = bed,
    5668                                 firstlayout = True,
     
    5870                                 ds = ds,
    5971                                 )
    60 student.invokeFactory('StudentAccommodation',acco_id)
     72        student.invokeFactory('StudentAccommodation',acco_id)
     73        acco = getattr(student,acco_id)
     74        ds.set('acco_res_date', current)
     75        ds.set('bed', bed)
     76        ds.set('session', session)
     77        acco.getContent().edit(mapping=ds)
     78        #wftool.doActionFor(acco,'pay_maintainance_fee',dest_container=acco)
     79        return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % student.absolute_url())
     80pin = str(ds.get('acco_main_sc_pin'))
     81pp = context.portal_pins
    6182acco = getattr(student,acco_id)
    62 wftool.doActionFor(acco,'open',dest_container=acco)
    63 ds.set('acco_res_date', current)
    64 ds.set('bed', bed)
    65 ds.set('session', session)
     83ds.set('acco_maint_date', current)
    6684acco.getContent().edit(mapping=ds)
     85wftool.doActionFor(acco,'pay_maintainance_fee',dest_container=acco)
    6786return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % student.absolute_url())
     87
    6888##return context.accommodation_pin_form(rendered = res,
    6989##                                 psm = "successfully reserved bed %s" % bed,
  • WAeUP_SRP/trunk/skins/waeup_student/student_index.py

    r723 r742  
    3434    elif state == 'application_pin_entered':
    3535        return redirect("%s/passport_entry_view" % student.absolute_url())
     36    return redirect("%s/student_view" % student.absolute_url())
    3637
    3738
  • WAeUP_SRP/trunk/skins/waeup_student/widget_scratch_card_pin_render.pt

    r523 r742  
    11<tal:block define="mode options/mode;
    22                   id here/getWidgetId;
     3                   id_p string:${id}_p;
    34                   id_b string:${id}_b;
    45                   id_n string:${id}_n;
    5                    prefix options/prefix;
     6                   prefix options/datastructure/?id_p;
    67                   batch options/datastructure/?id_b;
    78                   nr options/datastructure/?id_n;
Note: See TracChangeset for help on using the changeset viewer.