diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index e2fd0df923d299dad2e5c4ef7c5234d37ece1daf..09c416a7fd2ec977bc04cf47d4cdb3f3889008b2 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -241,7 +241,7 @@ class modMyModule extends DolibarrModules // $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'; + // $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('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text'); diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index eb5ca99ea48287d87f320fdcf1d50c4d2fb81548..cd65237448903e0a4d8ec79b6ee34ddfc5beff13 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -299,6 +299,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0; if (preg_match('/^.b$/', $value)) $qualifiedforclean=0; if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0; + if (preg_match('/^NoteSomeFeaturesAreDisabled/', $value)) $qualifiedforclean=0; if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0; // orders if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index c8b72ebcdd9d154d8c278320da58b7c3d9667221..4e14c6987c06b51ffd731409140f691e383ad342 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -44,7 +44,7 @@ class DoliDBPgsql extends DoliDB //! Collate used to force collate when creating database var $forcecollate=''; // Can't be static as it may be forced with a dynamic value //! Version min database - const VERSIONMIN='8.4.0'; // Version min database + const VERSIONMIN='9.0.0'; // Version min database /** @var resource Resultset of last query */ private $_results; @@ -315,6 +315,10 @@ class DoliDBPgsql extends DoliDB } } + // Replace group_concat(x) with string_agg(x, ',') + $line=preg_replace('/GROUP_CONCAT\(([^\)]+)\)/i','STRING_AGG(\\1, \',\')',$line); + //print $line."\n"; + // Remove () in the tables in FROM if 1 table $line=preg_replace('/FROM\s*\((([a-z_]+)\s+as\s+([a-z_]+)\s*)\)/i','FROM \\1',$line); //print $line."\n"; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index b88e4ed9f83a8240a20be2d3028c25a8a0c21aee..154639f848dd151c288310a6d78660eea08cf0c9 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -169,6 +169,7 @@ class modProduct extends DolibarrModules if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation')); $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid'); $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p'; if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; @@ -176,7 +177,7 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object'; if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc'; $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity("product", 1).')'; - if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; + if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields" if (! empty($conf->global->PRODUIT_MULTIPRICES)) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fb59e1dd8fd1b95041e2aad218f96bdee9aca993..329277b97969b8c61da8158b4016838256eebfed 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -177,6 +177,7 @@ Groups=Groups NoUserGroupDefined=No user group defined Password=Password PasswordRetype=Retype your password +NoteSomeFeaturesAreDisabled=Note that a lot of features/modules are disabled in this demonstration. Name=Name Person=Person Parameter=Parameter diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index 04693c017ede393e15d35feceb794b09c3c98e14..f25ea3ea72f8ee7d2d7fb398b329720cd30d6f6c 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -162,6 +162,12 @@ class PgsqlTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals($result, $sql.' DEFERRABLE INITIALLY IMMEDIATE;'); + // Create a constraint + $sql='SELECT a.b, GROUP_CONCAT(a.c) FROM table GROUP BY a.b'; + $result=DoliDBPgsql::convertSQLFromMysql($sql); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($result, "SELECT a.b, STRING_AGG(a.c, ',') FROM table GROUP BY a.b"); + return $result; } }