test phpcs v3
This commit is contained in:
parent
b00164ca39
commit
62b83412ee
@ -185,9 +185,9 @@ class Orders extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
function post($request_data = null)
|
function post($request_data = null)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401, "Insuffisant rights");
|
throw new RestException(401, "Insuffisant rights");
|
||||||
}
|
}
|
||||||
// Check mandatory fields
|
// Check mandatory fields
|
||||||
$result = $this->_validate($request_data);
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
@ -219,24 +219,24 @@ class Orders extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLines($id) {
|
function getLines($id) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$this->commande->getLinesArray();
|
$this->commande->getLinesArray();
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($this->commande->lines as $line) {
|
foreach ($this->commande->lines as $line) {
|
||||||
array_push($result,$this->_cleanObjectDatas($line));
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,20 +250,20 @@ class Orders extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function postLine($id, $request_data = null) {
|
function postLine($id, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->addline(
|
$updateRes = $this->commande->addline(
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
$request_data->qty,
|
$request_data->qty,
|
||||||
@ -290,15 +290,14 @@ class Orders extends DolibarrApi
|
|||||||
$request_data->origin,
|
$request_data->origin,
|
||||||
$request_data->origin_id,
|
$request_data->origin_id,
|
||||||
$request_data->multicurrency_subprice
|
$request_data->multicurrency_subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $updateRes;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new RestException(400, $this->commande->error);
|
throw new RestException(400, $this->commande->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -313,50 +312,50 @@ class Orders extends DolibarrApi
|
|||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function putLine($id, $lineid, $request_data = null) {
|
function putLine($id, $lineid, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->commande->updateline(
|
$updateRes = $this->commande->updateline(
|
||||||
$lineid,
|
$lineid,
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
$request_data->qty,
|
$request_data->qty,
|
||||||
$request_data->remise_percent,
|
$request_data->remise_percent,
|
||||||
$request_data->tva_tx,
|
$request_data->tva_tx,
|
||||||
$request_data->localtax1_tx,
|
$request_data->localtax1_tx,
|
||||||
$request_data->localtax2_tx,
|
$request_data->localtax2_tx,
|
||||||
'HT',
|
'HT',
|
||||||
$request_data->info_bits,
|
$request_data->info_bits,
|
||||||
$request_data->date_start,
|
$request_data->date_start,
|
||||||
$request_data->date_end,
|
$request_data->date_end,
|
||||||
$request_data->product_type,
|
$request_data->product_type,
|
||||||
$request_data->fk_parent_line,
|
$request_data->fk_parent_line,
|
||||||
0,
|
0,
|
||||||
$request_data->fk_fournprice,
|
$request_data->fk_fournprice,
|
||||||
$request_data->pa_ht,
|
$request_data->pa_ht,
|
||||||
$request_data->label,
|
$request_data->label,
|
||||||
$request_data->special_code,
|
$request_data->special_code,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$request_data->multicurrency_subprice
|
$request_data->multicurrency_subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
$result = $this->get($id);
|
$result = $this->get($id);
|
||||||
unset($result->line);
|
unset($result->line);
|
||||||
return $this->_cleanObjectDatas($result);
|
return $this->_cleanObjectDatas($result);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,29 +372,27 @@ class Orders extends DolibarrApi
|
|||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function deleteLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Check the lineid $lineid is a line of ojbect
|
// TODO Check the lineid $lineid is a line of ojbect
|
||||||
|
|
||||||
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
} else {
|
||||||
else
|
throw new RestException(405, $this->commande->error);
|
||||||
{
|
}
|
||||||
throw new RestException(405, $this->commande->error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -407,9 +404,9 @@ class Orders extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = null) {
|
function put($id, $request_data = null) {
|
||||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
@ -550,21 +547,21 @@ class Orders extends DolibarrApi
|
|||||||
function reopen($id) {
|
function reopen($id) {
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
throw new RestException(400, 'Order ID is mandatory');
|
throw new RestException(400, 'Order ID is mandatory');
|
||||||
}
|
}
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->set_reopen(DolibarrApiAccess::$user);
|
$result = $this->commande->set_reopen(DolibarrApiAccess::$user);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $this->commande->error);
|
throw new RestException(405, $this->commande->error);
|
||||||
}else if( $result == 0) {
|
}else if( $result == 0) {
|
||||||
throw new RestException(304);
|
throw new RestException(304);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -587,19 +584,19 @@ class Orders extends DolibarrApi
|
|||||||
function setinvoiced($id) {
|
function setinvoiced($id) {
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
throw new RestException(400, 'Order ID is mandatory');
|
throw new RestException(400, 'Order ID is mandatory');
|
||||||
}
|
}
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->classifyBilled(DolibarrApiAccess::$user);
|
$result = $this->commande->classifyBilled(DolibarrApiAccess::$user);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(400, $this->commande->error);
|
throw new RestException(400, $this->commande->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
@ -675,23 +672,23 @@ class Orders extends DolibarrApi
|
|||||||
function settodraft($id, $idwarehouse=-1)
|
function settodraft($id, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->set_draft(DolibarrApiAccess::$user, $idwarehouse);
|
$result = $this->commande->set_draft(DolibarrApiAccess::$user, $idwarehouse);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Nothing done. May be object is already closed');
|
throw new RestException(304, 'Nothing done. May be object is already closed');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error when closing Order: '.$this->commande->error);
|
throw new RestException(500, 'Error when closing Order: '.$this->commande->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
@ -728,24 +725,24 @@ class Orders extends DolibarrApi
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($proposalid)) {
|
if(empty($proposalid)) {
|
||||||
throw new RestException(400, 'Proposal ID is mandatory');
|
throw new RestException(400, 'Proposal ID is mandatory');
|
||||||
}
|
}
|
||||||
|
|
||||||
$propal = new Propal($this->db);
|
$propal = new Propal($this->db);
|
||||||
$result = $propal->fetch($proposalid);
|
$result = $propal->fetch($proposalid);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Proposal not found');
|
throw new RestException(404, 'Proposal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->createFromProposal($propal, DolibarrApiAccess::$user);
|
$result = $this->commande->createFromProposal($propal, DolibarrApiAccess::$user);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $this->commande->error);
|
throw new RestException(405, $this->commande->error);
|
||||||
}
|
}
|
||||||
$this->commande->fetchObjectLinked();
|
$this->commande->fetchObjectLinked();
|
||||||
|
|
||||||
@ -785,7 +782,7 @@ class Orders extends DolibarrApi
|
|||||||
$commande = array();
|
$commande = array();
|
||||||
foreach (Orders::$FIELDS as $field) {
|
foreach (Orders::$FIELDS as $field) {
|
||||||
if (!isset($data[$field]))
|
if (!isset($data[$field]))
|
||||||
throw new RestException(400, "$field field missing");
|
throw new RestException(400, $field ." field missing");
|
||||||
$commande[$field] = $data[$field];
|
$commande[$field] = $data[$field];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -250,24 +250,24 @@ class Invoices extends DolibarrApi
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($orderid)) {
|
if(empty($orderid)) {
|
||||||
throw new RestException(400, 'Order ID is mandatory');
|
throw new RestException(400, 'Order ID is mandatory');
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = new Commande($this->db);
|
$order = new Commande($this->db);
|
||||||
$result = $order->fetch($orderid);
|
$result = $order->fetch($orderid);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->createFromOrder($order, DolibarrApiAccess::$user);
|
$result = $this->invoice->createFromOrder($order, DolibarrApiAccess::$user);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $this->invoice->error);
|
throw new RestException(405, $this->invoice->error);
|
||||||
}
|
}
|
||||||
$this->invoice->fetchObjectLinked();
|
$this->invoice->fetchObjectLinked();
|
||||||
return $this->_cleanObjectDatas($this->invoice);
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
@ -512,66 +512,66 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws 400
|
* @throws 400
|
||||||
*/
|
*/
|
||||||
function postLine($id, $request_data = null) {
|
function postLine($id, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
// Reset fk_parent_line for no child products and special product
|
// Reset fk_parent_line for no child products and special product
|
||||||
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
|
if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) {
|
||||||
$request_data->fk_parent_line = 0;
|
$request_data->fk_parent_line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate pa_ht
|
// calculate pa_ht
|
||||||
$marginInfos = getMarginInfos($request_data->subprice, $request_data->remise_percent, $request_data->tva_tx, $request_data->localtax1_tx, $request_data->localtax2_tx, $request_data->fk_fournprice, $request_data->pa_ht);
|
$marginInfos = getMarginInfos($request_data->subprice, $request_data->remise_percent, $request_data->tva_tx, $request_data->localtax1_tx, $request_data->localtax2_tx, $request_data->fk_fournprice, $request_data->pa_ht);
|
||||||
$pa_ht = $marginInfos[0];
|
$pa_ht = $marginInfos[0];
|
||||||
|
|
||||||
$updateRes = $this->invoice->addline(
|
$updateRes = $this->invoice->addline(
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
$request_data->qty,
|
$request_data->qty,
|
||||||
$request_data->tva_tx,
|
$request_data->tva_tx,
|
||||||
$request_data->localtax1_tx,
|
$request_data->localtax1_tx,
|
||||||
$request_data->localtax2_tx,
|
$request_data->localtax2_tx,
|
||||||
$request_data->fk_product,
|
$request_data->fk_product,
|
||||||
$request_data->remise_percent,
|
$request_data->remise_percent,
|
||||||
$request_data->date_start,
|
$request_data->date_start,
|
||||||
$request_data->date_end,
|
$request_data->date_end,
|
||||||
$request_data->fk_code_ventilation,
|
$request_data->fk_code_ventilation,
|
||||||
$request_data->info_bits,
|
$request_data->info_bits,
|
||||||
$request_data->fk_remise_except,
|
$request_data->fk_remise_except,
|
||||||
'HT',
|
'HT',
|
||||||
0,
|
0,
|
||||||
$request_data->product_type,
|
$request_data->product_type,
|
||||||
$request_data->rang,
|
$request_data->rang,
|
||||||
$request_data->special_code,
|
$request_data->special_code,
|
||||||
$request_data->origin,
|
$request_data->origin,
|
||||||
$request_data->origin_id,
|
$request_data->origin_id,
|
||||||
$request_data->fk_parent_line,
|
$request_data->fk_parent_line,
|
||||||
empty($request_data->fk_fournprice)?null:$request_data->fk_fournprice,
|
empty($request_data->fk_fournprice)?null:$request_data->fk_fournprice,
|
||||||
$pa_ht,
|
$pa_ht,
|
||||||
$request_data->label,
|
$request_data->label,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->situation_percent,
|
$request_data->situation_percent,
|
||||||
$request_data->fk_prev_id,
|
$request_data->fk_prev_id,
|
||||||
$request_data->fk_unit
|
$request_data->fk_unit
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes < 0) {
|
if ($updateRes < 0) {
|
||||||
throw new RestException(400, 'Unable to insert the new line. Check your inputs. '.$this->invoice->error);
|
throw new RestException(400, 'Unable to insert the new line. Check your inputs. '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $updateRes;
|
return $updateRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -647,23 +647,23 @@ class Invoices extends DolibarrApi
|
|||||||
function settodraft($id, $idwarehouse=-1)
|
function settodraft($id, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->set_draft(DolibarrApiAccess::$user, $idwarehouse);
|
$result = $this->invoice->set_draft(DolibarrApiAccess::$user, $idwarehouse);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Nothing done.');
|
throw new RestException(304, 'Nothing done.');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error : '.$this->invoice->error);
|
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
@ -750,23 +750,23 @@ class Invoices extends DolibarrApi
|
|||||||
function settopaid($id, $close_code='', $close_note='')
|
function settopaid($id, $close_code='', $close_note='')
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
|
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error : '.$this->invoice->error);
|
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -801,23 +801,23 @@ class Invoices extends DolibarrApi
|
|||||||
function settounpaid($id)
|
function settounpaid($id)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->set_unpaid(DolibarrApiAccess::$user);
|
$result = $this->invoice->set_unpaid(DolibarrApiAccess::$user);
|
||||||
if ($result == 0) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Nothing done');
|
throw new RestException(304, 'Nothing done');
|
||||||
}
|
}
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500, 'Error : '.$this->invoice->error);
|
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -852,27 +852,27 @@ class Invoices extends DolibarrApi
|
|||||||
function useDiscount($id, $discountid) {
|
function useDiscount($id, $discountid) {
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
throw new RestException(400, 'Invoice ID is mandatory');
|
throw new RestException(400, 'Invoice ID is mandatory');
|
||||||
}
|
}
|
||||||
if(empty($discountid)) {
|
if(empty($discountid)) {
|
||||||
throw new RestException(400, 'Discount ID is mandatory');
|
throw new RestException(400, 'Discount ID is mandatory');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->insert_discount($discountid);
|
$result = $this->invoice->insert_discount($discountid);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $this->invoice->error);
|
throw new RestException(405, $this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -899,27 +899,27 @@ class Invoices extends DolibarrApi
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
throw new RestException(400, 'Invoice ID is mandatory');
|
throw new RestException(400, 'Invoice ID is mandatory');
|
||||||
}
|
}
|
||||||
if(empty($discountid)) {
|
if(empty($discountid)) {
|
||||||
throw new RestException(400, 'Credit ID is mandatory');
|
throw new RestException(400, 'Credit ID is mandatory');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$discount = new DiscountAbsolute($this->db);
|
$discount = new DiscountAbsolute($this->db);
|
||||||
$result = $discount->fetch($discountid);
|
$result = $discount->fetch($discountid);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Credit not found');
|
throw new RestException(404, 'Credit not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $discount->link_to_invoice(0, $id);
|
$result = $discount->link_to_invoice(0, $id);
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $discount->error);
|
throw new RestException(405, $discount->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -941,24 +941,24 @@ class Invoices extends DolibarrApi
|
|||||||
function getPayments($id) {
|
function getPayments($id) {
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
throw new RestException(400, 'Invoice ID is mandatory');
|
throw new RestException(400, 'Invoice ID is mandatory');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
$result = $this->invoice->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Invoice not found');
|
throw new RestException(404, 'Invoice not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->invoice->getListOfPayments();
|
$result = $this->invoice->getListOfPayments();
|
||||||
if( $result < 0) {
|
if( $result < 0) {
|
||||||
throw new RestException(405, $this->invoice->error);
|
throw new RestException(405, $this->invoice->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -1111,7 +1111,7 @@ class Invoices extends DolibarrApi
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
throw new RestException(403);
|
throw new RestException(403);
|
||||||
}
|
}
|
||||||
foreach($arrayofamounts as $id => $amount) {
|
foreach($arrayofamounts as $id => $amount) {
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
|
|||||||
@ -248,45 +248,45 @@ class Contracts extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function postLine($id, $request_data = null) {
|
function postLine($id, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->contract->fetch($id);
|
$result = $this->contract->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Contract not found');
|
throw new RestException(404, 'Contract not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
$request_data = (object) $request_data;
|
$request_data = (object) $request_data;
|
||||||
$updateRes = $this->contract->addline(
|
$updateRes = $this->contract->addline(
|
||||||
$request_data->desc,
|
$request_data->desc,
|
||||||
$request_data->subprice,
|
$request_data->subprice,
|
||||||
$request_data->qty,
|
$request_data->qty,
|
||||||
$request_data->tva_tx,
|
$request_data->tva_tx,
|
||||||
$request_data->localtax1_tx,
|
$request_data->localtax1_tx,
|
||||||
$request_data->localtax2_tx,
|
$request_data->localtax2_tx,
|
||||||
$request_data->fk_product,
|
$request_data->fk_product,
|
||||||
$request_data->remise_percent,
|
$request_data->remise_percent,
|
||||||
$request_data->date_start, // date_start = date planned start, date ouverture = date_start_real
|
$request_data->date_start, // date_start = date planned start, date ouverture = date_start_real
|
||||||
$request_data->date_end, // date_end = date planned end, date_cloture = date_end_real
|
$request_data->date_end, // date_end = date planned end, date_cloture = date_end_real
|
||||||
$request_data->HT,
|
$request_data->HT,
|
||||||
$request_data->subprice_excl_tax,
|
$request_data->subprice_excl_tax,
|
||||||
$request_data->info_bits,
|
$request_data->info_bits,
|
||||||
$request_data->fk_fournprice,
|
$request_data->fk_fournprice,
|
||||||
$request_data->pa_ht,
|
$request_data->pa_ht,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$request_data->rang
|
$request_data->rang
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $updateRes;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -301,49 +301,49 @@ class Contracts extends DolibarrApi
|
|||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function putLine($id, $lineid, $request_data = null) {
|
function putLine($id, $lineid, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->contract->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'Contrat not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_data = (object) $request_data;
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
$updateRes = $this->contract->updateline(
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
$lineid,
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
$request_data->desc,
|
}
|
||||||
$request_data->subprice,
|
|
||||||
$request_data->qty,
|
|
||||||
$request_data->remise_percent,
|
|
||||||
$request_data->date_ouveture_prevue,
|
|
||||||
$request_data->date_fin_validite,
|
|
||||||
$request_data->tva_tx,
|
|
||||||
$request_data->localtax1_tx,
|
|
||||||
$request_data->localtax2_tx,
|
|
||||||
$request_data->date_ouverture,
|
|
||||||
$request_data->date_cloture,
|
|
||||||
'HT',
|
|
||||||
$request_data->info_bits,
|
|
||||||
$request_data->fk_fourn_price,
|
|
||||||
$request_data->pa_ht,
|
|
||||||
$request_data->array_options,
|
|
||||||
$request_data->fk_unit
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
$request_data = (object) $request_data;
|
||||||
$result = $this->get($id);
|
|
||||||
unset($result->line);
|
|
||||||
return $this->_cleanObjectDatas($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
$updateRes = $this->contract->updateline(
|
||||||
|
$lineid,
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_ouveture_prevue,
|
||||||
|
$request_data->date_fin_validite,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
$request_data->date_ouverture,
|
||||||
|
$request_data->date_cloture,
|
||||||
|
'HT',
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->fk_fourn_price,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->fk_unit
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
$result = $this->get($id);
|
||||||
|
unset($result->line);
|
||||||
|
return $this->_cleanObjectDatas($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -437,29 +437,29 @@ class Contracts extends DolibarrApi
|
|||||||
* @throws 404
|
* @throws 404
|
||||||
*/
|
*/
|
||||||
function deleteLine($id, $lineid) {
|
function deleteLine($id, $lineid) {
|
||||||
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->contract->fetch($id);
|
$result = $this->contract->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Contrat not found');
|
throw new RestException(404, 'Contrat not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Check the lineid $lineid is a line of ojbect
|
// TODO Check the lineid $lineid is a line of ojbect
|
||||||
|
|
||||||
$updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user);
|
$updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user);
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new RestException(405, $this->contract->error);
|
throw new RestException(405, $this->contract->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -471,9 +471,9 @@ class Contracts extends DolibarrApi
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function put($id, $request_data = null) {
|
function put($id, $request_data = null) {
|
||||||
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->contract->fetch($id);
|
$result = $this->contract->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
|
|||||||
@ -503,19 +503,19 @@ if (! empty($force_install_message))
|
|||||||
name="db_pass_root"
|
name="db_pass_root"
|
||||||
class="needroot"
|
class="needroot"
|
||||||
value="<?php
|
value="<?php
|
||||||
// If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1.
|
// If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1.
|
||||||
$autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : @$db_pass_root);
|
$autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : @$db_pass_root);
|
||||||
if (!empty($dolibarr_main_prod)) {
|
if (!empty($dolibarr_main_prod)) {
|
||||||
$autofill = '';
|
$autofill = '';
|
||||||
}
|
}
|
||||||
// Do not autofill password if instance is a production instance
|
// Do not autofill password if instance is a production instance
|
||||||
if (!empty($_SERVER["SERVER_NAME"]) && !in_array($_SERVER["SERVER_NAME"],
|
if (!empty($_SERVER["SERVER_NAME"]) && !in_array($_SERVER["SERVER_NAME"],
|
||||||
array('127.0.0.1', 'localhost', 'localhostgit'))
|
array('127.0.0.1', 'localhost', 'localhostgit'))
|
||||||
) {
|
) {
|
||||||
$autofill = '';
|
$autofill = '';
|
||||||
} // Do not autofill password for remote access
|
} // Do not autofill password for remote access
|
||||||
print dol_escape_htmltag($autofill);
|
print dol_escape_htmltag($autofill);
|
||||||
?>"
|
?>"
|
||||||
<?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootpass)) {
|
<?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootpass)) {
|
||||||
print ' disabled'; // May be removed by javascript
|
print ' disabled'; // May be removed by javascript
|
||||||
} ?>
|
} ?>
|
||||||
|
|||||||
@ -1453,7 +1453,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
|||||||
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
|
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
|
||||||
* @param string $helppagename Name of wiki page for help ('' by default).
|
* @param string $helppagename Name of wiki page for help ('' by default).
|
||||||
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
|
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
|
||||||
* For other external page: http://server/url
|
* For other external page: http://server/url
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $helppagename='')
|
function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $helppagename='')
|
||||||
@ -2071,4 +2071,3 @@ if (! function_exists("llxFooter"))
|
|||||||
print "</html>\n";
|
print "</html>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user