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

Copy quote does not populate item product fields #998

Open
chegel opened this issue Nov 16, 2023 · 1 comment
Open

Copy quote does not populate item product fields #998

chegel opened this issue Nov 16, 2023 · 1 comment
Assignees
Labels
Milestone

Comments

@chegel
Copy link

chegel commented Nov 16, 2023

Copy quote does not populate items product fields.

Expected Behavior

All quote items fields should be copied.

Current Behavior

When I make a copy of the quote fields such as item_product_id are not populated in the database for copied items. As result, fields such as $item->product_sku are not available in pdf templates in copied quotes.

Screenshots

item_product_id are null after quote with id 554 was copied, 563 was created as result:
null-fields

how it should be:
fixed

Possible Solution

I suggest adding item_product_id, item_discount_amount, item_product_unit and item_product_unit_id to the copy_quote function.

Steps to Reproduce

  1. create a quote
  2. copy the quote
  3. check ip_quote_items table

Context (Environment)

IP 1.6.0, nginx, Ubuntu 22.04

Detailed Description

I suggest to add missing fields to the copy_quote function.

Possible Implementation

Add item_product_id, item_discount_amount, item_product_unit and item_product_unit_id to the copy_quote function:

    public function copy_quote($source_id, $target_id)
    {
        $this->load->model('quotes/mdl_quote_items');

        $quote_items = $this->mdl_quote_items->where('quote_id', $source_id)->get()->result();

        foreach ($quote_items as $quote_item) {
            $db_array = array(
                'quote_id' => $target_id,
                'item_tax_rate_id' => $quote_item->item_tax_rate_id,
                'item_product_id' => $quote_item->item_product_id,
                'item_name' => $quote_item->item_name,
                'item_description' => $quote_item->item_description,
                'item_quantity' => $quote_item->item_quantity,
                'item_price' => $quote_item->item_price,
                'item_discount_amount' => $quote_item->item_discount_amount,
                'item_order' => $quote_item->item_order,
                'item_product_unit' => $quote_item->item_product_unit,
                'item_product_unit_id' => $quote_item->item_product_unit_id,
            );
      ....
    }

Failure Logs

@nielsdrost7 nielsdrost7 self-assigned this Nov 17, 2023
@nielsdrost7
Copy link
Contributor

nielsdrost7 commented Nov 17, 2023

Thanks for the extensive bug report, man!
Keep'em coming.
I'll take a look at the solution as soon as I can

@nielsdrost7 nielsdrost7 added this to the 1.6.2 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants