diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c5f00ca11fc..5fbb113a05d 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1464,20 +1464,23 @@ if ($step == 6 && $datatoimport) $db->begin(); // Open input file + $nbok=0; $pathfile=$conf->import->dir_temp.'/'.$filetoimport; $result=$obj->import_open_file($pathfile,$langs); if ($result > 0) { $sourcelinenb=0; // Loop on each input file record - while ($arrayrecord=$obj->import_read_record()) + while ($sourcelinenb < $nboflines) { $sourcelinenb++; + $arrayrecord=$obj->import_read_record(); if ($excludefirstline && $sourcelinenb == 1) continue; $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,sizeof($fieldssource),$importid); if (sizeof($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (sizeof($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; + if (! sizeof($obj->errors) && ! sizeof($obj->warnings)) $nbok++; } // Close file $obj->import_close_file(); @@ -1491,8 +1494,9 @@ if ($step == 6 && $datatoimport) print ''; - // If no errors and no warnings - if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' '.$langs->trans("NoErrors").'
'; + // Show OK + if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' '.$langs->trans("NoErrors").'

'; + else print $langs->trans("NbOfLinesOK",$nbok).'

'; // Show Errors //var_dump($arrayoferrors); @@ -1789,20 +1793,22 @@ if ($step == 7 && $datatoimport) $db->begin(); // Open input file + $nbok=0; $pathfile=$conf->import->dir_temp.'/'.$filetoimport; $result=$obj->import_open_file($pathfile,$langs); if ($result > 0) { $sourcelinenb=0; - // Loop on each input file record - while ($arrayrecord=$obj->import_read_record()) + while ($sourcelinenb < $nboflines) { $sourcelinenb++; + $arrayrecord=$obj->import_read_record(); if ($excludefirstline && $sourcelinenb == 1) continue; $result=$obj->import_insert($arrayrecord,$array_match_file_to_database,$objimport,sizeof($fieldssource),$importid); if (sizeof($obj->errors)) $arrayoferrors[$sourcelinenb]=$obj->errors; if (sizeof($obj->warnings)) $arrayofwarnings[$sourcelinenb]=$obj->warnings; + if (! sizeof($obj->errors) && ! sizeof($obj->warnings)) $nbok++; } // Close file $obj->import_close_file(); @@ -1817,10 +1823,10 @@ if ($step == 7 && $datatoimport) print ''; - // Show result - print '
'; print '
'; + print '
'; + print $langs->trans("NbOfLinesImported",$nbok).'

'; print $langs->trans("FileWasImported",$importid).'
'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'
'; print '
'; diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index a341b9c519d..1d45579e791 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -92,4 +92,5 @@ TooMuchWarnings=There is still %s other source lines with warnings but ou EmptyLine=Empty line (will be discarded) CorrectErrorBeforeRunningImport=You must first correct all errors before running definitive import. YouCanUseImportIdToFindRecord=You can find all imported records in your database by filtering on field import_key='%s'. - +NbOfLinesOK=Number of lines with no errors and no warnings: %s. +NbOfLinesImported=Number of lines successfully imported: %s. diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang index 2a26d978606..4996b5add43 100644 --- a/htdocs/langs/fr_FR/exports.lang +++ b/htdocs/langs/fr_FR/exports.lang @@ -93,3 +93,5 @@ EmptyLine=Ligne vide (sera ignorée) CorrectErrorBeforeRunningImport=Vous devez d'abord corriger toutes les erreurs avant de pouvoir lancer l'import définitif. FileWasImported=Le fichier a été importé sous le numéro d'import %s. YouCanUseImportIdToFindRecord=Vous pourrez retrouver les enregistrements issus de cet import dans votre base par un filtrage sur le champ import_key='%s'. +NbOfLinesOK=Nombre de lignes sans erreurs ni warning: %s. +NbOfLinesImported=Nombre de lignes importées avec succès: %s. \ No newline at end of file diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 34ebab31ace..af48ee90878 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -811,11 +811,11 @@ class Product extends CommonObject /** - * \brief Modifie le prix d'un produit/service - * \param id Id du produit/service a modifier - * \param newprice Nouveau prix - * \param newpricebase HT ou TTC - * \param user Objet utilisateur qui modifie le prix + * \brief Modify price of a product/Service + * \param id Id of product/service to change + * \param newprice New price + * \param newpricebase HT or TTC + * \param user Object user that make change * \param newvat New VAT Rate * \param newminprice New price min * \param level 0=standard, >0 = level if multilevel prices @@ -827,6 +827,10 @@ class Product extends CommonObject dol_syslog("Product::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level, LOG_DEBUG); + // Clean parameters + if (empty($this->tva_tx)) $this->tva_tx=0; + + // Check parameters if ($newvat == '') $newvat=$this->tva_tx; if ($newprice!='' || $newprice==0)