Commit graph

812 commits

Author SHA1 Message Date
VIAL-GOUTEYRON Quentin
2d44fdf49c
CLOSE #29244 Feature to merge contacts (#39512)
Add the ability to merge two contacts, the same way third parties and members
can already be merged. The merged contact is absorbed by the current one, all
its satellite data is moved, then it is deleted.

Contact::mergeContact() orchestrates everything in a single transaction, using
the new CommonObject::commonReplaceContact() helper and the replaceContact()
static methods of Contact, ActionComm and User. A replaceContact hook lets the
external modules move their own data. No schema change, no migration.

Three specific traps of this table are handled:
- llx_element_contact.fk_socpeople references llx_socpeople only when
  c_type_contact.source is 'external', and llx_user when it is 'internal', so
  both queries filter on it. Without that filter the internal assignments of
  the users would silently be moved to the merged contact.
- Contact::updateRoles(), called by update(), deletes then reinserts every
  societe_contacts row of the contact from $this->roles. It is neutralised by
  setting roles to null, and update() is called before the links are moved.
- Every table having a unique index on the contact id is deduplicated before
  its update, so the update cannot violate it. $ignoreerrors is never used:
  the FIXME of commonReplaceThirdparty() documents the links it loses.

The files are moved after the commit and not before, unlike mergeCompany() and
mergeMembers(): a failure after the move leaves them with the database rolled
back but the files already gone. A name collision renames the file instead of
losing it, and a failure is reported to the user instead of being ignored.

Access guards live in the class and not in the page, so the REST API, the
scheduled jobs and the modules benefit from them too. They cover both contacts,
fetch() by rowid applying neither an entity nor a permission filter: entity,
private contact of another user, external user, sales representative perimeter,
absorbing a shared contact into a private one, and a contact linked to a user
account (moving llx_user.fk_socpeople would let the email of that user be
rewritten from the contact card, so it requires the permission to create users).

Form::select_contact() gets a one line fix on the way: it accepts a $filter
parameter, documents it, forwards it to the ajax branch, but dropped it when
building the combo, so the merge popup could not exclude the current contact.

Known limitations, out of the scope of this pull request: merging contacts of
different entities is refused, Contact::update() neither writes url, no_email,
fk_parent nor import_key while its $nosyncuser parameter is declared but never
read, and with CONTACT_USE_SEARCH_TO_SELECT set the current contact is still
offered in the popup, contact/ajax/contact.php overwriting the filter it gets.
2026-08-19 02:26:34 +02:00
MDW
6dac0c7263
Qual: Fix 'SqlInjection' notices (#39203)
# Qual: Fix 'SqlInjection' notices

Batch of 25 files with changes to fix 'SqlInjection' Notices
2026-07-19 15:53:14 +02:00
Laurent Destailleur
9b3bebcd5e Automated merge from 23.0 to develop 2026-06-19 03:59:57 +02:00
w3houde
07644d7f49
Fix #34852 keep events without thirdparty visible to non-extended users (#38832)
When a user lacks 'societe / client / voir', the agenda list / index /
pertype / peruser / API endpoints and ActionComm::load_board_userid_v2 SQL
add an EXISTS sub-query to filter on societe_commerciaux. The clause was
written without a guard on a.fk_soc IS NULL, so any event not attached
to a thirdparty (the common case for personal reminders or internal-only
events) was silently excluded - even when the event was assigned to the
user himself.

Wrap the EXISTS / NOT EXISTS branches with 'a.fk_soc IS NULL OR ...' so
events without a thirdparty stay visible regardless of the sale-rep
filter. Matches eldy's stated semantics on the issue: event permission
depends on the assignee, not on the linked thirdparty.

Touches the five list paths plus the API agendaevents endpoint.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-17 03:09:21 +02:00
Laurent Destailleur
dc3f3e15e8 Merge 2026-06-12 19:25:23 +02:00
w3houde
7faaa8aba8
Fix #35421 persist fk_task on actioncomm create/update/fetch (#38709)
ActionComm::create()'s INSERT and ActionComm::update()'s UPDATE both
omitted the fk_task column, so the value posted via /agendaevents or
the manual create-event form was silently dropped. The fetch() SELECT
was also missing the column, so even if it had been written it would
not have been loaded back.

Add fk_task to all three SQL statements and assign it from the row in
fetch(), matching the existing pattern for fk_user_action / fk_contact.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 00:07:56 +02:00
Laurent Destailleur
5fbb3cee1d Add missing url into RSS of agenda event 2026-04-28 23:47:13 +02:00
Laurent Destailleur
b07051116b Fix use a better uid in agenda RSS 2026-04-28 23:33:42 +02:00
Laurent Destailleur
0c661b173d Clean code 2026-04-14 19:23:50 +02:00
Laurent Destailleur
4df92d0e78 CI 2026-04-12 13:23:58 +02:00
Laurent Destailleur
386883408d Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop 2026-03-23 23:59:02 +01:00
Laurent Destailleur
a06b14b7dc FIX #GHSA-v5fq-cf5m-vwv7 - Credit Grzegorz Tworek, Sec4check
(grzegorz.tworek@sec4check.pl)
2026-03-23 23:48:30 +01:00
Laurent Destailleur
3dfce11ae8 Merge 2026-03-05 00:42:13 +01:00
Laurent Destailleur
1650d96091 FIX Pb with import of agendaevents. Date and import id not visible. 2026-03-04 16:52:48 +01:00
Laurent Destailleur
cf0ab8d300 Fix label of type 2026-03-04 12:51:56 +01:00
David Beniamine
a2397ff88b
Improve user card performance by avoid mysql OR (#37125)
* Improve user card performance by avoid mysql OR

* Negate first condition to avoid duplicates in UNION

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-02-24 19:27:40 +01:00
Laurent Destailleur
012c1fb078 Debug v23 - sql request for list of actioncomm must not use a OR 2026-02-07 20:07:09 +01:00
spsolauv
ac36cda432
ActionComm clone also categories when cloning object (#36761)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-01-06 00:04:59 +01:00
Frédéric FRANCE
a43e7ae58c
clean phpdoc (#36342)
* clean phpdoc

* Update actioncomm.class.php
2025-11-20 16:24:38 +01:00
Frédéric FRANCE
29b3880e6c
add dolBuildUrl (#35664)
* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

* clean baseline

* add dolBuildUrl

* add dolBuildUrl

* add dolBuildUrl

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-17 02:31:07 +02:00
ldestailleur
2da06f9fb1 Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into develop 2025-10-06 01:37:53 +02:00
kkhelifa-opendsi
404ad0e876
FIX: substitutions on subject of the sent email reminder of the event (#35621) 2025-10-03 19:01:10 +02:00
Frédéric FRANCE
f5dab1a3b6
clean code (#35535)
* clean code

* clean code

* clean code

* clean code

* clean code
2025-09-28 22:27:15 +02:00
ldestailleur
a43bf46a75 Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into develop 2025-09-26 01:27:00 +02:00
ldestailleur
13cdc20266 Fix warning 2025-09-26 01:12:30 +02:00
ldestailleur
20875dead9 Use fields into the list of events 2025-09-24 12:01:52 +02:00
ldestailleur
16a7431168 Add fields for actioncomm to fix #35422 2025-09-24 11:13:24 +02:00
ldestailleur
daa98872eb Fix trans 2025-09-19 16:09:43 +02:00
Frédéric FRANCE
1b83c39cc0
NEW Add sms reminder in reminder of agenda events (#35239)
* add reminder by sms

* fix url dolistore

* add cron task to send sms reminder

* add cron task to send sms reminder

* add cron task to send sms reminder

* add cron task to send sms reminder

* Update sms.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-09-05 15:38:15 +02:00
Frédéric FRANCE
6f763f4d16
add value to make update of object easier (#35222) 2025-09-04 14:28:26 +02:00
Frédéric FRANCE
cc03c92614
fix update resource (#35015)
* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource

* fix update resource
2025-08-20 19:02:08 +02:00
ldestailleur
2d848e5512 Parameters $maxlen and $notooltip of Contract have been inverted to
follow the standard.
2025-08-17 02:20:52 +02:00
kkhelifa-opendsi
e85e15b4fd
FIX - The test for fetch the third party is not necessary because the thirdparty is not required on a event and it's not required for send the reminder by email to the user. (#34731)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-08-07 16:22:35 +02:00
ldestailleur
4274c8102e Fix missing update of replyto 2025-07-22 01:54:25 +02:00
ldestailleur
453c0bff06 Fix missing update of replyto 2025-07-22 01:54:01 +02:00
ldestailleur
c02a9d816b Debug v22 2025-06-23 00:04:20 +02:00
ldestailleur
1c3687b292 Fix CI 2025-06-21 16:50:14 +02:00
ldestailleur
dc641d7380 Debug v22 2025-06-21 15:29:54 +02:00
ldestailleur
5df59e1e3f Debug v22 2025-06-10 17:29:16 +02:00
ldestailleur
36b00c5951 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into develop 2025-06-02 14:59:18 +02:00
atm-irvine
de4990a0fd
Fix fatal error by validating array key type before using in empty() (#34295) 2025-05-27 16:04:25 +02:00
ldestailleur
c675f7439c Fix title of event no more visible 2025-04-26 04:05:01 +02:00
ldestailleur
9a54786884 Factorize code for tooltip of actioncomm 2025-04-03 14:23:16 +02:00
ldestailleur
10c0fba6b0 WIP Recurring events 2025-04-03 13:59:46 +02:00
MDW
d64298f6c1
Qual: Fix phan notices (htdocs/compta) (#33427) 2025-03-12 20:41:50 +01:00
ldestailleur
9276042264 Fix CI 2025-03-06 11:34:27 +01:00
ldestailleur
d20e730c66 Clean code 2025-03-06 04:56:54 +01:00
Frédéric FRANCE
af93e6d39f
fix ajax tooltip 2025-03-04 16:20:30 +01:00
Laurent Destailleur (aka Eldy)
0932c2e492 Debug v21 2025-01-24 17:28:10 +01:00
Frédéric FRANCE
0c9fd6714b
remove debug 2025-01-22 08:50:53 +01:00