Преглед изворни кода

Fix test if empty was inverted

Laurent Destailleur пре 10 година
родитељ
комит
9a6e13d253

+ 1 - 1
htdocs/core/lib/functions.lib.php

@@ -3743,7 +3743,7 @@ function yn($yesno, $case=1, $color=0)
  *
  *	@param	string	$num            Id of object
  *	@param  int		$level		    Level of subdirs to return (1, 2 or 3 levels)
- * 	@param	int		$alpha		    Use alpha ref
+ * 	@param	int		$alpha		    0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0).
  *  @param  int		$withoutslash   0=With slash at end, 1=without slash at end (except if '/', we return '')
  *  @param	Object	$object			Object
  *  @param	string	$modulepart		Type of object ('invoice_supplier, 'donation', 'invoice', ...')

+ 7 - 6
htdocs/fourn/class/fournisseur.facture.class.php

@@ -1151,7 +1151,7 @@ class FactureFournisseur extends CommonInvoice
         if (empty($txtva)) $txtva=0;
         if (empty($txlocaltax1)) $txlocaltax1=0;
         if (empty($txlocaltax2)) $txlocaltax2=0;
-
+        
         $remise_percent=price2num($remise_percent);
         $qty=price2num($qty);
         $pu=price2num($pu);
@@ -1197,7 +1197,7 @@ class FactureFournisseur extends CommonInvoice
             }
             else
             {
-                dol_syslog("Error error=".$this->error, LOG_ERR);
+                dol_syslog("Error after updateline error=".$this->error, LOG_ERR);
                 $this->db->rollback();
                 return -1;
             }
@@ -2096,16 +2096,17 @@ class SupplierInvoiceLine extends CommonObjectLine
 
 		$this->db->begin();
 
-		if ($this->fk_product) {
+		if (empty($this->fk_product))
+		{
 			$fk_product = "null";
 		} else {
 			$fk_product = $this->fk_product;
 		}
 
-		if ($this->fk_unit) {
-			$fk_unit = "'".$this->db->escape($this->fk_unit)."'";
-		} else {
+		if (empty($this->fk_unit)) {
 			$fk_unit = "null";
+		} else {
+		    $fk_unit = "'".$this->db->escape($this->fk_unit)."'";
 		}
 
 		$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";