Can users see their registration?

Are you a Director, Presenter, Reviewer or Conference Manager in need of help? Want to talk to us about workflow issues? This is your forum.

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.
jansteenstra822
Posts: 5
Joined: Sat Mar 27, 2010 1:28 am

Can users see their registration?

Postby jansteenstra822 » Sat Mar 27, 2010 1:32 am

We have an OCS up and running for some months and have just implemented the registration and payment modules.

Registration works fine. Users can choose several registration types with several options. As administrator, we are able to view these registrations in the registration manager. We were wondering, though, how and if users could see their registration type and options.

Thanks in advance.

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Thu Apr 01, 2010 8:40 pm

I have created a receipt page. I find that PayPal's receipts aren't detailed enough. This is where I have people returned to the website from PayPal (or whatever payment gateway is used). And then, after that, if they click on the registration link, they will be taken to the receipt page. Here are a couple of examples:
Picture 6.png
Picture 6.png (126.19 KiB) Viewed 4578 times

Picture 7.png
Picture 7.png (146.22 KiB) Viewed 4578 times

jansteenstra822
Posts: 5
Joined: Sat Mar 27, 2010 1:28 am

Re: Can users see their registration?

Postby jansteenstra822 » Tue Apr 06, 2010 1:59 am

That was exactly what I am talking about. It looks very neat. Now people can see what they registered for. I suppose you can't share the code for that?

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Tue Apr 13, 2010 6:12 am

I apologize for the delayed response. I've been having some email issues. I can try to share, but, as with anything in OCS, you generally need to touch multiple files, so I can't guarantee that I will be able to find everything for you.

Please let me know whether you're using OCS 2.1.2 or 2.3 so that I can give you the right code.

RickMath
Posts: 264
Joined: Fri Feb 27, 2009 12:30 am

Re: Can users see their registration?

Postby RickMath » Tue Apr 13, 2010 6:28 pm

Trudy

Your work on this is wonderful. Can you share the code? I running OCS 2.1.2 and will upgrade to OCS 2.3 over the summer.

I am sure I speak for others that would appreciate the above.

Thanks

Rick

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Thu Oct 28, 2010 7:33 am

Finally some code (OCS 2.3) for anyone that's still interested in this. Note that I had to append .txt onto the files as you aren't allowed to upload .php files.

I added a function:
/plugins/paymethod/paypal/PayPalPlugin.inc.php:displayPaymentReceipt (see attachment)

You have to add a function with the same name here:
/classes/payment/PaymentManager.inc.php:displayPaymentReceipt
(oops, in OCS 2.3.3 this has been moved to /lib/pkp/classes/payment 2010-12-13)

Code: Select all

   function displayPaymentReceipt() {
      $paymentPlugin =& $this->getPaymentPlugin();
      if ($paymentPlugin !== null && $paymentPlugin->isConfigured()) return $paymentPlugin->displayPaymentReceipt();
      return false;
   }

and here:
/classes/plugins/PaymethodPlugin.inc.php:displayPaymentReceipt

Code: Select all

   function displayPaymentReceipt() {
      die('ABSTRACT METHOD');
   }


Then you have to redirect people to the receipt page after they finish paying with paypal:
/plugins/paymethod/paypal/PayPalPlugin.inc.php:displayPaymentForm (see attachment)

Added this code in:
/pages/schedconf/SchedConfHandler.inc.php:registration (attached)

Code: Select all

         // MOHSHO 2008: added /displayReceipt to end of URL so that people could get a receipt
         if (in_array('displayReceipt', $args) || $registration->getDatePaid())  {
            $paymentManager->displayPaymentReceipt();
            exit();
         }


I added a few lines in the PayPal locale file (see attached, search for receipt):
/plugins/paymethod/paypal/locale/en_US/locale.xml

I will continue in a 2nd post. There is a max of 3 attachments per post...
Attachments
locale.xml
/plugins/paymethod/paypal/locale/en_US/locale.xml
(3.13 KiB) Downloaded 171 times
SchedConfHandler.inc.php.txt
/pages/schedconf/SchedConfHandler.inc.php
(23.89 KiB) Downloaded 176 times
PayPalPlugin.inc.php.txt
/plugins/paymethod/paypal/PayPalPlugin.inc.php
(13.7 KiB) Downloaded 163 times
Last edited by tshore on Mon Dec 13, 2010 9:44 pm, edited 2 times in total.

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Thu Oct 28, 2010 7:37 am

Create a new template file for the receipt page:
/plugins/paymethod/paypal/templates/paymentReceipt.tpl (attached)

Oh, and that might be it. There may be other things that you had to do, but that's all I could find. I hope someone finds this to be useful.
Attachments
paymentReceipt.tpl.txt
/plugins/paymethod/paypal/templates/paymentReceipt.tpl
(5.1 KiB) Downloaded 175 times

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Tue Dec 14, 2010 12:52 pm

I think that there are more changes required - sorry.

I just noticed that /plugins/paymethod/paypal/templates/paymentReceipt.tpl calls a new function:

/classes/registration/Registration.inc.php:getAmountPaid().

Code: Select all

   /**
    * Get registration amount paid.
    * @return int
    */
   function getAmountPaid() {
      return $this->getData('amountPaid');
   }
   
   /**
    * Set registration amount paid.
    * @param $amountPaid int
    */
   function setAmountPaid($amountPaid) {
      return $this->setData('amountPaid', $amountPaid);
   }


You also need to add a field in the registrations DB table:

Code: Select all

ALTER TABLE `registrations`
ADD `amount_paid` BIGINT( 20 ) DEFAULT '0' AFTER `date_paid`;


Also need to add this line:

Code: Select all

   $registration->setAmountPaid($queuedPayment->getAmount());

to the function /classes/payment/ocs/OCSPaymentManager.inc.php:fulfillQueuedPayment

And there may be more...

r2d2
Posts: 32
Joined: Fri Aug 28, 2009 1:36 pm

Re: Can users see their registration?

Postby r2d2 » Mon Apr 04, 2011 12:39 pm

Hi Trudy,

Thank you for this valuable contribution. In addition to above, the following is also necessary:

In \classes\registration\RegistrationDAO.inc.php, add the following line to approximately line 154. This is necessary to display the amount paid on the page:

Code: Select all

$registration->setAmountPaid($row['amount_paid']);


Also, both of the following functions need to be updated as below with amount_paid and related variables:

Code: Select all

   /**
    * Insert a new Registration.
    * @param $registration Registration
    * @return boolean
    */
   function insertRegistration(&$registration) {
      $ret = $this->update(
         sprintf('INSERT INTO registrations
            (sched_conf_id, user_id, type_id, date_registered, date_paid, amount_paid, membership, domain, ip_range, special_requests)
            VALUES
            (?, ?, ?, %s, %s, ?, ?, ?, ?, ?)',
            $this->dateToDB($registration->getDateRegistered()), $this->dateToDB($registration->getDatePaid())),
         array(
            $registration->getSchedConfId(),
            $registration->getUserId(),
            $registration->getTypeId(),
            $registration->getAmountPaid(),
            $registration->getMembership(),
            $registration->getDomain(),
            $registration->getIPRange(),
            $registration->getSpecialRequests()
         )
      );
      $registration->setId($this->getInsertRegistrationId());
      return $registration->getId();
   }

   /**
    * Update an existing registration.
    * @param $registration Registration
    * @return boolean
    */
   function updateRegistration(&$registration) {
      return $this->update(
         sprintf('UPDATE registrations
            SET
               sched_conf_id = ?,
               user_id = ?,
               type_id = ?,
               date_registered = %s,
               date_paid = %s,
               amount_paid = ?,
               membership = ?,
               domain = ?,
               ip_range = ?,
               special_requests = ?
            WHERE registration_id = ?',
            $this->dateToDB($registration->getDateRegistered()), $this->dateToDB($registration->getDatePaid())),
         array(
            $registration->getSchedConfId(),
            $registration->getUserId(),
            $registration->getTypeId(),
            $registration->getAmountPaid(),
            $registration->getMembership(),
            $registration->getDomain(),
            $registration->getIPRange(),
            $registration->getSpecialRequests(),
            $registration->getId()
         )
      );
   }

r2d2
Posts: 32
Joined: Fri Aug 28, 2009 1:36 pm

Re: Can users see their registration?

Postby r2d2 » Mon Apr 04, 2011 8:04 pm

Hi Trudy,

Inserting the amount_paid variable as above only shows the amount for the Registration Type, without adding each Registration Options to this amount. I guess we need to use the totalFees variable as you defined in paymentReceipt.tpl. I couldn't make it work though. Could you please briefly tell me how you did it?

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Tue Apr 05, 2011 6:59 am

Hmmm. This should be taken care of in an unmodified version of OCS, no? I can see where it's calculated in classes/registration/form/UserRegistrationForm.inc.php.

I think I also made some changes in:

/classes/payment/ocs/OCSQueuedPayment.inc.php

but I think that this just reworks the description sent to PayPal. I've attached a copy of this file from OCS 2.3.3.
OCSQueuedPayment.inc.php.txt
/classes/payment/ocs/OCSQueuedPayment.inc.php
(2.8 KiB) Downloaded 157 times

r2d2
Posts: 32
Joined: Fri Aug 28, 2009 1:36 pm

Re: Can users see their registration?

Postby r2d2 » Tue Apr 05, 2011 9:24 am

Hi Trudy,

Thanks for a quick reply.Yes, I have applied your customization to an unmodified version of OCS 2.3.3.

The OCSQueuedPayment.inc.php file you have just posted is the same as the one you posted earlier. The only slight difference is that it displays the prices of options on the browser, without making any calculations. This does not address the issue.

I have just realized that no matter what the total fee is, the system always enters '1' in to the amount_paid column of the registrations table. Since the default value of "amount_paid" is '0', that means the system does write in to the amount_paid column. But it writes it as a binary value (I guess). Here, '1' should mean 'exists'. I suspect I need to define the "amount_paid" variable in \classes\registration\RegistrationDAO.inc.php here:

Code: Select all


import('registration.Registration');
import('registration.RegistrationType');

define('REGISTRATION_DATE_REGISTERED',   0x01);
define('REGISTRATION_DATE_PAID',   0x02);

define('REGISTRATION_USER',      0x01);
define('REGISTRATION_MEMBERSHIP',   0x02);
define('REGISTRATION_DOMAIN',      0x03);
define('REGISTRATION_IP_RANGE',      0x04);


I do not know what these numbers are (hexadecimals?). How should we define the amount_paid vairable here?

Thanks again.

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Tue Apr 05, 2011 10:53 am

Sorry about re-posting the same file. Did a search on the page for that file and my browser didn't find it, so I thought that I hadn't included it before...

You don't need to define a new variable at the top of RegistrationDAO.inc.php.

Is it possible that you aren't completing your test payments? Nothing is written to the amount_paid field in the registrations table until the PayPal IPN is received. So you need to complete a transaction all the way to the end (either using a real PayPal payment or a Sandbox payment) for the amount_paid field to contain the correct amount.

r2d2
Posts: 32
Joined: Fri Aug 28, 2009 1:36 pm

Re: Can users see their registration?

Postby r2d2 » Tue Apr 05, 2011 12:27 pm

I have actually made 5-6 real payments using my credit card. The system successfully receives PayPal IPN message, and then inserts '1' (rather than the totalFees) into the amount_paid field. I wonder which file(s) are responsible for transferring the total fees variable received via the PayPal IPN message. PayPal communicates with the system via IPN, and transfers that variable to the system, but I am not sure where (and how) the system writes it in to the registrations database. I have been hair pulling with this single issue for two days without luck.

tshore
Posts: 266
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario
Contact:

Re: Can users see their registration?

Postby tshore » Tue Apr 05, 2011 7:57 pm

PayPalPlugin.inc.php does this:

Code: Select all

                     // Fulfill the queued payment.
                     if ($ocsPaymentManager->fulfillQueuedPayment($queuedPaymentId, $queuedPayment)) {

which is in OCSPaymentManager.inc.php and it does this:

Code: Select all

            $registration->setAmountPaid($queuedPayment->getAmount());
            $registrationDao->updateRegistration($registration);

And the actual writing to the DB is in RegistrationDAO.inc.php:

Code: Select all

   function updateRegistration(&$registration) {
      return $this->update(
         sprintf('UPDATE registrations
            SET
               sched_conf_id = ?,
               user_id = ?,
               type_id = ?,
               date_registered = %s,
               date_paid = %s,
               payment_method = ?,
               amount_paid = ?,
               membership = ?,
               domain = ?,
               ip_range = ?,
               special_requests = ?
            WHERE registration_id = ?',
            $this->dateToDB($registration->getDateRegistered()), $this->dateToDB($registration->getDatePaid())),
         array(
            $registration->getSchedConfId(),
            $registration->getUserId(),
            $registration->getTypeId(),
            $registration->getPaymentMethod(),
            $registration->getAmountPaid(),
            $registration->getMembership(),
            $registration->getDomain(),
            $registration->getIPRange(),
            $registration->getSpecialRequests(),
            $registration->getId()
         )
      );
   }


Return to “OCS Conference Support and Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests