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
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: 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: Yahoo [Bot] and 1 guest