2
0
forked from Wavyzz/dolibarr

6 Commits

Author SHA1 Message Date
Frédéric FRANCE
51034c05f9 clean code (#34966) 2025-08-15 17:31:07 +02:00
Frédéric FRANCE
944cc36b9c clean code (#34886)
* clean code

* clean code

* clean code

* clean code

* clean code

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-08-06 22:01:32 +02:00
ldestailleur
5599b72603 Fix CI 2025-08-06 20:44:25 +02:00
ldestailleur
bd999c21a2 Fix CI 2025-08-06 19:49:31 +02:00
ldestailleur
d03af36d95 Fix use of const trigger to avoid compatibility pb in future. 2025-08-06 19:08:01 +02:00
Jon Bendtsen
772337d162 redoing PR Api objectlinks #33738 (#33781)
* redoing PR Api objectlinks #33738

* loading objectlinks api from main api folder

* bringing $FIELDS up to develop branch standard

* trying to tell phan the expected array types

* phan return and input type specifications

* trying to fix 'Method ObjectLink::_makeobject() should return int but return statement is missing.'

* trying to return an ObjecTLink

* get returns an ObjectLink object

* making sure that function _makeobject always has an return

* making sure deleteByValues always has a return statement

* remove empty line

* making sure getByValues always has a return value

* trying to fix phan for _validate

* no < around objectlink

* trying to fix some phan and phan-stan errors

* public variable target should be fk_target

* making TRIGGER_PREFIX more like in core/class/commonobject.class.php

* trying to save and use the notrigger value

* typecast objectlink fk_source and fk_target to string in the hope that they are later made correctly to int

* whitespace to trigger a build of my branch

* back to being int - because that is what they are

* trying to typecast

* trying to help PHPStan to validate fk_source and fk_target

* trying to use  the same way as  are used

* splitting  over multiple lines

* Fix: update ObjectLink return type in API methods

### FIX: Update ObjectLink return type in API methods

- Updated the return type of several methods from `ObjectLink` to `Object` to reflect a return type compatible with Luracast/Restler

* fix: refactor field setting in ObjectLinks class

# Fix: Refactor field setting in ObjectLinks class

- Removed the static `$INTFIELDS` array and moved its logic to a new private
method `_setObjectLinkField`.
- Updated `create`, `getByValues`, and `deleteByValues` methods to use
`_setObjectLinkField` for setting fields.
- Cleaned up the code by removing redundant field validation and type casting
logic.

* noting that relation type can both be string and null

* escaping strings before parsing them to the database

* -> not global

* trying to fix phpstan errors by flipping so the string part is first

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: MDW <mdeweerd@users.noreply.github.com>
2025-04-16 14:49:39 +02:00