فهرست منبع

Finished migration to the new architecture of extrafields

Laurent Destailleur 5 سال پیش
والد
کامیت
6f82c212a0

+ 1 - 1
htdocs/admin/mails_senderprofile_list.php

@@ -393,7 +393,7 @@ print '</tr>'."\n";
 
 // Detect if we need a fetch on each output line
 $needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
+foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
 {
 	if (preg_match('/\$object/', $val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
 }

+ 1 - 1
htdocs/asset/list.php

@@ -407,7 +407,7 @@ print '</tr>'."\n";
 
 // Detect if we need a fetch on each output line
 $needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
+foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
 {
 	if (preg_match('/\$object/', $val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
 }

+ 0 - 4
htdocs/compta/paiement/list.php

@@ -117,8 +117,6 @@ if (GETPOST("orphelins", "alpha"))
     $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
     $sql.= " p.statut, p.num_paiement,";
     $sql.= " c.code as paiement_code";
-	// Add fields for extrafields
-	foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
 	// Add fields from hooks
 	$parameters=array();
 	$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters);    // Note that $action and $object may have been modified by hook
@@ -139,8 +137,6 @@ else
     $sql.= " c.code as paiement_code,";
     $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
     $sql.= " s.rowid as socid, s.nom as name, s.email";
-	// Add fields for extrafields
-	foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
 	// Add fields from hooks
 	$parameters=array();
 	$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters);    // Note that $action and $object may have been modified by hook

+ 3 - 3
htdocs/core/class/commondocgenerator.class.php

@@ -596,7 +596,7 @@ abstract class CommonDocGenerator
 		$line->fetch_optionals();
 
         $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
-        
+
         // Check if the current line belongs to a supplier order
         if (get_class($line) == 'CommandeFournisseurLigne')
         {
@@ -606,7 +606,7 @@ abstract class CommonDocGenerator
             $columns = "";
             foreach ($extralabels as $key => $value)
                 $columns .= "$key, ";
-            
+
             if ($columns != "")
             {
                 $columns = substr($columns, 0, strlen($columns) - 2);
@@ -843,7 +843,7 @@ abstract class CommonDocGenerator
 				$id = $object->array_options['options_'.$key];
 				if ($id != "")
 				{
-					$param = $extrafields->attribute_param[$key];
+					$param = $extrafields->attributes[$object->table_element]['param'][$key];
 					$param_list=array_keys($param['options']);              // $param_list='ObjectName:classPath'
 					$InfoFieldList = explode(":", $param_list[0]);
 					$classname=$InfoFieldList[0];

+ 4 - 4
htdocs/core/tpl/advtarget.tpl.php

@@ -302,10 +302,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
                 );
 				print '</td><td>' . "\n";
 			} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
-				print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
+				print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]);
 				print '</td><td>' . "\n";
 			} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
-				print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
+				print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key]);
 				print '</td><td>' . "\n";
 			} else {
 				print '<table class="nobordernopadding"><tr>';
@@ -499,10 +499,10 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
             );
 			print '</td><td>' . "\n";
 		} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
-			print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
+			print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']);
 			print '</td><td>' . "\n";
 		} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
-			print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
+			print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_' . $key . '_cnct']);
 			print '</td><td>' . "\n";
 		} else {
 			print '<table class="nobordernopadding"><tr>';

+ 3 - 1
htdocs/product/stock/productlot_list.php

@@ -216,7 +216,9 @@ $sql.= " p.ref as product_ref,";
 $sql.= " p.label as product_label,";
 $sql.= " p.tobatch";
 // Add fields for extrafields
-foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
+	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+}
 // Add fields from hooks
 $parameters=array();
 $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters);    // Note that $action and $object may have been modified by hook

+ 1 - 1
htdocs/reception/list.php

@@ -473,7 +473,7 @@ foreach ($search_array_options as $key => $val)
 {
     $crit=$val;
     $tmpkey=preg_replace('/search_options_/', '', $key);
-    $typ=$extrafields->attribute_type[$tmpkey];
+    $typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
     $mode=0;
     if (in_array($typ, array('int','double','real'))) $mode=1;    							// Search on a numeric
     if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2;    		// Search on a foreign key int

+ 1 - 1
htdocs/resource/list.php

@@ -71,7 +71,7 @@ foreach ($search_array_options as $key => $val)
 {
 	$crit=$val;
 	$tmpkey=preg_replace('/search_options_/', '', $key);
-	$typ=$extrafields->attribute_type[$tmpkey];
+	$typ=$extrafields->attributes[$object->table_element]['type'][$tmpkey];
 	if ($val != '') {
 		$param.='&search_options_'.$tmpkey.'='.urlencode($val);
 	}

+ 0 - 8
htdocs/societe/website.php

@@ -428,14 +428,6 @@ print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '',
 print '</tr>'."\n";
 
 
-// Detect if we need a fetch on each output line
-$needToFetchEachLine=0;
-foreach ($extrafields->attribute_computed as $key => $val)
-{
-	if (preg_match('/\$object/', $val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
-}
-
-
 // Detect if we need a fetch on each output line
 $needToFetchEachLine=0;
 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)