OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Patch: conditionally suppress fee code prompt

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 http://forum.pkp.sfu.ca

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.

Patch: conditionally suppress fee code prompt

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

If none of the active registration types for a scheduled conference requires a fee code, then suppress the fee code prompt from the user registration form. This avoids making users unnecessarily feel like they are somehow not getting the best deal available.

Code: Select all
--- ocs-2.0.0-1/classes/registration/form/UserRegistrationForm.inc.php.feecode  2008-03-04 01:21:04.023542000 -0800
+++ ocs-2.0.0-1/classes/registration/form/UserRegistrationForm.inc.php  2008-03-18 17:22:13.002439000 -0700
@@ -97,5 +97,5 @@

                }
-
+               $templateMgr->assign('promptFeeCode', $registrationTypeDao->registrationTypeRequiringCodeExists($schedConf->getSchedConfId()));
                if ($this->captchaEnabled) {
                        import('captcha.CaptchaManager');
--- ocs-2.0.0-1/classes/registration/RegistrationTypeDAO.inc.php.feecode        2007-05-11 12:02:04.000000000 -0700
+++ ocs-2.0.0-1/classes/registration/RegistrationTypeDAO.inc.php        2008-03-18 17:36:35.224052000 -0700
@@ -477,4 +477,22 @@
        }

+       function registrationTypeRequiringCodeExists($schedConfId) {
+               $time = $this->dateToDB(time());
+               $result = &$this->retrieve(
+                       "SELECT COUNT(*)
+                               FROM registration_types
+                               WHERE sched_conf_id = ?
+                               AND code IS NOT NULL AND code != ''
+                               AND opening_date <= $time AND closing_date > $time
+                               AND pub = 1",
+                        array($schedConfId)
+               );
+               $returner = isset($result->fields[0]) && $result->fields[0] != 0 ? true : false;
+
+               $result->Close();
+               unset($result);
+
+               return $returner;
+       }
 }

--- ocs-2.0.0-1/templates/registration/userRegistrationForm.tpl.feecode 2008-03-03 15:49:21.000000000 -0800
+++ ocs-2.0.0-1/templates/registration/userRegistrationForm.tpl 2008-03-18 17:24:53.194185000 -0700
@@ -82,10 +82,10 @@
        </tr>
 </table>
-
+{if $promptFeeCode}
 <p>
        <label for="feeCode">{translate key="schedConf.registration.feeCode"}</label>&nbsp;&nbsp;<input id="feeCode" name="feeCode" type="text" value="{$feeCode|escape}" class="textField" /><br />
        {translate key="schedConf.registration.feeCode.description"}
 </p>
-
+{/if}
 <div class="separator"></div>

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

Return to OCS Development

Who is online

Users browsing this forum: No registered users and 1 guest