Skip to content

Commit ff04a79

Browse files
pacsoclaude
andcommitted
Carry PHP patches and apply them after BarcodeBuddy extraction
Adds a patches/ directory and a Dockerfile step that applies each *.patch against /app/bbuddy with --forward --silent, so patches that have already been merged upstream become a no-op rather than a build failure. First patch (register-barcode-after-create.patch) is the one open as Forceu/barcodebuddy#297 — it makes processRefreshedBarcode register the barcode in Grocy after the user creates a product via BB's "Create Product" flow, instead of leaving it for a follow-up Add/Consume click. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ca7fdae commit ff04a79

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ RUN \
2121
# add local files
2222
COPY root/ /
2323

24+
# patches applied to upstream BarcodeBuddy after extraction
25+
COPY patches/ /tmp/patches/
26+
2427

2528
# install packages
2629
RUN \
@@ -54,6 +57,7 @@ RUN \
5457
php8-xml \
5558
php8-xmlwriter \
5659
php8-zlib \
60+
patch \
5761
procps \
5862
redis \
5963
screen \
@@ -100,6 +104,11 @@ sed -i 's/SCRIPT_LOCATION=.*/SCRIPT_LOCATION="\/app\/bbuddy\/index.php"/g' /app/
100104
sed -i 's/WWW_USER=.*/WWW_USER="barcodebuddy"/g' /app/bbuddy/example/grabInput.sh && \
101105
sed -i 's/IS_DOCKER=.*/IS_DOCKER=true/g' /app/bbuddy/example/grabInput.sh && \
102106
sed -i 's/const DEFAULT_USE_REDIS =.*/const DEFAULT_USE_REDIS = "1";/g' /app/bbuddy/incl/db.inc.php && \
107+
echo "**** applying local patches ****" && \
108+
for p in /tmp/patches/*.patch; do \
109+
patch -p1 -d /app/bbuddy --forward --silent < "$p" \
110+
|| echo "WARNING: $p did not apply cleanly (may already be in upstream)"; \
111+
done && \
103112
rm -rf \
104113
/root/.cache \
105114
/tmp/*
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- a/incl/processing.inc.php
2+
+++ b/incl/processing.inc.php
3+
@@ -329,6 +329,9 @@ function processRefreshedBarcode(string $barcode): void {
4+
$productInfo = API::getLastCreatedProduct(5);
5+
if ($productInfo != null) {
6+
DatabaseConnection::getInstance()->updateSavedBarcodeMatch($barcode, $productInfo->id);
7+
+ API::addBarcode($productInfo->id, $barcode, null);
8+
+ $log = new LogOutput("Associated barcode $barcode with " . $productInfo->name, EVENT_TYPE_ASSOCIATE_PRODUCT);
9+
+ $log->setVerbose()->dontSendWebsocket()->createLog();
10+
}
11+
}
12+

0 commit comments

Comments
 (0)