Patch: detect truncation of Special Requests

OCS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 16
Joined: Wed Oct 10, 2007 12:45 am
Location: University of British Columbia

Patch: detect truncation of Special Requests

Postby derekp » Wed Mar 19, 2008 3:38 pm

The database column for storing special requests stores only 255 characters. With PostgreSQL, attempting to store a longer string causes an error, which this patch detects and avoids.

Code: Select all

--- ocs-2.0.0-1/classes/registration/form/        2007-04-10 13:45:08.000000000 -0700
+++ ocs-2.0.0-1/classes/registration/form/      2008-03-04 01:28:26.016780000 -0800
@@ -68,4 +68,5 @@
                // Notify email flag is valid value
                $this->addCheck(new FormValidatorInSet($this, 'notifyEmail', 'optional', 'manager.registration.form.notifyEmailValid', array('1')));
+               $this->addCheck(new FormValidatorLength($this, 'specialRequests', 'optional', 'manager.registration.form.specialRequestsTruncated', '<=', 255));

@@ -90,4 +91,6 @@
                $templateMgr->assign('registrationTypes', $registrationTypes);
                $templateMgr->assign('helpTopicId', 'schedConf.managementPages.registration');
+               $this->setData('specialRequests', String::substr($this->getData('specialRequests'), 0, 255));

--- ocs-2.0.0-1/classes/registration/form/    2007-05-10 12:38:26.000000000 -0700
+++ ocs-2.0.0-1/classes/registration/form/  2008-03-04 01:21:04.023542000 -0800
@@ -35,5 +35,5 @@
                $this->addCheck(new FormValidator($this, 'registrationTypeId', 'required', 'manager.registration.form.typeIdRequired'));
                $this->addCheck(new FormValidatorCustom($this, 'registrationTypeId', 'required', 'manager.registration.form.typeIdValid', create_function('$registrationTypeId, $schedConfId', '$registrationTypeDao = &DAORegistry::getDAO(\'RegistrationTypeDAO\'); return $registrationTypeDao->openRegistrationTypeExistsByTypeId($registrationTypeId, $schedConfId);'), array($schedConf->getSchedConfId())));
+               $this->addCheck(new FormValidatorLength($this, 'specialRequests', 'optional', 'manager.registration.form.specialRequestsTruncated', '<=', 255));
                $captchaManager =& new CaptchaManager();
@@ -121,4 +121,5 @@
                $templateMgr->assign('schedConfSettings', $schedConf->getSettings());
                $templateMgr->assign_by_ref('user', $user);
+               $this->setData('specialRequests', String::substr($this->getData('specialRequests'), 0, 255));
--- ocs-2.0.0-1/locale/en_US/locale.xml.regvalidation   2008-03-03 15:54:10.000000000 -0800
+++ ocs-2.0.0-1/locale/en_US/locale.xml 2008-03-04 01:31:37.032504000 -0800
@@ -1498,4 +1498,5 @@
        <message key="manager.registration.form.notifyEmailValid">Please use the checkbox provided.</message>
        <message key="manager.registration.form.registrationContactRequired">In order to send the user a notification email, the registration contact name and email address must be specified in the Conference Setup.</message>
+       <message key="manager.registration.form.specialRequestsTruncated"><![CDATA[The Special Requests field is too long, and has been truncated. If this is OK, please submit this form again.]]></message>
        <message key="manager.registration.form.userId">User</message>
        <message key="manager.registration.form.typeId">Registration type</message>

Posts: 16
Joined: Wed Oct 10, 2007 12:45 am
Location: University of British Columbia

Make special requests prompt customizable per schedConf

Postby derekp » Wed Mar 19, 2008 3:42 pm

Currently, the special requests prompt for conference registration reads,
Please describe any special requirements or requests, such as dietary, access, etc.

It would be nice if the prompt were customizable per scheduled conference. For example, a conference might ask registrants to also specify their preferred roommate.

Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Patch: detect truncation of Special Requests

Postby asmecher » Sat Mar 22, 2008 4:46 am

Hi Derek,

Thanks for the heads-up -- actually, since this is a text box, it should probably be changed to a text column rather than a varchar(255). See This can be fixed for an OCS 2.0 installation via an ALTER TABLE statement.

Alec Smecher
Public Knowledge Project Team

Return to “OCS Development”

Who is online

Users browsing this forum: No registered users and 2 guests