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

@ -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);
@ -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);
@ -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'];

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

@ -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();
@ -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']);

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');
} }
@ -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);

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

@ -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);
@ -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();
@ -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();
@ -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']);
@ -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

@ -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'];
@ -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 {
@ -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