diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c5f00ca11fc049706867e5892fc7360340b5bf4b..5fbb113a05d1d4cc75dbd92caeb83edd4a343bb9 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 '</div>'; - // If no errors and no warnings - if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoErrors").'</b><br>'; + // Show OK + if (! sizeof($arrayoferrors) && ! sizeof($arrayofwarnings)) print img_tick().' <b>'.$langs->trans("NoErrors").'</b><br><br>'; + else print $langs->trans("NbOfLinesOK",$nbok).'</b><br><br>'; // 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 '</div>'; - // Show result - print '<br>'; print '<center>'; + print '<br>'; + print $langs->trans("NbOfLinesImported",$nbok).'</b><br><br>'; print $langs->trans("FileWasImported",$importid).'<br>'; print $langs->trans("YouCanUseImportIdToFindRecord",$importid).'<br>'; print '</center>'; diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index a341b9c519d570633779d93148e2ed398cecd12f..1d45579e791e6d65680763367899170b0237f737 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -92,4 +92,5 @@ TooMuchWarnings=There is still <b>%s</b> 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 <b>import_key='%s'</b>. - +NbOfLinesOK=Number of lines with no errors and no warnings: <b>%s</b>. +NbOfLinesImported=Number of lines successfully imported: <b>%s</b>. diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang index 2a26d978606c8bf4a63f1508c0c718235dede92d..4996b5add43d8d145cd8c6f796bfb32766e9b289 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 <b>%s</b>. YouCanUseImportIdToFindRecord=Vous pourrez retrouver les enregistrements issus de cet import dans votre base par un filtrage sur le champ <b>import_key='%s'</b>. +NbOfLinesOK=Nombre de lignes sans erreurs ni warning: <b>%s</b>. +NbOfLinesImported=Nombre de lignes importées avec succès: <b>%s</b>. \ No newline at end of file diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 34ebab31aceaf83c3ad465255757646bdb9b25d7..af48ee908781c537bb839e59c048456d7cd8c494 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)