Changeset 97539e in indico


Ignore:
Timestamp:
01/28/11 16:11:35 (2 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
fced0f
Parents:
2e8d57
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (01/28/11 15:32:23)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (01/28/11 16:11:35)
Message:

[IMP] Properly handle modifications with disabled sections

  • If a section is disabled, modifying a registration will clear the values in the section's form
File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/registration.py

    r2e8d57 r97539e  
    126126        form.setActivated(self.isActivated()) 
    127127        form.setMandatoryAccount(self.isMandatoryAccount()) 
    128         form.setAllSessions() 
    129128        form.notification=self.getNotification().clone() 
    130129        form.personalData = self.getPersonalData().clone() 
     
    138137        if rpf is not None : 
    139138            form.reasonParticipationForm = rpf.clone() 
     139        form.setAllSessions() 
    140140        ses = self.getSessionsForm() 
    141141        if ses is not None : 
     
    769769        booking.append( _(""" 
    770770\tQuantity\t\tItem\t\tunit.price\t\tCost""")) 
     771        #All billable general fields 
    771772        for gsf in registrant.getMiscellaneousGroupList(): 
    772773            miscGroup=registrant.getMiscellaneousGroupById(gsf.getId()) 
     
    790791                        value=":%s"%value 
    791792                    if(quantity>0): 
    792                          booking.append("""%i\t\t%s : %s%s\t\t%s\t\t%s %s"""%(quantity,miscGroup.getTitle(),caption,value,price,price*quantity,currency) ) 
     793                        booking.append("""%i\t\t%s : %s%s\t\t%s\t\t%s %s"""%(quantity,miscGroup.getTitle(),caption,value,price,price*quantity,currency) ) 
     794        #All billable standard fields (accommodation, sessions, social events) 
    793795        for bf in registrant.getBilledForms(): 
    794796            for item in bf.getBilledItems(): 
     
    40644066            self.setReasonParticipation(data.get("reason","")) 
    40654067 
     4068 
    40664069        if self.getRegistrationForm().getSessionsForm().isEnabled(): 
    4067             sessions=data.get("sessions",[]) 
     4070            sessions = data.get("sessions", []) 
    40684071            if not isinstance(sessions, list): 
    40694072                sessions = [ sessions ] 
     
    40764079                newSessions += [session for session in sessions if not session.isBillable()] 
    40774080                self.setSessions(newSessions) 
     4081        else: 
     4082            self.setSessions([]) 
    40784083 
    40794084        if self.getRegistrationForm().getAccommodationForm().isEnabled(): 
     
    40914096                if ad > dd: 
    40924097                    raise FormValuesError( _("Arrival date has to be earlier than departure date")) 
    4093             if self.getRegistrationForm().getAccommodationForm().getAccommodationTypesList() !=[] and data.get("accommodationType",None) is None: 
    4094                 raise FormValuesError( _("It is mandatory to choose an accommodation in order to register")) 
    40954098            # Allow changing of the dates only if the current accomodation is not billable or the user hasn't paid yet 
    40964099            currentAccoType = self._accommodation.getAccommodationType() 
     
    41084111                    ((currentAccoType is None or not currentAccoType.isBillable()) and \ 
    41094112                     (accoType is None or not accoType.isBillable())): 
     4113                    if self.getRegistrationForm().getAccommodationForm().getAccommodationTypesList() !=[] and data.get("accommodationType",None) is None: 
     4114                        raise FormValuesError( _("It is mandatory to choose an accommodation in order to register")) 
    41104115                    self._accommodation.setAccommodationType(accoType) 
     4116        else: # AccommodationForm disabled 
     4117            self._accommodation.setAccommodationType(None) 
    41114118 
    41124119        if self.getRegistrationForm().getSocialEventForm().isEnabled(): 
     
    41204127                    newSE = SocialEvent(seItem, int(data.get("places-%s"%seItem.getId(), "1"))) 
    41214128                    self.addSocialEvent(newSE) 
     4129        else: 
     4130            for seItem in self.getSocialEvents()[:]: 
     4131                self.removeSocialEventById(seItem.getId()) 
    41224132        #if not self.getPayed(): 
    41234133        #    self._miscellaneous = {} 
     
    44394449 
    44404450    def getBilledForms(self): 
     4451        """ 
     4452 
     4453        """ 
    44414454        forms = [] 
    44424455        if self._accommodation: 
     
    45724585            if at is not None: 
    45734586                at.increaseNoPlaces() 
     4587                self._price = at.getPrice() 
     4588                self._billable = at.isBillable() 
     4589                self._currency = at.getCurrency() 
     4590            else: 
     4591                self._price = 0 
     4592                self._billable = False 
     4593                self._currency = "" 
    45744594            self._accommodationType = at 
    4575             self._price = at.getPrice() 
    4576             self._billable = at.isBillable() 
    4577             self._currency = at.getCurrency() 
    45784595 
    45794596class SocialEvent(Persistent): 
Note: See TracChangeset for help on using the changeset viewer.