diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 91d5b29dce6..c7e57641c29 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -46,7 +46,11 @@ if ($action == 'add' && ! empty($permissiontoadd))
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
- $object->$key=GETPOST($key,'alpha');
+ $value = GETPOST($key,'alpha');
+ if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
+ if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
+
+ $object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
@@ -85,7 +89,11 @@ if ($action == 'update' && ! empty($permissiontoadd))
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
- $object->$key=GETPOST($key,'alpha');
+ $value = GETPOST($key,'alpha');
+ if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
+ if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
+
+ $object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 2c637872e8d..dfa0baf4e8b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5159,7 +5159,8 @@ abstract class CommonObject
elseif ($type == 'link')
{
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
- $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, (($val['notnull'] == 1)?0:1));
+ $showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1);
+ $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
}
elseif ($type == 'password')
{
@@ -5706,6 +5707,8 @@ abstract class CommonObject
*/
public function createCommon(User $user, $notrigger = false)
{
+ global $langs;
+
$error = 0;
$now=dol_now();
@@ -5718,10 +5721,27 @@ abstract class CommonObject
$keys=array();
$values = array();
foreach ($fieldvalues as $k => $v) {
- $keys[] = $k;
- $values[] = $this->quote($v, $this->fields[$k]);
+ $keys[$k] = $k;
+ $value = $this->fields[$k];
+ $values[$k] = $this->quote($v, $value);
}
+ // Clean and check mandatory
+ foreach($keys as $key)
+ {
+ if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key]=''; // This is an implicit foreign key field
+ if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]=''; // This is an explicit foreign key field
+
+ //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
+ if ($this->fields[$key]['notnull'] == 1 && empty($values[$key]))
+ {
+ $error++;
+ $this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
+ }
+ }
+
+ if ($error) return -1;
+
$this->db->begin();
if (! $error)
@@ -5815,6 +5835,8 @@ abstract class CommonObject
*/
public function updateCommon(User $user, $notrigger = false)
{
+ global $langs;
+
$error = 0;
$fieldvalues = $this->set_save_query();
@@ -5835,6 +5857,21 @@ abstract class CommonObject
}
$tmp[] = $k.'='.$this->quote($v, $this->fields[$k]);
}
+
+ // Clean and check mandatory
+ foreach($keys as $key)
+ {
+ if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key]=''; // This is an implicit foreign key field
+ if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]=''; // This is an explicit foreign key field
+
+ //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
+ if ($this->fields[$key]['notnull'] == 1 && empty($values[$key]))
+ {
+ $error++;
+ $this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
+ }
+ }
+
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ;
$this->db->begin();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b3bd62fcf59..e95f43e3283 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5153,7 +5153,7 @@ class Form
dol_include_once($classpath);
if ($classname && class_exists($classname))
{
- $objecttmp = new $classname($db);
+ $objecttmp = new $classname($this->db);
}
}
if (! is_object($objecttmp))
diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php
new file mode 100644
index 00000000000..e89c118c6f9
--- /dev/null
+++ b/htdocs/core/tpl/commonfields_add.tpl.php
@@ -0,0 +1,51 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $action
+ * $conf
+ * $langs
+ */
+?>
+
+fields as $key => $val)
+{
+ if (abs($val['visible']) != 1) continue; // Discard such field from form
+ if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
+
+ print '
';
+}
+
+?>
+
\ No newline at end of file
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
new file mode 100644
index 00000000000..eeb8a761896
--- /dev/null
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -0,0 +1,60 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $action
+ * $conf
+ * $langs
+ */
+?>
+
+fields as $key => $val)
+{
+ if (abs($val['visible']) != 1) continue; // Discard such field from form
+ if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
+
+ print '
';
+}
+
+?>
+
\ No newline at end of file
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index 813938951a1..af72b13a245 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -178,6 +178,8 @@ CREATE TABLE llx_websiteaccount(
login varchar(64) NOT NULL,
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password
+ fk_soc integer,
+ fk_website integer,
date_last_login datetime,
date_previous_login datetime,
date_creation datetime NOT NULL,
@@ -185,8 +187,7 @@ CREATE TABLE llx_websiteaccount(
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
- status integer,
- fk_soc integer
+ status integer
) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_websiteaccount.key.sql b/htdocs/install/mysql/tables/llx_websiteaccount.key.sql
index 1ebab80b361..463218b04cd 100644
--- a/htdocs/install/mysql/tables/llx_websiteaccount.key.sql
+++ b/htdocs/install/mysql/tables/llx_websiteaccount.key.sql
@@ -17,10 +17,12 @@
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_rowid (rowid);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_login (login);
-ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_import_key (import_key);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_status (status);
+ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_website (fk_website);
ALTER TABLE llx_websiteaccount ADD INDEX idx_websiteaccount_fk_soc (fk_soc);
-- END MODULEBUILDER INDEXES
+ALTER TABLE llx_websiteaccount ADD UNIQUE INDEX uk_websiteaccount_login_website_soc(login, fk_website, fk_soc);
+
--ALTER TABLE llx_websiteaccount ADD CONSTRAINT llx_websiteaccount_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
diff --git a/htdocs/install/mysql/tables/llx_websiteaccount.sql b/htdocs/install/mysql/tables/llx_websiteaccount.sql
index cc88c2ece3a..838fc170595 100644
--- a/htdocs/install/mysql/tables/llx_websiteaccount.sql
+++ b/htdocs/install/mysql/tables/llx_websiteaccount.sql
@@ -20,6 +20,8 @@ CREATE TABLE llx_websiteaccount(
login varchar(64) NOT NULL,
pass_crypted varchar(128),
pass_temp varchar(128), -- temporary password when asked for forget password
+ fk_soc integer,
+ fk_website integer,
date_last_login datetime,
date_previous_login datetime,
date_creation datetime NOT NULL,
@@ -27,7 +29,6 @@ CREATE TABLE llx_websiteaccount(
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
- status integer,
- fk_soc integer
+ status integer
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 987b599ee31..efb467e37b7 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -65,7 +65,7 @@ class MyObject extends CommonObject
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'help' is a string visible as a tooltip on field
- * 'comment' is not used. You can store here any text of your choice
+ * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'showoncombobox' if field must be shown into the label of combobox
*/
@@ -89,8 +89,8 @@ class MyObject extends CommonObject
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
- 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
- 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
+ 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
+ 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
);
public $rowid;
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index f7a059d54d5..76c5fd7dc16 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -172,40 +172,9 @@ if ($action == 'create')
dol_fiche_head(array(), '');
print '
'."\n";
- foreach($object->fields as $key => $val)
- {
- if (abs($val['visible']) != 1) continue; // Discard such field from form
- if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
- print '
';
- }
+ // Common attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
@@ -217,7 +186,7 @@ if ($action == 'create')
print '
';
print '';
print ' ';
- print ''; // Cancel for create doe not post form
+ print ''; // Cancel for create does not post form if we don't know the backtopage
print '
'."\n";
- foreach($object->fields as $key => $val)
- {
- if (abs($val['visible']) != 1) continue; // Discard such field from form
- if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
- print '
';
- }
+ // Common attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql
index 2b728128605..ef96d309224 100644
--- a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql
+++ b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql
@@ -15,8 +15,10 @@
-- BEGIN MODULEBUILDER INDEXES
-ALTER TABLE llx_myobject ADD UNIQUE INDEX idx_fieldobject (fieldobject);
+ALTER TABLE llx_myobject ADD INDEX idx_fieldobject (fieldobject);
-- END MODULEBUILDER INDEXES
+--ALTER TABLE llx_myobject ADD UNIQUE INDEX uk_myobject_fieldxyz(fieldx, fieldy);
+
--ALTER TABLE llx_myobject ADD CONSTRAINT llx_myobject_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index 11aedd037d9..6e7a74c45d9 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -231,7 +231,7 @@ dol_fiche_end();
$morehtmlcenter = '';
if (! empty($conf->website->enabled)) {
if (! empty($user->rights->societe->lire)) {
- $morehtmlcenter .= 'id).'">' . $langs->trans("AddWebsiteAccount") . '';
+ $morehtmlcenter .= 'id).'">' . $langs->trans("AddWebsiteAccount") . '';
} else {
$morehtmlcenter .= '' . $langs->trans("AddAction") . '';
}
@@ -259,6 +259,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."websiteaccount_extrafields as ef on (t.rowid = ef.fk_object)";
if ($objectwebsiteaccount->getIsmultientitymanaged() == 1) $sql.= " WHERE t.entity IN (".getEntity('websiteaccount').")";
else $sql.=" WHERE 1 = 1";
+$sql.=" AND fk_soc = ".$object->id;
foreach($search as $key => $val)
{
$mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
diff --git a/htdocs/website/class/websiteaccount.class.php b/htdocs/website/class/websiteaccount.class.php
index e07eef3deaf..b96f511cac3 100644
--- a/htdocs/website/class/websiteaccount.class.php
+++ b/htdocs/website/class/websiteaccount.class.php
@@ -56,18 +56,20 @@ class WebsiteAccount extends CommonObject
/**
- * 'type' if the field format.
- * 'label' the translation key.
- * 'enabled' is a condition when the field must be managed.
- * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
- * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
- * 'index' if we want an index in database.
- * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
- * 'position' is the sort order of field.
- * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
- * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
- * 'help' is a string visible as a tooltip on field
- * 'comment' is not used. You can store here any text of your choice.
+ * 'type' if the field format.
+ * 'label' the translation key.
+ * 'enabled' is a condition when the field must be managed.
+ * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
+ * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
+ * 'index' if we want an index in database.
+ * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
+ * 'position' is the sort order of field.
+ * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
+ * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
+ * 'help' is a string visible as a tooltip on field
+ * 'comment' is not used. You can store here any text of your choice. It is not used by application.
+ * 'default' is a default value for creation (can still be replaced by the global setup of default values)
+ * 'showoncombobox' if field must be shown into the label of combobox
*/
// BEGIN MODULEBUILDER PROPERTIES
@@ -77,8 +79,10 @@ class WebsiteAccount extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Login',),
- 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1,),
+ 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>30, 'notnull'=>-1,),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1),
+ 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>1, 'index'=>1),
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
@@ -89,7 +93,6 @@ class WebsiteAccount extends CommonObject
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'visible'=>-2, 'enabled'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'default'=>1, 'arrayofkeyval'=>array('1'=>'Active','0'=>'Disabled')),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>0,),
);
public $rowid;
public $login;
diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php
index 6e15430802a..abdfd06e911 100644
--- a/htdocs/website/websiteaccount_card.php
+++ b/htdocs/website/websiteaccount_card.php
@@ -65,7 +65,6 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
-$thirdpartyid = GETPOST('thirdpartyid', 'int');
// Initialize technical objects
$object=new WebsiteAccount($db);
@@ -163,34 +162,13 @@ if ($action == 'create')
print '';
print '';
print '';
- print '';
- dol_fiche_head(array(), '');
+ dol_fiche_head();
print '
'."\n";
- foreach($object->fields as $key => $val)
- {
- if (abs($val['visible']) != 1) continue; // Discard such field from form
- if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
-
- print '
';
- }
+ // Common attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
@@ -202,7 +180,7 @@ if ($action == 'create')
print '
';
print '';
print ' ';
- print ''; // Cancel for create doe not post form
+ print ''; // Cancel for create does not post form if we don't know the backtopage
print '
'."\n";
- foreach($object->fields as $key => $val)
- {
- if (abs($val['visible']) != 1) continue; // Discard such field from form
- if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
- print '
';
- }
+ // Common attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';