2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Laurent Destailleur
2024-03-21 23:28:50 +01:00
695 changed files with 13321 additions and 6861 deletions

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,11 +83,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string'),
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string'),
)
);
@@ -98,37 +99,37 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
$actioncomm_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'type_id' => array('name'=>'type_id', 'type'=>'xsd:string'),
'type_code' => array('name'=>'type_code', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:string'),
'label' => array('name'=>'label', 'type'=>'xsd:string'),
'datep' => array('name'=>'datep', 'type'=>'xsd:dateTime'),
'datef' => array('name'=>'datef', 'type'=>'xsd:dateTime'),
'datec' => array('name'=>'datec', 'type'=>'xsd:dateTime'),
'datem' => array('name'=>'datem', 'type'=>'xsd:dateTime'),
'note' => array('name'=>'note', 'type'=>'xsd:string'),
'percentage' => array('name'=>'percentage', 'type'=>'xsd:string'),
'author' => array('name'=>'author', 'type'=>'xsd:string'),
'usermod' => array('name'=>'usermod', 'type'=>'xsd:string'),
'userownerid' => array('name'=>'userownerid', 'type'=>'xsd:string'),
'priority' => array('name'=>'priority', 'type'=>'xsd:string'),
'fulldayevent' => array('name'=>'fulldayevent', 'type'=>'xsd:string'),
'location' => array('name'=>'location', 'type'=>'xsd:string'),
'socid' => array('name'=>'socid', 'type'=>'xsd:string'),
'contactid' => array('name'=>'contactid', 'type'=>'xsd:string'),
'projectid' => array('name'=>'projectid', 'type'=>'xsd:string'),
'fk_element' => array('name'=>'fk_element', 'type'=>'xsd:string'),
'elementtype' => array('name'=>'elementtype', 'type'=>'xsd:string'));
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'type_id' => array('name' => 'type_id', 'type' => 'xsd:string'),
'type_code' => array('name' => 'type_code', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:string'),
'label' => array('name' => 'label', 'type' => 'xsd:string'),
'datep' => array('name' => 'datep', 'type' => 'xsd:dateTime'),
'datef' => array('name' => 'datef', 'type' => 'xsd:dateTime'),
'datec' => array('name' => 'datec', 'type' => 'xsd:dateTime'),
'datem' => array('name' => 'datem', 'type' => 'xsd:dateTime'),
'note' => array('name' => 'note', 'type' => 'xsd:string'),
'percentage' => array('name' => 'percentage', 'type' => 'xsd:string'),
'author' => array('name' => 'author', 'type' => 'xsd:string'),
'usermod' => array('name' => 'usermod', 'type' => 'xsd:string'),
'userownerid' => array('name' => 'userownerid', 'type' => 'xsd:string'),
'priority' => array('name' => 'priority', 'type' => 'xsd:string'),
'fulldayevent' => array('name' => 'fulldayevent', 'type' => 'xsd:string'),
'location' => array('name' => 'location', 'type' => 'xsd:string'),
'socid' => array('name' => 'socid', 'type' => 'xsd:string'),
'contactid' => array('name' => 'contactid', 'type' => 'xsd:string'),
'projectid' => array('name' => 'projectid', 'type' => 'xsd:string'),
'fk_element' => array('name' => 'fk_element', 'type' => 'xsd:string'),
'elementtype' => array('name' => 'elementtype', 'type' => 'xsd:string'));
$elementtype = 'actioncomm';
@@ -150,7 +151,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
if (is_array($extrafield_array)) {
@@ -175,8 +176,8 @@ $server->wsdl->addComplexType(
'sequence',
'',
array(
'code' => array('name'=>'code', 'type'=>'xsd:string'),
'libelle' => array('name'=>'libelle', 'type'=>'xsd:string')
'code' => array('name' => 'code', 'type' => 'xsd:string'),
'libelle' => array('name' => 'libelle', 'type' => 'xsd:string')
)
);
@@ -209,9 +210,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'getListActionCommType',
// Entry values
array('authentication'=>'tns:authentication'),
array('authentication' => 'tns:authentication'),
// Exit values
array('result'=>'tns:result', 'actioncommtypes'=>'tns:actioncommtypes'),
array('result' => 'tns:result', 'actioncommtypes' => 'tns:actioncommtypes'),
$ns,
$ns.'#getListActionCommType',
$styledoc,
@@ -223,9 +224,9 @@ $server->register(
$server->register(
'getActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'actioncomm'=>'tns:actioncomm'),
array('result' => 'tns:result', 'actioncomm' => 'tns:actioncomm'),
$ns,
$ns.'#getActionComm',
$styledoc,
@@ -237,9 +238,9 @@ $server->register(
$server->register(
'createActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#createActionComm',
$styledoc,
@@ -251,9 +252,9 @@ $server->register(
$server->register(
'updateActionComm',
// Entry values
array('authentication'=>'tns:authentication', 'actioncomm'=>'tns:actioncomm'),
array('authentication' => 'tns:authentication', 'actioncomm' => 'tns:actioncomm'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#updateActionComm',
$styledoc,
@@ -303,29 +304,29 @@ function getActionComm($authentication, $id)
if ($result > 0) {
$actioncomm_result_fields = array(
'id' => $actioncomm->id,
'ref'=> $actioncomm->ref,
'ref_ext'=> $actioncomm->ref_ext,
'type_id'=> $actioncomm->type_id,
'type_code'=> $actioncomm->type_code,
'type'=> $actioncomm->type,
'label'=> $actioncomm->label,
'datep'=> dol_print_date($actioncomm->datep, 'dayhourrfc'),
'datef'=> dol_print_date($actioncomm->datef, 'dayhourrfc'),
'datec'=> dol_print_date($actioncomm->datec, 'dayhourrfc'),
'datem'=> dol_print_date($actioncomm->datem, 'dayhourrfc'),
'note'=> $actioncomm->note_private,
'percentage'=> $actioncomm->percentage,
'author'=> $actioncomm->authorid,
'usermod'=> $actioncomm->usermodid,
'userownerid'=> $actioncomm->userownerid,
'priority'=> $actioncomm->priority,
'fulldayevent'=> $actioncomm->fulldayevent,
'location'=> $actioncomm->location,
'socid'=> $actioncomm->socid,
'contactid'=> $actioncomm->contact_id,
'projectid'=> $actioncomm->fk_project,
'fk_element'=> $actioncomm->fk_element,
'elementtype'=> $actioncomm->elementtype
'ref' => $actioncomm->ref,
'ref_ext' => $actioncomm->ref_ext,
'type_id' => $actioncomm->type_id,
'type_code' => $actioncomm->type_code,
'type' => $actioncomm->type,
'label' => $actioncomm->label,
'datep' => dol_print_date($actioncomm->datep, 'dayhourrfc'),
'datef' => dol_print_date($actioncomm->datef, 'dayhourrfc'),
'datec' => dol_print_date($actioncomm->datec, 'dayhourrfc'),
'datem' => dol_print_date($actioncomm->datem, 'dayhourrfc'),
'note' => $actioncomm->note_private,
'percentage' => $actioncomm->percentage,
'author' => $actioncomm->authorid,
'usermod' => $actioncomm->usermodid,
'userownerid' => $actioncomm->userownerid,
'priority' => $actioncomm->priority,
'fulldayevent' => $actioncomm->fulldayevent,
'location' => $actioncomm->location,
'socid' => $actioncomm->socid,
'contactid' => $actioncomm->contact_id,
'projectid' => $actioncomm->fk_project,
'fk_element' => $actioncomm->fk_element,
'elementtype' => $actioncomm->elementtype
);
$elementtype = 'actioncomm';
@@ -345,8 +346,8 @@ function getActionComm($authentication, $id)
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'actioncomm'=>$actioncomm_result_fields);
'result' => array('result_code' => 'OK', 'result_label' => ''),
'actioncomm' => $actioncomm_result_fields);
} else {
$error++;
$errorcode = 'NOT_FOUND';
@@ -360,7 +361,7 @@ function getActionComm($authentication, $id)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -399,12 +400,12 @@ function getListActionCommType($authentication)
if ($result > 0) {
$resultarray = array();
foreach ($cactioncomm->liste_array as $code => $libeller) {
$resultarray[] = array('code'=>$code, 'libelle'=>$libeller);
$resultarray[] = array('code' => $code, 'libelle' => $libeller);
}
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'actioncommtypes'=>$resultarray);
'result' => array('result_code' => 'OK', 'result_label' => ''),
'actioncommtypes' => $resultarray);
} else {
$error++;
$errorcode = 'NOT_FOUND';
@@ -418,7 +419,7 @@ function getListActionCommType($authentication)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -493,7 +494,7 @@ function createActionComm($authentication, $actioncomm)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id);
} else {
$db->rollback();
$error++;
@@ -503,7 +504,7 @@ function createActionComm($authentication, $actioncomm)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -586,12 +587,13 @@ function updateActionComm($authentication, $actioncomm)
$error++;
}
}
'@phan-var-force array{id:string} $actioncomm';
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id
'result' => array('result_code' => 'OK', 'result_label' => ''),
'id' => $object->id
);
} elseif ($objectfound) {
$db->rollback();
@@ -606,7 +608,7 @@ function updateActionComm($authentication, $actioncomm)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -706,6 +707,7 @@ function updateContact($authentication, $contact)
$error++;
}
}
'@phan-var-force array{id:string} $contact';
if ((!$error) && ($objectfound)) {
$db->commit();

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -83,11 +84,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string')
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string')
)
);
// Define WSDL Return object
@@ -98,8 +99,8 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
@@ -111,22 +112,22 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:int'),
'desc' => array('name'=>'desc', 'type'=>'xsd:string'),
'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'),
'qty' => array('name'=>'qty', 'type'=>'xsd:double'),
'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'),
'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'),
'total' => array('name'=>'total', 'type'=>'xsd:double'),
'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'),
'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'),
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:int'),
'desc' => array('name' => 'desc', 'type' => 'xsd:string'),
'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'),
'qty' => array('name' => 'qty', 'type' => 'xsd:double'),
'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'),
'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'),
'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'),
'total' => array('name' => 'total', 'type' => 'xsd:double'),
'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'),
'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'),
// From product
'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'),
'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'),
'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'),
'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string')
'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'),
'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'),
'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'),
'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string')
)
);
@@ -168,29 +169,29 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'),
'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'),
'fk_user_valid' => array('name'=>'fk_user_valid', 'type'=>'xsd:string'),
'date' => array('name'=>'date', 'type'=>'xsd:date'),
'date_due' => array('name'=>'date_due', 'type'=>'xsd:date'),
'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'),
'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'),
'payment_mode_id' => array('name'=>'payment_mode_id', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:int'),
'total_net' => array('name'=>'type', 'type'=>'xsd:double'),
'total_vat' => array('name'=>'type', 'type'=>'xsd:double'),
'total' => array('name'=>'type', 'type'=>'xsd:double'),
'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'),
'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'),
'status' => array('name'=>'status', 'type'=>'xsd:int'),
'close_code' => array('name'=>'close_code', 'type'=>'xsd:string'),
'close_note' => array('name'=>'close_note', 'type'=>'xsd:string'),
'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'),
'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2')
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'),
'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'),
'fk_user_valid' => array('name' => 'fk_user_valid', 'type' => 'xsd:string'),
'date' => array('name' => 'date', 'type' => 'xsd:date'),
'date_due' => array('name' => 'date_due', 'type' => 'xsd:date'),
'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'),
'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'),
'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'),
'payment_mode_id' => array('name' => 'payment_mode_id', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:int'),
'total_net' => array('name' => 'type', 'type' => 'xsd:double'),
'total_vat' => array('name' => 'type', 'type' => 'xsd:double'),
'total' => array('name' => 'type', 'type' => 'xsd:double'),
'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'),
'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'),
'status' => array('name' => 'status', 'type' => 'xsd:int'),
'close_code' => array('name' => 'close_code', 'type' => 'xsd:string'),
'close_note' => array('name' => 'close_note', 'type' => 'xsd:string'),
'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'),
'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2')
)
);
/*
@@ -237,9 +238,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'getInvoice',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'invoice'=>'tns:invoice'),
array('result' => 'tns:result', 'invoice' => 'tns:invoice'),
$ns,
$ns.'#getInvoice',
$styledoc,
@@ -249,9 +250,9 @@ $server->register(
$server->register(
'getInvoicesForThirdParty',
// Entry values
array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'invoices'=>'tns:InvoicesArray2'),
array('result' => 'tns:result', 'invoices' => 'tns:InvoicesArray2'),
$ns,
$ns.'#getInvoicesForThirdParty',
$styledoc,
@@ -261,9 +262,9 @@ $server->register(
$server->register(
'createInvoice',
// Entry values
array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'),
array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'),
$ns,
$ns.'#createInvoice',
$styledoc,
@@ -273,9 +274,9 @@ $server->register(
$server->register(
'createInvoiceFromOrder',
// Entry values
array('authentication'=>'tns:authentication', 'id_order'=>'xsd:string', 'ref_order'=>'xsd:string', 'ref_ext_order'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id_order' => 'xsd:string', 'ref_order' => 'xsd:string', 'ref_ext_order' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'),
$ns,
$ns.'#createInvoiceFromOrder',
$styledoc,
@@ -285,9 +286,9 @@ $server->register(
$server->register(
'updateInvoice',
// Entry values
array('authentication'=>'tns:authentication', 'invoice'=>'tns:invoice'),
array('authentication' => 'tns:authentication', 'invoice' => 'tns:invoice'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'),
$ns,
$ns.'#updateInvoice',
$styledoc,
@@ -340,29 +341,29 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
foreach ($invoice->lines as $line) {
//var_dump($line); exit;
$linesresp[] = array(
'id'=>$line->id,
'type'=>$line->product_type,
'desc'=>dol_htmlcleanlastbr($line->desc),
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'unitprice'=> $line->subprice,
'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '',
'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '',
'product_id'=>$line->fk_product,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
'id' => $line->id,
'type' => $line->product_type,
'desc' => dol_htmlcleanlastbr($line->desc),
'total_net' => $line->total_ht,
'total_vat' => $line->total_tva,
'total' => $line->total_ttc,
'vat_rate' => $line->tva_tx,
'qty' => $line->qty,
'unitprice' => $line->subprice,
'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '',
'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '',
'product_id' => $line->fk_product,
'product_ref' => $line->product_ref,
'product_label' => $line->product_label,
'product_desc' => $line->product_desc,
);
$i++;
}
// Create invoice
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'invoice'=>array(
'result' => array('result_code' => 'OK', 'result_label' => ''),
'invoice' => array(
'id' => $invoice->id,
'ref' => $invoice->ref,
'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', // If not defined, field is not added into soap
@@ -400,7 +401,7 @@ function getInvoice($authentication, $id = 0, $ref = '', $ref_ext = '')
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -475,20 +476,20 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
$linesresp = array();
foreach ($invoice->lines as $line) {
$linesresp[] = array(
'id'=>$line->id,
'type'=>$line->product_type,
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'unitprice'=> $line->subprice,
'date_start'=> $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '',
'date_end'=> $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '',
'product_id'=>$line->fk_product,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
'id' => $line->id,
'type' => $line->product_type,
'total_net' => $line->total_ht,
'total_vat' => $line->total_tva,
'total' => $line->total_ttc,
'vat_rate' => $line->tva_tx,
'qty' => $line->qty,
'unitprice' => $line->subprice,
'date_start' => $line->date_start ? dol_print_date($line->date_start, 'dayrfc') : '',
'date_end' => $line->date_end ? dol_print_date($line->date_end, 'dayrfc') : '',
'product_id' => $line->fk_product,
'product_ref' => $line->product_ref,
'product_label' => $line->product_label,
'product_desc' => $line->product_desc,
);
}
@@ -510,7 +511,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
'total' => $invoice->total_ttc,
'note_private' => $invoice->note_private ? $invoice->note_private : '',
'note_public' => $invoice->note_public ? $invoice->note_public : '',
'status'=> $invoice->statut,
'status' => $invoice->statut,
'project_id' => $invoice->fk_project,
'close_code' => $invoice->close_code ? $invoice->close_code : '',
'close_note' => $invoice->close_note ? $invoice->close_note : '',
@@ -523,8 +524,8 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
}
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'invoices'=>$linesinvoice
'result' => array('result_code' => 'OK', 'result_label' => ''),
'invoices' => $linesinvoice
);
} else {
@@ -535,7 +536,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -641,8 +642,8 @@ function createInvoice($authentication, $invoice)
if (!$error) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_invoice->id,
'ref'=>$new_invoice->ref, 'ref_ext'=>$new_invoice->ref_ext);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $new_invoice->id,
'ref' => $new_invoice->ref, 'ref_ext' => $new_invoice->ref_ext);
} else {
$db->rollback();
$error++;
@@ -653,7 +654,7 @@ function createInvoice($authentication, $invoice)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -662,11 +663,11 @@ function createInvoice($authentication, $invoice)
/**
* Create an invoice from an order
*
* @param array $authentication Array of authentication information
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param string $id_order id of order to copy invoice from
* @param string $ref_order ref of order to copy invoice from
* @param string $ref_ext_order ref_ext of order to copy invoice from
* @return array Array result
* @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result
*/
function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '', $ref_ext_order = '')
{
@@ -732,20 +733,20 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
} else {
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref, 'ref_ext'=>$newobject->ref_ext);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref, 'ref_ext' => $newobject->ref_ext);
}
return $objectresp;
}
/**
* Uddate an invoice, only change the state of an invoice
* Update an invoice, only change the state of an invoice
*
* @param array $authentication Array of authentication information
* @param array $invoice Invoice
* @return array Array result
* @param array{login:string,password:string,entity:?int,dolibarrkey:string} $authentication Array of authentication information
* @param array{id:string,ref:string,ref_ext:string,status?:string} $invoice Invoice
* @return array{result:array{result_code:string,result_label:string},id?:int,ref?:string,ref_ext?:string} Array result
*/
function updateInvoice($authentication, $invoice)
{
@@ -808,10 +809,10 @@ function updateInvoice($authentication, $invoice)
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id,
'ref'=>$object->ref,
'ref_ext'=>$object->ref_ext
'result' => array('result_code' => 'OK', 'result_label' => ''),
'id' => $object->id,
'ref' => $object->ref,
'ref_ext' => $object->ref_ext
);
} elseif ($objectfound) {
$db->rollback();
@@ -826,7 +827,7 @@ function updateInvoice($authentication, $invoice)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 JF FERRY <jfefe@aternatik.fr>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,11 +83,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string')
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string')
)
);
// Define WSDL Return object
@@ -97,37 +98,37 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
$line_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'type' => array('name'=>'type', 'type'=>'xsd:int'),
'fk_commande' => array('name'=>'fk_commande', 'type'=>'xsd:int'),
'fk_parent_line' => array('name'=>'fk_parent_line', 'type'=>'xsd:int'),
'desc' => array('name'=>'desc', 'type'=>'xsd:string'),
'qty' => array('name'=>'qty', 'type'=>'xsd:double'),
'price' => array('name'=>'price', 'type'=>'xsd:double'),
'unitprice' => array('name'=>'unitprice', 'type'=>'xsd:double'),
'vat_rate' => array('name'=>'vat_rate', 'type'=>'xsd:double'),
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'type' => array('name' => 'type', 'type' => 'xsd:int'),
'fk_commande' => array('name' => 'fk_commande', 'type' => 'xsd:int'),
'fk_parent_line' => array('name' => 'fk_parent_line', 'type' => 'xsd:int'),
'desc' => array('name' => 'desc', 'type' => 'xsd:string'),
'qty' => array('name' => 'qty', 'type' => 'xsd:double'),
'price' => array('name' => 'price', 'type' => 'xsd:double'),
'unitprice' => array('name' => 'unitprice', 'type' => 'xsd:double'),
'vat_rate' => array('name' => 'vat_rate', 'type' => 'xsd:double'),
'remise' => array('name'=>'remise', 'type'=>'xsd:double'),
'remise_percent' => array('name'=>'remise_percent', 'type'=>'xsd:double'),
'remise' => array('name' => 'remise', 'type' => 'xsd:double'),
'remise_percent' => array('name' => 'remise_percent', 'type' => 'xsd:double'),
'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'),
'total' => array('name'=>'total', 'type'=>'xsd:double'),
'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'),
'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'),
'total' => array('name' => 'total', 'type' => 'xsd:double'),
'date_start' => array('name'=>'date_start', 'type'=>'xsd:date'),
'date_end' => array('name'=>'date_end', 'type'=>'xsd:date'),
'date_start' => array('name' => 'date_start', 'type' => 'xsd:date'),
'date_end' => array('name' => 'date_end', 'type' => 'xsd:date'),
// From product
'product_id' => array('name'=>'product_id', 'type'=>'xsd:int'),
'product_ref' => array('name'=>'product_ref', 'type'=>'xsd:string'),
'product_label' => array('name'=>'product_label', 'type'=>'xsd:string'),
'product_desc' => array('name'=>'product_desc', 'type'=>'xsd:string')
'product_id' => array('name' => 'product_id', 'type' => 'xsd:int'),
'product_ref' => array('name' => 'product_ref', 'type' => 'xsd:string'),
'product_label' => array('name' => 'product_label', 'type' => 'xsd:string'),
'product_desc' => array('name' => 'product_desc', 'type' => 'xsd:string')
);
$elementtype = 'commandedet';
@@ -149,7 +150,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
} else {
$type = 'xsd:string';
}
$extrafield_line_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_line_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
if (is_array($extrafield_line_array)) {
@@ -198,39 +199,39 @@ $server->wsdl->addComplexType(
);
$order_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'ref', 'type'=>'xsd:string'),
'ref_client' => array('name'=>'ref_client', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'thirdparty_id' => array('name'=>'thirdparty_id', 'type'=>'xsd:int'),
'status' => array('name'=>'status', 'type'=>'xsd:int'),
'billed' => array('name'=>'billed', 'type'=>'xsd:string'),
'total_net' => array('name'=>'total_net', 'type'=>'xsd:double'),
'total_vat' => array('name'=>'total_vat', 'type'=>'xsd:double'),
'total_localtax1' => array('name'=>'total_localtax1', 'type'=>'xsd:double'),
'total_localtax2' => array('name'=>'total_localtax2', 'type'=>'xsd:double'),
'total' => array('name'=>'total', 'type'=>'xsd:double'),
'date' => array('name'=>'date', 'type'=>'xsd:date'),
'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'),
'date_validation' => array('name'=>'date_validation', 'type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'),
'source' => array('name'=>'source', 'type'=>'xsd:string'),
'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'),
'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'),
'project_id' => array('name'=>'project_id', 'type'=>'xsd:string'),
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'ref', 'type' => 'xsd:string'),
'ref_client' => array('name' => 'ref_client', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'thirdparty_id' => array('name' => 'thirdparty_id', 'type' => 'xsd:int'),
'status' => array('name' => 'status', 'type' => 'xsd:int'),
'billed' => array('name' => 'billed', 'type' => 'xsd:string'),
'total_net' => array('name' => 'total_net', 'type' => 'xsd:double'),
'total_vat' => array('name' => 'total_vat', 'type' => 'xsd:double'),
'total_localtax1' => array('name' => 'total_localtax1', 'type' => 'xsd:double'),
'total_localtax2' => array('name' => 'total_localtax2', 'type' => 'xsd:double'),
'total' => array('name' => 'total', 'type' => 'xsd:double'),
'date' => array('name' => 'date', 'type' => 'xsd:date'),
'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'),
'date_validation' => array('name' => 'date_validation', 'type' => 'xsd:dateTime'),
'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'),
'source' => array('name' => 'source', 'type' => 'xsd:string'),
'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'),
'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'),
'project_id' => array('name' => 'project_id', 'type' => 'xsd:string'),
'mode_reglement_id' => array('name'=>'mode_reglement_id', 'type'=>'xsd:string'),
'mode_reglement_code' => array('name'=>'mode_reglement_code', 'type'=>'xsd:string'),
'mode_reglement' => array('name'=>'mode_reglement', 'type'=>'xsd:string'),
'cond_reglement_id' => array('name'=>'cond_reglement_id', 'type'=>'xsd:string'),
'cond_reglement_code' => array('name'=>'cond_reglement_code', 'type'=>'xsd:string'),
'cond_reglement' => array('name'=>'cond_reglement', 'type'=>'xsd:string'),
'cond_reglement_doc' => array('name'=>'cond_reglement_doc', 'type'=>'xsd:string'),
'mode_reglement_id' => array('name' => 'mode_reglement_id', 'type' => 'xsd:string'),
'mode_reglement_code' => array('name' => 'mode_reglement_code', 'type' => 'xsd:string'),
'mode_reglement' => array('name' => 'mode_reglement', 'type' => 'xsd:string'),
'cond_reglement_id' => array('name' => 'cond_reglement_id', 'type' => 'xsd:string'),
'cond_reglement_code' => array('name' => 'cond_reglement_code', 'type' => 'xsd:string'),
'cond_reglement' => array('name' => 'cond_reglement', 'type' => 'xsd:string'),
'cond_reglement_doc' => array('name' => 'cond_reglement_doc', 'type' => 'xsd:string'),
'date_livraison' => array('name'=>'date_livraison', 'type'=>'xsd:date'),
'demand_reason_id' => array('name'=>'demand_reason_id', 'type'=>'xsd:string'),
'date_livraison' => array('name' => 'date_livraison', 'type' => 'xsd:date'),
'demand_reason_id' => array('name' => 'demand_reason_id', 'type' => 'xsd:string'),
'lines' => array('name'=>'lines', 'type'=>'tns:LinesArray2')
'lines' => array('name' => 'lines', 'type' => 'tns:LinesArray2')
);
$elementtype = 'commande';
@@ -252,7 +253,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
} else {
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
if (is_array($extrafield_array)) {
@@ -312,8 +313,8 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
// Register WSDL
$server->register(
'getOrder',
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Entry values
array('result'=>'tns:result', 'order'=>'tns:order'), // Exit values
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Entry values
array('result' => 'tns:result', 'order' => 'tns:order'), // Exit values
$ns,
$ns.'#getOrder',
$styledoc,
@@ -323,8 +324,8 @@ $server->register(
$server->register(
'getOrdersForThirdParty',
array('authentication'=>'tns:authentication', 'idthirdparty'=>'xsd:string'), // Entry values
array('result'=>'tns:result', 'orders'=>'tns:OrdersArray2'), // Exit values
array('authentication' => 'tns:authentication', 'idthirdparty' => 'xsd:string'), // Entry values
array('result' => 'tns:result', 'orders' => 'tns:OrdersArray2'), // Exit values
$ns,
$ns.'#getOrdersForThirdParty',
$styledoc,
@@ -334,8 +335,8 @@ $server->register(
$server->register(
'createOrder',
array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'), // Exit values
array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'), // Exit values
$ns,
$ns.'#createOrder',
$styledoc,
@@ -345,8 +346,8 @@ $server->register(
$server->register(
'updateOrder',
array('authentication'=>'tns:authentication', 'order'=>'tns:order'), // Entry values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), // Exit values
array('authentication' => 'tns:authentication', 'order' => 'tns:order'), // Entry values
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'), // Exit values
$ns,
$ns.'#updateOrder',
$styledoc,
@@ -356,8 +357,8 @@ $server->register(
$server->register(
'validOrder',
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'id_warehouse'=>'xsd:string'), // Entry values
array('result'=>'tns:result'), // Exit values
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'id_warehouse' => 'xsd:string'), // Entry values
array('result' => 'tns:result'), // Exit values
$ns,
$ns.'#validOrder',
$styledoc,
@@ -424,34 +425,34 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '')
foreach ($order->lines as $line) {
//var_dump($line); exit;
$linesresp[] = array(
'id'=>$line->rowid,
'fk_commande'=>$line->fk_commande,
'fk_parent_line'=>$line->fk_parent_line,
'desc'=>$line->desc,
'qty'=>$line->qty,
'price'=>$line->price,
'unitprice'=>$line->subprice,
'vat_rate'=>$line->tva_tx,
'remise'=>$line->remise,
'remise_percent'=>$line->remise_percent,
'product_id'=>$line->fk_product,
'product_type'=>$line->product_type,
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'date_start'=>$line->date_start,
'date_end'=>$line->date_end,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc
'id' => $line->rowid,
'fk_commande' => $line->fk_commande,
'fk_parent_line' => $line->fk_parent_line,
'desc' => $line->desc,
'qty' => $line->qty,
'price' => $line->price,
'unitprice' => $line->subprice,
'vat_rate' => $line->tva_tx,
'remise' => $line->remise,
'remise_percent' => $line->remise_percent,
'product_id' => $line->fk_product,
'product_type' => $line->product_type,
'total_net' => $line->total_ht,
'total_vat' => $line->total_tva,
'total' => $line->total_ttc,
'date_start' => $line->date_start,
'date_end' => $line->date_end,
'product_ref' => $line->product_ref,
'product_label' => $line->product_label,
'product_desc' => $line->product_desc
);
$i++;
}
// Create order
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'order'=>array(
'result' => array('result_code' => 'OK', 'result_label' => ''),
'order' => array(
'id' => $order->id,
'ref' => $order->ref,
'ref_client' => $order->ref_client,
@@ -503,7 +504,7 @@ function getOrder($authentication, $id = 0, $ref = '', $ref_ext = '')
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -579,26 +580,26 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
$linesresp = array();
foreach ($order->lines as $line) {
$linesresp[] = array(
'id'=>$line->rowid,
'type'=>$line->product_type,
'fk_commande'=>$line->fk_commande,
'fk_parent_line'=>$line->fk_parent_line,
'desc'=>$line->desc,
'qty'=>$line->qty,
'price'=>$line->price,
'unitprice'=>$line->subprice,
'tva_tx'=>$line->tva_tx,
'remise'=>$line->remise,
'remise_percent'=>$line->remise_percent,
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'date_start'=>$line->date_start,
'date_end'=>$line->date_end,
'product_id'=>$line->fk_product,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc
'id' => $line->rowid,
'type' => $line->product_type,
'fk_commande' => $line->fk_commande,
'fk_parent_line' => $line->fk_parent_line,
'desc' => $line->desc,
'qty' => $line->qty,
'price' => $line->price,
'unitprice' => $line->subprice,
'tva_tx' => $line->tva_tx,
'remise' => $line->remise,
'remise_percent' => $line->remise_percent,
'total_net' => $line->total_ht,
'total_vat' => $line->total_tva,
'total' => $line->total_ttc,
'date_start' => $line->date_start,
'date_end' => $line->date_end,
'product_id' => $line->fk_product,
'product_ref' => $line->product_ref,
'product_label' => $line->product_label,
'product_desc' => $line->product_desc
);
}
@@ -644,8 +645,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
}
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'orders'=>$linesorders
'result' => array('result_code' => 'OK', 'result_label' => ''),
'orders' => $linesorders
);
} else {
@@ -656,7 +657,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -786,7 +787,7 @@ function createOrder($authentication, $order)
if ($result >= 0) {
dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG);
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
} else {
dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR);
$db->rollback();
@@ -797,7 +798,7 @@ function createOrder($authentication, $order)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -865,10 +866,10 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
} else {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''));
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''));
}
return $objectresp;
@@ -878,7 +879,7 @@ function validOrder($authentication, $id = 0, $id_warehouse = 0)
* Update an order
*
* @param array $authentication Array of authentication information
* @param array $order Order info
* @param array{id:string,ref:string,refext:string} $order Order info
* @return array Array result
*/
function updateOrder($authentication, $order)
@@ -969,10 +970,10 @@ function updateOrder($authentication, $order)
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id,
'ref'=>$object->ref,
'ref_ext'=>$object->ref_ext
'result' => array('result_code' => 'OK', 'result_label' => ''),
'id' => $object->id,
'ref' => $object->ref,
'ref_ext' => $object->ref_ext
);
} elseif ($objectfound) {
$db->rollback();
@@ -987,7 +988,7 @@ function updateOrder($authentication, $order)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -81,11 +82,11 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'dolibarrkey' => array('name'=>'dolibarrkey', 'type'=>'xsd:string'),
'sourceapplication' => array('name'=>'sourceapplication', 'type'=>'xsd:string'),
'login' => array('name'=>'login', 'type'=>'xsd:string'),
'password' => array('name'=>'password', 'type'=>'xsd:string'),
'entity' => array('name'=>'entity', 'type'=>'xsd:string'),
'dolibarrkey' => array('name' => 'dolibarrkey', 'type' => 'xsd:string'),
'sourceapplication' => array('name' => 'sourceapplication', 'type' => 'xsd:string'),
'login' => array('name' => 'login', 'type' => 'xsd:string'),
'password' => array('name' => 'password', 'type' => 'xsd:string'),
'entity' => array('name' => 'entity', 'type' => 'xsd:string'),
)
);
// Define WSDL Return object
@@ -96,48 +97,48 @@ $server->wsdl->addComplexType(
'all',
'',
array(
'result_code' => array('name'=>'result_code', 'type'=>'xsd:string'),
'result_label' => array('name'=>'result_label', 'type'=>'xsd:string'),
'result_code' => array('name' => 'result_code', 'type' => 'xsd:string'),
'result_label' => array('name' => 'result_label', 'type' => 'xsd:string'),
)
);
$thirdparty_fields = array(
'id' => array('name'=>'id', 'type'=>'xsd:string'),
'ref' => array('name'=>'name', 'type'=>'xsd:string'),
'ref_ext' => array('name'=>'ref_ext', 'type'=>'xsd:string'),
'fk_user_author' => array('name'=>'fk_user_author', 'type'=>'xsd:string'),
'status' => array('name'=>'status', 'type'=>'xsd:string'),
'client' => array('name'=>'client', 'type'=>'xsd:string'),
'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'),
'customer_code' => array('name'=>'customer_code', 'type'=>'xsd:string'),
'supplier_code' => array('name'=>'supplier_code', 'type'=>'xsd:string'),
'customer_code_accountancy' => array('name'=>'customer_code_accountancy', 'type'=>'xsd:string'),
'supplier_code_accountancy' => array('name'=>'supplier_code_accountancy', 'type'=>'xsd:string'),
'date_creation' => array('name'=>'date_creation', 'type'=>'xsd:dateTime'),
'date_modification' => array('name'=>'date_modification', 'type'=>'xsd:dateTime'),
'note_private' => array('name'=>'note_private', 'type'=>'xsd:string'),
'note_public' => array('name'=>'note_public', 'type'=>'xsd:string'),
'address' => array('name'=>'address', 'type'=>'xsd:string'),
'zip' => array('name'=>'zip', 'type'=>'xsd:string'),
'town' => array('name'=>'town', 'type'=>'xsd:string'),
'region_code' => array('name'=>'region_code', 'type'=>'xsd:string'),
'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'),
'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'),
'country' => array('name'=>'country', 'type'=>'xsd:string'),
'phone' => array('name'=>'phone', 'type'=>'xsd:string'),
'fax' => array('name'=>'fax', 'type'=>'xsd:string'),
'email' => array('name'=>'email', 'type'=>'xsd:string'),
'url' => array('name'=>'url', 'type'=>'xsd:string'),
'profid1' => array('name'=>'profid1', 'type'=>'xsd:string'),
'profid2' => array('name'=>'profid2', 'type'=>'xsd:string'),
'profid3' => array('name'=>'profid3', 'type'=>'xsd:string'),
'profid4' => array('name'=>'profid4', 'type'=>'xsd:string'),
'profid5' => array('name'=>'profid5', 'type'=>'xsd:string'),
'profid6' => array('name'=>'profid6', 'type'=>'xsd:string'),
'capital' => array('name'=>'capital', 'type'=>'xsd:string'),
'vat_used' => array('name'=>'vat_used', 'type'=>'xsd:string'),
'vat_number' => array('name'=>'vat_number', 'type'=>'xsd:string'));
'id' => array('name' => 'id', 'type' => 'xsd:string'),
'ref' => array('name' => 'name', 'type' => 'xsd:string'),
'ref_ext' => array('name' => 'ref_ext', 'type' => 'xsd:string'),
'fk_user_author' => array('name' => 'fk_user_author', 'type' => 'xsd:string'),
'status' => array('name' => 'status', 'type' => 'xsd:string'),
'client' => array('name' => 'client', 'type' => 'xsd:string'),
'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'),
'customer_code' => array('name' => 'customer_code', 'type' => 'xsd:string'),
'supplier_code' => array('name' => 'supplier_code', 'type' => 'xsd:string'),
'customer_code_accountancy' => array('name' => 'customer_code_accountancy', 'type' => 'xsd:string'),
'supplier_code_accountancy' => array('name' => 'supplier_code_accountancy', 'type' => 'xsd:string'),
'date_creation' => array('name' => 'date_creation', 'type' => 'xsd:dateTime'),
'date_modification' => array('name' => 'date_modification', 'type' => 'xsd:dateTime'),
'note_private' => array('name' => 'note_private', 'type' => 'xsd:string'),
'note_public' => array('name' => 'note_public', 'type' => 'xsd:string'),
'address' => array('name' => 'address', 'type' => 'xsd:string'),
'zip' => array('name' => 'zip', 'type' => 'xsd:string'),
'town' => array('name' => 'town', 'type' => 'xsd:string'),
'region_code' => array('name' => 'region_code', 'type' => 'xsd:string'),
'country_id' => array('name' => 'country_id', 'type' => 'xsd:string'),
'country_code' => array('name' => 'country_code', 'type' => 'xsd:string'),
'country' => array('name' => 'country', 'type' => 'xsd:string'),
'phone' => array('name' => 'phone', 'type' => 'xsd:string'),
'fax' => array('name' => 'fax', 'type' => 'xsd:string'),
'email' => array('name' => 'email', 'type' => 'xsd:string'),
'url' => array('name' => 'url', 'type' => 'xsd:string'),
'profid1' => array('name' => 'profid1', 'type' => 'xsd:string'),
'profid2' => array('name' => 'profid2', 'type' => 'xsd:string'),
'profid3' => array('name' => 'profid3', 'type' => 'xsd:string'),
'profid4' => array('name' => 'profid4', 'type' => 'xsd:string'),
'profid5' => array('name' => 'profid5', 'type' => 'xsd:string'),
'profid6' => array('name' => 'profid6', 'type' => 'xsd:string'),
'capital' => array('name' => 'capital', 'type' => 'xsd:string'),
'vat_used' => array('name' => 'vat_used', 'type' => 'xsd:string'),
'vat_number' => array('name' => 'vat_number', 'type' => 'xsd:string'));
$elementtype = 'societe';
@@ -159,7 +160,7 @@ if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafie
$type = 'xsd:string';
}
$extrafield_array['options_'.$key] = array('name'=>'options_'.$key, 'type'=>$type);
$extrafield_array['options_'.$key] = array('name' => 'options_'.$key, 'type' => $type);
}
}
@@ -186,9 +187,9 @@ $server->wsdl->addComplexType(
'',
array(
//'limit' => array('name'=>'limit','type'=>'xsd:string'),
'client' => array('name'=>'client', 'type'=>'xsd:string'),
'supplier' => array('name'=>'supplier', 'type'=>'xsd:string'),
'category' => array('name'=>'category', 'type'=>'xsd:string')
'client' => array('name' => 'client', 'type' => 'xsd:string'),
'supplier' => array('name' => 'supplier', 'type' => 'xsd:string'),
'category' => array('name' => 'category', 'type' => 'xsd:string')
)
);
@@ -200,7 +201,7 @@ $server->wsdl->addComplexType(
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:thirdparty[]')
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:thirdparty[]')
),
'tns:thirdparty'
);
@@ -232,9 +233,9 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register(
'getThirdParty',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'barcode'=>'xsd:string', 'profid1'=>'xsd:string', 'profid2'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string', 'barcode' => 'xsd:string', 'profid1' => 'xsd:string', 'profid2' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'thirdparty'=>'tns:thirdparty'),
array('result' => 'tns:result', 'thirdparty' => 'tns:thirdparty'),
$ns,
$ns.'#getThirdParty',
$styledoc,
@@ -246,9 +247,9 @@ $server->register(
$server->register(
'createThirdParty',
// Entry values
array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'),
array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string', 'ref'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string', 'ref' => 'xsd:string'),
$ns,
$ns.'#createThirdParty',
$styledoc,
@@ -260,9 +261,9 @@ $server->register(
$server->register(
'updateThirdParty',
// Entry values
array('authentication'=>'tns:authentication', 'thirdparty'=>'tns:thirdparty'),
array('authentication' => 'tns:authentication', 'thirdparty' => 'tns:thirdparty'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#updateThirdParty',
$styledoc,
@@ -275,9 +276,9 @@ $server->register(
$server->register(
'getListOfThirdParties',
// Entry values
array('authentication'=>'tns:authentication', 'filterthirdparty'=>'tns:filterthirdparty'),
array('authentication' => 'tns:authentication', 'filterthirdparty' => 'tns:filterthirdparty'),
// Exit values
array('result'=>'tns:result', 'thirdparties'=>'tns:ThirdPartiesArray2'),
array('result' => 'tns:result', 'thirdparties' => 'tns:ThirdPartiesArray2'),
$ns,
$ns.'#getListOfThirdParties',
$styledoc,
@@ -289,9 +290,9 @@ $server->register(
$server->register(
'deleteThirdParty',
// Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'),
array('authentication' => 'tns:authentication', 'id' => 'xsd:string', 'ref' => 'xsd:string', 'ref_ext' => 'xsd:string'),
// Exit values
array('result'=>'tns:result', 'id'=>'xsd:string'),
array('result' => 'tns:result', 'id' => 'xsd:string'),
$ns,
$ns.'#deleteThirdParty',
$styledoc,
@@ -401,8 +402,8 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'thirdparty'=>$thirdparty_result_fields);
'result' => array('result_code' => 'OK', 'result_label' => ''),
'thirdparty' => $thirdparty_result_fields);
} elseif ($result == -2) {
$error++;
$errorcode = 'DUPLICATE_FOUND';
@@ -420,7 +421,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -544,7 +545,7 @@ function createThirdParty($authentication, $thirdparty)
$newobject->add_commercial($fuser, $thirdparty["commid"]);
}
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref);
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'id' => $newobject->id, 'ref' => $newobject->ref);
} else {
$db->rollback();
$error++;
@@ -554,7 +555,7 @@ function createThirdParty($authentication, $thirdparty)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -669,11 +670,13 @@ function updateThirdParty($authentication, $thirdparty)
}
}
'@phan-var-force array{id:string} $thirdparty';
if ((!$error) && ($objectfound)) {
$db->commit();
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'id'=>$object->id
'result' => array('result_code' => 'OK', 'result_label' => ''),
'id' => $object->id
);
} elseif ($objectfound) {
$db->rollback();
@@ -688,7 +691,7 @@ function updateThirdParty($authentication, $thirdparty)
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
@@ -769,16 +772,16 @@ function getListOfThirdParties($authentication, $filterthirdparty)
}
}
$arraythirdparties[] = array('id'=>$obj->socRowid,
'ref'=>$obj->ref,
'ref_ext'=>$obj->ref_ext,
'address'=>$obj->address,
'zip'=>$obj->zip,
'town'=>$obj->town,
'country'=>$obj->country,
'phone'=>$obj->phone,
'fax'=>$obj->fax,
'url'=>$obj->url
$arraythirdparties[] = array('id' => $obj->socRowid,
'ref' => $obj->ref,
'ref_ext' => $obj->ref_ext,
'address' => $obj->address,
'zip' => $obj->zip,
'town' => $obj->town,
'country' => $obj->country,
'phone' => $obj->phone,
'fax' => $obj->fax,
'url' => $obj->url
);
$arraythirdparties[$i] = array_merge($arraythirdparties[$i], $extrafieldsOptions);
@@ -793,13 +796,13 @@ function getListOfThirdParties($authentication, $filterthirdparty)
if ($error) {
$objectresp = array(
'result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel),
'thirdparties'=>$arraythirdparties
'result' => array('result_code' => $errorcode, 'result_label' => $errorlabel),
'thirdparties' => $arraythirdparties
);
} else {
$objectresp = array(
'result'=>array('result_code' => 'OK', 'result_label' => ''),
'thirdparties'=>$arraythirdparties
'result' => array('result_code' => 'OK', 'result_label' => ''),
'thirdparties' => $arraythirdparties
);
}
@@ -855,7 +858,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
if ($result > 0) {
$db->commit();
$objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''));
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''));
} else {
$db->rollback();
$error++;
@@ -876,7 +879,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
}
if ($error) {
$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel));
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;