Skip to content

Commit 91fd68a

Browse files
authored
Merge pull request #641 from PAWECOGmbH/staging
Staging to production
2 parents 8e04847 + 6d8e102 commit 91fd68a

File tree

13 files changed

+231
-44
lines changed

13 files changed

+231
-44
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ config.cfm
1010

1111
### Log files ###
1212
www/logs
13-
.history
13+
.history
14+
15+
### NGINX files ###
16+
config/nginx

compose-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
volumes:
1313
- ./www:/var/www
1414
- ./config/nginx/conf.d:/etc/nginx/conf.d
15+
- ./config/nginx/custom.conf:/etc/nginx/custom.conf
1516
- userdata_volume:/var/www/userdata
1617
networks:
1718
- saaster_net

compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
volumes:
1313
- ./www:/var/www
1414
- ./config/nginx/conf.d:/etc/nginx/conf.d
15+
- ./config/nginx/custom.conf:/etc/nginx/custom.conf
1516
- userdata_volume:/var/www/userdata
1617
networks:
1718
- npm_network
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ server {
3636
}
3737

3838
location @lucee {
39+
3940
proxy_pass http://tomcat_backend;
4041
proxy_set_header Host $host;
4142
proxy_set_header X-Real-IP $remote_addr;
4243
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
4344
proxy_set_header X-Forwarded-Proto $scheme;
45+
4446
}
4547

4648
}

config/example.custom.conf

Lines changed: 0 additions & 8 deletions
This file was deleted.

config/nginx/conf.d/custom.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

readme.md

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ mv config/example.env .env
4242
```
4343
Update the ```.env``` file with your configuration. You can also adopt the suggestions for the local environment.<br><br>
4444

45+
<b>5. Copy the NGINX base settings</b><br>
46+
```
47+
mv config/example.base.conf config/nginx/base.conf
48+
```
4549

46-
<b>5. Set up the application configuration</b><br>
50+
<b>6. Set up the application configuration</b><br>
4751
Copy the example configuration file and make any necessary changes:
4852
```
4953
mv config/example.config_dev.cfm www/config.cfm
@@ -54,24 +58,24 @@ Note: If you change the ```config.cfm``` file after the first start of the appli
5458

5559
<br>
5660

57-
<b>6. Start the containers</b><br>
61+
<b>7. Start the containers</b><br>
5862
Use Docker Compose to start the development environment:
5963
```
6064
docker compose -f compose-dev.yml up
6165
```
6266

63-
<b>7. Configure Lucee</b><br>
67+
<b>8. Configure Lucee</b><br>
6468
Access the Lucee admin interface:
6569

6670
+ <b>URL:</b> ```http://localhost:8080/lucee/admin/server.cfm```
6771
+ <b>Steps:</b>
68-
+ Set up the database connection (<b>important:</b> Make sure to enable 'Allow Multiple Queries.')
72+
+ Set up the database connection (<b>important:</b> Make sure to enable 'Allow Multiple Queries.')
6973
+ Configure SMTP (you can use Inbucket for local email handling).
7074
+ Adjust any additional settings required for your development setup.
71-
75+
7276
<br>
7377

74-
<b>8. Set up Saaster</b><br>
78+
<b>9. Set up Saaster</b><br>
7579
Run the setup script to initialize Saaster:
7680

7781
+ <b>URL:</b> ```http://localhost:8080/setup/index.cfm```
@@ -147,7 +151,7 @@ We welcome contributions from developers to help improve Saaster. Whether it's f
147151
Implement your changes and commit them with a clear and concise commit message:<br>
148152
```git add .```<br>
149153
```git commit -m "Add feature description"```
150-
154+
151155
5. <b>Push your branch</b><br>
152156
Push your branch to your forked repository:<br>
153157
```git push origin feature/your-feature-name```
@@ -177,12 +181,3 @@ For more information or if you're unsure about something, feel free to open an i
177181
- [taffy](https://github.com/atuttle/Taffy)
178182

179183

180-
181-
182-
183-
184-
185-
186-
187-
188-

www/backend/core/com/plans.cfc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ component displayname="plans" output="false" {
320320
321321
"
322322
)
323-
323+
324324
local.arrPlan = arrayNew(1);
325325

326-
if (local.getPlan.recordCount) {
326+
if (local.getPlan.recordCount and local.getPlan.intPlanID gt 0) {
327327

328328
cfloop( query = local.getPlan ) {
329329

@@ -419,7 +419,7 @@ component displayname="plans" output="false" {
419419

420420
// Get all the included modules of the current plan
421421
structAppend(local.structPlan, getModulesIncluded(local.getPlan.intPlanID));
422-
422+
423423

424424
local.objPrices = new backend.core.com.prices(
425425
vat=local.getPlan.decVat,
@@ -759,6 +759,11 @@ component displayname="plans" output="false" {
759759
// Get all the included modules of the current plan
760760
structAppend(local.planStruct, getModulesIncluded(local.qCurrentPlan.intPlanID));
761761

762+
} else {
763+
764+
// If we do not have any plans, set maxUsers to 99999 (unlimited)
765+
local.planStruct['maxUsers'] = 99999;
766+
762767
}
763768

764769
}

www/backend/core/handler/sysadmin/customers.cfm

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
param name="form.billing_address" default="";
1818
param name="form.billing_info" default="";
1919
20-
// Check whether the email is valid
20+
// Check whether the email is valid
2121
checkEmail = application.objGlobal.checkEmail(form.email);
2222
if (!checkEmail) {
2323
getAlert('alertEnterEmail', 'warning');
@@ -45,6 +45,7 @@
4545
4646
}
4747
48+
// Edit user
4849
if (structKeyExists(form, "edit_user")) {
4950
param name="form.customer_id" default="";
5051
param name="form.user_id " default="";
@@ -115,4 +116,116 @@
115116
116117
location url="#application.mainURL#/sysadmin/customers/details/#form.customer_id#" addtoken="false";
117118
}
119+
120+
// Add new customer
121+
if (structKeyExists(form, "add_customer")) {
122+
123+
customerStruct = {};
124+
customerStruct['strCompanyName'] = form.company;
125+
customerStruct['strFirstName'] = form.first_name;
126+
customerStruct['strLastName'] = form.last_name;
127+
customerStruct['strEmail'] = form.email;
128+
customerStruct['strLanguage'] = form.language;
129+
customerStruct['password'] = form.password;
130+
131+
checkEmail = application.objGlobal.checkEmail(form.email);
132+
133+
if (checkEmail) {
134+
135+
// Check for already registered email
136+
qCheckDouble = queryExecute(
137+
options = {datasource = application.datasource},
138+
params = {
139+
strEmail = {type: "nvarchar", value: form.email}
140+
},
141+
sql = "
142+
SELECT intUserID
143+
FROM users
144+
WHERE strEmail = :strEmail
145+
"
146+
);
147+
148+
if (qCheckDouble.recordCount) {
149+
getAlert('This e-mail address is already in use!', 'warning');
150+
location url="#application.mainURL#/sysadmin/customers" addtoken="false";
151+
}
152+
153+
// Hash and salt the password
154+
hashedStruct = application.objGlobal.generateHash(form.password);
155+
customerStruct['hash'] = hashedStruct.thisHash;
156+
customerStruct['salt'] = hashedStruct.thisSalt;
157+
158+
// Save the customer into the db
159+
objRegister = new frontend.core.com.register();
160+
insertCustomer = objRegister.insertCustomer(customerStruct);
161+
if (insertCustomer.success) {
162+
163+
qNewUser = queryExecute(
164+
options = {datasource = application.datasource},
165+
params = {
166+
strEmail = {type: "nvarchar", value: form.email}
167+
},
168+
sql = "
169+
SELECT intCustomerID
170+
FROM users
171+
WHERE strEmail = :strEmail
172+
"
173+
);
174+
175+
newCustomerID = qNewUser.intCustomerID;
176+
177+
// Update country or timezone
178+
if (structKeyExists(form, "countryID") and isNumeric(form.countryID)) {
179+
180+
queryExecute(
181+
options = {datasource = application.datasource},
182+
params = {
183+
intCustomerID: {type: "numeric", value: newCustomerID},
184+
intCountryID: {type: "numeric", value: form.countryID}
185+
},
186+
sql = "
187+
UPDATE customers
188+
SET intCountryID = :intCountryID
189+
WHERE intCustomerID = :intCustomerID
190+
"
191+
)
192+
193+
} else {
194+
195+
queryExecute(
196+
options = {datasource = application.datasource},
197+
params = {
198+
intCustomerID: {type: "numeric", value: newCustomerID},
199+
intTimeZoneID: {type: "numeric", value: form.timezoneID}
200+
},
201+
sql = "
202+
UPDATE customers
203+
SET intTimeZoneID = :intTimeZoneID
204+
WHERE intCustomerID = :intCustomerID
205+
"
206+
)
207+
208+
}
209+
210+
getAlert('The new customer has been added.', 'success');
211+
212+
213+
} else {
214+
215+
getAlert(insertCustomer.message, 'danger');
216+
217+
}
218+
219+
location url="#application.mainURL#/sysadmin/customers" addtoken="false";
220+
221+
222+
223+
}
224+
225+
226+
227+
}
228+
229+
230+
118231
</cfscript>

0 commit comments

Comments
 (0)