Project:Ubercart Product Keys
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:freixas
Status:postponed

Issue Summary

Opening new issue as requested here: http://drupal.org/node/1071850#comment-4306530

O.k. tried using the 'del?' checkbox to remove a license key, but they key is not removed. My key is listed like so:

Key ID Sequence Product Order ID # Act Revoke? Del?
148 XXXX-2011-IS-4U-XXM None None 0 - Key xxxxx-xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

My URL at this stage is : admin/store/products/keys/list?page=6

After selecting delete for the key, I click 'update keys'

Which returns this message on a new page.

Delete product keys
There are no product keys to delete.

URL is: admin/store/products/keys/delete?d=d%255B0%255D%3D148&ret=admin/store/products/keys/list

Comments

#1

Just to confirm that the key has not be sold and is not assigned/linked to a user account

#2

I took a look at the database and it seems that there should be no problem with deleting the key in the database. I'll have to take a look at the code when I have time to see if I can figure out what it happening.

You may want to jot down the record data before deleting it. Maybe that will give us some clues. And, no, I don't need the exact product key number—what you listed above is fine.

#3

O.k. I will backup the database and remove the record from the `uc_product_keys` table only

#4

Update - Deleting the license key row from the table worked fine. That's o.k. for me as an admin, but the client won't have this level of access, nor would they want to .

#5

Assigned to:Anonymous» freixas

Did you note the values in the record? Or could you get them from your backup? I'd like to see what was in the record. I don't need the product key itself.

Keep in mind that the functionality for deleting is there and it works for me. It's quite possible there is a bug in the code, but I'm going to need help finding the problem.

#6

Yes, I did note the values. Record 148 was the key I was trying to delete. At the time (last night) it was the last record in the list. When I came to delete the key from the DB this morning, the client had added some additional keys, so i've added the adjacent records, 147,149 for comparison.

147
13
0
0
0
XXXXX-XXXXX-XXXXX-XXXXXX-XXXXX
0
0

148
13
0
0
0
XXXXX-XXXXX-XXXXX-XXXXXX-XXXXX
0
0

149
6
0
0
0
XXXXX-XXXXX-XXXXX-XXXXXX-XXXXX
0
0

#7

Everything looks normal.

I should have looked closer at:

admin/store/products/keys/delete?d=d%255B0%255D%3D148&ret=admin/store/products/keys/list

What it should have been (I think) is:

admin/store/products/keys/delete?d=d[]=148&ret=admin/store/products/keys/list

I see two problems in the URL. There is an extra 0 I can't account for (d%255B0) and the URL has been doubly-encoded (in other words, [ became %5B which then became %255B).

Here are the lines of code that produces this URL:

<?php
   
if ($form['delete_' . $key->pkid]['#value']) {
     
$deletions[] = 'd[]=' . $key->pkid;
    }
...
drupal_goto('admin/store/products/keys/delete', implode('&', $deletions) . '&ret=' . implode('/', arg()));
?>

I don't know why your URL is getting encoded twice. Perhaps some other module is interfering? There is a hook in drupal_goto() called hook_exit() that takes the URL as a parameter, but this has no return value, so I don't know how it could affect the URL. Is there anything else in your setup that might do the double-encoding?

If you are a programmer and have a test system, you could try inserting debug statements in drupal_goto() to see what goes out. Since I don't get the double encoding, I can't do this. In fact, here's what I see in my browser when I try to delete one key:

admin/store/products/keys/delete?d[]=35&ret=admin/store/products/keys/list

The problem could be on your end or mine, but everything I'm doing here seems legit.

#8

Thanks for the pointers here Freixas. I'll run some tests on our staging server.
We are running the secure pages module, so I'll take a look at the paths and add some debug to the URL path code.

I'll come back to you.

#9

FWIW, I use the Secure Pages module and its enabled for the pages where I display and delete a product key.

#10

Hmm, strange - on my first go at deleting the same key on the staging server and it works!

URL

/store/products/keys/delete?d[]=148&ret=admin/store/products/keys/list

Delete product keys
Delete the following product keys?

148
Deletion is permanent. There is no undo.

It's on the same server but just running on a subdomain - the site is an exact clone... i'll need to dig a little deeper.

#11

O.k. the only difference between the staging domain and the live domain is secure pages.

I've added this to my secure pages ignore list on the live site:

admin/store/products/keys*

now the keys DO get deleted properly and my return path is:

http://www.mydomain.com/admin/store/products/keys/delete?d[]=163&ret=admin/store/products/keys/list

If I remove the rule from secure pages then it breaks again

https://www.mydomain.com/admin/store/products/keys/delete?d=d%255B0%255D%3D163&ret=admin/store/products/keys/list

So it looks like, for me at least, this is a secure pages conflict - at least I have a solution, but I'm not sure why you don't experience the same thing?

update: I should probably clarify that I had a wildcard secure pages rule for 'admin*' - making all the admin pages https: by default.

#12

I'm on version 6.x-1.8. My little test site for uc_product_keys exists only on my PC and is only accessible by me, so it doesn't have the latest version (6.x-1.9). When I get a chance, I'll download and try the new version and see if the error hits me as well. It's possible I'm passing the parameters the wrong way—I think I copied this technique from some Ubercart code.

I'll let you know. Thanks for tracking this down with me.

BTW, I also protect all admin pages.

#13

o.k. I can confirm that we are also using secure pages 6.x-1.8

#14

Status:active» postponed
nobody click here