Skip to content

Commit 42a60a9

Browse files
committed
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <[email protected]> # Conflicts: # config/version.php
2 parents a8ca3ad + 734b888 commit 42a60a9

File tree

1,039 files changed

+8928
-5334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,039 files changed

+8928
-5334
lines changed

app/Http/Controllers/Api/ConsumablesController.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function store(ImageUploadRequest $request)
154154
public function show($id)
155155
{
156156
$this->authorize('view', Consumable::class);
157-
$consumable = Consumable::findOrFail($id);
157+
$consumable = Consumable::with('users')->findOrFail($id);
158158

159159
return (new ConsumablesTransformer)->transformConsumable($consumable);
160160
}
@@ -253,33 +253,39 @@ public function getDataView($consumableId)
253253
public function checkout(Request $request, $id)
254254
{
255255
// Check if the consumable exists
256-
if (is_null($consumable = Consumable::find($id))) {
256+
if (!$consumable = Consumable::with('users')->find($id)) {
257257
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.does_not_exist')));
258258
}
259259

260260
$this->authorize('checkout', $consumable);
261261

262-
if ($consumable->qty > 0) {
262+
// Make sure there is at least one available to checkout
263+
if ($consumable->numRemaining() <= 0) {
264+
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.checkout.unavailable')));
265+
\Log::debug('No enough remaining');
266+
}
263267

264-
// Check if the user exists
265-
$assigned_to = $request->input('assigned_to');
266-
if (is_null($user = User::find($assigned_to))) {
267-
// Return error message
268-
return response()->json(Helper::formatStandardApiResponse('error', null, 'No user found'));
269-
}
268+
// Check if the user exists - @TODO: this should probably be handled via validation, not here??
269+
if (!$user = User::find($request->input('assigned_to'))) {
270+
// Return error message
271+
return response()->json(Helper::formatStandardApiResponse('error', null, 'No user found'));
272+
\Log::debug('No valid user');
273+
}
270274

271-
// Update the consumable data
272-
$consumable->assigned_to = e($assigned_to);
275+
// Update the consumable data
276+
$consumable->assigned_to = $request->input('assigned_to');
273277

274-
$consumable->users()->attach($consumable->id, [
275-
'consumable_id' => $consumable->id,
276-
'user_id' => $user->id,
277-
'assigned_to' => $assigned_to,
278-
'note' => $request->input('note'),
279-
]);
278+
$consumable->users()->attach($consumable->id,
279+
[
280+
'consumable_id' => $consumable->id,
281+
'user_id' => $user->id,
282+
'assigned_to' => $request->input('assigned_to'),
283+
'note' => $request->input('note'),
284+
]
285+
);
280286

281287
// Log checkout event
282-
$logaction = $consumable->logCheckout(e($request->input('note')), $user);
288+
$logaction = $consumable->logCheckout($request->input('note'), $user);
283289
$data['log_id'] = $logaction->id;
284290
$data['eula'] = $consumable->getEula();
285291
$data['first_name'] = $user->first_name;
@@ -289,9 +295,7 @@ public function checkout(Request $request, $id)
289295
$data['require_acceptance'] = $consumable->requireAcceptance();
290296

291297
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/consumables/message.checkout.success')));
292-
}
293298

294-
return response()->json(Helper::formatStandardApiResponse('error', null, 'No consumables remaining'));
295299
}
296300

297301
/**

app/Http/Controllers/Consumables/ConsumableCheckoutController.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ class ConsumableCheckoutController extends Controller
2424
*/
2525
public function create($consumableId)
2626
{
27-
if (is_null($consumable = Consumable::find($consumableId))) {
27+
28+
if (is_null($consumable = Consumable::with('users')->find($consumableId))) {
2829
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.does_not_exist'));
2930
}
31+
32+
// Make sure there is at least one available to checkout
33+
if ($consumable->numRemaining() <= 0){
34+
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.checkout.unavailable'));
35+
}
36+
3037
$this->authorize('checkout', $consumable);
3138

3239
return view('consumables/checkout', compact('consumable'));
@@ -44,12 +51,18 @@ public function create($consumableId)
4451
*/
4552
public function store(Request $request, $consumableId)
4653
{
47-
if (is_null($consumable = Consumable::find($consumableId))) {
54+
if (is_null($consumable = Consumable::with('users')->find($consumableId))) {
4855
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.not_found'));
4956
}
5057

5158
$this->authorize('checkout', $consumable);
5259

60+
// Make sure there is at least one available to checkout
61+
if ($consumable->numRemaining() <= 0) {
62+
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.checkout.unavailable'));
63+
}
64+
65+
5366
$admin_user = Auth::user();
5467
$assigned_to = e($request->input('assigned_to'));
5568

config/version.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
return array (
3-
'app_version' => 'v6.1.0-pre',
4-
'full_app_version' => 'v6.1.0-pre - build 10030-gdcbd216e2',
5-
'build_version' => '10030',
3+
'app_version' => 'v6.1.0',
4+
'full_app_version' => 'v6.1.0 - build 10161-ga8ca3ad2a',
5+
'build_version' => '10161',
66
'prerelease_version' => '',
7-
'hash_version' => 'gdcbd216e2',
8-
'full_hash' => 'v6.1.0-pre-986-gdcbd216e2',
7+
'hash_version' => 'ga8ca3ad2a',
8+
'full_hash' => 'v6.1.0-127-ga8ca3ad2a',
99
'branch' => 'master',
1010
);

resources/lang/af/admin/accessories/general.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
'update' => 'Opdatering bywerk',
1717
'use_default_eula' => 'Gebruik eerder die <a href="#" data-toggle="modal" data-target="#eulaModal">primary standaard EULA</a>.',
1818
'use_default_eula_disabled' => '<del>Gebruik die primêre standaardverlof in plaas daarvan.</del> Geen primêre standaard EULA is ingestel nie. Voeg asseblief een by Instellings.',
19+
'clone' => 'Clone Accessory',
1920

2021
);

resources/lang/af/admin/accessories/message.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'checkout' => array(
2525
'error' => 'Toebehore is nie nagegaan nie, probeer asseblief weer',
2626
'success' => 'Toebehore suksesvol nagegaan.',
27+
'unavailable' => 'Accessory is not available for checkout. Check quantity available',
2728
'user_does_not_exist' => 'Die gebruiker is ongeldig. Probeer asseblief weer.'
2829
),
2930

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

33
return [
4-
'asset_maintenance_type' => 'Onderhoudstipe',
4+
'asset_maintenance_type' => 'Asset Maintenance Type',
55
'title' => 'Titel',
6-
'start_date' => 'begin',
7-
'completion_date' => 'voltooi',
6+
'start_date' => 'Start Date',
7+
'completion_date' => 'Completion Date',
88
'cost' => 'koste',
99
'is_warranty' => 'Garantieverbetering',
10-
'asset_maintenance_time' => 'dae',
10+
'asset_maintenance_time' => 'Asset Maintenance Time (in days)',
1111
'notes' => 'notas',
12-
'update' => 'Opdateer',
13-
'create' => 'Skep'
12+
'update' => 'Update Asset Maintenance',
13+
'create' => 'Create Asset Maintenance'
1414
];

resources/lang/af/admin/groups/message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
return array(
44

55
'group_exists' => 'Groep bestaan ​​reeds!',
6-
'group_not_found' => 'Groep [: id] bestaan ​​nie.',
6+
'group_not_found' => 'Group ID :id does not exist.',
77
'group_name_required' => 'Die naam veld is nodig',
88

99
'success' => array(

resources/lang/af/admin/hardware/form.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
return [
44
'bulk_delete' => 'Bevestig bates vir die verwydering van grootmaat',
5+
'bulk_restore' => 'Confirm Bulk Restore Assets',
56
'bulk_delete_help' => 'Hersien die bates vir grootmaatverwydering hieronder. Sodra dit verwyder is, kan hierdie bates herstel word, maar hulle word nie meer geassosieer met enige gebruikers wat hulle tans toegewys is nie.',
7+
'bulk_restore_help' => 'Review the assets for bulk restoration below. Once restored, these assets will not be associated with any users they were previously assigned to.',
68
'bulk_delete_warn' => 'Jy is op die punt om te verwyder: bate_count bates.',
9+
'bulk_restore_warn' => 'You are about to restore :asset_count assets.',
710
'bulk_update' => 'Grootskaalse opdateringsbates',
811
'bulk_update_help' => 'Met hierdie vorm kan u verskeie bates gelyktydig bywerk. Vul slegs die velde in wat u moet verander. Enige velde wat leeg is, bly onveranderd.',
912
'bulk_update_warn' => 'You are about to edit the properties of a single asset.|You are about to edit the properties of :asset_count assets.',
@@ -45,7 +48,7 @@
4548
'asset_location_update_default' => 'Update only default location',
4649
'asset_not_deployable' => 'That asset status is not deployable. This asset cannot be checked out.',
4750
'asset_deployable' => 'That status is deployable. This asset can be checked out.',
48-
'processing_spinner' => 'Processing...',
51+
'processing_spinner' => 'Processing... (This might take a bit of time on large files)',
4952
'optional_infos' => 'Optional Information',
5053
'order_details' => 'Order Related Information'
5154
];

resources/lang/af/admin/hardware/general.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
'error_messages' => 'Error messages:',
4343
'success_messages' => 'Success messages:',
4444
'alert_details' => 'Please see below for details.',
45-
'custom_export' => 'Custom Export'
45+
'custom_export' => 'Custom Export',
46+
'mfg_warranty_lookup' => ':manufacturer Warranty Status Lookup',
4647
];

resources/lang/af/admin/hardware/message.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
'restore' => [
2323
'error' => 'Bate is nie herstel nie, probeer asseblief weer',
2424
'success' => 'Bate herstel suksesvol.',
25+
'bulk_success' => 'Asset restored successfully.',
26+
'nothing_updated' => 'No assets were selected, so nothing was restored.',
2527
],
2628

2729
'audit' => [

0 commit comments

Comments
 (0)