Skip to content

Commit 8a40774

Browse files
authored
Merge pull request #638 from PAWECOGmbH/development
Dev to Staging
2 parents fda6f12 + 5e4ec61 commit 8a40774

File tree

10 files changed

+225
-24
lines changed

10 files changed

+225
-24
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 custom file ###
16+
config/nginx/custom.conf

config/example.custom.conf

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
# For your own NGINX settings#
1+
# ==========================================================
2+
# Custom NGINX Configuration File
23
#
3-
# server {
4-
# listen 80;
5-
# server_name yourdomain.com;
6-
# return 301 https://www.yourdomain.com$request_uri;
7-
# }
4+
# This file is intended for developer-specific NGINX settings.
5+
# You can define additional rules, headers, location blocks,
6+
# or other configurations without modifying the default setup.
7+
#
8+
# Do NOT create a new `server {}` block here!
9+
# This file is included inside the main server block.
810
#
11+
# Example:
12+
# add_header X-Frame-Options SAMEORIGIN;
13+
# location /custom-api/ {
14+
# proxy_pass http://backend_service;
15+
# }
16+
# ==========================================================

config/nginx/conf.d/custom.conf

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

config/nginx/conf.d/default.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ server {
4343
proxy_set_header X-Forwarded-Proto $scheme;
4444
}
4545

46+
include /nginx/custom.conf;
47+
4648
}

www/backend/core/com/plans.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ component displayname="plans" output="false" {
323323

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

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 tinezone
178+
if (len(trim(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>

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

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@
6161
6262
qCustomers = objSysadmin.getCustomerSearch(searchString, cust_start, session.cust_sort);
6363
}else {
64-
64+
6565
qCustomers = objSysadmin.getCustomer(cust_start, session.cust_sort);
6666
}
6767
6868
cntCountries = application.objGlobal.getCountry().recordCount;
6969
70+
qCountries = application.objGlobal.getCountry();
71+
if (!qCountries.recordCount) {
72+
timeZones = new backend.core.com.time().getTimezones();
73+
}
74+
7075
</cfscript>
7176

7277

@@ -86,6 +91,12 @@
8691
<li class="breadcrumb-item active">Customers</li>
8792
</ol>
8893
</div>
94+
<!--- Button new customer --->
95+
<div class="#getLayout.layoutPageHeader# col-lg-3 col-md-4 col-sm-4 col-xs-12 align-items-end float-start">
96+
<a href="##" data-bs-toggle="modal" data-bs-target="##customer_new" class="btn btn-primary">
97+
<i class="fas fa-plus pe-3"></i> New customer
98+
</a>
99+
</div>
89100
</div>
90101
</div>
91102
<cfif structKeyExists(session, "alert")>
@@ -256,6 +267,82 @@
256267
</div>
257268
</div>
258269
</cfoutput>
259-
260270

261-
</div>
271+
272+
</div>
273+
274+
<!--- Modal new customer --->
275+
<cfoutput>
276+
<form action="#application.mainURL#/sysadm/customers" method="post">
277+
<input type="hidden" name="add_customer">
278+
<div id="customer_new" class="modal modal-blur fade" tabindex="-1" style="display: none;" aria-hidden="true" data-bs-backdrop='static' data-bs-keyboard='false'>
279+
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
280+
<div class="modal-content">
281+
<div class="modal-header">
282+
<h5 class="modal-title">Add new customer</h5>
283+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
284+
</div>
285+
<div class="modal-body">
286+
<div class="mb-3">
287+
<label class="form-label">Company *</label>
288+
<input type="text" name="company" class="form-control" autocomplete="off" maxlength="50" required>
289+
</div>
290+
<div class="mb-3">
291+
<label class="form-label">First name *</label>
292+
<input type="text" name="first_name" class="form-control" autocomplete="off" maxlength="50" required>
293+
</div>
294+
<div class="mb-3">
295+
<label class="form-label">Last name *</label>
296+
<input type="text" name="last_name" class="form-control" autocomplete="off" maxlength="50" required>
297+
</div>
298+
<div class="mb-3">
299+
<label class="form-label">E-Mail address *</label>
300+
<input type="email" name="email" class="form-control" autocomplete="off" maxlength="50" required>
301+
</div>
302+
<div class="mb-3">
303+
<label class="form-label">Password *</label>
304+
<input type="text" name="password" class="form-control" autocomplete="off" maxlength="50" required>
305+
</div>
306+
<div class="mb-3">
307+
<label class="form-label">#getTrans('formLanguage')#</label>
308+
<select name="language" class="form-select">
309+
<cfloop list="#application.allLanguages#" index="i">
310+
<cfset lngIso = listfirst(i,"|")>
311+
<cfset lngName = listlast(i,"|")>
312+
<option value="#lngIso#" <cfif lngIso eq session.lng>selected</cfif>>#lngName#</option>
313+
</cfloop>
314+
</select>
315+
</div>
316+
<cfif qCountries.recordCount>
317+
<div class="mb-3">
318+
<label class="form-label">#getTrans('formCountry')# *</label>
319+
<select name="countryID" class="form-select" required>
320+
<option value=""></option>
321+
<cfloop query="qCountries">
322+
<option value="#qCountries.intCountryID#">#qCountries.strCountryName#</option>
323+
</cfloop>
324+
</select>
325+
</div>
326+
<cfelse>
327+
<div class="mb-3">
328+
<label class="form-label">#getTrans('titTimezone')# *</label>
329+
<select name="timezoneID" class="form-select" required>
330+
<option value=""></option>
331+
<cfloop array="#timeZones#" index="i">
332+
<option value="#i.id#">#i.timezone# - #i.city# (#i.utc#)</option>
333+
</cfloop>
334+
</select>
335+
</div>
336+
</cfif>
337+
</div>
338+
<div class="modal-footer">
339+
<a href="##" class="btn btn-link link-secondary" data-bs-dismiss="modal">Cancel</a>
340+
<button type="submit" class="btn btn-primary ms-auto">
341+
Save customer
342+
</button>
343+
</div>
344+
</div>
345+
</div>
346+
</div>
347+
</form>
348+
</cfoutput>

www/backend/core/views/sysadmin/customers_details.cfm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// Customers currency
1515
custCurrency = getCustomer.currencyStruct.iso;
1616
custCurrencyID = new backend.core.com.currency().getCurrency(custCurrency).id;
17-
1817
if (!isStruct(getCustomer) or structIsEmpty(getCustomer)) {
1918
location url="#application.mainURL#/sysadmin/customers" addtoken="false";
2019
}

www/frontend/core/com/register.cfc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ component displayname="customer" output="false" {
9191
local.argsReturnValue['message'] = "";
9292
local.argsReturnValue['success'] = false;
9393

94-
param name="local.company_name" default="";
95-
param name="local.first_name" default="";
96-
param name="local.last_name" default="";
97-
param name="local.email" default="";
98-
param name="local.language" default="";
99-
param name="local.password" default=""; //(the password must be hashed already!)
100-
param name="local.uuid" default="";
101-
10294
local.company_name = '';
10395
local.first_name = '';
10496
local.last_name = '';
@@ -134,7 +126,6 @@ component displayname="customer" output="false" {
134126
}
135127

136128

137-
138129
try {
139130

140131
queryExecute(

www/frontend/core/scheduletasks/tasks.cfm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
44
// This file gets executed from the scheduler every 2 minutes
55
6-
setting requesttimeout = 1000;
76
objLogs = application.objLog;
87
objTime = new backend.core.com.time(1);
98

0 commit comments

Comments
 (0)