Topic: Supplier Description is overwritten

Items and Inventory -> Items -> Purchase Pricing

On every "Purchase Order Delivery" action the "Supplier's Code or Description" is overwritten with the product name in the "General Settings" tab.

Here is the fix:

purchasing/includes/purchasing_db.inc

Line 113

    if ($description != "")
        $sql .= ",supplier_description=".db_escape($description);
    $sql .= " WHERE stock_id=".db_escape($stock_id)." AND supplier_id=".db_escape($supplier_id);

should be:

    if ($description = "")
        $sql .= ",supplier_description=".db_escape($description);
    $sql .= " WHERE stock_id=".db_escape($stock_id)." AND supplier_id=".db_escape($supplier_id);

Re: Supplier Description is overwritten

Hello @ckrosco

The only place the supplier's code or Description is shown is on the written purchase order. On all other places we are using our own name due to internal confusion otherwise.

So this is not a bug. The only person(s) that need to know the suppliers code is the suppler himself. Right?

Joe

Re: Supplier Description is overwritten

@ckrosco: If you still want t, then your code should be checked:

if ($description = "")

is an assignment but it should be

if ($description == "")

which is a comparison.

4 (edited by ckrosco 04/18/2023 05:51:33 pm)

Re: Supplier Description is overwritten

The only person(s) that need to know the suppliers code is the suppler himself. Right?

Right. But the supplier code is changed to $description everytime the supply order is processed (purchase order entry -> receive purchase order items -> enter supplier invoice)

Please see the attached screen shots. I created a product called "General Settings name"  with the suppliers description = "supplier's code"

After processing the order, the suppliers description becomes "General Settings name".

Post's attachments

fapurchase2.jpeg 27.6 kb, 12 downloads since 2023-04-18 

You don't have the permssions to download the attachments of this post.

5 (edited by ckrosco 04/18/2023 05:38:39 pm)

Re: Supplier Description is overwritten

I don't see a way to add two photos, so here is the second screen shot after processing the order.

Post's attachments

fapurchase5.jpeg 33.3 kb, 9 downloads since 2023-04-18 

You don't have the permssions to download the attachments of this post.

Re: Supplier Description is overwritten

And another really irritating change that happens during this order process is that the purchase price is truncated to the default number of decimal points.

I put the price in at 2.569879 but after processing the order it becomes 2.57 - which is wrong.

These names and prices were put in randomly. In my actual business I have several products that I buy in lots of 42. The per item price is e.g. 13.6904761905 X 42 = 575

When the price is truncated I get a decimal amount, and the supplier's currency does not use decimals.

Re: Supplier Description is overwritten

apmuthu wrote:

@ckrosco: If you still want t, then your code should be checked:

if ($description = "")

is an assignment but it should be

if ($description == "")

which is a comparison.

Thanks - that's good to know. (non-programmer here)

Re: Supplier Description is overwritten

ckrosco wrote:
apmuthu wrote:

@ckrosco: If you still want t, then your code should be checked:


Thanks - that's good to know. (non-programmer here)

So I just tried it with == but then the suppliers description becomes blank. If I just use one = the suppliers description remains intact.

Re: Supplier Description is overwritten

As I mentioned above, I am not a programmer. But these changes are solving my problems:

purchasing/includes/purchasing_db.inc

line 113

if ($description = "")

line 109

$price = round($price * $data['conversion_factor'], 6);

Trouble is I have to remember to make these changes every time I upgrade.

FrontAccounting is great! These little hitches cause me grief, but at least I can mess with the code.

But if my messing is going to break something, please let me know!

Re: Supplier Description is overwritten

@ckrosco
The supplier_code should only be updateded if there is no data for supplier price record. So this has been changed and committed.
Please replace the file on your server.

Regarding the price truncation, I will have a closer look into this.

Joe

Post's attachments

purchasing_db.inc 8.8 kb, 1 downloads since 2023-04-19 

You don't have the permssions to download the attachments of this post.

Re: Supplier Description is overwritten

Hello again,

@ckrosco
I understand your problem with the price decimals. We could simply remove the rounding and only calculate the $price = $price * $data['conversion_factor']. This lets you decide how many decimals the $price should be in. Or as you showed, 6 decimals. What do you think?

Joe

Re: Supplier Description is overwritten

The description problem still exists.  Once a PO is cut, the ENTIRE PO should remain as it was when it was cut unless it is later intentionally edited.  If the price is changed later for the item for that supplier, we do not go back and change the price in the PO that was already cut.  That being said, then why go back and change the description in an existing PO?  Once the description is set for an item in a PO, LIKE the price it should remain as it was set when cut UNLESS it is deliberately edited.

As far as the pricing goes, I would recommend removing the rounding.

13 (edited by poncho1234 04/26/2023 01:46:53 pm)

Re: Supplier Description is overwritten

Related topic with some additional info that may be helpful:-

https://frontaccounting.com/punbb/viewtopic.php?id=8318

Joe's post #13 is particularly pertinent.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Supplier Description is overwritten

These items has now been fixed and committed to stable repo.

See forum topic https://frontaccounting.com/punbb/viewt … p?id=10276

Joe

Re: Supplier Description is overwritten

Once the description is set for an item in a PO, LIKE the price it should remain as it was set when cut, just if it is deliberately edited.