Compare commits

...

4 Commits

Author SHA1 Message Date
Dave
b510eec9aa feature/IO-3456-Broken-Image - Fix issue 2025-12-04 14:20:58 -05:00
Dave Richer
123066f1cd Merged in release/2025-11-21 (pull request #2671)
Release/2025 11 21 into Master-AIO - IO-3435 IO-3445 IO-3440 IO-3446
2025-11-21 19:19:15 +00:00
Allan Carr
a153cca3c0 Merged in feature/IO-3440-Payment-By-Date-Excel (pull request #2669)
IO-3440 Payment By Date - Excel
2025-11-21 00:26:54 +00:00
Allan Carr
35c7c32c8e IO-3440 Payment By Date - Excel
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2025-11-20 16:29:05 -08:00
2 changed files with 37 additions and 7 deletions

View File

@@ -1221,7 +1221,7 @@ export const TemplateList = (type, context) => {
payments_by_date_excel: { payments_by_date_excel: {
title: i18n.t("reportcenter.templates.payments_by_date_excel"), title: i18n.t("reportcenter.templates.payments_by_date_excel"),
subject: i18n.t("reportcenter.templates.payments_by_date_excel"), subject: i18n.t("reportcenter.templates.payments_by_date_excel"),
key: "payments_by_date", key: "payments_by_date_excel",
reporttype: "excel", reporttype: "excel",
disabled: false, disabled: false,
rangeFilter: { rangeFilter: {

View File

@@ -134,13 +134,16 @@ const insertUserAssociation = async (uid, email, shopId) => {
/** /**
* PATCH handler for updating bodyshop fields. * PATCH handler for updating bodyshop fields.
* Allows patching: shopname, address1, address2, city, state, zip_post, country, email, timezone, phone, logo_img_path * Allows patching: shopname, address1, address2, city, state, zip_post, country, email, timezone, phone
* Also allows updating logo_img_path via a simple logoUrl string, which is expanded to the full object.
* @param req * @param req
* @param res * @param res
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
const patchPartsManagementProvisioning = async (req, res) => { const patchPartsManagementProvisioning = async (req, res) => {
const { id } = req.params; const { id } = req.params;
// Fields that can be directly patched 1:1
const allowedFields = [ const allowedFields = [
"shopname", "shopname",
"address1", "address1",
@@ -151,31 +154,58 @@ const patchPartsManagementProvisioning = async (req, res) => {
"country", "country",
"email", "email",
"timezone", "timezone",
"phone", "phone"
"logo_img_path" // NOTE: logo_img_path is handled separately via logoUrl
]; ];
const updateFields = {}; const updateFields = {};
// Copy over simple scalar fields if present
for (const field of allowedFields) { for (const field of allowedFields) {
if (req.body[field] !== undefined) { if (req.body[field] !== undefined) {
updateFields[field] = req.body[field]; updateFields[field] = req.body[field];
} }
} }
// Handle logo update via a simple href string, same behavior as provision route
if (typeof req.body.logo_img_path === "string") {
const trimmed = req.body.logo_img_path.trim();
if (trimmed) {
updateFields.logo_img_path = {
src: trimmed,
width: "",
height: "",
headerMargin: DefaultNewShop.logo_img_path.headerMargin
};
}
}
if (Object.keys(updateFields).length === 0) { if (Object.keys(updateFields).length === 0) {
return res.status(400).json({ error: "No valid fields provided for update." }); return res.status(400).json({ error: "No valid fields provided for update." });
} }
// Check that the bodyshop has an external_shop_id before allowing patch // Check that the bodyshop has an external_shop_id before allowing patch
try { try {
// Fetch the bodyshop by id
const shopResp = await client.request( const shopResp = await client.request(
`query GetBodyshop($id: uuid!) { bodyshops_by_pk(id: $id) { id external_shop_id } }`, `query GetBodyshop($id: uuid!) {
bodyshops_by_pk(id: $id) {
id
external_shop_id
}
}`,
{ id } { id }
); );
if (!shopResp.bodyshops_by_pk?.external_shop_id) { if (!shopResp.bodyshops_by_pk?.external_shop_id) {
return res.status(400).json({ error: "Cannot patch: bodyshop does not have an external_shop_id." }); return res.status(400).json({ error: "Cannot patch: bodyshop does not have an external_shop_id." });
} }
} catch (err) { } catch (err) {
return res.status(500).json({ error: "Failed to validate bodyshop external_shop_id.", detail: err }); return res.status(500).json({
error: "Failed to validate bodyshop external_shop_id.",
detail: err
});
} }
try { try {
const resp = await client.request(UPDATE_BODYSHOP_BY_ID, { id, fields: updateFields }); const resp = await client.request(UPDATE_BODYSHOP_BY_ID, { id, fields: updateFields });
if (!resp.update_bodyshops_by_pk) { if (!resp.update_bodyshops_by_pk) {