File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed
src/Services/ProjectSystem Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -63,17 +63,19 @@ public function getMaximumBuildableCountForBOMEntry(ProjectBOMEntry $projectBOME
6363 */
6464 public function getMaximumBuildableCount (Project $ project ): int
6565 {
66+ $ bom_entries = $ project ->getBomEntries ();
67+ if ($ bom_entries ->isEmpty ()) {
68+ return 0 ;
69+ }
6670 $ maximum_buildable_count = PHP_INT_MAX ;
67- foreach ($ project -> getBomEntries () as $ bom_entry ) {
71+ foreach ($ bom_entries as $ bom_entry ) {
6872 //Skip BOM entries without a part (as we can not determine that)
6973 if (!$ bom_entry ->isPartBomEntry ()) {
7074 continue ;
7175 }
72-
7376 //The maximum buildable count for the whole project is the minimum of all BOM entries
7477 $ maximum_buildable_count = min ($ maximum_buildable_count , $ this ->getMaximumBuildableCountForBOMEntry ($ bom_entry ));
7578 }
76-
7779 return $ maximum_buildable_count ;
7880 }
7981
Original file line number Diff line number Diff line change 88{% endblock %}
99
1010{% block card_content %}
11- {% set can_build = buildHelper.projectBuildable (project , number_of_builds ) %}
11+ {% set bom_empty = project .bomEntries | length == 0 %}
12+ {% set can_build = not bom_empty and buildHelper.projectBuildable (project , number_of_builds ) %}
1213 {% import " components/projects.macro.html.twig" as project_macros %}
1314
1415 {% if project .status is not empty and project .status != " in_production" %}
1819 {% endif %}
1920
2021 <div class =" alert {% if can_build %}alert-success{% else %}alert-danger{% endif %}" role =" alert" >
21- {% if not can_build %}
22+ {% if bom_empty %}
23+ <h5 ><i class =" fa-solid fa-circle-exclamation fa-fw" ></i > {% trans %}project.builds.no_bom_entries{% endtrans %}</h5 >
24+ <span class =" text-muted" >{% trans %}project.builds.no_bom_entries_hint{% endtrans %}</span >
25+ {% elseif not can_build %}
2226 <h5 ><i class =" fa-solid fa-circle-exclamation fa-fw" ></i > {% trans %}project.builds.build_not_possible{% endtrans %}</h5 >
2327 <b >{% trans with {" %number_of_builds%" : number_of_builds } %}project.builds.following_bom_entries_miss_instock_n{% endtrans %}</b >
2428 <ul >
Original file line number Diff line number Diff line change 1- {% set can_build = buildHelper.projectBuildable (project ) %}
1+ {% set bom_empty = project .bomEntries | length == 0 %}
2+ {% set can_build = not bom_empty and buildHelper.projectBuildable (project ) %}
23
34{% import " components/projects.macro.html.twig" as project_macros %}
45
910{% endif %}
1011
1112<div class =" alert mt-2 {% if can_build %}alert-success{% else %}alert-danger{% endif %}" role =" alert" >
12- {% if not can_build %}
13+ {% if bom_empty %}
14+ <h5 ><i class =" fa-solid fa-circle-exclamation fa-fw" ></i > {% trans %}project.builds.no_bom_entries{% endtrans %}</h5 >
15+ <span class =" text-muted" >{% trans %}project.builds.no_bom_entries_hint{% endtrans %}</span >
16+ {% elseif not can_build %}
1317 <h5 ><i class =" fa-solid fa-circle-exclamation fa-fw" ></i > {% trans %}project.builds.build_not_possible{% endtrans %}</h5 >
1418 <b >{% trans %}project.builds.following_bom_entries_miss_instock{% endtrans %}</b >
1519 <ul >
2731 <div class =" row mt-2" >
2832 <div class =" col-4" >
2933 <div class =" input-group mb-3" >
30- <input type =" number" min =" 1" class =" form-control" placeholder =" {% trans %}project.builds.number_of_builds{% endtrans %}" name =" n" required >
34+ <input type =" number" min =" 1" class =" form-control" placeholder =" {% trans %}project.builds.number_of_builds{% endtrans %}" name =" n" required value = " 1 " >
3135 <input type =" hidden" name =" _redirect" value =" {{ uri_without_host(app .request ) }}" >
3236 <button class =" btn btn-outline-secondary" type =" submit" id =" button-addon2" >{% trans %}project.build.btn_build{% endtrans %}</button >
3337 </div >
You can’t perform that action at this time.
0 commit comments