OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



bug in viewtemplates.tpl

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

bug in viewtemplates.tpl

Postby newone » Mon Nov 25, 2013 1:46 pm

I have encountered a bug in OJS in viewPayments.tpl.

Whenever I try to navigate the last page in Subscriptions Summary > Payments > Records, I get an error at the bottom of the records and the navigation that sends you back or forward a page disappears. I also noticed that I get this error when I click the link for page 3 and the navigation that should appear at the bottom of the records also disappears.

I am using OJS 2.4.2 and I keep getting this error:
Fatal error: Call to a member function getUsername() on a non-object in /xxxx/xxxx/xxxx/cache/t_compile/%%24^249^2499BF4E%%viewPayments.tpl.php on line 62

There was a post on the forum with a link to patch the problem. I patched using the changes on the link below but the problem is still there.
viewtopic.php?f=8&t=9246&p=35907

Any suggestions for a fix.
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby newone » Wed Dec 25, 2013 12:00 am

Any update. Bug is still there.
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Thu Dec 26, 2013 6:51 am

Hi newone,

It sounds to me like you have a database discrepancy. I suspect there's an entry in the subscriptions table with a user_id that doesn't correspond to a valid entry in the users table.

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

Re: bug in viewtemplates.tpl

Postby newone » Sat Jan 11, 2014 2:53 am

asmecher wrote:Hi newone,

It sounds to me like you have a database discrepancy. I suspect there's an entry in the subscriptions table with a user_id that doesn't correspond to a valid entry in the users table.

Regards,
Alec Smecher
Public Knowledge Project Team



How do I check if there are discrepancy? What should I look for?

I did apply the bug. Please, take a look here at someone else having similar problem
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Sat Jan 11, 2014 7:28 am

Hi newone,

Run the following MySQL query:
Code: Select all
SELECT s.user_id FROM subscriptions s LEFT JOIN users u ON (u.user_id=s.user_id) WHERE u.user_id IS NULL;
If there are any results, you'll need to delete them from the subscriptions table. The easiest way to do this, if you're not familiar with SQL, is using a tool like phpMyAdmin; many hosts already have this installed.

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

Re: bug in viewtemplates.tpl

Postby newone » Sun Jan 12, 2014 1:37 am

Hi Alec,

I ran the query and I got the following: MySQL returned an empty result set (i.e. zero rows).

So, what should I do next?

On a similar note, I also noticed that in Records in Subscription Management > Payments payments, when click the username of the person that paid to download an article, it shows a 404 Error. .

Any ideas?
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Mon Jan 13, 2014 6:26 am

Hi newone,

And for the following query?
Code: Select all
SELECT c.user_id FROM completed_payments c LEFT JOIN users u ON (c.user_id=u.user_id) WHERE u.user_id IS NULL;
For the 404 error, what does the URL look like? (Feel free to remove your domain name if you'd rather not share it.)

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

Re: bug in viewtemplates.tpl

Postby newone » Tue Jan 14, 2014 4:28 pm

Hi Alec,

I got something. It says:
This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.
Showing rows 0 - 9 (10 total, Query took 0.0038 sec) [user_id: 171 - 1989]

I also see the user_id table listing only these IDs. I take it these are the affected IDs.
171
171
697
743
816
948
955
1103
1246
1989

I get the 404 error link by going to Subscription Manager, then Payments, then Records, where I see all the payments. You get the 404 error two ways. This is link, where you can click on username or details. Clicking on both produces 404 error.
http://www.xxx.com/index.php/journal/su ... ewPayments

Clicking the username produces a 404 error.

If I click Details link, I can view information on any of the payments (payment, timestamp, name of file downloaded, etc). On this page, clicking the username also produces a 404 error.

The 404 link structure
http://www.xxxx.com/index.php/journal/s ... ofile/2245

Do not know what is causing the 404 issues.

I would appreciate a fix to both.
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Thu Jan 16, 2014 8:38 am

Hi newone,

To solve the data problem with the completed_payments table, you'll need to remove the problem entries. To do that, for each user_id listed above, execute:
Code: Select all
DELETE FROM completed_payments WHERE user_id=123;
(...replacing 123 with the user ID.)

As for the 404s, I've filed that bug at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8536 and will ask one of our devs to have a look.

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

Re: bug in viewtemplates.tpl

Postby JasonNugent » Thu Jan 16, 2014 9:37 am

Hi newone,

The following small patch should fix your 404 problems:

https://github.com/pkp/ojs/commit/e9c66 ... b571b.diff

Cheers,
Jason
JasonNugent
Site Admin
 
Posts: 895
Joined: Tue Jan 10, 2006 6:20 am

Re: bug in viewtemplates.tpl

Postby newone » Fri Jan 17, 2014 2:41 am

HI Alec,

That did the trick on the database! Thanks a lot. :D

After the small patch was applied, I do not see the 404 error, but now, the link is not working correctly, unless this is how it was intended to work. This is what is happening:

Whenever you click the username link in Subscriptions Manager, then Payments, then Records for ANY user that paid for an article, the link will open the profile of the admin, which can be edited. For example, when I hoover the mouse over the username of a user that paid for an article, the link looks something like this:
http://www.xxx.com/index.php/journal/user/profile/1245
http://www.xxx.com/index.php/journal/user/profile/1251

Still in Subscriptions Manager, when I click any of the links above to view the profile of each user, I see the admin profile instead of the user. The actual user profile does not show up. Ideally, what should happen is that the admin should see the profile of ANY person that bought an article. Can this be fixed?

Is there a way to save the "users" column in the database with only first name, last name, and email address of each user as SQl or CSV file? I have tried to export from the database, but it saves all the fields like username, phone, mailing, phone, etc? I have also tried to use the Import/Export on the site to get the XML for the users of the journal, but the XML shows ALL the fields. I just need the first name, last name, and email. Is there a way to do this?

Thanks so much.
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Fri Jan 17, 2014 5:46 am

Hi newone,

I already sent Jason a heads-up about his patch not working the way it was intended -- he'll fix it shortly and post back here. Meanwhile, I suggest reversing the patch to avoid confusion.

To export the database in various ways the best thing to do is install a web-based tool like phpMyAdmin; it'll allow you to export various parts of the database in formats like CSV, IIRC.

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

Re: bug in viewtemplates.tpl

Postby JasonNugent » Fri Jan 17, 2014 8:10 am

Hi newone,

Yes, apologies for my first suggested fix. I have something almost ready for you. I am just testing it now.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 895
Joined: Tue Jan 10, 2006 6:20 am

Re: bug in viewtemplates.tpl

Postby JasonNugent » Fri Jan 17, 2014 8:26 am

Hi newone,

This should do the trick:

https://github.com/pkp/ojs/commit/6a8b9 ... 0a995bb3c1

It is a much more substantial change. And, as Alec mentioned, please revert the previous change if you have not already.

Cheers,
Jason
JasonNugent
Site Admin
 
Posts: 895
Joined: Tue Jan 10, 2006 6:20 am

Re: bug in viewtemplates.tpl

Postby newone » Tue Jan 21, 2014 6:09 am

Hi Alec and Jason,

Perfecto! The patch works and thanks very much for both of your assistance. :)

For saving parts of a table, I wrote an SQL statement:
Code: Select all
SELECT first_name, last_name, email FROM users

This returned all users in the database and there is an export link at the bottom of the results. If you click it, you can export in any format you wish. I also found out that you can search for the table and select the fields, and then export.

Newone
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Next

Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests