You are viewing the PKP Support Forum | PKP Home Wiki

Patch: detect truncation of Special Requests

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

Moderators: jmacgreg, michael

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page. While these are OJS-specific, the OCS codebase is similar enough to OJS they should be of help. There is also an [url=http://pkp.sfu.ca/ocs_documentation[/url]OCS Documentation[/url] page with some more general documentation that might also be of interest.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a technical support question, try the OCS Technical Support subforum.

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/RegistrationForm.inc.php.regvalidation        2007-04-10 13:45:08.000000000 -0700
+++ ocs-2.0.0-1/classes/registration/form/RegistrationForm.inc.php      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/UserRegistrationForm.inc.php.regvalidation    2007-05-10 12:38:26.000000000 -0700
+++ ocs-2.0.0-1/classes/registration/form/UserRegistrationForm.inc.php  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: 16
Joined: Wed Oct 10, 2007 12:45 am
Location: University of British Columbia

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 http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=3314. This can be fixed for an OCS 2.0 installation via an ALTER TABLE statement.

Alec Smecher
Public Knowledge Project Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OCS Development

Who is online

Users browsing this forum: No registered users and 1 guest