Files
dolibarr/test/phpunit
Alexandre Janniaux c3b3840f08 QUAL Refactor merging companies and fix #26272 with Reception objects (#26320)
* societe: add missing model_pdf field

The field is used by the class but wasn't declared.

* societe: expose Societe::mergeCompany

The code is directly copied from societe/card.php with as less changes
as possible.

The original code came from deb91ad7c1.

* societe: remove fields from property copy

$phone_pro and $fk_project are not existing for societe. This was added
from deb91ad7c1.

* SocieteTest: test the merge functionality

This test is a simple smoke test to check that the mergeCompany() will
work correctly on simple case and actually merge the details of the
company.

More complex deduplication pattern with objects referencing the deleted
Societe object, will be written for each of the different object class
in their respective test file.

* societe: card: use the new mergeCompany function

Since the code is almost the same, there should be no differences in
behaviour right now.

* societe: api_thirdparties: use Societe::mergeCompany()

* societe: fix issue when merging companies

When a Societe object is merged against another, its related objects are
supposed to reference the new Societe object so that the databse doesn't
raise foreign key errors.

The list references the objects that need to be transformed, and
Reception objects weren't part of this list.

Fix #26272

* ReceptionTest: check company merge hook

Before a Societe object is destroyed from the database, every object
referencing the FK should be destroyed or should reference another
object.

In the case of two companies being merged, the case arises and Reception
objects need to be moved to the new company. This commit brings a
non-regression test for this case.

Refs #26272

* Update societe.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2023-10-26 16:30:38 +02:00
..
2023-09-10 19:41:14 +02:00
2023-09-09 21:16:58 +02:00
2023-10-20 03:59:02 +02:00
2023-08-06 01:41:53 +02:00
2023-10-17 15:48:38 +02:00
2023-09-29 17:04:11 +02:00
2020-09-18 03:07:13 +02:00
2023-09-10 19:41:14 +02:00
2023-08-12 01:08:04 +02:00
2023-06-04 19:46:44 +02:00
2023-08-04 17:26:38 +02:00
2023-08-26 00:43:51 +02:00
2023-08-26 00:43:51 +02:00
2023-08-26 00:43:51 +02:00
2023-09-10 15:23:32 +02:00
2023-09-05 00:49:01 +02:00