{"action":"created","comment":{"url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/comments/223653151","pull_request_review_id":162829290,"id":223653151,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzY1MzE1MQ==","diff_hunk":"@@ -388,35 +388,39 @@ public function processBulkUpdateOrderStatus()\n                             if ($current_order_state->id == $order_state->id) {\n                                 $this->errors[] = $this->trans('Order #%d has already been assigned this status.', array('#%d' => $id_order), 'Admin.Orderscustomers.Notification');\n                             } else {\n-                                $history = new OrderHistory();\n-                                $history->id_order = $order->id;\n-                                $history->id_employee = (int) $this->context->employee->id;\n+                                if(!$this->canRemoveQuantitiesIfNeeded($order->getProductsDetail(), $current_order_state, $order_state)) {\n+                                    $this->errors[] = $this->trans('Some quantities from order #%d cannot be removed from the stock.', array('#%d' => $id_order), 'Admin.Orderscustomers.Notification');","path":"controllers/admin/AdminOrdersController.php","position":8,"original_position":8,"commit_id":"abc2272472bb05fc9110610698ae864cf18b47ff","original_commit_id":"abc2272472bb05fc9110610698ae864cf18b47ff","user":{"login":"Ginkosama","id":17412884,"node_id":"MDQ6VXNlcjE3NDEyODg0","avatar_url":"https://avatars2.githubusercontent.com/u/17412884?v=4","gravatar_id":"","url":"https://api.github.com/users/Ginkosama","html_url":"https://github.com/Ginkosama","followers_url":"https://api.github.com/users/Ginkosama/followers","following_url":"https://api.github.com/users/Ginkosama/following{/other_user}","gists_url":"https://api.github.com/users/Ginkosama/gists{/gist_id}","starred_url":"https://api.github.com/users/Ginkosama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ginkosama/subscriptions","organizations_url":"https://api.github.com/users/Ginkosama/orgs","repos_url":"https://api.github.com/users/Ginkosama/repos","events_url":"https://api.github.com/users/Ginkosama/events{/privacy}","received_events_url":"https://api.github.com/users/Ginkosama/received_events","type":"User","site_admin":false},"body":"Yes this message can be much more explicit, i will make a commit to improve it","created_at":"2018-10-09T10:57:19Z","updated_at":"2018-10-09T10:57:19Z","html_url":"https://github.com/PrestaShop/PrestaShop/pull/10919#discussion_r223653151","pull_request_url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/comments/223653151"},"html":{"href":"https://github.com/PrestaShop/PrestaShop/pull/10919#discussion_r223653151"},"pull_request":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919"}},"in_reply_to_id":223639761},"pull_request":{"url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919","id":221164572,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMTY0NTcy","html_url":"https://github.com/PrestaShop/PrestaShop/pull/10919","diff_url":"https://github.com/PrestaShop/PrestaShop/pull/10919.diff","patch_url":"https://github.com/PrestaShop/PrestaShop/pull/10919.patch","issue_url":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/10919","number":10919,"state":"open","locked":false,"title":"[BO] Verify stock if needed before updating to delivered","user":{"login":"Ginkosama","id":17412884,"node_id":"MDQ6VXNlcjE3NDEyODg0","avatar_url":"https://avatars2.githubusercontent.com/u/17412884?v=4","gravatar_id":"","url":"https://api.github.com/users/Ginkosama","html_url":"https://github.com/Ginkosama","followers_url":"https://api.github.com/users/Ginkosama/followers","following_url":"https://api.github.com/users/Ginkosama/following{/other_user}","gists_url":"https://api.github.com/users/Ginkosama/gists{/gist_id}","starred_url":"https://api.github.com/users/Ginkosama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ginkosama/subscriptions","organizations_url":"https://api.github.com/users/Ginkosama/orgs","repos_url":"https://api.github.com/users/Ginkosama/repos","events_url":"https://api.github.com/users/Ginkosama/events{/privacy}","received_events_url":"https://api.github.com/users/Ginkosama/received_events","type":"User","site_admin":false},"body":"There is a stock issue occurring if you follow these steps :\r\n\r\n- On a Prestashop with Advanced Stock Management and Back-order allowed\r\n- Create two warehouses A and B\r\n- Create a product P that can be stored in both warehouses\r\n- Create an order with 2 P\r\n- Update the order status to payment accepted ( the warehouse A is the default one, so it's real quantity goes to -2 )\r\n- When your supplier deliver you the 2 P, you make a mistake and increase the quantity in the warehouse B\r\n- Update the order status to delivered\r\n\r\nThe warehouse A usable and real quantity are now at 0, and the warehouse B usable and real quantity are at 2, resulting in an overall quantity of 2, which is wrong.\r\n\r\nOne can think that the physical quantity of the warehouse A should be at -2, resulting in an overall quantity of 0. But that is just wrong, we can't have negative stock value in the physical world. 0 is the correct value here.\r\n\r\nThe problem is that when removeProduct() is called, there is no check for success, it is just assumed that it was done correctly.\r\n\r\nAs there is not enough quantity in warehouse A to deliver the products, it should not let us update the status to delivered.\r\n\r\nThis commit fix that by checking if the quantity can be removed, if necessary, before allowing the status update to delivered.\r\n\r\nIn this case an error will be displayed and a transfer of 2 P from warehouse B to A will be necessary before being able to deliver the product.\r\n\r\n<!--\r\nThank you for contributing to the PrestaShop project! \r\n\r\nPlease take the time to edit the \"Answers\" rows with the necessary information.\r\n\r\nCheck out our contribution guidelines to find out how to complete it:\r\nhttps://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/#pull-requests\r\n -->\r\n\r\n| Questions     | Answers\r\n| ------------- | -------------------------------------------------------\r\n| Branch?       | develop / 1.7.5.x / 1.6.1.x\r\n| Description?  | See this PR message\r\n| Type?         | bug fix / improvement\r\n| Category?     | BO\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Fixed ticket? | \r\n| How to test?  | See this PR message\r\n\r\n<!-- Click the form's \"Preview\" button to make sure the table is functional in GitHub. Thank you! -->\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/prestashop/prestashop/10919)\r\n<!-- Reviewable:end -->\r\n","created_at":"2018-10-08T15:48:36Z","updated_at":"2018-10-09T10:57:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5682222924d0a92756a7fcf3bf56d07f7fd0a077","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":19737369,"node_id":"MDU6TGFiZWwxOTczNzM2OQ==","url":"https://api.github.com/repos/PrestaShop/PrestaShop/labels/Bug","name":"Bug","color":"d4c5f9","default":false},{"id":186105912,"node_id":"MDU6TGFiZWwxODYxMDU5MTI=","url":"https://api.github.com/repos/PrestaShop/PrestaShop/labels/waiting%20for%20author","name":"waiting for author","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919/commits","review_comments_url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919/comments","review_comment_url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/10919/comments","statuses_url":"https://api.github.com/repos/PrestaShop/PrestaShop/statuses/abc2272472bb05fc9110610698ae864cf18b47ff","head":{"label":"Ginkosama:patch-1","ref":"patch-1","sha":"abc2272472bb05fc9110610698ae864cf18b47ff","user":{"login":"Ginkosama","id":17412884,"node_id":"MDQ6VXNlcjE3NDEyODg0","avatar_url":"https://avatars2.githubusercontent.com/u/17412884?v=4","gravatar_id":"","url":"https://api.github.com/users/Ginkosama","html_url":"https://github.com/Ginkosama","followers_url":"https://api.github.com/users/Ginkosama/followers","following_url":"https://api.github.com/users/Ginkosama/following{/other_user}","gists_url":"https://api.github.com/users/Ginkosama/gists{/gist_id}","starred_url":"https://api.github.com/users/Ginkosama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ginkosama/subscriptions","organizations_url":"https://api.github.com/users/Ginkosama/orgs","repos_url":"https://api.github.com/users/Ginkosama/repos","events_url":"https://api.github.com/users/Ginkosama/events{/privacy}","received_events_url":"https://api.github.com/users/Ginkosama/received_events","type":"User","site_admin":false},"repo":{"id":52291626,"node_id":"MDEwOlJlcG9zaXRvcnk1MjI5MTYyNg==","name":"PrestaShop","full_name":"Ginkosama/PrestaShop","private":false,"owner":{"login":"Ginkosama","id":17412884,"node_id":"MDQ6VXNlcjE3NDEyODg0","avatar_url":"https://avatars2.githubusercontent.com/u/17412884?v=4","gravatar_id":"","url":"https://api.github.com/users/Ginkosama","html_url":"https://github.com/Ginkosama","followers_url":"https://api.github.com/users/Ginkosama/followers","following_url":"https://api.github.com/users/Ginkosama/following{/other_user}","gists_url":"https://api.github.com/users/Ginkosama/gists{/gist_id}","starred_url":"https://api.github.com/users/Ginkosama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ginkosama/subscriptions","organizations_url":"https://api.github.com/users/Ginkosama/orgs","repos_url":"https://api.github.com/users/Ginkosama/repos","events_url":"https://api.github.com/users/Ginkosama/events{/privacy}","received_events_url":"https://api.github.com/users/Ginkosama/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Ginkosama/PrestaShop","description":"PrestaShop offers a free, fully scalable, Open Source e-commerce solution.","fork":true,"url":"https://api.github.com/repos/Ginkosama/PrestaShop","forks_url":"https://api.github.com/repos/Ginkosama/PrestaShop/forks","keys_url":"https://api.github.com/repos/Ginkosama/PrestaShop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ginkosama/PrestaShop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ginkosama/PrestaShop/teams","hooks_url":"https://api.github.com/repos/Ginkosama/PrestaShop/hooks","issue_events_url":"https://api.github.com/repos/Ginkosama/PrestaShop/issues/events{/number}","events_url":"https://api.github.com/repos/Ginkosama/PrestaShop/events","assignees_url":"https://api.github.com/repos/Ginkosama/PrestaShop/assignees{/user}","branches_url":"https://api.github.com/repos/Ginkosama/PrestaShop/branches{/branch}","tags_url":"https://api.github.com/repos/Ginkosama/PrestaShop/tags","blobs_url":"https://api.github.com/repos/Ginkosama/PrestaShop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ginkosama/PrestaShop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ginkosama/PrestaShop/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ginkosama/PrestaShop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ginkosama/PrestaShop/statuses/{sha}","languages_url":"https://api.github.com/repos/Ginkosama/PrestaShop/languages","stargazers_url":"https://api.github.com/repos/Ginkosama/PrestaShop/stargazers","contributors_url":"https://api.github.com/repos/Ginkosama/PrestaShop/contributors","subscribers_url":"https://api.github.com/repos/Ginkosama/PrestaShop/subscribers","subscription_url":"https://api.github.com/repos/Ginkosama/PrestaShop/subscription","commits_url":"https://api.github.com/repos/Ginkosama/PrestaShop/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ginkosama/PrestaShop/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ginkosama/PrestaShop/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ginkosama/PrestaShop/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ginkosama/PrestaShop/contents/{+path}","compare_url":"https://api.github.com/repos/Ginkosama/PrestaShop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ginkosama/PrestaShop/merges","archive_url":"https://api.github.com/repos/Ginkosama/PrestaShop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ginkosama/PrestaShop/downloads","issues_url":"https://api.github.com/repos/Ginkosama/PrestaShop/issues{/number}","pulls_url":"https://api.github.com/repos/Ginkosama/PrestaShop/pulls{/number}","milestones_url":"https://api.github.com/repos/Ginkosama/PrestaShop/milestones{/number}","notifications_url":"https://api.github.com/repos/Ginkosama/PrestaShop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ginkosama/PrestaShop/labels{/name}","releases_url":"https://api.github.com/repos/Ginkosama/PrestaShop/releases{/id}","deployments_url":"https://api.github.com/repos/Ginkosama/PrestaShop/deployments","created_at":"2016-02-22T17:32:05Z","updated_at":"2016-02-22T17:32:15Z","pushed_at":"2018-10-08T16:44:55Z","git_url":"git://github.com/Ginkosama/PrestaShop.git","ssh_url":"git@github.com:Ginkosama/PrestaShop.git","clone_url":"https://github.com/Ginkosama/PrestaShop.git","svn_url":"https://github.com/Ginkosama/PrestaShop","homepage":"http://www.prestashop.com/","size":329703,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"PrestaShop:develop","ref":"develop","sha":"2ba52e6cef2ab9fe35d8817f4d21970977a8214c","user":{"login":"PrestaShop","id":2815696,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MTU2OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/2815696?v=4","gravatar_id":"","url":"https://api.github.com/users/PrestaShop","html_url":"https://github.com/PrestaShop","followers_url":"https://api.github.com/users/PrestaShop/followers","following_url":"https://api.github.com/users/PrestaShop/following{/other_user}","gists_url":"https://api.github.com/users/PrestaShop/gists{/gist_id}","starred_url":"https://api.github.com/users/PrestaShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrestaShop/subscriptions","organizations_url":"https://api.github.com/users/PrestaShop/orgs","repos_url":"https://api.github.com/users/PrestaShop/repos","events_url":"https://api.github.com/users/PrestaShop/events{/privacy}","received_events_url":"https://api.github.com/users/PrestaShop/received_events","type":"Organization","site_admin":false},"repo":{"id":6763587,"node_id":"MDEwOlJlcG9zaXRvcnk2NzYzNTg3","name":"PrestaShop","full_name":"PrestaShop/PrestaShop","private":false,"owner":{"login":"PrestaShop","id":2815696,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4MTU2OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/2815696?v=4","gravatar_id":"","url":"https://api.github.com/users/PrestaShop","html_url":"https://github.com/PrestaShop","followers_url":"https://api.github.com/users/PrestaShop/followers","following_url":"https://api.github.com/users/PrestaShop/following{/other_user}","gists_url":"https://api.github.com/users/PrestaShop/gists{/gist_id}","starred_url":"https://api.github.com/users/PrestaShop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrestaShop/subscriptions","organizations_url":"https://api.github.com/users/PrestaShop/orgs","repos_url":"https://api.github.com/users/PrestaShop/repos","events_url":"https://api.github.com/users/PrestaShop/events{/privacy}","received_events_url":"https://api.github.com/users/PrestaShop/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PrestaShop/PrestaShop","description":"PrestaShop offers a fully scalable open source ecommerce solution.","fork":false,"url":"https://api.github.com/repos/PrestaShop/PrestaShop","forks_url":"https://api.github.com/repos/PrestaShop/PrestaShop/forks","keys_url":"https://api.github.com/repos/PrestaShop/PrestaShop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PrestaShop/PrestaShop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PrestaShop/PrestaShop/teams","hooks_url":"https://api.github.com/repos/PrestaShop/PrestaShop/hooks","issue_events_url":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/events{/number}","events_url":"https://api.github.com/repos/PrestaShop/PrestaShop/events","assignees_url":"https://api.github.com/repos/PrestaShop/PrestaShop/assignees{/user}","branches_url":"https://api.github.com/repos/PrestaShop/PrestaShop/branches{/branch}","tags_url":"https://api.github.com/repos/PrestaShop/PrestaShop/tags","blobs_url":"https://api.github.com/repos/PrestaShop/PrestaShop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PrestaShop/PrestaShop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PrestaShop/PrestaShop/git/refs{/sha}","trees_url":"https://api.github.com/repos/PrestaShop/PrestaShop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PrestaShop/PrestaShop/statuses/{sha}","languages_url":"https://api.github.com/repos/PrestaShop/PrestaShop/languages","stargazers_url":"https://api.github.com/repos/PrestaShop/PrestaShop/stargazers","contributors_url":"https://api.github.com/repos/PrestaShop/PrestaShop/contributors","subscribers_url":"https://api.github.com/repos/PrestaShop/PrestaShop/subscribers","subscription_url":"https://api.github.com/repos/PrestaShop/PrestaShop/subscription","commits_url":"https://api.github.com/repos/PrestaShop/PrestaShop/commits{/sha}","git_commits_url":"https://api.github.com/repos/PrestaShop/PrestaShop/git/commits{/sha}","comments_url":"https://api.github.com/repos/PrestaShop/PrestaShop/comments{/number}","issue_comment_url":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/comments{/number}","contents_url":"https://api.github.com/repos/PrestaShop/PrestaShop/contents/{+path}","compare_url":"https://api.github.com/repos/PrestaShop/PrestaShop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PrestaShop/PrestaShop/merges","archive_url":"https://api.github.com/repos/PrestaShop/PrestaShop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PrestaShop/PrestaShop/downloads","issues_url":"https://api.github.com/repos/PrestaShop/PrestaShop/issues{/number}","pulls_url":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls{/number}","milestones_url":"https://api.github.com/repos/PrestaShop/PrestaShop/milestones{/number}","notifications_url":"https://api.github.com/repos/PrestaShop/PrestaShop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PrestaShop/PrestaShop/labels{/name}","releases_url":"https://api.github.com/repos/PrestaShop/PrestaShop/releases{/id}","deployments_url":"https://api.github.com/repos/PrestaShop/PrestaShop/deployments","created_at":"2012-11-19T16:41:31Z","updated_at":"2018-10-09T10:04:38Z","pushed_at":"2018-10-09T10:34:07Z","git_url":"git://github.com/PrestaShop/PrestaShop.git","ssh_url":"git@github.com:PrestaShop/PrestaShop.git","clone_url":"https://github.com/PrestaShop/PrestaShop.git","svn_url":"https://github.com/PrestaShop/PrestaShop","homepage":"http://www.prestashop.com/","size":371644,"stargazers_count":3223,"watchers_count":3223,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2925,"mirror_url":null,"archived":false,"open_issues_count":1162,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2925,"open_issues":1162,"watchers":3223,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919"},"html":{"href":"https://github.com/PrestaShop/PrestaShop/pull/10919"},"issue":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/10919"},"comments":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/issues/10919/comments"},"review_comments":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919/comments"},"review_comment":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/pulls/10919/commits"},"statuses":{"href":"https://api.github.com/repos/PrestaShop/PrestaShop/statuses/abc2272472bb05fc9110610698ae864cf18b47ff"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Ginkosama"}}