';
else
{
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 224a3a65cc9..2137fa76e04 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1002,6 +1002,7 @@ class Categorie extends CommonObject
// phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE fk_parent = ".$this->id;
+ $sql .= " AND entity IN (".getEntity('category').")";
$res = $this->db->query($sql);
if ($res)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5bd45655f69..3d6c28f7536 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6962,7 +6962,7 @@ abstract class CommonObject
* This function is responsible to output the
and
according to correct number of columns received into $params['colspan']
*
* @param Extrafields $extrafields Extrafield Object
- * @param string $mode Show output (view) or input (edit) for extrafield
+ * @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
@@ -7010,7 +7010,8 @@ abstract class CommonObject
$perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1);
}
- if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
+ if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
+ elseif (($mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3 && abs($visibility) != 4) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
elseif ($mode == 'view' && empty($visibility)) continue;
if (empty($perms)) continue;
// Load language if required
@@ -7038,9 +7039,10 @@ abstract class CommonObject
case "view":
$value = $this->array_options["options_".$key.$keysuffix];
break;
- case "edit":
- $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
- // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
+ case "create":
+ case "edit":
+ $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
+ // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
{
if (is_array($getposttemp)) {
@@ -7144,7 +7146,8 @@ abstract class CommonObject
case "view":
$out .= $extrafields->showOutputField($key, $value);
break;
- case "edit":
+ case "create":
+ case "edit":
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
break;
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 20c723ba8a2..f688880b789 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1508,10 +1508,10 @@ class FormFile
if (!empty($addfilterfields))
{
print '
';
- print '
';
- print '
';
- print '
';
- print '
';
+ print '
';
+ print '
';
+ print '
';
+ print '
';
// Action column
print '
';
$searchpicto = $form->showFilterButtons();
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index ecf137adb04..a48cf36c117 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -127,7 +127,7 @@ class FormTicket
* @param int $withdolfichehead With dol_fiche_head
* @return void
*/
- public function showForm($withdolfichehead = 0)
+ public function showForm($withdolfichehead = 0, $mode = 'edit')
{
global $conf, $langs, $user, $hookmanager;
@@ -414,7 +414,7 @@ class FormTicket
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
- print $ticketstat->showOptionals($extrafields, 'edit');
+ print $ticketstat->showOptionals($extrafields, 'create');
}
print '';
diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php
index 45ca9a29197..53cbe3d99cf 100644
--- a/htdocs/core/tpl/extrafields_add.tpl.php
+++ b/htdocs/core/tpl/extrafields_add.tpl.php
@@ -45,7 +45,7 @@ if (empty($reshook)) {
$params = array();
if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
$params['cols'] = $parameters['colspanvalue'];
- print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params
+ print $object->showOptionals($extrafields, 'create', $params);
}
?>
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 1ef3ef07255..e6cbad245d9 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].' '."\n";
if (empty($enabled)) continue; // 0 = Never visible field
- if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
+ if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5 && abs($enabled) != 4) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list <> 4 = not visible at the creation
if (empty($perms)) continue; // 0 = Not visible
// Load language if required
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
index f621d332003..242ad38c077 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php
@@ -98,10 +98,10 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
*/
public function getExample()
{
- global $conf, $langs, $mysoc;
+ global $conf, $db, $langs, $mysoc;
- $object = new MyObject($this->db);
- $object->initAsSpecimen();
+ $object = new MyObject($db);
+ $object->initAsSpecimen();
/*$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index b2cab72a0a1..41b00fb85ef 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1280,7 +1280,13 @@ else
// Accountancy_code_buy
print '