diff --git a/pages/printlabel.php b/pages/printlabel.php index f07b65b..7039375 100644 --- a/pages/printlabel.php +++ b/pages/printlabel.php @@ -20,23 +20,12 @@ if (!Machine::exists($machineid)) { exit(); } -$labeltype = "machineid"; -if (!empty($VARS["labeltype"])) { - switch ($VARS["labeltype"]) { - case "doortag": - $labeltype = "doortag"; - break; - case "machineidanonymous": - $labeltype = "machineidanonymous"; - break; - case "pickupslip": - $labeltype = "pickupslip"; - break; - case "machineid": - default: - $labeltype = "machineid"; - } +$labeltype = array_keys($SETTINGS["labels"]["templates"])[0]; + +if (!empty($VARS["labeltype"]) && array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) { + $labeltype = $VARS["labeltype"]; } + $machine = new Machine($machineid); $pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid"; @@ -44,18 +33,15 @@ $pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid";
get("Go to machine"); ?> diff --git a/print/print.php b/print/print.php index 455df0c..db8901a 100644 --- a/print/print.php +++ b/print/print.php @@ -24,26 +24,16 @@ if (!Machine::exists($machineid)) { exit("No such machine."); } -$labeltype = "machineid"; -switch ($VARS["labeltype"]) { - case "doortag": - $labeltype = "doortag"; - break; - case "machineidanonymous": - $labeltype = "machineidanonymous"; - break; - case "pickupslip": - $labeltype = "pickupslip"; - break; - case "machineid": - default: - $labeltype = "machineid"; +$labeltype = array_keys($SETTINGS["labels"]["templates"])[0]; + +if (array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) { + $labeltype = $VARS["labeltype"]; } + $machine = new Machine($machineid); $mergedata = [ "id" => $machine->getID(), - "link" => str_replace("{{id}}", $machine->getID(), $SETTINGS["branding"]["trackinglink"]), "price" => number_format($machine->getPrice(), 2), "devicetype" => $machine->getTypeLabel(), "devicetype_lowercase" => strtolower($machine->getTypeLabel()), @@ -61,9 +51,13 @@ $mergedata = [ "clientbillingaddress" => "", "clientshippingaddress" => "", "clientpublicnotes" => "", - "clientprivatenotes" => "", + "clientprivatenotes" => "" ]; +foreach ($SETTINGS["labels"]["fields"] as $id => $val) { + $mergedata[$id] = str_replace("{{id}}", $machine->getID(), $val); +} + /** * https://stackoverflow.com/a/14167216 */ diff --git a/print/templates/doortag.glabels b/print/templates/doortag.glabels index 725f0c5..b0114c4 100644 Binary files a/print/templates/doortag.glabels and b/print/templates/doortag.glabels differ diff --git a/print/templates/machineid.glabels b/print/templates/machineid.glabels index 4848c9f..45d5edc 100644 Binary files a/print/templates/machineid.glabels and b/print/templates/machineid.glabels differ diff --git a/print/templates/machineidanonymous.glabels b/print/templates/machineidanonymous.glabels index 65012cd..3f16ae3 100644 Binary files a/print/templates/machineidanonymous.glabels and b/print/templates/machineidanonymous.glabels differ diff --git a/print/templates/machineidinternal.glabels b/print/templates/machineidinternal.glabels new file mode 100644 index 0000000..16848cf Binary files /dev/null and b/print/templates/machineidinternal.glabels differ diff --git a/print/templates/pickupslip.glabels b/print/templates/pickupslip.glabels index cae948b..9f9f58e 100644 Binary files a/print/templates/pickupslip.glabels and b/print/templates/pickupslip.glabels differ diff --git a/settings.template.php b/settings.template.php index 6879b13..7930766 100644 --- a/settings.template.php +++ b/settings.template.php @@ -37,10 +37,30 @@ $SETTINGS = [ // Name of the app. "site_title" => "MachineManager", "branding" => [ - "machineidnumber" => "Netsyms device ID number, machine ID number", - "shortmachineid" => "Device ID Number", + // Title of public tracking page "publictitle" => "Device Lookup", - "trackinglink" => "https://qr.ntsm.io/?t=mid&q={{id}}" + // Shown in public tracking page + "machineidnumber" => "Netsyms device ID number, machine ID number", + // Shown in public tracking page + "shortmachineid" => "Device/Machine ID Number", + "labels" => [ + // Shown above machine ID barcodes on labels (key ${idnumbertitle}) + "idnumbertitle" => "Netsyms Device ID #", + // Rendered to QR codes on labels (key ${link}) + "link" => "https://qr.ntsm.io/?t=mid&q={{id}}", + // Rendered on labels (key ${linktitle_lg}) + "linktitle_lg" => "Scan QR code or visit ntsm.io/pci for device\ninfo and tracking", + // Rendered on labels (key ${linktitle_sm}) + "linktitle_sm" => "Scan QR code or visit ntsm.io/pci for device info and tracking", + // Rendered on labels (key ${linktitle_xl}) + "linktitle_xl" => "You can check the status of your device by scanning the QR code, or by going to ntsm.io/pci and entering the Netsyms Device ID.", + // Rendered on labels (key ${companyname}) + "companyname" => "Netsyms Technologies", + // Rendered on labels (key ${companyphone}) + "companyphone" => "(406) 404-7177", + // Rendered on labels (key ${companywebsite}) + "companywebsite" => "netsyms.com" + ] ], // Settings for connecting to the AccountHub server. "accounthub" => [