Attached is a patch for extra fields to allow the use by an external
module. I added a test for the existence of the table (eg
mymodule_extrafileds). The problem was in the setup module to define
extra fields

For data manipulation, it works by adding calls to hooks.



Le 11/08/2012 11:47, Jean-François FERRY a écrit :
> Hello,
>
> I would use the extrafieldsfeatures in an external module. But in the
> file core/class/extrafields.class.php, the object type is limited to
> member, company, contact and product (hard coded) :\
>
> Is there a way to use them on another object while avoiding Modify the core?
>
>
>
>
> _______________________________________________
> Dolibarr-dev mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index d3add99..45f2754 100755
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -110,6 +110,11 @@
         if ($elementtype == 'company') $table='societe_extrafields';
         if ($elementtype == 'contact') $table='socpeople_extrafields';
         if ($elementtype == 'product') $table='product_extrafields';
+
+        // Check if table of extrafields exists
+        $info_table = $this->db->DDLInfoTable('llx_'.$elementtype.'_extrafields');
+        if (is_array($info_table) && count($info_table) > 0) $table = $elementtype.'_extrafields';
+
         if (empty($table))
         {
             print 'ErrorBarValueForParameters';
_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à