Merge pull request #9227 from frederic34/phpcsv3

Upgrade Phpcs to v3
This commit is contained in:
Laurent Destailleur 2018-08-12 17:47:12 +02:00 committed by GitHub
commit 3835749b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 501 additions and 521 deletions

View File

@ -133,7 +133,7 @@ install:
- | - |
echo "Installing PHP CodeSniffer" echo "Installing PHP CodeSniffer"
composer -n require squizlabs/php_codesniffer ^2 composer -n require squizlabs/php_codesniffer ^3
echo echo
- | - |
@ -384,4 +384,3 @@ after_failure:
# TODO: PostgreSQL log file # TODO: PostgreSQL log file
echo echo
fi fi

View File

@ -4,6 +4,7 @@
<description>Dolibarr coding standard.</description> <description>Dolibarr coding standard.</description>
<exclude-pattern type="relative">build/html</exclude-pattern> <exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern> <exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern> <exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern type="relative">htdocs/includes</exclude-pattern> <exclude-pattern type="relative">htdocs/includes</exclude-pattern>
@ -24,30 +25,15 @@
<!-- Rules from Generic Standard --> <!-- Rules from Generic Standard -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" /> <rule ref="Generic.CodeAnalysis.EmptyStatement">
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedCATCH"> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedElse"/>
<severity>0</severity> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedElseif"/>
</rule> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedFOREACH"> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedForeach"/>
<severity>0</severity> <exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowed"/>
</rule> <exclude name="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning"/>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedIF"> </rule>
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedELSE">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedELSEIF">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowed">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowedWarning">
<severity>0</severity>
</rule>
<!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> --> <!-- <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" /> -->
@ -363,6 +349,9 @@
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps"> <rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore"> <rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
<severity>0</severity> <severity>0</severity>
</rule> </rule>

View File

@ -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];
} }

View File

@ -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)) {

View File

@ -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 ) {

View File

@ -196,7 +196,7 @@ interface Database
* *
* @param string $query SQL query string * @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer * @return resource Resultset of answer
*/ */

View File

@ -21,10 +21,10 @@
/* Enable jcrop plugin onto id cropbox */ /* Enable jcrop plugin onto id cropbox */
jQuery(function() { jQuery(function() {
jQuery('#cropbox').Jcrop({ jQuery('#cropbox').Jcrop({
onSelect: updateCoords, onSelect: updateCoords,
onChange: updateCoords onChange: updateCoords
}); });
}); });
/* Update fields that store new size */ /* Update fields that store new size */

View File

@ -35,12 +35,12 @@
* @param string $urloption More parameters on URL request * @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value * @param int $autoselect Automatic selection if just one value
* @param array $ajaxoptions Multiple options array * @param array $ajaxoptions Multiple options array
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done * - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* Ex: array('disabled'=> ) * - Ex: array('disabled'=> )
* Ex: array('show'=> ) * - Ex: array('show'=> )
* Ex: array('update_textarea'=> ) * - Ex: array('update_textarea'=> )
* Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
* @return string Script * @return string Script
*/ */
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
@ -622,4 +622,3 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=a
return $out; return $out;
} }

View File

@ -162,15 +162,15 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
* *
* @param int $iSecond Number of seconds * @param int $iSecond Number of seconds
* @param string $format Output format ('all': total delay days hour:min like "2 days 12:30", * @param string $format Output format ('all': total delay days hour:min like "2 days 12:30",
* 'allwithouthour': total delay days without hour part like "2 days", * - 'allwithouthour': total delay days without hour part like "2 days",
* 'allhourmin': total delay with format hours:min like "60:30", * - 'allhourmin': total delay with format hours:min like "60:30",
* 'allhour': total delay hours without min/sec like "60:30", * - 'allhour': total delay hours without min/sec like "60:30",
* 'fullhour': total delay hour decimal like "60.5" for 60:30, * - 'fullhour': total delay hour decimal like "60.5" for 60:30,
* 'hour': only hours part "12", * - 'hour': only hours part "12",
* 'min': only minutes part "30", * - 'min': only minutes part "30",
* 'sec': only seconds part, * - 'sec': only seconds part,
* 'month': only month part, * - 'month': only month part,
* 'year': only year part); * - 'year': only year part);
* @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour)
* @param int $lengthOfWeek Length of week (default 7) * @param int $lengthOfWeek Length of week (default 7)
* @return string Formated text of duration * @return string Formated text of duration
@ -964,4 +964,3 @@ function monthArray($outputlangs,$short=0)
return $montharray; return $montharray;
} }

View File

@ -253,19 +253,19 @@ function GETPOSTISSET($paramname)
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] * Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
* Note: The property $user->default_values is loaded by main.php when loading the user. * Note: The property $user->default_values is loaded by main.php when loading the user.
* *
* @param string $paramname Name of parameter to found * @param string $paramname Name of parameter to found
* @param string $check Type of check * @param string $check Type of check
* ''=no check (deprecated) * ''=no check (deprecated)
* 'none'=no check (only for param that should have very rich content) * 'none'=no check (only for param that should have very rich content)
* 'int'=check it's numeric (integer or float) * 'int'=check it's numeric (integer or float)
* 'intcomma'=check it's integer+comma ('1,2,3,4...') * 'intcomma'=check it's integer+comma ('1,2,3,4...')
* 'alpha'=check it's text and sign * 'alpha'=check it's text and sign
* 'aZ'=check it's a-z only * 'aZ'=check it's a-z only
* 'aZ09'=check it's simple alpha string (recommended for keys) * 'aZ09'=check it's simple alpha string (recommended for keys)
* 'array'=check it's array * 'array'=check it's array
* 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) * 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
* 'nohtml', 'alphanohtml'=check there is no html content * 'nohtml', 'alphanohtml'=check there is no html content
* 'custom'= custom filter specify $filter and $options) * 'custom'= custom filter specify $filter and $options)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
* @param mixed $options Options to pass to filter_var when $check is set to 'custom' * @param mixed $options Options to pass to filter_var when $check is set to 'custom'
@ -7174,11 +7174,11 @@ function dol_getmypid()
/** /**
* Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields) * Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
* *
* @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR). Example: array("p.field1","p.field2") * @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR). Example: array("p.field1","p.field2")
* @param string $value The value to look for. * @param string $value The value to look for.
* If param $mode is 0, can contains several keywords separated with a space or | * If param $mode is 0, can contains several keywords separated with a space or |
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2 * like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2 * or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
* If param $mode is 2, can contains a list of int id separated by comma like "1,3,4" * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
* If param $mode is 3, can contains a list of string separated by comma like "a,b,c" * If param $mode is 3, can contains a list of string separated by comma like "a,b,c"

View File

@ -377,8 +377,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
* *
* @param array $array_sql SQL requests to be executed when enabling module * @param array $array_sql SQL requests to be executed when enabling module
* @param string $options String with options when disabling module: * @param string $options String with options when disabling module:
* 'noboxes' = Do not insert boxes * - 'noboxes' = Do not insert boxes
* 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation * - 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation
* *
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
@ -468,7 +468,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
* *
* @param string[] $array_sql SQL requests to be executed when module is disabled * @param string[] $array_sql SQL requests to be executed when module is disabled
* @param string $options Options when disabling module: * @param string $options Options when disabling module:
* 'newboxdefonly|noboxes' = We don't remove boxes. * - 'newboxdefonly|noboxes' = We don't remove boxes.
* *
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */

View File

@ -803,7 +803,7 @@ class ProductFournisseur extends Product
* @param int $showsuptitle Show "Supplier" into output string * @param int $showsuptitle Show "Supplier" into output string
* @param int $maxlen Max length of name * @param int $maxlen Max length of name
* @param integer $notooltip 1=Disable tooltip * @param integer $notooltip 1=Disable tooltip
* @param array $productFournList list of ProductFournisseur objects * @param array $productFournList list of ProductFournisseur objects
* to display in table format. * to display in table format.
* @return string String with supplier price * @return string String with supplier price
*/ */
@ -850,4 +850,3 @@ class ProductFournisseur extends Product
} }
} }

View File

@ -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
} ?> } ?>

View File

@ -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='')
@ -1653,7 +1653,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
* @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''. * @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''.
* @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
* @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now. * @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now.
* @param array $menu_array_after Table of menu entries to show after entries of menu handler * @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules. * @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
@ -2071,4 +2071,3 @@ if (! function_exists("llxFooter"))
print "</html>\n"; print "</html>\n";
} }
} }

View File

@ -777,8 +777,8 @@ class MouvementStock extends CommonObject
* Create or update batch record (update table llx_product_batch). No check is done here, done by parent. * Create or update batch record (update table llx_product_batch). No check is done here, done by parent.
* *
* @param array|int $dluo Could be either * @param array|int $dluo Could be either
* - int if row id of product_batch table * - int if row id of product_batch table
* - or complete array('fk_product_stock'=>, 'batchnumber'=>) * - or complete array('fk_product_stock'=>, 'batchnumber'=>)
* @param int $qty Quantity of product with batch number. May be a negative amount. * @param int $qty Quantity of product with batch number. May be a negative amount.
* @return int <0 if KO, else return productbatch id * @return int <0 if KO, else return productbatch id
*/ */

View File

@ -199,72 +199,72 @@ if ($resql)
'</td>'. '</td>'.
'<td class="liste_titre" align="right">'; '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
'</td>'. print '</td>';
'</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( print_liste_field_titre(
'Ref', 'Ref',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.ref', 'cf.ref',
'', '',
$param, $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
'Company', 'Company',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
's.nom', 's.nom',
'', '',
$param, $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
'Author', 'Author',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'u.login', 'u.login',
'', '',
'', '',
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
'AmountTTC', 'AmountTTC',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.total_ttc', 'cf.total_ttc',
'', '',
$param, $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
'OrderCreation', 'OrderCreation',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.date_creation', 'cf.date_creation',
'', '',
$param, $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print_liste_field_titre( print_liste_field_titre(
'Status', 'Status',
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.fk_statut', 'cf.fk_statut',
'', '',
$param, $param,
'align="right"', 'align="right"',
$sortfield, $sortfield,
$sortorder $sortorder
); );
print '</tr>'; print '</tr>';
$userstatic = new User($db); $userstatic = new User($db);
@ -324,8 +324,8 @@ if ($resql)
} }
$i++; $i++;
} }
print '</table>'. print '</table>';
'</form>'; print '</form>';
$db->free($resql); $db->free($resql);
@ -337,5 +337,4 @@ else
} }
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -555,7 +555,7 @@ class Ticket extends CommonObject
* @param int $offset Offset for query * @param int $offset Offset for query
* @param int $arch archive or not (not used) * @param int $arch archive or not (not used)
* @param array $filter Filter for query * @param array $filter Filter for query
* output * output
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '') public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '')

View File

@ -92,7 +92,7 @@ $server->wsdl->addComplexType(
/* /*
* Les catégories filles, sous tableau dez la catégorie * Les catégories filles, sous tableau dez la catégorie
*/ */
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'FillesArray', 'FillesArray',
'complexType', 'complexType',
'array', 'array',
@ -108,38 +108,38 @@ $server->wsdl->addComplexType(
/* /*
* Image of product * Image of product
*/ */
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'PhotosArray', 'PhotosArray',
'complexType', 'complexType',
'array', 'array',
'sequence', 'sequence',
'', '',
array( array(
'image' => array( 'image' => array(
'name' => 'image', 'name' => 'image',
'type' => 'tns:image', 'type' => 'tns:image',
'minOccurs' => '0', 'minOccurs' => '0',
'maxOccurs' => 'unbounded' 'maxOccurs' => 'unbounded'
) )
) )
); );
/* /*
* An image * An image
*/ */
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'image', 'image',
'complexType', 'complexType',
'struct', 'struct',
'all', 'all',
'', '',
array( array(
'photo' => array('name'=>'photo','type'=>'xsd:string'), 'photo' => array('name'=>'photo','type'=>'xsd:string'),
'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'), 'photo_vignette' => array('name'=>'photo_vignette','type'=>'xsd:string'),
'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'), 'imgWidth' => array('name'=>'imgWidth','type'=>'xsd:string'),
'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string') 'imgHeight' => array('name'=>'imgHeight','type'=>'xsd:string')
) )
); );
/* /*
* Retour * Retour