Fix bug reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2017-10-07 20:21:47 +02:00
parent f89676126e
commit e40bffb0d5
6 changed files with 19 additions and 25 deletions

View File

@ -57,7 +57,7 @@ class AdherentType extends CommonObject
public $subscription; public $subscription;
/** @var string Public note */ /** @var string Public note */
public $note; public $note;
/** @var bool Can vote*/ /** @var integer Can vote */
public $vote; public $vote;
/** @var string Email sent during validation */ /** @var string Email sent during validation */
public $mail_valid; public $mail_valid;

View File

@ -68,7 +68,7 @@ class Documents extends DolibarrApi
*/ */
public function index($module_part, $original_file='', $regeneratedoc=0) public function index($module_part, $original_file='', $regeneratedoc=0)
{ {
global $conf; global $conf, $langs;
if (empty($module_part)) { if (empty($module_part)) {
throw new RestException(400, 'bad value for parameter modulepart'); throw new RestException(400, 'bad value for parameter modulepart');
@ -108,7 +108,7 @@ class Documents extends DolibarrApi
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Invoice not found'); throw new RestException(404, 'Invoice not found');
} }
$result = $this->invoice->generateDocument($this->invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $this->invoice->generateDocument($this->invoice->modelpdf, $langs, $hidedetails, $hidedesc, $hideref);
if( $result <= 0 ) { if( $result <= 0 ) {
throw new RestException(500, 'Error generating document'); throw new RestException(500, 'Error generating document');
} }

View File

@ -1306,11 +1306,8 @@ class Account extends CommonObject
} }
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if (empty($mode))
{
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
} if ($mode == 'transactions')
else if ($mode == 'transactions')
{ {
$url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id;
} }

View File

@ -1562,6 +1562,8 @@ class FichinterLigne extends CommonObjectLine
{ {
global $langs,$conf; global $langs,$conf;
$error=0;
if ($this->statut == 0) if ($this->statut == 0)
{ {
dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid); dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid);

View File

@ -1981,10 +1981,16 @@ class CommandeFournisseur extends CommonOrder
if ($user->rights->fournisseur->commande->receptionner) if ($user->rights->fournisseur->commande->receptionner)
{ {
// Define the new status
if ($type == 'par') $statut = self::STATUS_RECEIVED_PARTIALLY; if ($type == 'par') $statut = self::STATUS_RECEIVED_PARTIALLY;
if ($type == 'tot') $statut = self::STATUS_RECEIVED_COMPLETELY; elseif ($type == 'tot') $statut = self::STATUS_RECEIVED_COMPLETELY;
if ($type == 'nev') $statut = self::STATUS_CANCELED_AFTER_ORDER; elseif ($type == 'nev') $statut = self::STATUS_CANCELED_AFTER_ORDER;
if ($type == 'can') $statut = self::STATUS_CANCELED_AFTER_ORDER; elseif ($type == 'can') $statut = self::STATUS_CANCELED_AFTER_ORDER;
else {
$error++;
dol_syslog(get_class($this)."::Livraison Error -2", LOG_ERR);
return -2;
}
// Some checks to accept the record // Some checks to accept the record
if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS))
@ -2018,14 +2024,6 @@ class CommandeFournisseur extends CommonOrder
// TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty). // TODO LDR01 Add a control test to accept only if ALL predefined products are received (same qty).
// $statut is the new statut after reception
if (! $error && ! ($statut == self::STATUS_RECEIVED_PARTIALLY || $statut == self::STATUS_RECEIVED_COMPLETELY || $statut == self::STATUS_CANCELED_AFTER_ORDER))
{
$error++;
dol_syslog(get_class($this)."::Livraison Error -2", LOG_ERR);
$result = -2;
}
if (! $error) if (! $error)
{ {
$this->db->begin(); $this->db->begin();

View File

@ -3596,14 +3596,11 @@ class Product extends CommonObject
case 2: case 2:
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,1,2); return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,1,2);
case 3: case 3:
if ($status == 0 ) if ($status == 0)
{ {
return img_picto($langs->trans('ProductStatusNotOnBatch'),'statut5'); return img_picto($langs->trans('ProductStatusNotOnBatch'),'statut5');
} }
else
{
return img_picto($langs->trans('ProductStatusOnBatch'),'statut4'); return img_picto($langs->trans('ProductStatusOnBatch'),'statut4');
}
case 4: case 4:
return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,0,2); return $this->LibStatut($status,3,2).' '.$this->LibStatut($status,0,2);
case 5: case 5: