Change fk_unit service lines management

This commit is contained in:
atm-lena
2022-07-20 15:38:37 +02:00
parent cc5a5e40d9
commit 7f1a17bcc9
10 changed files with 41 additions and 29 deletions

View File

@@ -8504,10 +8504,11 @@ function dol_osencode($str)
* @param string $fieldkey Field to search the key into
* @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @param string $filters Filter on other fields
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0)
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = array())
{
global $cache_codes;
@@ -8529,6 +8530,9 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
if (!empty($entityfilter)) {
$sql .= " AND entity IN (".getEntity($tablename).")";
}
if ($filters) {
$sql .= $filters;
}
$resql = $db->query($sql);
if ($resql) {