diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ee25ea86eff..dbb99d0f993 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1217,7 +1217,7 @@ if ($resql) { if ($permissiontocancel) { $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); } - if ($user->rights->facture->creer) { + if (!empty($conf->invoice->enabled) && $user->rights->facture->creer) { $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); } if ($permissiontoclose) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index a864168d161..285d9d366f7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -668,6 +668,8 @@ class Invoices extends DolibarrApi $result = $this->invoice->delete(DolibarrApiAccess::$user); if ($result < 0) { throw new RestException(500, 'Error when deleting invoice'); + } elseif ($result == 0) { + throw new RestException(403, 'Invoice not erasable'); } return array( diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 85848942fbe..31b2aa8e187 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -336,11 +336,11 @@ if ($action == 'importCSV' && !empty($user->rights->stock->mouvement->creer)) { continue; } //var_dump($data); - $tmp_id_sw = $data[$i][0]['val']; - $tmp_id_tw = $data[$i][1]['val']; - $tmp_id_product = $data[$i][2]['val']; - $tmp_qty = $data[$i][3]['val']; - $tmp_batch = $data[$i][4]['val']; + $tmp_id_sw = (int) $data[$i][0]['val']; + $tmp_id_tw = (int) $data[$i][1]['val']; + $tmp_id_product = (int) $data[$i][2]['val']; + $tmp_qty = price2num((float) $data[$i][3]['val'], 'MS'); + $tmp_batch = dol_escape_htmltag($data[$i][4]['val']); if (!is_numeric($tmp_id_product)) { $result = fetchref($productstatic, $tmp_id_product);