Skip to content

Commit 6eb7d72

Browse files
authored
Merge pull request #674 from PAWECOGmbH/663-expand-the-customer-overview
Expand customer overview and info mail to sysadmin
2 parents 3ff7dbf + 6b3bd5c commit 6eb7d72

File tree

5 files changed

+67
-11
lines changed

5 files changed

+67
-11
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SET NAMES utf8mb4;
2+
SET FOREIGN_KEY_CHECKS = 0;
3+
4+
INSERT INTO system_settings (strSettingVariable, strDefaultValue, strDescription)
5+
VALUES
6+
('settingMailNewRegistrations', '1', 'Would you like to be notified about new registrations by email?');
7+
8+
SET FOREIGN_KEY_CHECKS = 1;

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@
127127
<select class="form-select" name="sort" onchange="this.form.submit()">
128128
<option value="strCompanyName ASC" <cfif session.cust_sort eq "strCompanyName ASC">selected</cfif>>Customer name A -> Z</option>
129129
<option value="strCompanyName DESC" <cfif session.cust_sort eq "strCompanyName DESC">selected</cfif>>Customer name Z -> A</option>
130+
<option value="strContactPerson ASC" <cfif session.cust_sort eq "strContactPerson ASC">selected</cfif>>Contact name A -> Z</option>
131+
<option value="strContactPerson DESC" <cfif session.cust_sort eq "strContactPerson DESC">selected</cfif>>Contact name Z -> A</option>
132+
<option value="strCity ASC" <cfif session.cust_sort eq "strCity ASC">selected</cfif>>City A -> Z</option>
133+
<option value="strCity DESC" <cfif session.cust_sort eq "strCity DESC">selected</cfif>>City Z -> A</option>
134+
<option value="dtmInsertDate DESC" <cfif session.cust_sort eq "dtmInsertDate DESC">selected</cfif>>Registered (newest first)</option>
135+
<option value="dtmInsertDate ASC" <cfif session.cust_sort eq "dtmInsertDate ASC">selected</cfif>>Registered (oldest first)</option>
130136
</select>
131137
</div>
132138
</div>
@@ -143,11 +149,12 @@
143149
<table class="table table-vcenter table-mobile-md card-table">
144150
<thead>
145151
<tr>
146-
<th width="20%">Company</th>
152+
<th width="25%">Company</th>
147153
<th width="20%">Contact</th>
148-
<th width="20%">City</th>
149-
<th width="20%">Phone</th>
150-
<th width="15%"></th>
154+
<th width="15%">City</th>
155+
<th width="15%">Phone</th>
156+
<th width="10%">Registered</th>
157+
<th width="15%">Actions</th>
151158
</tr>
152159
</thead>
153160
<tbody>
@@ -167,7 +174,7 @@
167174
<a href="#application.mainURL#/sysadmin/customers/details/#qCustomers.intCustomerID#">
168175
<div class="flex-fill">
169176
<cfif len(trim(qCustomers.strCompanyName))>
170-
<div class="font-weight-medium">#qCustomers.strCompanyName#</div>
177+
<div class="font-weight-medium">#qCustomers.strCompanyName# <cfif qCustomers.intCustomerID eq session.customer_id>(SysAdmin)</cfif></div>
171178
<cfelse>
172179
<div class="font-weight-medium">#qCustomers.strContactPerson# (Private)</div>
173180
</cfif>
@@ -185,14 +192,19 @@
185192
<td data-label="Phone">
186193
#qCustomers.strPhone#
187194
</td>
195+
<td data-label="Registered">
196+
#lsDateFormat(qCustomers.dtmInsertDate)#
197+
</td>
188198
<td>
189199
<div class="btn-list flex-nowrap">
190200
<a href="#application.mainURL#/sysadmin/customers/edit/#qCustomers.intCustomerID#" class="btn">
191201
Edit
192202
</a>
193-
<a href="#application.mainURL#/sysadm/customers?logincustomer=#qCustomers.intCustomerID#" class="btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Login as customer" onclick="return confirm('You are about to leave your sysadmin session and log in as this customer. Do you want to proceed?')">
194-
Login
195-
</a>
203+
<cfif qCustomers.intCustomerID neq session.customer_id>
204+
<a href="#application.mainURL#/sysadm/customers?logincustomer=#qCustomers.intCustomerID#" class="btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Login as customer" onclick="return confirm('You are about to leave your sysadmin session and log in as this customer. Do you want to proceed?')">
205+
Login
206+
</a>
207+
</cfif>
196208
</div>
197209
</td>
198210
</tr>

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@
141141
Contact person
142142
</div>
143143
<div>
144-
E-mail
144+
Email
145145
</div>
146146
<div>
147147
Phone
148148
</div>
149+
<div>
150+
Registered at
151+
</div>
149152
</div>
150153
<div class="me-5 d-flex flex-column ps-3">
151154
<div>
@@ -155,7 +158,10 @@
155158
#getCustomer.email#
156159
</div>
157160
<div>
158-
#getCustomer.phone#
161+
#getCustomer.phone#&nbsp;
162+
</div>
163+
<div>
164+
#lsDateFormat(getCustomer.insertDate)#
159165
</div>
160166
</div>
161167
</div>

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
qSwissQrBill = objSysadmin.getSystemSetting('settingSwissQrBill');
2727
qSwissQrIBAN = objSysadmin.getSystemSetting('settingIBANnumber');
2828
qSwissQrRef = objSysadmin.getSystemSetting('settingQRreference');
29+
infoMailNewRegistrations = objSysadmin.getSystemSetting('settingMailNewRegistrations');
2930
customerData = application.objSysAdmin.getSysAdminData();
3031
countryData = application.objCustomer.getUserDataByID(customerData.customerID);
3132
32-
3333
</cfscript>
3434

3535

@@ -66,6 +66,23 @@
6666
</div>
6767
<form action="#application.mainURL#/sysadm/settings" method="post">
6868
<input type="hidden" name="edit_sysadmin_settings">
69+
<div class="card-body">
70+
71+
<h3>Generel settings</h3>
72+
<div class="border align-baseline p-3">
73+
<div class="row">
74+
<div class="col-lg-6">
75+
<p>#infoMailNewRegistrations.strDescription#</p>
76+
<select name="#infoMailNewRegistrations.strSettingVariable#" class="form-select w-50">
77+
<option value="0" <cfif infoMailNewRegistrations.strDefaultValue eq 0>selected</cfif>>No</option>
78+
<option value="1" <cfif infoMailNewRegistrations.strDefaultValue eq 1>selected</cfif>>Yes</option>
79+
</select>
80+
</div>
81+
</div>
82+
</div>
83+
84+
</div>
85+
6986
<div class="card-body">
7087

7188
<h3>Invoice settings</h3>

www/frontend/core/com/register.cfc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,19 @@ component displayname="customer" output="false" {
199199

200200
);
201201

202+
// Send notification email to sysadmin
203+
if (application.objSysAdmin.getSystemSetting('settingMailNewRegistrations').strDefaultValue eq 1) {
204+
205+
mail to="#application.toEmail#" from="#application.fromEmail#" subject="#application.projectName#: A new customer has registered" type="html" {
206+
writeOutput("
207+
A new customer has successfully registered on #application.projectName#. <br><br>
208+
<strong>Company:</strong> #local.company_name#<br>
209+
<strong>Contact:</strong> #local.first_name# #local.last_name#<br>
210+
<strong>Email:</strong> #local.email#");
211+
}
212+
213+
}
214+
202215
local.argsReturnValue['message'] = "OK";
203216
local.argsReturnValue['success'] = true;
204217

0 commit comments

Comments
 (0)