Lots of errors :(
Great concept to this but unfortunately to many errors to be usable. I fixed a few of them but gave up after running into more.
First off, I'm using Drupal 6.19 and ubercart 2.x
The File Handler routine:
function uc_file_retro_form_submit($form_id, $form_state, $form) {
will always fail with a missing argument because the form handler only submits two arguments. I dropped the $form argument off this and it gets past this problem.
Next when it creates the tables on install it's not creating the "description" field on the uc_file_retro_que table, preventing it from even adding stuff to the que at all. I added the field but didn't look into why it did not create it on it's own.
After doing this and finally figuring out how to actually process the que, the new file does not inherit the correct properties. My previous files for this product are set to a 1 year expiration, unlimited download limit, and 3 ip address limit. Well the qued file shows up with no expiration, unilimited download, and unlimited ip addresses. I have not looked further into it to see why yet, might if I'm feeling spunky tomorrow but at this time I'm giving up will probably be just more errors to fix after fixing this one.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 934204-api-changes.patch | 9.72 KB | agentrickard |
Comments
Comment #1
steven6282 commentedFor those that want to use this module but are having the same problems I have here is a new function uc_file_retro_batch_process that will correct the problems with the added files not inheriting the original settings. The way I coded it is to go the same time interval from the original purchase date, not from the date you add it so you may want to change that. Feel free to message me if you need help with it.
Oh and as for the "description" field not being created, thats because it's not even in the schema in the install file so of course it would not create it.
Comment #2
torgospizzaSince this isn't fixed, please don't mark it as fixed. I'd love to patch this up but I just found this issue now.
Thanks for the report. Will mark this as "needs review" until I can get to it and issue a new release.
Comment #3
TY2U commentedHi there,
Thank you for this module! I was looking for something to do this for a long time before I came across this. I don't understand why file downloads is all messed up in UC. This module wasn't working properly either so I came here and tried the patches in this thread. I also recreated the database table with the description field. It now will process the queue actually and list the orders it affects. However, no orders are changed. Users still have the same files on their accounts. Am I missing something?
Thanks =)
Comment #4
torgospizzaI'm confused. Are you saying that the NEW files you're adding via this module are not actually being added to their accounts? That's what uc_file_user_renew() does. I'm wondering if the patch above is using an expiration date and you don't have any setup? We don't use expiration dates on our site, so I never did test that aspect of it, though I'd have to dig into the code a bit more to see if the (sensible?) default works without needing to be specified.
Comment #5
TY2U commentedThanks for the quick response =)
Yes I think you may have just nailed it on the head. I will do a test and tell you step by step what I am doing.
* The product feature has been added.
* Queued product feature 10 for 1
Processing file queue
100%
Processing 1 out of 1
Currently processing order #18
File Process Results
11 orders were processed:
with all the orders listed in here
Now checking a users Files tab they have the old file but not the new one I just tried to add.
I do have it set to allow unlimited downloads and no expiration date so maybe this is indeed the problem.
Comment #6
torgospizzaYeah that could be it. I'll have to test with that patch. The weird thing is, the module works fine for me without the patch, so I'm not quite sure without digging in. I'll see what I can do this week - pretty busy lately but I'll do my best.
Comment #7
TY2U commentedWell, I think I fixed it.
I added this OR part to it. I don't know if it should be NULL or -1 but it works now. Added the file to the users =)
Comment #8
torgospizzaYeah, TBH I'm not even sure the expiry stuff needs to be there - I could've sworn that uc_file_user_renew() does that on its own accord. I'll see if I can work that angle and see what that code really needs to be.
Comment #9
agentrickardHere's a proper patch the fixes the following errors:
1) Removed
$form['#validate'][] = 'uc_file_retro_form_validate';since the validation function does not exist.2) Fixes arguments for
function uc_file_retro_form_submit3) Correct bad usage of "in_queue" and "processed" values for 'status' column. Replaces with 0 and 1, since the actual schema defines
uc_file_retro.statusas an integer column.4) Wraps
All SKUsmessage int()properly.5) Standardizes SYNTAX CASE in SQL statements.
6) Properly handles the 'All SKU' value, which means that any model should be selected.
7) Ups the batch limit from 100 to 1000. TODO: need better handling here, so that unfinished processes can be completed later.
8) Adds batch result data so that a queue can be marked complete properly. NEEDS WORK.
9) Fixes the function call to
uc_file_user_renew, which was missing the final two parameters.10) Properly calculates $file_limits being passed to
uc_file_user_renew11) Adds the 'description' column to
uc_file_retro_schema12) Provides
uc_file_retro_update_6002to add the 'description' column for existing installs.Working more like expected now. The batch handling for "completed" vs. "partial" updates still needs a lot of work, though.
Comment #10
torgospizzaWow, sweet. Thanks, Ken! Will try to commit your patch this week.
Comment #11
netentropy commentedHey thanks for the module and the patch but the patch fails when I attempt to patch
patching file uc_file_retro.module
Hunk #1 FAILED at 53.
Hunk #2 FAILED at 62.
Hunk #3 FAILED at 81.
Hunk #4 FAILED at 107.
Hunk #5 FAILED at 123.
Hunk #6 FAILED at 153.
Hunk #7 FAILED at 185.
Hunk #8 FAILED at 210.
Hunk #9 FAILED at 252.
Hunk #10 FAILED at 291.
10 out of 10 hunks FAILED
How can I fix this?
Comment #12
torgospizzaLet me work on getting the patch applied. I didn't get a chance to yet. Once the patch is in, I'll commit a new -dev version. Sorry for the hold up.
Comment #13
netentropy commentedgreat thanks! we are doing a huge migration next week and this would be so helpful. if not i will have to recreate all the hash keys another way.
Comment #14
myregistration commentedHi, Any idea when you'll commit the next dev? Thanks! :)
Comment #15
torgospizzaCommitted this to the git repo (my first git commit!)... sorry for the delay. I'll try to roll a point release soon. I noticed a couple other problems with the code itself (like using db_query("insert...") rather than drupal_write_record. I'll remedy that and roll a patch then commit those to git and hopefully an actual release! :)
Comment #16
torgospizza