diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a72617a3cd1..38c8dda9922 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1814,8 +1814,9 @@ abstract class CommonDocGenerator // Reset enabled: only printable attribute determines PDF visibility $enabled = 0; $disableOnEmpty = 0; + $printable = 0; if (!empty($extrafields->attributes[$object->table_element]['printable'][$key])) { - $printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]); + $printable = (int) $extrafields->attributes[$object->table_element]['printable'][$key]; if (in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty'])) { $enabled = 1; } @@ -1825,11 +1826,7 @@ abstract class CommonDocGenerator } } - if (empty($extrafields->attributes[$object->table_element]['printable'][$key])) { - continue; - } - - if (empty($enabled)) { + if (empty($enabled) || empty($printable)) { continue; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 40f38a494ef..12b2a261d5d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8076,7 +8076,11 @@ abstract class CommonObject } if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList .= ', '.$parentField; + if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) { + $keyList .= ', main.'.$parentField; + } else { + $keyList .= ', '.$parentField; + } } $filter_categorie = false; @@ -8309,10 +8313,6 @@ abstract class CommonObject $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); - if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { - list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList .= ', '.$parentField; - } if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { if (strpos($InfoFieldList[4], 'extra.') !== false) { $keyList = 'main.'.$InfoFieldList[2].' as rowid'; @@ -8320,6 +8320,14 @@ abstract class CommonObject $keyList = $InfoFieldList[2].' as rowid'; } } + if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { + list($parentName, $parentField) = explode('|', $InfoFieldList[3]); + if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) { + $keyList .= ', main.'.$parentField; + } else { + $keyList .= ', '.$parentField; + } + } $filter_categorie = false; if (count($InfoFieldList) > 5) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index cfd1d04e4d9..dff75e94746 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1809,10 +1809,6 @@ class ExtraFields $parentField = ''; $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); - if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { - list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList .= ', '.$parentField; - } if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { if (strpos($InfoFieldList[4], 'extra.') !== false) { $keyList = 'main.'.$InfoFieldList[2].' as rowid'; @@ -1820,6 +1816,14 @@ class ExtraFields $keyList = $InfoFieldList[2].' as rowid'; } } + if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { + list($parentName, $parentField) = explode('|', $InfoFieldList[3]); + if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) { + $keyList .= ', main.'.$parentField; + } else { + $keyList .= ', '.$parentField; + } + } $InfoFieldList[5] = (string) $InfoFieldList[5]; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 940310af752..37f6715a727 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3050,9 +3050,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.(log|json)$/', basename($original_file))); $original_file = $dolibarr_main_data_root.'/'.$original_file; } elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { - // Wrapping for doctemplates $accessallowed = $user->admin; - $original_file = $dolibarr_main_data_root.'/doctemplates/'.$original_file; + $relative_file = $original_file; + $ent = ($entity > 0 ? $entity : $conf->entity); + $path_with_entity = $dolibarr_main_data_root . '/' . $ent . '/doctemplates/' . $relative_file; + if ($ent > 1 && file_exists(dol_osencode($path_with_entity))) { + $original_file = $path_with_entity; + } else { + $original_file = $dolibarr_main_data_root . '/doctemplates/' . $relative_file; + } } elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { // Wrapping for doctemplates of websites $accessallowed = ($fuser->hasRight('website', 'write') && preg_match('/\.jpg$/i', basename($original_file))); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 40e630a8dfb..d2b4f04bc6f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -740,6 +740,11 @@ if ($action == 'create' || $action == 'presend') { print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); $formticket->trackid = ''; // TODO Use a unique key 'tic' to avoid conflict in upload file feature + + if (GETPOST("mode", "aZ09") == 'init' && empty($_POST)) { + $formticket->clear_attached_files(); + } + $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 223a0ebd03a..34b80b4cbb1 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -779,7 +779,7 @@ if ($projectid) { print ''; } -$url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : ''); +$url = DOL_URL_ROOT.'/ticket/card.php?action=create&mode=init'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : ''); if (!empty($socid)) { $url .= '&socid='.$socid; } diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index a46885296be..9323f25845f 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -616,7 +616,11 @@ class FormWebPortal extends Form } if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { list($parentName, $parentField) = explode('|', $InfoFieldList[3]); - $keyList .= ', ' . $parentField; + if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) { + $keyList .= ', main.'.$parentField; + } else { + $keyList .= ', '.$parentField; + } } $filter_categorie = false;