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

Can not update recurrent supplier invoice as suggested in UI. #31788

Open
mdeweerd opened this issue Nov 13, 2024 · 0 comments
Open

Can not update recurrent supplier invoice as suggested in UI. #31788

mdeweerd opened this issue Nov 13, 2024 · 0 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@mdeweerd
Copy link
Contributor

Bug

Got error 500:

[Wed Nov 13 01:04:11.212888 2024] [php:error] [pid 568638:tid 568638] [client 192.168.0.254:5351] PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string / int in /home/www/REDACTED/dolibarr19/htdocs/fourn/facture/card-rec.php:804\nStack trace:\n#0 {main}\n  thrown in /home/www/REDACTED/dolibarr19/htdocs/fourn/facture/card-rec.php on line 804, referer: https://REDACTED/

For line

                        if (((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight("produit", "ignore_price_min_advance")) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) && $price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min))) {

This is fixed in the dev version 21.

After adding casts to the line, the http error is gone, but when I try to update the value for the recurrent supplier invoice line, it is not updated.

fourn/facture/card-rec.php?id=1
POST
action=updateline&mode=&id=1&lineid=1&type=1&special_code=0&fk_parent_line=&productid=75&product_desc=&date_start_fill=0&date_end_fill=0&fourn_ref=&fournprice=&tva_tx=0&price_ht=70%2C51&qty=1&remise_percent=&save=Enregistrer

The original price for the line is 75.51 .

No error is shown nor logged.

$object->updateline() is called with the updated price, and returns 0.

FactureFournisseurRec::updateline facid=1 rowid=1, desc=, pu_ht=70.51, qty=1, txtva=0, txlocaltax1=0, txlocaltax2=0, fk_product=75, remise_percent=, info_bits=0, price_base_type=HT, pu_ttc=0, type=1, fk_unit=, pu_ht_devise=0

The line is not updated because updateline requires that the status is SUSPENDED and the status of the recurring invoice is NULL.

IMHO, either the UI should not propose to edit the lines, or the recurrent invoice model should be effectively editable (the latter is more logical - it allows updating a recurrent supplier invoice without deactivating it).

In updateline, to bypass the issue, I updated the test to:

      if ($this->status == null || $this->status == self::STATUS_SUSPENDED) {

Dolibarr Version

19.0.2

Environment PHP

8.2.20

Environment Database

No response

Steps to reproduce the behavior and expected behavior

No response

Attached files

No response

@mdeweerd mdeweerd added the Bug This is a bug (something does not work as expected) label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

1 participant