From cec96b33aeb4bc21e2118048aac3ee2fa804166b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Dec 2020 12:30:59 +0100 Subject: [PATCH] Fix warning --- htdocs/core/lib/ws.lib.php | 2 +- htdocs/webservices/server_invoice.php | 24 ++++++++----------- htdocs/webservices/server_order.php | 14 +++++------ htdocs/webservices/server_other.php | 9 +++---- htdocs/webservices/server_payment.php | 5 ++-- .../webservices/server_productorservice.php | 16 ++++++------- htdocs/webservices/server_project.php | 8 +++---- .../webservices/server_supplier_invoice.php | 5 ++-- htdocs/webservices/server_thirdparty.php | 22 ++++++++--------- htdocs/webservices/server_user.php | 21 +++++++--------- test/phpunit/WebservicesInvoicesTest.php | 2 ++ 11 files changed, 59 insertions(+), 69 deletions(-) diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index faf1b5bc871..2545c8e5973 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -29,7 +29,7 @@ * @param array $authentication Array with authentication informations ('login'=>,'password'=>,'entity'=>,'dolibarrkey'=>) * @param int $error Number of errors * @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 */ function check_authentication($authentication, &$error, &$errorcode, &$errorlabel) diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 5a8e6fb241c..e1f08cbb1ca 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -288,7 +288,7 @@ $server->register( */ 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); @@ -363,7 +363,7 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', 'status' => $invoice->statut, - 'project_id' => $invoic->fk_project, + 'project_id' => $invoice->fk_project, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', '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) { - global $db, $conf, $langs; + global $db, $conf; 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 : '', 'date' => $invoice->date ?dol_print_date($invoice->date, '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_modification' => $invoice->datem ?dol_print_date($invoice->datem, 'dayhourrfc') : '', 'type' => $invoice->type, @@ -492,7 +492,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', 'status'=> $invoice->statut, - 'project_id' => $invoic->fk_project, + 'project_id' => $invoice->fk_project, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', 'payment_mode_id' => $invoice->mode_reglement_id ? $invoice->mode_reglement_id : '', @@ -528,17 +528,16 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) * Create an invoice * * @param array $authentication Array of authentication information - * @param Facture $invoice Invoice + * @param array $invoice Invoice * @return array Array result */ function createInvoice($authentication, $invoice) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); - dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice->id. - ", ref=".$invoice->ref.", ref_ext=".$invoice->ref_ext); + dol_syslog("Function: createInvoice login=".$authentication['login']." id=".$invoice['id'].", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']); 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']; else $arrayoflines = $invoice['lines']; - foreach ($arrayoflines as $key => $line) + foreach ($arrayoflines as $line) { // $key can be 'line' or '0','1',... $newline = new FactureLigne($db); @@ -654,10 +653,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' { 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']; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 30c105d7192..361b2a08f4a 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -354,7 +354,7 @@ $server->register( */ 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); @@ -504,7 +504,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') */ function getOrdersForThirdParty($authentication, $idthirdparty) { - global $db, $conf, $langs; + global $db, $conf; dol_syslog("Function: getOrdersForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty); @@ -707,7 +707,7 @@ function createOrder($authentication, $order) $extrafields->fetch_name_optionals_label($elementtype, true); 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; $newobject->array_options[$key] = $order[$key]; @@ -813,7 +813,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) { 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 $objectresp = array(); @@ -830,7 +830,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) if ($fuser->rights->commande->lire) { $order = new Commande($db); - $result = $order->fetch($id, $ref, $ref_ext); + $result = $order->fetch($id); $order->fetch_thirdparty(); $db->begin(); @@ -889,8 +889,6 @@ function updateOrder($authentication, $order) { global $db, $conf, $langs; - $now = dol_now(); - dol_syslog("Function: updateOrder login=".$authentication['login']); if ($authentication['entity']) $conf->entity = $authentication['entity']; @@ -950,7 +948,7 @@ function updateOrder($authentication, $order) $extrafields->fetch_name_optionals_label($elementtype, true); 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; if (isset($order[$key])) diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 71ee78d3c4d..61f53f7e275 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -145,7 +145,7 @@ $server->register( */ function getVersions($authentication) { - global $db, $conf, $langs; + global $conf; dol_syslog("Function: getVersions login=".$authentication['login']); @@ -188,7 +188,7 @@ function getVersions($authentication) */ 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); @@ -283,10 +283,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') { if (file_exists($original_file)) { - dol_syslog("Function: getDocument $original_file $filename content-type=$type"); - - $file = $fileparams['fullname']; - $filename = basename($file); + dol_syslog("Function: getDocument $original_file content-type=$type"); $f = fopen($original_file, 'r'); $content_file = fread($f, filesize($original_file)); diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 8a9b19d76d6..3fd3868a36a 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -45,6 +45,7 @@ $langs->load("main"); if (empty($conf->global->MAIN_MODULE_WEBSERVICES)) { $langs->load("admin"); + dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled"); print $langs->trans("WarningModuleNotActive", 'WebServices').'.

'; print $langs->trans("ToActivateModule"); @@ -139,7 +140,7 @@ $server->register( */ function createPayment($authentication, $payment) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); @@ -165,7 +166,7 @@ function createPayment($authentication, $payment) if (!$error) { $soc = new Societe($db); - $res = $soc->fetch($payment['thirdparty_id']); + $soc->fetch($payment['thirdparty_id']); $new_payment = new Paiement($db); $new_payment->amount = doubleval($payment['amount']); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index bb068167b74..473a720f46a 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -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'])) { - 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])); } @@ -479,7 +479,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' */ function createProductOrService($authentication, $product) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); @@ -650,7 +650,7 @@ function createProductOrService($authentication, $product) */ function updateProductOrService($authentication, $product) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); @@ -721,7 +721,7 @@ function updateProductOrService($authentication, $product) $extrafields->fetch_name_optionals_label($elementtype, true); 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; $newobject->array_options[$key] = $product[$key]; @@ -824,7 +824,7 @@ function updateProductOrService($authentication, $product) */ function deleteProductOrService($authentication, $listofidstring) { - global $db, $conf, $langs; + global $db, $conf; dol_syslog("Function: deleteProductOrService login=".$authentication['login']); @@ -855,7 +855,7 @@ function deleteProductOrService($authentication, $listofidstring) $db->begin(); - foreach ($listofid as $key => $id) + foreach ($listofid as $id) { $newobject = new Product($db); $result = $newobject->fetch($id); @@ -917,7 +917,7 @@ function deleteProductOrService($authentication, $listofidstring) */ function getListOfProductsOrServices($authentication, $filterproduct) { - global $db, $conf, $langs; + global $db, $conf; 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'])) { - 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])); } diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 0817332c09f..8d76786df71 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -131,7 +131,7 @@ $server->wsdl->addComplexType( ); $project_elements = array(); -foreach ($listofreferent as $key => $_) +foreach ($listofreferent as $key => $label) { $project_elements[$key] = array('name'=>$key, 'type'=>'tns:elementsArray'); } @@ -279,7 +279,7 @@ function createProject($authentication, $project) $extrafields->fetch_name_optionals_label($elementtype, true); 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; $newobject->array_options[$key] = $project[$key]; @@ -338,7 +338,7 @@ function createProject($authentication, $project) */ function getProject($authentication, $id = '', $ref = '') { - global $db, $conf, $langs; + global $db, $conf; 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'])) { $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])); } diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index be90b60c36f..507095ac78b 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -225,7 +225,7 @@ $server->register( */ 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); @@ -333,7 +333,7 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') */ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) { - global $db, $conf, $langs; + global $db, $conf; dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty); @@ -344,6 +344,7 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) $errorcode = ''; $errorlabel = ''; $error = 0; $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); + // Check parameters if (!$error && empty($idthirdparty)) { diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 5bde94cc0d5..12b2d3315c8 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -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'])) { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { //$value=$object->array_options["options_".$key]; $type = $extrafields->attributes[$elementtype]['type'][$key]; @@ -290,7 +290,7 @@ $server->register( */ 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); @@ -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'])) { - 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])); } @@ -408,7 +408,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') */ function createThirdParty($authentication, $thirdparty) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); @@ -483,7 +483,7 @@ function createThirdParty($authentication, $thirdparty) $extrafields->fetch_name_optionals_label($elementtype, true); 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; $newobject->array_options[$key] = $thirdparty[$key]; @@ -538,7 +538,7 @@ function createThirdParty($authentication, $thirdparty) */ function updateThirdParty($authentication, $thirdparty) { - global $db, $conf, $langs; + global $db, $conf; $now = dol_now(); @@ -617,7 +617,7 @@ function updateThirdParty($authentication, $thirdparty) $extrafields->fetch_name_optionals_label($elementtype, true); 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; $object->array_options[$key] = $thirdparty[$key]; @@ -672,9 +672,7 @@ function updateThirdParty($authentication, $thirdparty) */ function getListOfThirdParties($authentication, $filterthirdparty) { - global $db, $conf, $langs; - - $now = dol_now(); + global $db, $conf; 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'])) { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { $extrafieldsOptions['options_'.$key] = $obj->{$key}; } @@ -782,7 +780,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) */ 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); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 25cb2324412..8619a952ea1 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -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'])) { - foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) + foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { $type = $extrafields->attributes[$elementtype]['type'][$key]; if ($type == 'date' || $type == 'datetime') {$type = 'xsd:dateTime'; } @@ -308,7 +308,7 @@ $server->register( */ 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); @@ -399,9 +399,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') */ function getListOfGroups($authentication) { - global $db, $conf, $langs; - - $now = dol_now(); + global $db, $conf; dol_syslog("Function: getListOfGroups login=".$authentication['login']); @@ -477,7 +475,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) { 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']; @@ -601,7 +599,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $extrafields->fetch_name_optionals_label($elementtype, true); 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 = substr($key, 8); // Remove 'contact_' prefix @@ -644,7 +642,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) } } else { $error++; - $errors = ($thirdparty->error ? array($thirdparty->error) : $thirdparty->errors); + $errorcode = join(', ', ($thirdparty->error ? array($thirdparty->error) : $thirdparty->errors)); } } } else { @@ -662,7 +660,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) { $db->rollback(); $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) { - 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']; @@ -715,7 +713,6 @@ function setUserPassword($authentication, $shortuser) { $objectresp = array( 'result'=>array('result_code' => 'OK', 'result_label' => ''), - 'groups'=>$arraygroups ); } else { diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 650e391587b..beb3e844809 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -102,6 +102,8 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; + $now = dol_now(); + // create a third_party, needed to create an invoice // // The third party is created in setUpBeforeClass() and not in the