So, this issue is crazy and Im not sure how to fix it.
Basically I have a module for a sales opportunity. Creating a record of this module can be done normally, in which case you select the customer it is for via a relate field.
However it can also be done from the customer screen by click an "Open Opportunity" button. This brings you to the edit view of the opportunity module, with an additional parameter for customerID passed.
I customized the edit view of the opportunity module so that I pass a variable to smarty called useCustomer and the customerID if a customerID is present.
The template then checks if useCustomer is set and instead of writing the relate field for customer, it simply writes a hidden field and stores the customer.
This works great. Except, the customer field will always do what it did right after repairing from the admin.
Meaning, if I repair from admin, then normally go to create a new opportunity, customer will be there. Then even if I access it from the customer, where it should be hidden, customer still appears.
Vice versa is true, if I first access it from a customer, no customer field is shown, it is hidden with the passed param. If I then access it normally, still no customer field, instead a hidden field with no value.
The very very very strange thing is, if I output the variable I am checking right before my if statement, it properly shows. So Test: {$useCustomer} will show Test: 1 if I access it from a customer, and Test: if I do not.
Somehow, the template is ignoring the if statement and just doing what it did before. I know the LOGIC of the code works, because if I repair/rebuild and run the other way, it will work. So somehow, the system seems to be caching the actual decision of the if statement in the template, if that makes any sense. Its very very strange to me and I cant remotely figure out why this is occuring.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks