diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index f5e65b49cb8..c8211799d02 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -111,6 +111,9 @@ $actioncomm_fields= array( 'fk_element' => array('name'=>'fk_element','type'=>'xsd:string'), 'elementtype' => array('name'=>'elementtype','type'=>'xsd:string')); + +$elementtype = 'actioncomm'; + //Retreive all extrafield for actioncomm // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -119,9 +122,9 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} @@ -308,7 +311,7 @@ function getActionComm($authentication, $id) //Get extrafield values $actioncomm->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); } @@ -448,7 +451,7 @@ function createActionComm($authentication, $actioncomm) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$actioncomm[$key]; @@ -542,7 +545,7 @@ function updateActionComm($authentication, $actioncomm) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $object->array_options[$key]=$actioncomm[$key]; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 10dc97a7fb1..0abbf02bd50 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -115,6 +115,10 @@ $contact_fields = array( 'poste' => array('name'=>'poste','type'=>'xsd:string') //... ); + +$elementtype = 'socpeople'; + + //Retreive all extrafield for contact // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -123,9 +127,9 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} @@ -311,7 +315,7 @@ function getContact($authentication, $id, $ref_ext) //Get extrafield values $contact->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $contact_result_fields=array_merge($contact_result_fields, array('options_'.$key => $contact->array_options['options_'.$key])); } @@ -416,7 +420,7 @@ function createContact($authentication, $contact) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('socpeople', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$contact[$key]; @@ -663,7 +667,7 @@ function updateContact($authentication, $contact) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('socpeople', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $object->array_options[$key]=$contact[$key]; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 2cefbf3e988..ebd1b71b0ed 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -110,6 +110,7 @@ $line_fields = array( 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string') ); +$elementtype = 'commandedet'; //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels @@ -119,10 +120,10 @@ $extrafield_line_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_line_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { //$value=$object->array_options["options_".$key]; - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} $extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); @@ -211,6 +212,8 @@ $order_fields = array( 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2') ); +$elementtype = 'commande'; + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -219,10 +222,10 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { //$value=$object->array_options["options_".$key]; - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); @@ -694,11 +697,13 @@ function createOrder($authentication, $order) $newobject->demand_reason_id=$order['demand_reason_id']; $newobject->date_creation=$now; + $elementtype = 'commande'; + // Retrieve all extrafield for order // fetch optionals attributes and labels $extrafields=new ExtraFields($db); - $extralabels=$extrafields->fetch_name_optionals_label('commandet', true); - foreach($extrafields->attribute_label as $key=>$label) + $extralabels=$extrafields->fetch_name_optionals_label('commande', true); + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$order[$key]; @@ -727,11 +732,13 @@ function createOrder($authentication, $order) $newline->date_start=$line['date_start']; $newline->date_end=$line['date_end']; + $elementtype = 'commandedet'; + // Retrieve all extrafield for lines // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('commandedet', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newline->array_options[$key]=$line[$key]; @@ -933,11 +940,13 @@ function updateOrder($authentication, $order) if (! $order['billed']) $result=$object->classifyUnBilled($fuser); } + $elementtype = 'commande'; + //Retreive all extrafield for object // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('commande', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; if (isset($order[$key])) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 451198945fc..f3d97c1c76f 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -130,6 +130,10 @@ $productorservice_fields = array( 'images' => array('name'=>'images','type'=>'tns:ImagesArray') ); + +$elementtype = 'product'; + + //Retreive all extrafield for product // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -138,9 +142,9 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} @@ -428,7 +432,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' //Get extrafield values $product->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $productorservice_result_fields=array_merge($productorservice_result_fields, array('options_'.$key => $product->array_options['options_'.$key])); } @@ -552,7 +556,7 @@ function createProductOrService($authentication, $product) $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$product[$key]; @@ -721,7 +725,7 @@ function updateProductOrService($authentication, $product) $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$product[$key]; @@ -1099,7 +1103,7 @@ function getProductsForCategory($authentication, $id, $lang = '') //Get extrafield values $tmpproduct->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $products[$iProduct]=array_merge($products[$iProduct], array('options_'.$key => $tmpproduct->array_options['options_'.$key])); } diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index bc8e53b62a6..063f244a80a 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -159,6 +159,8 @@ $project_fields = array( 'elements' => array('name'=>'elements','type'=>'tns:elements') ); +$elementtype = 'project'; + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -167,10 +169,10 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { //$value=$object->array_options["options_".$key]; - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type); @@ -270,7 +272,7 @@ function createProject($authentication, $project) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('project', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$project[$key]; @@ -374,11 +376,11 @@ function getProject($authentication, $id = '', $ref = '') //Retrieve all extrafields for project $extrafields=new ExtraFields($db); - $extralabels=$extrafields->fetch_name_optionals_label('societe', true); + $extralabels=$extrafields->fetch_name_optionals_label('project', true); //Get extrafield values $project->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $project_result_fields=array_merge($project_result_fields, array('options_'.$key => $project->array_options['options_'.$key])); } diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 8b5672d81fd..e897c4cccfc 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -120,6 +120,8 @@ $thirdparty_fields= array( 'vat_used' => array('name'=>'vat_used','type'=>'xsd:string'), 'vat_number' => array('name'=>'vat_number','type'=>'xsd:string')); +$elementtype = 'societe'; + // Retrieve all extrafields for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -128,10 +130,10 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { //$value=$object->array_options["options_".$key]; - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} @@ -359,7 +361,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') //Get extrafield values $thirdparty->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $thirdparty_result_fields=array_merge($thirdparty_result_fields, array('options_'.$key => $thirdparty->array_options['options_'.$key])); } @@ -472,7 +474,7 @@ function createThirdParty($authentication, $thirdparty) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('societe', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $newobject->array_options[$key]=$thirdparty[$key]; @@ -603,7 +605,7 @@ function updateThirdParty($authentication, $thirdparty) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('societe', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='options_'.$key; $object->array_options[$key]=$thirdparty[$key]; @@ -705,7 +707,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) { $extrafieldsOptions=array(); $obj=$db->fetch_object($resql); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $extrafieldsOptions['options_'.$key] = $obj->{$key}; } diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index ff320e8416d..8de37788010 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -183,6 +183,8 @@ $thirdpartywithuser_fields = array( 'group_id' => array('name'=>'group_id','type'=>'xsd:string') ); +$elementtype = 'socpeople'; + //Retreive all extrafield for contact // fetch optionals attributes and labels $extrafields=new ExtraFields($db); @@ -191,9 +193,9 @@ $extrafield_array=null; if (is_array($extrafields) && count($extrafields)>0) { $extrafield_array = array(); } -foreach($extrafields->attribute_label as $key=>$label) +foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { - $type =$extrafields->attribute_type[$key]; + $type =$extrafields->attributes[$elementtype]['type'][$key]; if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';} else {$type='xsd:string';} @@ -598,7 +600,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('socpeople', true); - foreach($extrafields->attribute_label as $key=>$label) + foreach($extrafields->attributes[$elementtype]['label'] as $key=>$label) { $key='contact_options_'.$key; $key=substr($key, 8); // Remove 'contact_' prefix