Skip to content

Commit

Permalink
Merge pull request #589 from PAWECOGmbH/staging
Browse files Browse the repository at this point in the history
Staging to Production
  • Loading branch information
ptruessel authored Dec 19, 2024
2 parents af9b544 + 91b3f25 commit 47d9b20
Show file tree
Hide file tree
Showing 30 changed files with 311 additions and 106 deletions.
13 changes: 13 additions & 0 deletions config/db/core/V5__update-modules.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

ALTER TABLE `modules`
ADD COLUMN `strRedirectPath` varchar(255) NULL AFTER `blnFree`;

INSERT INTO system_translations (strVariable, strStringDE, strStringEN)
VALUES
('txt404Text', 'Die angeforderte Seite wurde leider nicht gefunden!', 'The requested page could not be found!');


SET FOREIGN_KEY_CHECKS = 1;
9 changes: 5 additions & 4 deletions config/db/dev/create-plans.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ CREATE TABLE `plans` (
`blnRecommended` tinyint NULL DEFAULT 0,
`intMaxUsers` int NULL DEFAULT NULL,
`intNumTestDays` int NULL DEFAULT 0,
`blnTestDaysUpgrade` tinyint NULL DEFAULT 0,
`blnFree` tinyint NULL DEFAULT 0,
`blnDefaultPlan` tinyint NULL DEFAULT 0,
`intPrio` int NOT NULL,
Expand All @@ -120,10 +121,10 @@ CREATE TABLE `plans` (
-- ----------------------------
-- Records of plans
-- ----------------------------
INSERT INTO `plans` VALUES (1, 1, 'Free', '3 users + 0 guests\r\nBest for small, personal projects', '<ul><li>1 project</li><li>3 users</li><li>60 task limit</li></ul>', 'Try free', '', 0, 3, 0, 1, 0, 1);
INSERT INTO `plans` VALUES (2, 1, 'Standard', 'Up to 10 users\r\nFor teams that need planning and collaboration features.', '<p><strong>Try free for 30 days. Cancel anytime.</strong></p><ul><li>Unlimited projects</li><li>Unlimited tasks</li><li>Add users as needed</li><li>Collaboration and planning features</li></ul>', 'Try standard', '', 1, 10, 30, 0, 0, 2);
INSERT INTO `plans` VALUES (3, 1, 'Advanced', 'Up to 30 users\r\nFor teams that need planning and collaboration, + tracking workloads by hours, and advanced project reporting. ', '<p><strong>Including all from Basic plan and:</strong></p><ul><li>Advanced reporting</li><li>Track workloads by hours</li></ul><ul></ul>', 'Try advanced', '', 0, 30, 30, 0, 0, 3);
INSERT INTO `plans` VALUES (4, 1, 'Enterprise', 'Bis business for large companies.\r\nUp to 500 users or more - pleas ask for offer', '<ul><li>Unlimited projects</li><li>Unlimited tasks</li><li>Add users as needed no limits</li><li>and much more<br></li></ul>', 'Contact', 'contact/enterprise', 0, 0, 30, 0, 0, 4);
INSERT INTO `plans` VALUES (1, 1, 'Free', '3 users + 0 guests\r\nBest for small, personal projects', '<ul><li>1 project</li><li>3 users</li><li>60 task limit</li></ul>', 'Try free', '', 0, 3, 0, 0, 1, 0, 1);
INSERT INTO `plans` VALUES (2, 1, 'Standard', 'Up to 10 users\r\nFor teams that need planning and collaboration features.', '<p><strong>Try free for 30 days. Cancel anytime.</strong></p><ul><li>Unlimited projects</li><li>Unlimited tasks</li><li>Add users as needed</li><li>Collaboration and planning features</li></ul>', 'Try standard', '', 1, 10, 30, 0, 0, 0, 2);
INSERT INTO `plans` VALUES (3, 1, 'Advanced', 'Up to 30 users\r\nFor teams that need planning and collaboration, + tracking workloads by hours, and advanced project reporting. ', '<p><strong>Including all from Basic plan and:</strong></p><ul><li>Advanced reporting</li><li>Track workloads by hours</li></ul><ul></ul>', 'Try advanced', '', 0, 30, 30, 0, 0, 0, 3);
INSERT INTO `plans` VALUES (4, 1, 'Enterprise', 'Bis business for large companies.\r\nUp to 500 users or more - pleas ask for offer', '<ul><li>Unlimited projects</li><li>Unlimited tasks</li><li>Add users as needed no limits</li><li>and much more<br></li></ul>', 'Contact', 'contact/enterprise', 0, 0, 30, 0, 0, 0, 4);

-- ----------------------------
-- Table structure for plans_trans
Expand Down
79 changes: 44 additions & 35 deletions www/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ component displayname="Application" output="false" extends="backend.myapp.ownApp
this.name = variables.applicationname;
this.sessiontimeout = variables.sessiontimeout;
this.pdf.type = variables.pdf_type;
setting requesttimeout = variables.requesttimeout;
this.requesttimeout = variables.requesttimeout;

// Fixed values
this.sessionmanagement = true;
this.setdomaincookies = true;
processingdirective pageEncoding="utf-8";
this.processingdirective.pageEncoding = "utf-8";
this.mappings["/"] = getDirectoryFromPath(getCurrentTemplatePath());
setTimezone("UTC+00:00"); // Do NOT change the standard timezone!!!
this.timezone = "UTC+00:00"; // Do NOT change the standard timezone!!!

// Load java files
this.javaSettings = {
Expand Down Expand Up @@ -117,32 +117,37 @@ component displayname="Application" output="false" extends="backend.myapp.ownApp

public boolean function onRequestStart(required string TargetPage) {

// Reinit Application
if (structKeyExists(url, "reinit") and url.reinit eq 1) {
structClear(APPLICATION);
onApplicationStart();
application.langStruct = application.objLanguage.initLanguages();
}
// Check if the user is logged in as a sysadmin
if (structKeyExists(session, "sysadmin") and session.sysadmin) {

// Reinit Session
if (structKeyExists(url, "reinit") and url.reinit eq 2) {
structClear(SESSION);
onSessionStart();
}
// Reinit Application
if (structKeyExists(url, "reinit") and url.reinit eq 1) {
structClear(APPLICATION);
onApplicationStart();
application.langStruct = application.objLanguage.initLanguages();
}

// Reinit languages
if (structKeyExists(url, "reinit") and url.reinit eq 3) {
structDelete(session, "langStruct");
application.langStruct = application.objLanguage.initLanguages();
}
// Reinit Session
if (structKeyExists(url, "reinit") and url.reinit eq 2) {
structClear(SESSION);
onSessionStart();
}

// Reinit languages
if (structKeyExists(url, "reinit") and url.reinit eq 3) {
structDelete(session, "langStruct");
application.langStruct = application.objLanguage.initLanguages();
}

// Reinit Session AND Application AND languages
if (structKeyExists(url, "reinit") and url.reinit eq 4) {
structClear(SESSION);
structClear(APPLICATION);
onApplicationStart();
onSessionStart();
application.langStruct = application.objLanguage.initLanguages();
}

// Reinit Session AND Application AND languages
if (structKeyExists(url, "reinit") and url.reinit eq 4) {
structClear(SESSION);
structClear(APPLICATION);
onApplicationStart();
onSessionStart();
application.langStruct = application.objLanguage.initLanguages();
}


Expand All @@ -166,7 +171,7 @@ component displayname="Application" output="false" extends="backend.myapp.ownApp
thiscontent = application.objGlobal.getSEF(replace(cgi.path_info,'/','','one'));

// Change language
if (structKeyExists(url, "l")) {
if (structKeyExists(url, "l") and session.lng neq url.l) {
qCheckLanguage = queryExecute(
options = {datasource = application.datasource},
params = {
Expand Down Expand Up @@ -288,23 +293,27 @@ component displayname="Application" output="false" extends="backend.myapp.ownApp

if (application.environment eq "dev") {

writeOutput(arguments.exception);
dump(arguments.exception);
abort;

} else {

// Send email with error
mail to="#application.errorMail#" from="#application.fromEmail#" subject="ERROR - #application.projectName#" type="html" {
writeOutput("<h2>An error occured!</h2>");
writeOutput(arguments.exception);
// Send email with error, but only if its not of type missinginclude (bots)
local.errPath = "/frontend/" & variables.activeTheme & "/templates/error/";
if (arguments.exception.type eq "missinginclude") {
location url=local.errPath & "404.cfm" addtoken="false";
} else {
mail to="#application.errorMail#" from="#application.fromEmail#" subject="ERROR - #application.projectName#" type="html" {
writeOutput(arguments.exception);
}
location url=local.errPath & "error.cfm" addtoken="false";
}

location url="/error.cfm" addtoken="false";


}

}

setting enablecfoutputonly = false;

}

6 changes: 4 additions & 2 deletions www/backend/core/com/book.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ component displayname="book" output="false" {
local.status = "";
local.bookingID = 0;
local.invoiceID = 0;
local.redirectPath = "";

local.getTime = new backend.core.com.time(arguments.customerID);

local.argsReturnValue = structNew();

local.messageStruct = structNew();
local.messageStruct['title'] = "";
local.messageStruct['message'] = "";
Expand Down Expand Up @@ -119,6 +118,7 @@ component displayname="book" output="false" {
local.newProductID = local.bookingData.planID;
local.planID = local.newProductID;
local.moduleID = "";
local.redirectPath = "";

// Are there modules included?
if (structKeyExists(local.bookingData, "modulesIncluded")) {
Expand Down Expand Up @@ -155,6 +155,7 @@ component displayname="book" output="false" {
local.newProductID = local.bookingData.moduleID;
local.moduleID = local.newProductID;
local.planID = "";
local.redirectPath = local.bookingData.redirectPath;


// Neither plan nor module
Expand Down Expand Up @@ -827,6 +828,7 @@ component displayname="book" output="false" {
local.argsReturnValue['bookingID'] = local.bookingID;
local.argsReturnValue['invoiceID'] = local.invoiceID;
local.argsReturnValue['success'] = true;
local.argsReturnValue['redirectPath'] = local.redirectPath;

return local.argsReturnValue;

Expand Down
10 changes: 6 additions & 4 deletions www/backend/core/com/invoices.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ component displayname="invoices" output="false" {

local.objCurrency = new backend.core.com.currency();

local.userID = "";
local.userID = "0";
local.title = "";
local.invoiceDate = createODBCDate(now());
local.dueDate = createODBCDate(now()+30);
Expand Down Expand Up @@ -212,7 +212,9 @@ component displayname="invoices" output="false" {
local.total_text = "Total";
}

try {
/* try { */



queryExecute(
options = {datasource = application.datasource},
Expand Down Expand Up @@ -244,12 +246,12 @@ component displayname="invoices" output="false" {
)


} catch (any e) {
/* } catch (any e) {
local.argsReturnValue['message'] = e.message;
return argsReturnValue;
}
} */

// Recalculating
local.recalc = recalculateInvoice(local.invoiceID);
Expand Down
2 changes: 2 additions & 0 deletions www/backend/core/com/modules.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ component displayname="modules" output="false" {
sql = "
SELECT modules.intModuleID, modules.strTabPrefix, modules.strPicture, modules.intNumTestDays,
modules.blnBookable, modules.intPrio, modules.blnActive, modules.strSettingPath, modules.blnFree,
modules.strRedirectPath,
currencies.strCurrencyISO, currencies.strCurrencySign, currencies.intCurrencyID,
COALESCE(modules_prices.blnIsNet,0) as blnIsNet,
COALESCE(modules_prices.decPriceMonthly,0) as decPriceMonthly,
Expand Down Expand Up @@ -183,6 +184,7 @@ component displayname="modules" output="false" {
local.moduleStruct['currency'] = local.qModule.strCurrencyISO;
local.moduleStruct['settingPath'] = local.qModule.strSettingPath;
local.moduleStruct['testDays'] = local.qModule.intNumTestDays;
local.moduleStruct['redirectPath'] = local.qModule.strRedirectPath;
if (len(trim(local.qModule.strCurrencySign))) {
local.moduleStruct['currencySign'] = local.qModule.strCurrencySign;
} else {
Expand Down
8 changes: 6 additions & 2 deletions www/backend/core/handler/book_module.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@
session.currentModules = objModules.getBookedModules(session.customer_id);
getAlert('msgModuleActivated');
logWrite("user", "info", "A module has been activated [CustomerID: #session.customer_ID#, UserID: #session.user_ID#, ModuleID: #moduleID#]");
location url="#application.mainURL#/account-settings/modules" addtoken=false;
if (structKeyExists(makeBooking, "redirectPath") and len(trim(makeBooking.redirectPath))) {
location url="#makeBooking.redirectPath#" addtoken="false";
} else {
location url="#application.mainURL#/account-settings/modules" addtoken="false";
}
} else {
getAlert(makeBooking.message, 'danger');
logWrite("system", "error", "Could not book a module [CustomerID: #session.customer_ID#, UserID: #session.user_ID#, ModuleID: #moduleID#, Error: #makeBooking.message#]");
location url="#application.mainURL#/account-settings/modules" addtoken=false;
location url="#application.mainURL#/account-settings/modules" addtoken="false";
}
Expand Down
4 changes: 2 additions & 2 deletions www/backend/core/handler/sysadmin/invoices.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ if (structKeyExists(form, "settings")) {
invoiceID = form.settings;
param name="form.title" default="";
param name="form.userID" default="";
param name="form.userID" default="0";
param name="form.currency" default="";
param name="form.invoice_date" default="";
param name="form.due_date" default="";
Expand All @@ -222,7 +222,7 @@ if (structKeyExists(form, "settings")) {
if (updInvoice.success) {
getAlert('Update successful!');
} else {
getAlert(updInvoice.message);
getAlert(updInvoice.message, "danger");
}
location url="#application.mainURL#/sysadmin/invoice/edit/#invoiceID#" addtoken="false";
Expand Down
5 changes: 4 additions & 1 deletion www/backend/core/handler/sysadmin/modules.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ if (structKeyExists(form, "edit_module")) {
param name="form.desc" default="";
param name="form.test_days" default="0";
param name="form.path" default="";
param name="form.redirect" default="";
mapping = "backend/modules/" & form.prefix & "/settings";
path = "backend/modules/" & form.prefix & "/settings.cfm";
Expand Down Expand Up @@ -235,6 +236,7 @@ if (structKeyExists(form, "edit_module")) {
moduleID: {type: "numeric", value: form.edit_module},
modulePath: {type: "varchar", value: mapping},
free: {type: "boolean", value: form.free},
redirect: {type: "nvarchar", value: form.redirect}
},
sql = "
UPDATE modules
Expand All @@ -246,7 +248,8 @@ if (structKeyExists(form, "edit_module")) {
blnBookable = :bookable,
intNumTestDays = :test_days,
strSettingPath = :modulePath,
blnFree = :free
blnFree = :free,
strRedirectPath = :redirect
WHERE intModuleID = :moduleID
"
Expand Down
Loading

0 comments on commit 47d9b20

Please sign in to comment.