3 Commits

Author SHA1 Message Date
gitea-actions[bot] d7e6ec338e chore(version): pre-release bump to 01.08.02-dev [skip ci]
Publish to Composer / Publish Package (release) Failing after 22s
2026-06-21 16:53:32 +00:00
gitea-actions[bot] 162298f8f9 chore(version): auto-bump patch 01.08.01-dev [skip ci] 2026-06-21 16:53:23 +00:00
Jonathan Miller be03793478 fix: review #18 — WarrantyHelper $db before init, TruckStock negative guard + raw SQL, tech_id column name
Universal: Auto Version Bump / Version Bump (push) Successful in 8s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 10s
2026-06-21 11:52:54 -05:00
5 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Automation # INGROUP: mokocli.Automation
# VERSION: 01.08.00 # VERSION: 01.08.02
# BRIEF: Auto-create feature branch when an issue is opened # BRIEF: Auto-create feature branch when an issue is opened
name: "Universal: Issue Branch" name: "Universal: Issue Branch"
@@ -101,7 +101,7 @@ class CustomerSatisfactionHelper
->select('SUM(CASE WHEN s.rating >= 4 THEN 1 ELSE 0 END) AS five_star_count') ->select('SUM(CASE WHEN s.rating >= 4 THEN 1 ELSE 0 END) AS five_star_count')
->from($db->quoteName('#__mokosuitefield_surveys', 's')) ->from($db->quoteName('#__mokosuitefield_surveys', 's'))
->join('INNER', $db->quoteName('#__mokosuitefield_work_orders', 'wo') . ' ON wo.id = s.work_order_id') ->join('INNER', $db->quoteName('#__mokosuitefield_work_orders', 'wo') . ' ON wo.id = s.work_order_id')
->join('INNER', $db->quoteName('#__mokosuitefield_technicians', 't') . ' ON t.id = wo.tech_id') ->join('INNER', $db->quoteName('#__mokosuitefield_technicians', 't') . ' ON t.id = wo.technician_id')
->join('LEFT', $db->quoteName('#__contact_details', 'cd') . ' ON cd.id = t.contact_id') ->join('LEFT', $db->quoteName('#__contact_details', 'cd') . ' ON cd.id = t.contact_id')
->group('t.id, cd.name') ->group('t.id, cd.name')
->having('COUNT(s.id) >= 3') ->having('COUNT(s.id) >= 3')
@@ -47,8 +47,9 @@ class TruckStockHelper
$db->setQuery($db->getQuery(true) $db->setQuery($db->getQuery(true)
->update('#__mokosuitefield_truck_stock') ->update('#__mokosuitefield_truck_stock')
->set('quantity = quantity - ' . (float) $qty) ->set('quantity = quantity - ' . (float) $qty)
->where('vehicle_id = ' . $vehicleId) ->where('vehicle_id = ' . (int) $vehicleId)
->where('product_id = ' . $productId)); ->where('product_id = ' . (int) $productId)
->where('quantity >= ' . (float) $qty));
$db->execute(); $db->execute();
return $db->getAffectedRows() > 0; return $db->getAffectedRows() > 0;
@@ -58,7 +59,11 @@ class TruckStockHelper
{ {
$db = Factory::getContainer()->get(DatabaseInterface::class); $db = Factory::getContainer()->get(DatabaseInterface::class);
$db->setQuery("INSERT INTO #__mokosuitefield_truck_stock (vehicle_id, product_id, quantity, last_restocked) VALUES ({$vehicleId}, {$productId}, {$qty}, CURDATE()) ON DUPLICATE KEY UPDATE quantity = quantity + {$qty}, last_restocked = CURDATE()"); $db->setQuery(
'INSERT INTO #__mokosuitefield_truck_stock (vehicle_id, product_id, quantity, last_restocked)'
. ' VALUES (' . (int) $vehicleId . ', ' . (int) $productId . ', ' . (float) $qty . ', CURDATE())'
. ' ON DUPLICATE KEY UPDATE quantity = quantity + ' . (float) $qty . ', last_restocked = CURDATE()'
);
$db->execute(); $db->execute();
} }
} }
@@ -57,14 +57,14 @@ class WarrantyHelper
if (empty($warranty->id)) return (object) ['success' => false, 'error' => 'Equipment not found']; if (empty($warranty->id)) return (object) ['success' => false, 'error' => 'Equipment not found'];
if (!$warranty->under_warranty) return (object) ['success' => false, 'error' => 'Warranty expired']; if (!$warranty->under_warranty) return (object) ['success' => false, 'error' => 'Warranty expired'];
$db = Factory::getContainer()->get(DatabaseInterface::class);
// Verify work order exists and is linked to this equipment // Verify work order exists and is linked to this equipment
$db->setQuery($db->getQuery(true)->select('id')->from('#__mokosuitefield_work_orders') $db->setQuery($db->getQuery(true)->select('id')->from('#__mokosuitefield_work_orders')
->where('id = ' . (int) $woId)); ->where('id = ' . (int) $woId));
if (!(int) $db->loadResult()) { if (!(int) $db->loadResult()) {
return (object) ['success' => false, 'error' => 'Invalid work order']; return (object) ['success' => false, 'error' => 'Invalid work order'];
} }
$db = Factory::getContainer()->get(DatabaseInterface::class);
$now = Factory::getDate()->toSql(); $now = Factory::getDate()->toSql();
$claim = (object) [ $claim = (object) [
+1 -1
View File
@@ -2,7 +2,7 @@
<extension type="package" method="upgrade"> <extension type="package" method="upgrade">
<name>Package - MokoSuite Field</name> <name>Package - MokoSuite Field</name>
<packagename>mokosuitefield</packagename> <packagename>mokosuitefield</packagename>
<version>01.08.00</version> <version>01.08.02</version>
<creationDate>2026-06-12</creationDate> <creationDate>2026-06-12</creationDate>
<author>Moko Consulting</author> <author>Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail> <authorEmail>hello@mokoconsulting.tech</authorEmail>