Fix warning

This commit is contained in:
Laurent Destailleur 2020-12-28 12:30:59 +01:00
parent eac711f96c
commit cec96b33ae
11 changed files with 59 additions and 69 deletions

View File

@ -29,7 +29,7 @@
* @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) * @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>)
* @param int $error Number of errors * @param int $error Number of errors
* @param string $errorcode Error string code * @param string $errorcode Error string code
* @param string $errorlabel Error string label * @param string $errorlabel Error string label
* @return User Return user object identified by login/pass/entity into authentication array * @return User Return user object identified by login/pass/entity into authentication array
*/ */
function check_authentication($authentication, &$error, &$errorcode, &$errorlabel) function check_authentication($authentication, &$error, &$errorcode, &$errorlabel)

View File

@ -288,7 +288,7 @@ $server->register(
*/ */
function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
@ -363,7 +363,7 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_private' => $invoice->note_private ? $invoice->note_private : '',
'note_public' => $invoice->note_public ? $invoice->note_public : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '',
'status' => $invoice->statut, 'status' => $invoice->statut,
'project_id' => $invoic->fk_project, 'project_id' => $invoice->fk_project,
'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_code' => $invoice->close_code ? $invoice->close_code : '',
'close_note' => $invoice->close_note ? $invoice->close_note : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '',
'payment_mode_id' => $invoice->mode_reglement_id ? $invoice->mode_reglement_id : '', 'payment_mode_id' => $invoice->mode_reglement_id ? $invoice->mode_reglement_id : '',
@ -399,7 +399,7 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
*/ */
function getInvoicesForThirdParty($authentication, $idthirdparty) function getInvoicesForThirdParty($authentication, $idthirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty); dol_syslog("Function: getInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
@ -482,7 +482,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '', 'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '',
'date' => $invoice->date ?dol_print_date($invoice->date, 'dayrfc') : '', 'date' => $invoice->date ?dol_print_date($invoice->date, 'dayrfc') : '',
'date_due' => $invoice->date_lim_reglement ?dol_print_date($invoice->date_lim_reglement, 'dayrfc') : '', 'date_due' => $invoice->date_lim_reglement ?dol_print_date($invoice->date_lim_reglement, 'dayrfc') : '',
'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '',
'date_validation' => $invoice->date_validation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_validation' => $invoice->date_validation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '',
'date_modification' => $invoice->datem ?dol_print_date($invoice->datem, 'dayhourrfc') : '', 'date_modification' => $invoice->datem ?dol_print_date($invoice->datem, 'dayhourrfc') : '',
'type' => $invoice->type, 'type' => $invoice->type,
@ -492,7 +492,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_private' => $invoice->note_private ? $invoice->note_private : '',
'note_public' => $invoice->note_public ? $invoice->note_public : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '',
'status'=> $invoice->statut, 'status'=> $invoice->statut,
'project_id' => $invoic->fk_project, 'project_id' => $invoice->fk_project,
'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_code' => $invoice->close_code ? $invoice->close_code : '',
'close_note' => $invoice->close_note ? $invoice->close_note : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '',
'payment_mode_id' => $invoice->mode_reglement_id ? $invoice->mode_reglement_id : '', 'payment_mode_id' => $invoice->mode_reglement_id ? $invoice->mode_reglement_id : '',
@ -528,17 +528,16 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
* Create an invoice * Create an invoice
* *
* @param array $authentication Array of authentication information * @param array $authentication Array of authentication information
* @param Facture $invoice Invoice * @param array $invoice Invoice
* @return array Array result * @return array Array result
*/ */
function createInvoice($authentication, $invoice) function createInvoice($authentication, $invoice)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice->id. dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice['id'].", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']);
", ref=".$invoice->ref.", ref_ext=".$invoice->ref_ext);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];
@ -580,7 +579,7 @@ function createInvoice($authentication, $invoice)
if (isset($invoice['lines']['line'][0])) $arrayoflines = $invoice['lines']['line']; if (isset($invoice['lines']['line'][0])) $arrayoflines = $invoice['lines']['line'];
else $arrayoflines = $invoice['lines']; else $arrayoflines = $invoice['lines'];
foreach ($arrayoflines as $key => $line) foreach ($arrayoflines as $line)
{ {
// $key can be 'line' or '0','1',... // $key can be 'line' or '0','1',...
$newline = new FactureLigne($db); $newline = new FactureLigne($db);
@ -654,10 +653,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
{ {
global $db, $conf; global $db, $conf;
$now = dol_now(); dol_syslog("Function: createInvoiceFromOrder login=".$authentication['login']." id=".$id_order.", ref=".$ref_order.", ref_ext=".$ref_ext_order);
dol_syslog("Function: createInvoiceFromOrder login=".$authentication['login']." id=".$id_order.
", ref=".$ref_order.", ref_ext=".$ref_ext_order);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];

View File

@ -354,7 +354,7 @@ $server->register(
*/ */
function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
@ -504,7 +504,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
*/ */
function getOrdersForThirdParty($authentication, $idthirdparty) function getOrdersForThirdParty($authentication, $idthirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getOrdersForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty); dol_syslog("Function: getOrdersForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
@ -707,7 +707,7 @@ function createOrder($authentication, $order)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
$newobject->array_options[$key] = $order[$key]; $newobject->array_options[$key] = $order[$key];
@ -813,7 +813,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
dol_syslog("Function: validOrder login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: validOrder login=".$authentication['login']." id=".$id." id_warehouse=".$id_warehouse);
// Init and check authentication // Init and check authentication
$objectresp = array(); $objectresp = array();
@ -830,7 +830,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0)
if ($fuser->rights->commande->lire) if ($fuser->rights->commande->lire)
{ {
$order = new Commande($db); $order = new Commande($db);
$result = $order->fetch($id, $ref, $ref_ext); $result = $order->fetch($id);
$order->fetch_thirdparty(); $order->fetch_thirdparty();
$db->begin(); $db->begin();
@ -889,8 +889,6 @@ function updateOrder($authentication, $order)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
$now = dol_now();
dol_syslog("Function: updateOrder login=".$authentication['login']); dol_syslog("Function: updateOrder login=".$authentication['login']);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];
@ -950,7 +948,7 @@ function updateOrder($authentication, $order)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
if (isset($order[$key])) if (isset($order[$key]))

View File

@ -145,7 +145,7 @@ $server->register(
*/ */
function getVersions($authentication) function getVersions($authentication)
{ {
global $db, $conf, $langs; global $conf;
dol_syslog("Function: getVersions login=".$authentication['login']); dol_syslog("Function: getVersions login=".$authentication['login']);
@ -188,7 +188,7 @@ function getVersions($authentication)
*/ */
function getDocument($authentication, $modulepart, $file, $refname = '') function getDocument($authentication, $modulepart, $file, $refname = '')
{ {
global $db, $conf, $langs, $mysoc; global $db, $conf;
dol_syslog("Function: getDocument login=".$authentication['login'].' - modulepart='.$modulepart.' - file='.$file); dol_syslog("Function: getDocument login=".$authentication['login'].' - modulepart='.$modulepart.' - file='.$file);
@ -283,10 +283,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '')
{ {
if (file_exists($original_file)) if (file_exists($original_file))
{ {
dol_syslog("Function: getDocument $original_file $filename content-type=$type"); dol_syslog("Function: getDocument $original_file content-type=$type");
$file = $fileparams['fullname'];
$filename = basename($file);
$f = fopen($original_file, 'r'); $f = fopen($original_file, 'r');
$content_file = fread($f, filesize($original_file)); $content_file = fread($f, filesize($original_file));

View File

@ -45,6 +45,7 @@ $langs->load("main");
if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
{ {
$langs->load("admin"); $langs->load("admin");
dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
print $langs->trans("WarningModuleNotActive", 'WebServices').'.<br><br>'; print $langs->trans("WarningModuleNotActive", 'WebServices').'.<br><br>';
print $langs->trans("ToActivateModule"); print $langs->trans("ToActivateModule");
@ -139,7 +140,7 @@ $server->register(
*/ */
function createPayment($authentication, $payment) function createPayment($authentication, $payment)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
@ -165,7 +166,7 @@ function createPayment($authentication, $payment)
if (!$error) if (!$error)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$res = $soc->fetch($payment['thirdparty_id']); $soc->fetch($payment['thirdparty_id']);
$new_payment = new Paiement($db); $new_payment = new Paiement($db);
$new_payment->amount = doubleval($payment['amount']); $new_payment->amount = doubleval($payment['amount']);

View File

@ -438,7 +438,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = ''
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['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])); $productorservice_result_fields = array_merge($productorservice_result_fields, array('options_'.$key => $product->array_options['options_'.$key]));
} }
@ -479,7 +479,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = ''
*/ */
function createProductOrService($authentication, $product) function createProductOrService($authentication, $product)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
@ -650,7 +650,7 @@ function createProductOrService($authentication, $product)
*/ */
function updateProductOrService($authentication, $product) function updateProductOrService($authentication, $product)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
@ -721,7 +721,7 @@ function updateProductOrService($authentication, $product)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
$newobject->array_options[$key] = $product[$key]; $newobject->array_options[$key] = $product[$key];
@ -824,7 +824,7 @@ function updateProductOrService($authentication, $product)
*/ */
function deleteProductOrService($authentication, $listofidstring) function deleteProductOrService($authentication, $listofidstring)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: deleteProductOrService login=".$authentication['login']); dol_syslog("Function: deleteProductOrService login=".$authentication['login']);
@ -855,7 +855,7 @@ function deleteProductOrService($authentication, $listofidstring)
$db->begin(); $db->begin();
foreach ($listofid as $key => $id) foreach ($listofid as $id)
{ {
$newobject = new Product($db); $newobject = new Product($db);
$result = $newobject->fetch($id); $result = $newobject->fetch($id);
@ -917,7 +917,7 @@ function deleteProductOrService($authentication, $listofidstring)
*/ */
function getListOfProductsOrServices($authentication, $filterproduct) function getListOfProductsOrServices($authentication, $filterproduct)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getListOfProductsOrServices login=".$authentication['login']); dol_syslog("Function: getListOfProductsOrServices login=".$authentication['login']);
@ -1092,7 +1092,7 @@ function getProductsForCategory($authentication, $id, $lang = '')
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['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])); $products[$iProduct] = array_merge($products[$iProduct], array('options_'.$key => $tmpproduct->array_options['options_'.$key]));
} }

View File

@ -131,7 +131,7 @@ $server->wsdl->addComplexType(
); );
$project_elements = array(); $project_elements = array();
foreach ($listofreferent as $key => $_) foreach ($listofreferent as $key => $label)
{ {
$project_elements[$key] = array('name'=>$key, 'type'=>'tns:elementsArray'); $project_elements[$key] = array('name'=>$key, 'type'=>'tns:elementsArray');
} }
@ -279,7 +279,7 @@ function createProject($authentication, $project)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
$newobject->array_options[$key] = $project[$key]; $newobject->array_options[$key] = $project[$key];
@ -338,7 +338,7 @@ function createProject($authentication, $project)
*/ */
function getProject($authentication, $id = '', $ref = '') function getProject($authentication, $id = '', $ref = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getProject login=".$authentication['login']." id=".$id." ref=".$ref); dol_syslog("Function: getProject login=".$authentication['login']." id=".$id." ref=".$ref);
@ -389,7 +389,7 @@ function getProject($authentication, $id = '', $ref = '')
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
$project->fetch_optionals(); $project->fetch_optionals();
foreach ($extrafields->attributes[$elementtype]['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])); $project_result_fields = array_merge($project_result_fields, array('options_'.$key => $project->array_options['options_'.$key]));
} }

View File

@ -225,7 +225,7 @@ $server->register(
*/ */
function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getSupplierInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getSupplierInvoice login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
@ -333,7 +333,7 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
*/ */
function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty); dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
@ -344,6 +344,7 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty)
$errorcode = ''; $errorlabel = ''; $errorcode = ''; $errorlabel = '';
$error = 0; $error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters // Check parameters
if (!$error && empty($idthirdparty)) if (!$error && empty($idthirdparty))
{ {

View File

@ -132,7 +132,7 @@ if (is_array($extrafields) && count($extrafields) > 0) {
} }
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
//$value=$object->array_options["options_".$key]; //$value=$object->array_options["options_".$key];
$type = $extrafields->attributes[$elementtype]['type'][$key]; $type = $extrafields->attributes[$elementtype]['type'][$key];
@ -290,7 +290,7 @@ $server->register(
*/ */
function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
@ -367,7 +367,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['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])); $thirdparty_result_fields = array_merge($thirdparty_result_fields, array('options_'.$key => $thirdparty->array_options['options_'.$key]));
} }
@ -408,7 +408,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
*/ */
function createThirdParty($authentication, $thirdparty) function createThirdParty($authentication, $thirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
@ -483,7 +483,7 @@ function createThirdParty($authentication, $thirdparty)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
$newobject->array_options[$key] = $thirdparty[$key]; $newobject->array_options[$key] = $thirdparty[$key];
@ -538,7 +538,7 @@ function createThirdParty($authentication, $thirdparty)
*/ */
function updateThirdParty($authentication, $thirdparty) function updateThirdParty($authentication, $thirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now(); $now = dol_now();
@ -617,7 +617,7 @@ function updateThirdParty($authentication, $thirdparty)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'options_'.$key; $key = 'options_'.$key;
$object->array_options[$key] = $thirdparty[$key]; $object->array_options[$key] = $thirdparty[$key];
@ -672,9 +672,7 @@ function updateThirdParty($authentication, $thirdparty)
*/ */
function getListOfThirdParties($authentication, $filterthirdparty) function getListOfThirdParties($authentication, $filterthirdparty)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now();
dol_syslog("Function: getListOfThirdParties login=".$authentication['login']); dol_syslog("Function: getListOfThirdParties login=".$authentication['login']);
@ -725,7 +723,7 @@ function getListOfThirdParties($authentication, $filterthirdparty)
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$extrafieldsOptions['options_'.$key] = $obj->{$key}; $extrafieldsOptions['options_'.$key] = $obj->{$key};
} }
@ -782,7 +780,7 @@ function getListOfThirdParties($authentication, $filterthirdparty)
*/ */
function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: deleteThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: deleteThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);

View File

@ -195,7 +195,7 @@ if (is_array($extrafields) && count($extrafields) > 0) {
} }
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$type = $extrafields->attributes[$elementtype]['type'][$key]; $type = $extrafields->attributes[$elementtype]['type'][$key];
if ($type == 'date' || $type == 'datetime') {$type = 'xsd:dateTime'; } if ($type == 'date' || $type == 'datetime') {$type = 'xsd:dateTime'; }
@ -308,7 +308,7 @@ $server->register(
*/ */
function getUser($authentication, $id, $ref = '', $ref_ext = '') function getUser($authentication, $id, $ref = '', $ref_ext = '')
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: getUser login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getUser login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext);
@ -399,9 +399,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '')
*/ */
function getListOfGroups($authentication) function getListOfGroups($authentication)
{ {
global $db, $conf, $langs; global $db, $conf;
$now = dol_now();
dol_syslog("Function: getListOfGroups login=".$authentication['login']); dol_syslog("Function: getListOfGroups login=".$authentication['login']);
@ -477,7 +475,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
dol_syslog("Function: createUserFromThirdparty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: createUserFromThirdparty login=".$authentication['login']);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];
@ -601,7 +599,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label']))
{ {
foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label)
{ {
$key = 'contact_options_'.$key; $key = 'contact_options_'.$key;
$key = substr($key, 8); // Remove 'contact_' prefix $key = substr($key, 8); // Remove 'contact_' prefix
@ -644,7 +642,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
} }
} else { } else {
$error++; $error++;
$errors = ($thirdparty->error ? array($thirdparty->error) : $thirdparty->errors); $errorcode = join(', ', ($thirdparty->error ? array($thirdparty->error) : $thirdparty->errors));
} }
} }
} else { } else {
@ -662,7 +660,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
{ {
$db->rollback(); $db->rollback();
$objectresp = array( $objectresp = array(
'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel) 'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)
); );
} }
@ -680,9 +678,9 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
function setUserPassword($authentication, $shortuser) function setUserPassword($authentication, $shortuser)
{ {
global $db, $conf, $langs; global $db, $conf;
dol_syslog("Function: setUserPassword login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: setUserPassword login=".$authentication['login']);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];
@ -715,7 +713,6 @@ function setUserPassword($authentication, $shortuser)
{ {
$objectresp = array( $objectresp = array(
'result'=>array('result_code' => 'OK', 'result_label' => ''), 'result'=>array('result_code' => 'OK', 'result_label' => ''),
'groups'=>$arraygroups
); );
} }
else { else {

View File

@ -102,6 +102,8 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$now = dol_now();
// create a third_party, needed to create an invoice // create a third_party, needed to create an invoice
// //
// The third party is created in setUpBeforeClass() and not in the // The third party is created in setUpBeforeClass() and not in the