-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control if customer is the owner of the selected order in contact form #9126
Conversation
Thank's |
@okom3pom Sorry for the delay, I was fighting with 1.6 on a recent debian install ^^ 1.7 is really easier to configure for me :) |
* Check if customer select his order. | ||
*/ | ||
if (!empty($id_order)) { | ||
$order = new Order($id_order); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the order doesn't exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order information are empty. No error, and $order->id_customer
will return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try with injecting 9999
maybe someone can try too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then!
*/ | ||
if (!empty($id_order)) { | ||
$order = new Order($id_order); | ||
$id_order = (int) $order->id_customer === (int) $customer->id ? $id_order : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be aware that this:
(int) $order->id_customer === (int) $customer->id
Is basically equivalent to doing this:
$order->id_customer == $customer->id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if I'm agree with you, I prefer cast to integer because it's an id =)
Thank you @PierreRambaud |
This change is