diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index f8f6c0e9d..91d4c3eb3 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -414,6 +414,12 @@ public function withdrawAddHandler(Part $part, Request $request, EntityManagerIn throw new \LogicException("The timestamp must not be in the future!"); } + //Ensure that the amount is not null or negative + if ($amount <= 0) { + $this->addFlash('warning', 'part.withdraw.zero_amount'); + goto err; + } + try { switch ($action) { case "withdraw": diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 5b72a3075..c87b9af47 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -11958,115 +11958,115 @@ Please note, that you can not impersonate a disabled user. If you try you will g - + collection_type.new_element.tooltip This element was newly created and was not persisted to the database yet. - + part.merge.title Merge part - + part.merge.title.into into - + part.merge.confirm.title - Do you really want to merge <b>%other%</b> into <b>%target%</b>? + %other% into %target%?]]> - + part.merge.confirm.message - <b>%other%</b> will be deleted, and the part will be saved with the shown information. + %other% will be deleted, and the part will be saved with the shown information.]]> - + part.info.merge_modal.title Merge parts - + part.info.merge_modal.other_part Other part - + part.info.merge_modal.other_into_this Merge other part into this one (delete other part, keep this one) - + part.info.merge_modal.this_into_other Merge this part into other one (delete this part, keep other one) - + part.info.merge_btn Merge part - + part.update_part_from_info_provider.btn Update part from info providers - + info_providers.update_part.title Update existing part from info provider - + part.merge.flash.please_review Data not saved yet. Review the changes and click save to persist the new data. - + user.edit.flash.permissions_fixed Permissions required by other permissions were missing. This was corrected. Please check if the permissions are as you intended. - + permission.legend.dependency_note Please note that some permission operations depend on each other. If you encounter a warning that missing permissions were corrected and a permission was set to allow again, you have to set the dependent operation to forbid too. The dependents can normally found right of an operation. - + log.part_stock_changed.timestamp Timestamp - + part.info.withdraw_modal.timestamp Action timestamp - + part.info.withdraw_modal.timestamp.hint This field allows you to specify the real date, when the stock operation actually was performed, and not just when it was logged. This value is saved in the extra field of the log entry. - + part.info.withdraw_modal.delete_lot_if_empty Delete this lot, if it becomes empty @@ -12078,112 +12078,118 @@ Please note, that you can not impersonate a disabled user. If you try you will g - + eda_info.reference_prefix.placeholder e.g. R - + eda_info.reference_prefix Reference prefix - + eda_info.kicad_section.title KiCad specific settings - + eda_info.value Value - + eda_info.value.placeholder e.g. 100n - + eda_info.exclude_from_bom Exclude part from BOM - + eda_info.exclude_from_board Exclude part from PCB/Board - + eda_info.exclude_from_sim Exclude part from simulation - + eda_info.kicad_symbol KiCad schematic symbol - + eda_info.kicad_symbol.placeholder e.g. Transistor_BJT:BC547 - + eda_info.kicad_footprint KiCad footprint - + eda_info.kicad_footprint.placeholder e.g. Package_TO_SOT_THT:TO-92 - + part.edit.tab.eda EDA information - + api.api_endpoints.title API endpoints - + api.api_endpoints.partdb Part-DB API - + api.api_endpoints.kicad_root_url KiCad API root URL - + eda_info.visibility Force visibility - + eda_info.visibility.help By default, the visibility to the EDA software is automatically determined. With this checkbox, you can force the part to be visible or invisible. + + + part.withdraw.zero_amount + You tried to withdraw/add an amount of zero! No action was performed. + +