Commit Graph

1 Commits

Author SHA1 Message Date
Alexandre Janniaux
9fe9eee18a FIX|Fix some minor issues on Reception and add a new test for it (#26310)
* reception: reOpen: mirror $this->statut in $this->status

$this->statut is the deprecated variable, $this->status should also get
the correct value.

* reception: setDraft: mirror $this->statut in $this->status

$this->statut is the deprecated variable, $this->status should also get
the correct value.

* reception: add missing $weight field

Fix warning:

    Undefined property: Reception::$weight

* societe: add country_id field

* reception: use getDolGlobalInt when suitable

Using empty() implies that the value actually exists on the stdClass at
$conf->global, but it's not always the case. getDolGlobalInt will handle
this smoothly by checking first, which solves warnings like those:

    Undefined property: stdClass::$STOCK_CALCULATE_ON_RECEPTION

* ReceptionTest: add new test

The test checks the usual workflow of the Reception class, with, on the
one hand, the common CRUD operations:
 - create
 - fetch
 - update
 - delete

And on the other hand, the status handling for Reception:
 - valid: STATUS_DRAFT -> STATUS_VALID
 - setClosed: STATUS_VALID -> STATUS_CLOSED
 - reOpen: STATUS_CLOSED -> STATUS_VALID
 - setDraft: STATUS_VALID -> STATUS_DRAFT

The stocks lines are not tested yet, and the error cases, like any other
transition not described above, are not tested either. The permissions
for some of the operations are hardcoded for the test and there is no
failure check when the permission is not set yet.
2023-10-21 16:28:30 +02:00