Closed (fixed)
Project:
Addemar Subscription
Version:
7.x-1.1
Component:
Code
Priority:
Critical
Category:
Feature request
Assigned:
Reporter:
Created:
29 Jan 2016 at 10:56 UTC
Updated:
30 Apr 2016 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
Gleach commentedI've updated the patch.
Last patch had a conflict with the variable: '$key'.
Above all I fixed the the way data is passed to (with) soap.
Now I couldn't let Addemar (in Drupal) subscribe in several groups, eventhough I selected them!
It's fixed now. I'm passing an array of keys, instead of a string with keys seperated by a comma.
now: array(0 => id1, 1 => id2,..)
before: string (id1,id2,id3,...)
Now: Contact group with id2 will also be subscribed to.
Before: only id1 would be subscribed too.
Using version 1.5.
Comment #3
bart.hanssens commentedComment #4
stefan.r commentedShould this silently fail?
Unrelated as the issue was already in the module, but this is incorrect usage of t() (can be fixed in a followup)
Can we add a comment about why we skip group 0?
When would this be not numeric? And do we need to log any information here?
Coding standards nitpick: should be
isset(rather thanisset (Do special groups always have type 1?
Comment #5
Gleach commented1) We/you can set a watchdog message or error message
2) The variable_get_value can be set into a variable. That $var can be used into the t(), would that be ok?
3) Apparently this should be wrong. I thought contact groups started with id: '1'. If my source is right, id 0 does exist. making this if-statement excessive. The account where I have access to does not have a contact group with id 0. So this have to be looked at.
4) This is your/the original code... It's basically an extra check that's been tested there. If $cid somehow turned out to be a string, it will throw a drupal error message.
5) Weird, I have an auto-indenter which has been fine-tuned on Drupal coding standards. But you're absolutely right.
6) According to your/original code: yes. I have no idea why only static-groups are allowed in the first place. You will probably have your reasons. This could be an extension later on?
For now it's ok for me to work with static-groups only, as you/original code had intended.
Comment #6
stefan.r commentedOK, awaiting your new patch! Don't worry about 2, we can fix that elsewhere.
Comment #7
Gleach commented1,2,3 and 5 should be fixed now.
Can re-check the patch again and test it pls?
Comment #8
stefan.r commentedLook OK to me
Comment #10
Gleach commentedCritical:
Due to some local problems, my patch wasn't complete.
If you apply last patch to the module, the module will not work properly.
You won't be able to create more than one group in Addemar back-end.
Why? If you look at my new patch, you'll see I adjusted the key of the foreach loop (which wa $key). This is quite necessary...
If you see which argument is passed with the function (_addemar_subscription_add_more_newsletter_form), you'll see that an argument is called "$key".
Therefore I'm completely letting the module crash, when it the function is being called.
Simple fix: rename the key of the foreach.
My apologies for any inconveniences.
Comment #12
stefan.r commentedCommitted, thanks.
Comment #13
stefan.r commented$s_client->getMailgroupsByType() gives SoapFault: contact group not found in SoapClient->__call() as of today -- I assume Addemar's API has changed?
Comment #14
Gleach commentedYes, because not all 'keys' are legit as they can crash the whole app.
Therefore the try-catch was used for.
But probably it's better to NOT let the soap call 'try'.
Anyway, I've hard-coded checked on the possible values, which I do not like. But I don't see any other way?
See the patch in attachments. The patch is build on the last patch.
So basically, if you apply this patch (https://www.drupal.org/node/2658814#comment-11028833 ), than you can apply this patch.
Is this ok? Or do I need to commit a whole new patch starting from the current active version?
btw: Addemar has no updates, or no updates that influences the module for as far I can see?
Patch tested on Addemar Web Service v1.5 & v1.4
Comment #15
stefan.r commentedWe only have the SOAP error as of today. Maybe it's due to a change our the settings, but it looks like their API changed. So I've emailed them about this, perhaps they can fix it on their side.
But the problem is not the one in this patch... it's another line:
$groups_ids = $s_client->getMailgroupsByType();
So we'd probably need to loop through the IDs instead of doing a call to getMailgroupsByType() without any arguments.
Comment #16
stefan.r commentedHow about this?
Comment #18
Gleach commentedThis could and will work. Then again, I still don't like the idea that the id's are hardcoded.
On the other hand, if you look to previous addemar versions, then you'll notice that they didn't change the id's.
Comment #19
stefan.r commented