Skip to content
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

Merged
merged 1 commit into from
Jun 5, 2018
Merged

Control if customer is the owner of the selected order in contact form #9126

merged 1 commit into from
Jun 5, 2018

Conversation

PierreRambaud
Copy link
Contributor

@PierreRambaud PierreRambaud commented May 25, 2018

Questions Answers
Branch? 1.6.1.x
Description? Control if customer is the owner of the selected order in contact form
Type? bug fix
Category? FO
BC breaks? no
Deprecations? no
Fixed ticket? http://forge.prestashop.com/browse/BOOM-4362
How to test? Try to set an order id that is not owned by the customer (selected by his address) in contact form.

This change is Reviewable

@ghost
Copy link

ghost commented May 25, 2018

Thank's

@PierreRambaud
Copy link
Contributor Author

@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 :)

@PierreRambaud PierreRambaud added the Bug Type: Bug label May 25, 2018
* Check if customer select his order.
*/
if (!empty($id_order)) {
$order = new Order($id_order);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 :)

Copy link
Member

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;
Copy link
Member

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

Copy link
Contributor Author

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 =)

@eternoendless eternoendless added the Waiting for QA Status: action required, waiting for test feedback label May 28, 2018
@eternoendless eternoendless added this to the 1.6.1.20 milestone May 28, 2018
@marionf marionf added QA ✔️ Status: check done, code approved and removed Waiting for QA Status: action required, waiting for test feedback labels May 28, 2018
@eternoendless
Copy link
Member

Thank you @PierreRambaud

@eternoendless eternoendless merged commit bd60531 into PrestaShop:1.6.1.x Jun 5, 2018
@PierreRambaud PierreRambaud deleted the fix/boom-4362 branch June 5, 2018 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Type: Bug QA ✔️ Status: check done, code approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants