From 46586f3055bfc86687f84e7e5c664ee0d9b24508 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Jul 2017 14:54:13 +0200 Subject: [PATCH] Can export Websites pages. Work on export to be able to use the generic declaration of fields. --- htdocs/core/commonfieldsinexport.inc.php | 60 ++++++++++++++++++ htdocs/core/extrafieldsinexport.inc.php | 6 +- htdocs/core/modules/DolibarrModules.class.php | 6 +- htdocs/core/modules/modStripe.class.php | 2 +- htdocs/core/modules/modWebsites.class.php | 19 +++++- htdocs/exports/class/export.class.php | 29 +++++---- htdocs/exports/export.php | 6 +- .../install/mysql/migration/6.0.0-7.0.0.sql | 5 ++ htdocs/install/mysql/tables/llx_website.sql | 3 +- .../install/mysql/tables/llx_website_page.sql | 5 +- htdocs/langs/en_US/website.lang | 4 +- .../template/class/myobject.class.php | 4 +- .../core/modules/modMyModule.class.php | 32 +++++----- htdocs/theme/eldy/img/object_website.png | Bin 0 -> 366 bytes htdocs/theme/md/img/object_website.png | Bin 0 -> 305 bytes htdocs/websites/class/websitepage.class.php | 26 +++++++- 16 files changed, 157 insertions(+), 50 deletions(-) create mode 100644 htdocs/core/commonfieldsinexport.inc.php create mode 100644 htdocs/theme/eldy/img/object_website.png create mode 100644 htdocs/theme/md/img/object_website.png 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 ''; @@ -783,7 +783,7 @@ if ($step == 3 && $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 ''; @@ -978,7 +978,7 @@ if ($step == 4 && $datatoexport) 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 0000000000000000000000000000000000000000..aae8bf6eba03015d44032e7fafb2450c05a19dda GIT binary patch literal 366 zcmV-!0g?WRP)8K(as|6!e|CXMMYM0o63^NB9)?xg%PAt5GI7U3tF}EGqiHmrf=E*ogN`4 zX7O7%p7(l=b6&@V#ITAxG;n~4f9FCUvbewtTKGmAZ}6i6_f)~MU!#T`&hdzMRqqL0 z(7{a{BY^^zv8LaLc*b@&a2#c|S;Q{pRmuLFMPAj;)Y+s{?sZm@qynvrw36DaSMJa7`{-Aa4Q#1ZTh^^Q%HRkkrvoJozl1?8$PZ@u zO=L+2kiu&)r&_3K2D^quoMKKD^Qz|QdhE<__c|~G@W z58s*iThj$=vt6$4nM|gus?;45dvQ+Ty&9z2);2y0UwjoNww9U_x2^rtlsmeo;pCN; zg=ISX!A1i!Kfo`4(XurHsM(A1C{%%`!W+4%Fp$fQgimsBg(pBJ+`voWF1Rl|$4#M6 zT6$4h>Rq23O6T4Q9iXZZ=bRiIoRY&U0Am|X%=`qu{XyH-5P-Usg-2dHdf=gudF;Qr zibTuG&Q$p3yYN|It^ujKaq`rifr?T!U41array('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 .= ')';