';
print $langs->trans("None");
diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php
index e613c479ee0..da1cb9658a0 100644
--- a/htdocs/core/tpl/document_actions_post_headers.tpl.php
+++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php
@@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
);
$disablemove=1;
-if ($modulepart == 'produit') $disablemove=0;
+if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
// List of document
$formfile->list_of_documents(
diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php
new file mode 100644
index 00000000000..a608cb2da6b
--- /dev/null
+++ b/htdocs/core/tpl/extrafields_add.tpl.php
@@ -0,0 +1,40 @@
+
+ * Copyright (C) 2014 Juanjo Menent
+ *
+ * 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
+ *
+ * $parameters
+ * $cols
+ */
+?>
+
+executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+if (empty($reshook) && ! empty($extrafields->attribute_label)) {
+ print $object->showOptionals($extrafields, 'edit');
+}
+
+?>
+
\ No newline at end of file
diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php
new file mode 100644
index 00000000000..aa0e30473f1
--- /dev/null
+++ b/htdocs/core/tpl/extrafields_edit.tpl.php
@@ -0,0 +1,40 @@
+
+ * Copyright (C) 2014 Juanjo Menent
+ *
+ * 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
+ *
+ * $parameters
+ * $cols
+ */
+?>
+
+executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+if (empty($reshook) && ! empty($extrafields->attribute_label)) {
+ print $object->showOptionals($extrafields, 'edit');
+}
+
+?>
+
\ No newline at end of file
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index a5b693aa3f9..7a0a7fabfc7 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -110,7 +110,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 682ecf44839..0c34ff43ef0 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -120,7 +120,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 9dca5d1badb..c483dae647f 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -119,7 +119,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 5f1e564e30b..4b7bcb454cd 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 349726bab5b..9d6c5e4ccd3 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -175,7 +175,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
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 b2df01afe51..a34b5e8cab6 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
@@ -261,6 +261,12 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_extrafields ADD COLUMN datec datetime;
ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
+-- We fix value of 'list' fro m0 to 1 for all extrafields created before this migration
+UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
+
+ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
+--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
+
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql
index 3b9a9b2d72b..548508d451d 100644
--- a/htdocs/install/mysql/tables/llx_extrafields.sql
+++ b/htdocs/install/mysql/tables/llx_extrafields.sql
@@ -34,7 +34,7 @@ create table llx_extrafields
pos integer DEFAULT 0,
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
- list integer DEFAULT 0, -- list of values for field that are combo lists
+ list integer DEFAULT 1, -- list of values for field that are combo lists
langs varchar(64), -- example: fileofmymodule@mymodule
ishidden integer DEFAULT 0, -- Can be foreign key of external system
fk_user_author integer, -- user making creation
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 4a5f349215b..e91a9751b60 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -81,8 +81,10 @@ class MyObject extends CommonObject
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
- 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
+ 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
+ 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45),
+ 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
diff --git a/htdocs/modulebuilder/template/lib/myobject.lib.php b/htdocs/modulebuilder/template/lib/myobject.lib.php
index 25f85052133..5ce7c4f7c97 100644
--- a/htdocs/modulebuilder/template/lib/myobject.lib.php
+++ b/htdocs/modulebuilder/template/lib/myobject.lib.php
@@ -29,7 +29,7 @@
*/
function myobjectPrepareHead($object)
{
- global $langs, $conf;
+ global $db, $langs, $conf;
$langs->load("mymodule@mymodule");
@@ -40,17 +40,30 @@ function myobjectPrepareHead($object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
- if (isset($object->fields['note_public']) || isset($object->fields['note_pricate']))
+
+ if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
{
- $head[$h][0] = dol_buildpath("/mymodule/myobject_note.php", 1).'?id='.$object->id;
- $head[$h][1] = $langs->trans("Notes");
+ $nbNote = 0;
+ if(!empty($object->fields['note_private'])) $nbNote++;
+ if(!empty($object->fields['note_public'])) $nbNote++;
+ $head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Notes');
+ if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.'';
$head[$h][2] = 'note';
$h++;
}
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+ $upload_dir = $conf->mymodule->dir_output . "/myobject/" . dol_sanitizeFileName($object->ref);
+ $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
+ $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
- $head[$h][1] = $langs->trans("Documents");
+ $head[$h][1] = $langs->trans('Documents');
+ if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).'';
$head[$h][2] = 'document';
$h++;
+
$head[$h][0] = dol_buildpath("/mymodule/myobject_agenda.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda';
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 515768b8011..4160b2045fd 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -166,8 +166,9 @@ if (empty($reshook))
{
foreach ($object->fields as $key => $val)
{
+ 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');
- if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
@@ -280,6 +281,7 @@ if ($action == 'create')
print $langs->trans($val['label']);
print '
';
print '
';
+ $defaultcss='minwidth100';
if ($val['type'] == 'text')
{
print '
';
print '
';
}
+
+ // Other attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
+
print ''."\n";
dol_fiche_end();
@@ -307,8 +313,6 @@ if ($action == 'create')
print '';
}
-
-
// Part to edit record
if (($id || $ref) && $action == 'edit')
{
@@ -325,6 +329,7 @@ if (($id || $ref) && $action == 'edit')
foreach($object->fields as $key => $val)
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
+
print '