Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jun 30, 2024
2 parents 360914d + 8cc43bf commit 6f01996
Show file tree
Hide file tree
Showing 4 changed files with 2,506 additions and 523 deletions.
4 changes: 4 additions & 0 deletions lib/data/models/product_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ abstract class ProductEntity extends Object
actions.add(EntityAction.newInvoice);
}

if (userCompany!.canCreate(EntityType.quote) && !isDeleted!) {
actions.add(EntityAction.newQuote);
}

if (userCompany.canCreate(EntityType.purchaseOrder) && !isDeleted!) {
actions.add(EntityAction.newPurchaseOrder);
}
Expand Down
18 changes: 18 additions & 0 deletions lib/redux/product/product_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@ void handleProductAction(
),
);
break;
case EntityAction.newQuote:
final invoice = InvoiceEntity(state: state, entityType: EntityType.quote);
createEntity(
entity: invoice.rebuild(
(b) => b
..lineItems.addAll(
productIds.map(
(productId) => convertProductToInvoiceItem(
company: state.company,
invoice: invoice,
product: state.productState.map[productId],
currencyMap: state.staticState.currencyMap,
),
),
),
),
);
break;
case EntityAction.newPurchaseOrder:
final invoice =
InvoiceEntity(state: state, entityType: EntityType.purchaseOrder);
Expand Down
21 changes: 21 additions & 0 deletions lib/ui/system/update_dialog.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Dart imports:
import 'dart:convert';
import 'package:http/http.dart' as http;

// Flutter imports:
import 'package:flutter/foundation.dart';
Expand Down Expand Up @@ -37,6 +38,23 @@ enum UpdateState {
class _UpdateDialogState extends State<UpdateDialog> {
UpdateState updateState = UpdateState.initial;
String? updateResponse;
String? phpVersion;

@override
void initState() {
super.initState();

http
.read(Uri.parse(
'https://github.com/invoiceninja/invoiceninja/blob/v5-develop/composer.json?raw=true'))
.then((value) {
final data = jsonDecode(value);
setState(() {
phpVersion = data['require']['php'] ?? '';
phpVersion = phpVersion!.replaceFirst('^', '');
});
});
}

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -103,6 +121,9 @@ class _UpdateDialogState extends State<UpdateDialog> {
trailing: Icon(Icons.copy),
),
],
SizedBox(height: 20),
Text(localization.latestRequiresPhpVersion
.replaceFirst(':version', phpVersion ?? '...')),
],
),
actions: <Widget>[
Expand Down
Loading

0 comments on commit 6f01996

Please sign in to comment.