Пример #1
0
 def _process(self):
     if self._getUser() is not None and self._getUser().isRegisteredInConf(
             self._conf):
         if not self._conf.getRegistrationForm().inRegistrationPeriod(
         ) and not self._conf.getRegistrationForm().inModificationPeriod():
             p = registrationForm.WPRegistrationFormClosed(self, self._conf)
             return p.display()
         else:
             rp = self._getUser().getRegistrantById(self._conf.getId())
             # check if the email is being changed by another one that already exists
             if self._getRequestParams().get("email", "") != rp.getEmail(
             ) and self._conf.hasRegistrantByEmail(
                     self._getRequestParams().get("email", "")):
                 raise FormValuesError(
                     _("There is already a user with the email \"%s\". Please choose another one"
                       ) %
                     self._getRequestParams().get("email", "--no email--"))
             rp.setValues(self._getRequestParams(), self._getUser())
             self._regForm.getNotification(
             ).sendEmailModificationRegistrant(self._regForm, rp)
             if rp.doPay():
                 self._redirect(
                     urlHandlers.UHConfRegistrationFormCreationDone.getURL(
                         rp))
             else:
                 self._redirect(
                     urlHandlers.UHConfRegistrationForm.getURL(self._conf))
     else:
         self._redirect(
             urlHandlers.UHConfRegistrationForm.getURL(self._conf))
Пример #2
0
 def _processIfActive( self ):
     if self._getUser() is not None and self._getUser().isRegisteredInConf(self._conf):
         p = registrationForm.WPRegistrationFormAlreadyRegistered(self, self._conf)
     else:
         if self._conf.getRegistrationForm().isFull():
             p = registrationForm.WPRegistrationFormFull(self, self._conf)
         elif not self._conf.getRegistrationForm().inRegistrationPeriod():
             p = registrationForm.WPRegistrationFormClosed(self, self._conf)
         else:
             p = registrationForm.WPRegistrationFormDisplay(self, self._conf)
     return p.display()
Пример #3
0
    def _process( self ):
        canManageRegistration = self._conf.canManageRegistration(self._getUser())
        if not canManageRegistration and not self._regForm.isActivated():
            p = registrationForm.WPRegFormInactive( self, self._conf )
            return p.display()
        params = self._getRequestParams()
        email = self._regForm.getPersonalData().getValueFromParams(params, 'email')
        if email is None:
            raise FormValuesError(_("An email address has to be set in order to make the registration in the event."))
        elif not validMail(email, False):
            raise FormValuesError(_("The given email address is not valid."))
        matchedUsers = AvatarHolder().match({"email": email}, exact=1)
        if matchedUsers:
            user = matchedUsers[0]
        else:
            user = None
        # Check if the user can register
        if not canManageRegistration: # normal user registering. Managers can.
            if self._conf.getRegistrationForm().isFull():
                self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf))
                return
            elif not self._conf.getRegistrationForm().inRegistrationPeriod():
                p = registrationForm.WPRegistrationFormClosed(self, self._conf)
                return p.display()
        if user is None:
            if self._conf.hasRegistrantByEmail(email):
                raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email)
        else:
            if user.isRegisteredInConf(self._conf):
                self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
                return
            if self._conf.hasRegistrantByEmail(email):
                if canManageRegistration:
                    raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email)
                else:
                    raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference."%email)

        rp = registration.Registrant()
        self._conf.addRegistrant(rp)
        rp.setValues(self._getRequestParams(), user)
        rp.setSessionBillingEnabled(self._regForm.getSessionsForm().getType() != "2priorities")
        if user is not None:
            user.addRegistrant(rp)
            rp.setAvatar(user)
        # avoid multiple sending in case of db conflict
        email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp)
        if email:
            GenericMailer.send(email)
        if not canManageRegistration:
            self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
        else:
            self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
Пример #4
0
 def _process( self ):
     user = self._getUser()
     canManageRegistration = self._conf.canManageRegistration(user)
     if not canManageRegistration and (not self._regForm.isActivated() or not self._conf.hasEnabledSection("regForm")):
         p = registrationForm.WPRegFormInactive( self, self._conf )
         return p.display()
     if user is not None and user.isRegisteredInConf(self._conf):
         if not self._conf.getRegistrationForm().inRegistrationPeriod() and not self._conf.getRegistrationForm().inModificationPeriod():
             p = registrationForm.WPRegistrationFormClosed(self, self._conf)
             return p.display()
         else:
             p = registrationForm.WPRegistrationFormModify(self, self._conf)
             return p.display()
     self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
Пример #5
0
 def _process( self ):
     if self._getUser() is not None and self._getUser().isRegisteredInConf(self._conf): 
         if not self._conf.getRegistrationForm().inRegistrationPeriod() and not self._conf.getRegistrationForm().inModificationPeriod():
             p = registrationForm.WPRegistrationFormClosed(self, self._conf)
             return p.display()
         else:
             rp = self._getUser().getRegistrantById(self._conf.getId())
             rp.setValues(self._getRequestParams(), self._getUser())
             # avoid multiple sending in case of db conflict
             if not hasattr(self, "_emailsent"):
                 self._regForm.getNotification().sendEmailModificationRegistrant(self._regForm, rp)
                 self._emailSent = True
             if rp.doPay():
                 self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
             else:
                 self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
     else:
         self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
Пример #6
0
 def _process( self ):
     user = self._getUser()
     canManageRegistration = self._conf.canManageRegistration(user)
     if not canManageRegistration and (not self._regForm.isActivated() or not self._conf.hasEnabledSection("regForm")):
         p = registrationForm.WPRegFormInactive( self, self._conf )
         return p.display()
     params = self._getRequestParams()
     if canManageRegistration:
         matchedUsers = AvatarHolder().match({"email": params["email"]})
         if matchedUsers:
             user = matchedUsers[0]
         else:
             user = None
     else:
         if self._conf.getRegistrationForm().isFull():
             self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf))
             return
         elif not self._conf.getRegistrationForm().inRegistrationPeriod():
             p = registrationForm.WPRegistrationFormClosed(self, self._conf)
             return p.display()
     if user is None:
         if self._conf.hasRegistrantByEmail(self._getRequestParams().get("email","")):
             raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%self._getRequestParams().get("email","--no email--")) 
     else:
         if user.isRegisteredInConf(self._conf):
             self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf))
             return
     rp = registration.Registrant()
     self._conf.addRegistrant(rp)
     rp.setValues(self._getRequestParams(), user)
     if user is not None:
         user.addRegistrant(rp)
         rp.setAvatar(user)
     #if not canManageRegistration:
         # avoid multiple sending in case of db conflict
     if not hasattr(self, "_emailsent"):
         self._regForm.getNotification().sendEmailNewRegistrant(self._regForm, rp)
         self._emailSent = True
     if not canManageRegistration:
         self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
     else:
         self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
    def _process(self):
        canManageRegistration = self._conf.canManageRegistration(
            self._getUser())
        if not canManageRegistration and not self._regForm.isActivated():
            p = registrationForm.WPRegFormInactive(self, self._conf)
            return p.display()
        params = self._getRequestParams()
        email = self._regForm.getPersonalData().getValueFromParams(
            params, 'email')
        if email is None:
            raise FormValuesError(
                _("An email address has to be set in order to make the registration in the event."
                  ))
        elif not validMail(email, False):
            raise FormValuesError(_("The given email address is not valid."))
        matchedUsers = AvatarHolder().match({"email": email}, exact=1)
        if matchedUsers:
            user = matchedUsers[0]
        else:
            user = None
        # Check if the user can register
        if not canManageRegistration:  # normal user registering. Managers can.
            if self._conf.getRegistrationForm().isFull():
                self._redirect(
                    urlHandlers.UHConfRegistrationFormDisplay.getURL(
                        self._conf))
                return
            elif not self._conf.getRegistrationForm().inRegistrationPeriod():
                p = registrationForm.WPRegistrationFormClosed(self, self._conf)
                return p.display()
        if user is None:
            if self._conf.hasRegistrantByEmail(email):
                raise FormValuesError(
                    "There is already a user with the email \"%s\". Please choose another one"
                    % email)
        else:
            if user.isRegisteredInConf(
                    self._conf) or self._conf.hasRegistrantByEmail(email):
                if canManageRegistration:
                    raise FormValuesError(
                        "There is already a user with the email \"%s\". Please choose another one"
                        % email)
                else:
                    raise FormValuesError(
                        "You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference."
                        % email)

        rp = registration.Registrant()
        self._conf.addRegistrant(rp, user)
        rp.setValues(self._getRequestParams(), user)

        if user is not None:
            user.addRegistrant(rp)
            rp.setAvatar(user)

        # This creates the email to the new registrant and SENDS the email to the organizers if necessary... WTF.
        email = self._regForm.getNotification().createEmailNewRegistrant(
            self._regForm, rp)
        if self._regForm.isSendRegEmail() and rp.getEmail().strip():
            modEticket = self._conf.getRegistrationForm().getETicket()

            if modEticket.isEnabled() and modEticket.isAttachedToEmail():
                attachment = {
                    'name': "{0}-Ticket.pdf".format(self._target.getTitle()),
                    'binary': TicketToPDF(self._target, rp).getPDFBin(),
                }
                email["attachments"] = [attachment]
            GenericMailer.send(email)

        if canManageRegistration and user != self._getUser():
            self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
        else:
            self._redirect(
                urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))