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

Issue #2921376 by mbreden: Move stock-adding logic outside of an if-b… #82

Open
wants to merge 1 commit into
base: 7.x-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions includes/commerce_pos.transaction.inc
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,15 @@ function commerce_pos_transaction_pay_submit($form, &$form_state) {
$form_state['transaction']->doAction('saveOrder');
}
}
if (module_exists('commerce_pos_stock')) {
$order = commerce_order_load($form_state['transaction']->orderId);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
foreach ($order_wrapper->commerce_line_items->value() as $line_item) {
if (!empty($form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'])) {
$line_item->data['commerce_pos_stock_add_to_stock'] = $form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'];
commerce_line_item_save($line_item);
}
}

if (module_exists('commerce_pos_stock')) {
$order = commerce_order_load($form_state['transaction']->orderId);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
foreach ($order_wrapper->commerce_line_items->value() as $line_item) {
if (!empty($form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'])) {
$line_item->data['commerce_pos_stock_add_to_stock'] = $form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'];
commerce_line_item_save($line_item);
}
}
}
Expand Down