diff --git a/htdocs/core/commonfieldsinexport.inc.php b/htdocs/core/commonfieldsinexport.inc.php
new file mode 100644
index 00000000000..9a84ae6c199
--- /dev/null
+++ b/htdocs/core/commonfieldsinexport.inc.php
@@ -0,0 +1,60 @@
+db);
+
+ // Add common fields
+ foreach($tmpobject->fields as $keyfield => $valuefield)
+ {
+ $fieldname = 't' . '.' . $keyfield;
+ $fieldlabel = ucfirst($valuefield['label']);
+ $typeFilter = "Text";
+ $typefield=preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double
+ switch ($typefield) {
+ case 'int':
+ case 'integer':
+ case 'double':
+ case 'price':
+ $typeFilter = "Numeric";
+ break;
+ case 'date':
+ case 'datetime':
+ case 'timestamp':
+ $typeFilter = "Date";
+ break;
+ case 'boolean':
+ $typeFilter = "Boolean";
+ break;
+ /*
+ * case 'sellist':
+ * $tmp='';
+ * $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
+ * if ($tmpparam['options'] && is_array($tmpparam['options'])) {
+ * $tmpkeys=array_keys($tmpparam['options']);
+ * $tmp=array_shift($tmpkeys);
+ * }
+ * if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
+ * break;
+ */
+ }
+ if ($valuefield['enabled']) {
+ $this->export_fields_array[$r][$fieldname] = $fieldlabel;
+ $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
+ $this->export_entities_array[$r][$fieldname] = $keyforelement;
+ }
+ }
+}
+else
+{
+ dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile);
+}
+// End add common fields
diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php
index 7f9cf523105..13b2d1ae520 100644
--- a/htdocs/core/extrafieldsinexport.inc.php
+++ b/htdocs/core/extrafieldsinexport.inc.php
@@ -18,15 +18,17 @@ if ($resql) // This can fail when class is used on old database (during migra
$fieldname=$keyforaliasextra.'.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
- switch($obj->type)
- {
+ $typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double
+ switch ($typefield) {
case 'int':
+ case 'integer':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
+ case 'timestamp':
$typeFilter="Date";
break;
case 'boolean':
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index a3f8676fb65..7ef1143b9f8 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -363,10 +363,6 @@ class DolibarrModules // Can not be abstract, because we need to insta
-
-
-
-
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
@@ -381,6 +377,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
// a try catch on Fatal error to manage this correctly.
// We need constructor into function unActivateModule into admin.lib.php
+
/**
* Enables a module.
* Inserts all informations into database
@@ -2161,5 +2158,4 @@ class DolibarrModules // Can not be abstract, because we need to insta
{
return $this->_remove(array(), $options);
}
-
}
diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php
index e7e20be5b83..61fe75d8f2e 100644
--- a/htdocs/core/modules/modStripe.class.php
+++ b/htdocs/core/modules/modStripe.class.php
@@ -62,7 +62,7 @@ class modStripe extends DolibarrModules
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
- $this->picto='stripe@stripe';
+ $this->picto='stripe';
// Data directories to create when module is enabled.
$this->dirs = array();
diff --git a/htdocs/core/modules/modWebsites.class.php b/htdocs/core/modules/modWebsites.class.php
index 57abe371314..364e9e0fe26 100644
--- a/htdocs/core/modules/modWebsites.class.php
+++ b/htdocs/core/modules/modWebsites.class.php
@@ -71,7 +71,7 @@ class modWebsites extends DolibarrModules
$this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
- $this->langfiles = array("websites");
+ $this->langfiles = array("website");
// Constants
//-----------
@@ -122,5 +122,22 @@ class modWebsites extends DolibarrModules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
+
+ // Exports
+ $r=1;
+
+ $this->export_code[$r]=$this->rights_class.'_'.$r;
+ $this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r]='globe';
+ $keyforclass = 'WebsitePage'; $keyforclassfile='/websites/class/websitepage.class.php'; $keyforelement='Website';
+ include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+ //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
+ //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p';
+ $this->export_sql_end[$r] .=' WHERE t.fk_website = p.rowid';
+ $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('website').')';
+ $r++;
}
}
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 4c9d6eaabb4..b1b9b42adc5 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -127,20 +127,23 @@ class Export
// Test if permissions are ok
$bool=true;
- foreach($module->export_permission[$r] as $val)
+ if (isset($module->export_permission))
{
- $perm=$val;
- //print_r("$perm[0]-$perm[1]-$perm[2]
");
- if (! empty($perm[2]))
- {
- $bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
- }
- else
- {
- $bool=$user->rights->{$perm[0]}->{$perm[1]};
- }
- if ($perm[0]=='user' && $user->admin) $bool=true;
- if (! $bool) break;
+ foreach($module->export_permission[$r] as $val)
+ {
+ $perm=$val;
+ //print_r("$perm[0]-$perm[1]-$perm[2]
");
+ if (! empty($perm[2]))
+ {
+ $bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
+ }
+ else
+ {
+ $bool=$user->rights->{$perm[0]}->{$perm[1]};
+ }
+ if ($perm[0]=='user' && $user->admin) $bool=true;
+ if (! $bool) break;
+ }
}
//print $bool." $perm[0]"."
";
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index 909db84fcb4..49c60078666 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -591,7 +591,7 @@ if ($step == 2 && $datatoexport)
$i++;
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
- $entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
+ $entityicon=strtolower(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
print '
';
$entity=(! empty($objexport->array_export_entities[0][$code])?$objexport->array_export_entities[0][$code]:$objexport->array_export_icon[0]);
- $entityicon=(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
+ $entityicon=strtolower(! empty($entitytoicon[$entity])?$entitytoicon[$entity]:$entity);
$entitylang=(! empty($entitytolang[$entity])?$entitytolang[$entity]:$entity);
print '| ';
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 ba6be6291f6..be8bd9c2701 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
@@ -32,6 +32,11 @@ ALTER TABLE llx_website_page MODIFY COLUMN pageurl varchar(255);
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
+ALTER TABLE llx_website_page MODIFY COLUMN status INTEGER DEFAULT 1;
+UPDATE llx_website_page set status = 1 WHERE status IS NULL;
+
+ALTER TABLE llx_website ADD COLUMN import_key varchar(14);
+ALTER TABLE llx_website_page ADD COLUMN import_key varchar(14);
ALTER TABLE llx_fichinter ADD COLUMN import_key varchar(14);
ALTER TABLE llx_livraison ADD COLUMN import_key varchar(14);
ALTER TABLE llx_livraison ADD COLUMN extraparams varchar(255);
diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql
index 84a9dd47188..7773aa469c5 100644
--- a/htdocs/install/mysql/tables/llx_website.sql
+++ b/htdocs/install/mysql/tables/llx_website.sql
@@ -29,5 +29,6 @@ CREATE TABLE llx_website
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
- tms timestamp
+ tms timestamp,
+ import_key varchar(14) -- import key
) ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql
index 13ab3558c98..ec662e451f8 100644
--- a/htdocs/install/mysql/tables/llx_website_page.sql
+++ b/htdocs/install/mysql/tables/llx_website_page.sql
@@ -28,9 +28,10 @@ CREATE TABLE llx_website_page
lang varchar(6),
fk_page integer,
content mediumtext, -- text is not enough in size
- status integer,
+ status integer DEFAULT 1,
fk_user_create integer,
fk_user_modif integer,
date_creation datetime,
- tms timestamp
+ tms timestamp,
+ import_key varchar(14) -- import key
) ENGINE=innodb;
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index 82d0022b1f9..3e2d99d1503 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -40,4 +40,6 @@ ClonePage=Clone page/container
CloneSite=Clone site
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
PageIsANewTranslation=The new page is a translation of the current page ?
-LanguageMustNotBeSameThanClonedPage=You clone a page as a translation. The language of the new page must be different than language of source page.
\ No newline at end of file
+LanguageMustNotBeSameThanClonedPage=You clone a page as a translation. The language of the new page must be different than language of source page.
+ParentPageId=Parent page ID
+WebsiteId=Website ID
\ 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 83c7b6a4a61..daee7fcc879 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -61,8 +61,7 @@ class MyObject extends CommonObject
/**
* 'type' if the field format, 'label' the translation key, 'enabled' is a condition when the filed must be managed,
* 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed)
- * 'notnull' if not null in database
- * 'index' if we want an index in database
+ * 'notnull' if not null in database, 'index' if we want an index in database
* '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).
@@ -86,7 +85,6 @@ class MyObject extends CommonObject
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
- 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1),
);
// END MODULEBUILDER PROPERTIES
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 5ee59c10f90..53bbfde0a70 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -276,23 +276,23 @@ class modMyModule extends DolibarrModules
// Exports
$r=1;
- // Example:
- /* BEGIN MODULEBUILDER EXPORT MYOBJECT
+ /* BEGIN MODULEBUILDER EXPORT MYOBJECT */
+ /*
+ $langs->load("mymodule@mymodule");
$this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
- $this->export_icon[$r]='generic:MyModule'; // Put here code of icon then string for translation key of module name
- //$this->export_permission[$r]=array(array("mymodule","level1","level2"));
- $this->export_fields_array[$r]=array('t.rowid'=>"Id",'t.ref'=>'Ref','t.label'=>'Label','t.datec'=>"DateCreation",'t.tms'=>"DateUpdate");
- $this->export_TypeFields_array[$r]=array('t.rowid'=>'Numeric', 't.ref'=>'Text', 't.label'=>'Label', 't.datec'=>"Date", 't.tms'=>"Date");
- // $this->export_entities_array[$r]=array('t.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
- // $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
- // $this->export_sql_start[$r]='SELECT DISTINCT ';
- // $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
- // $this->export_sql_order[$r] .=' ORDER BY t.ref';
- // $r++;
- END MODULEBUILDER EXPORT MYOBJECT */
-
+ $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r]='myobject@mymodule';
+ $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
+ include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+ $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
+ include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+ //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+ $this->export_sql_start[$r]='SELECT DISTINCT ';
+ $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
+ $this->export_sql_end[$r] .=' WHERE 1 = 1';
+ $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
+ $r++; */
+ /* END MODULEBUILDER EXPORT MYOBJECT */
}
/**
diff --git a/htdocs/theme/eldy/img/object_website.png b/htdocs/theme/eldy/img/object_website.png
new file mode 100644
index 00000000000..aae8bf6eba0
Binary files /dev/null and b/htdocs/theme/eldy/img/object_website.png differ
diff --git a/htdocs/theme/md/img/object_website.png b/htdocs/theme/md/img/object_website.png
new file mode 100644
index 00000000000..4c4a2e48c29
Binary files /dev/null and b/htdocs/theme/md/img/object_website.png differ
diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php
index 7d5e59830e1..05f4abdbd79 100644
--- a/htdocs/websites/class/websitepage.class.php
+++ b/htdocs/websites/class/websitepage.class.php
@@ -58,8 +58,30 @@ class WebsitePage extends CommonObject
public $date_creation;
public $date_modification;
+ // BEGIN MODULEBUILDER PROPERTIES
/**
- */
+ * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
+ */
+ public $fields=array(
+ 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'),
+ 'pageurl' =>array('type'=>'varchar(16)', 'label'=>'WEBSITE_PAGENAME', 'enabled'=>1, 'visible'=>1, 'notnull'=>true, 'index'=>true, 'position'=>10, 'searchall'=>1, 'comment'=>'Alias of page'),
+ 'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
+ 'description' =>array('type'=>'varchar(255)', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
+ 'keywords' =>array('type'=>'varchar(255)', 'label'=>'Keywords', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
+ 'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
+ 'lang' =>array('type'=>'varchar(6)', 'label'=>'Lang', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
+ //'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000),
+ 'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0),
+ 'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'searchall'=>0),
+ 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
+ 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
+ //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
+ //'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500),
+ //'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
+ //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
+ 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1),
+ );
+ // END MODULEBUILDER PROPERTIES
/**
@@ -142,7 +164,7 @@ class WebsitePage extends CommonObject
$sql .= ' '.(! isset($this->lang)?'NULL':"'".$this->db->escape($this->lang)."'").',';
$sql .= ' '.(empty($this->fk_page)?'NULL':$this->db->escape($this->fk_page)).',';
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
- $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").',';
+ $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?"'".$this->db->idate($now)."'":"'".$this->db->idate($this->date_creation)."'").',';
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
$sql .= ')';
|