Skip to content

Commit

Permalink
added second email on User, and option to send Services and DID email…
Browse files Browse the repository at this point in the history
… notification
  • Loading branch information
magnussolution committed Mar 18, 2023
1 parent 9009400 commit 1ec21ca
Show file tree
Hide file tree
Showing 20 changed files with 536 additions and 302 deletions.
3 changes: 3 additions & 0 deletions app/model/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Ext.define('MBilling.model.User', {
}, {
name: 'email',
type: 'string'
}, {
name: 'email2',
type: 'string'
}, {
name: 'doc',
type: 'string'
Expand Down
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
67 changes: 56 additions & 11 deletions classic/src/view/user/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,42 @@ Ext.define('MBilling.view.user.Form', {
minLength: 8
}]
}, {
name: 'email',
fieldLabel: t('Email'),
allowBlank: true
}, {
name: 'doc',
fieldLabel: t('DOC'),
allowBlank: true
xtype: 'fieldcontainer',
layout: 'hbox',
defaults: {
xtype: 'textfield',
labelAlign: 'right',
flex: 1
},
items: [{
name: 'email',
fieldLabel: t('Email'),
allowBlank: true,
labelWidth: 145
}, {
name: 'email2',
fieldLabel: t('Email') + ' 2',
allowBlank: true
}]
}, {
name: 'vat',
fieldLabel: t('VAT'),
hidden: App.user.isClient,
allowBlank: true
xtype: 'fieldcontainer',
layout: 'hbox',
defaults: {
xtype: 'textfield',
labelAlign: 'right',
flex: 1
},
items: [{
name: 'doc',
fieldLabel: t('DOC'),
allowBlank: true,
labelWidth: 145
}, {
name: 'vat',
fieldLabel: t('VAT'),
hidden: App.user.isClient,
allowBlank: true
}]
}, {
xtype: 'moneyfield',
name: 'contract_value',
Expand Down Expand Up @@ -311,6 +335,27 @@ Ext.define('MBilling.view.user.Form', {
allowBlank: true,
flex: 3
}]
}, {
xtype: 'fieldcontainer',
layout: 'hbox',
defaults: {
xtype: 'textfield',
labelAlign: 'right',
labelWidth: 145,
flex: 1
},
items: [{
xtype: 'yesnocombo',
name: 'email_services',
fieldLabel: t('Services email notification'),
flex: 2
}, {
xtype: 'yesnocombo',
nname: 'email_did',
fieldLabel: t('DID email notification'),
labelWidth: 170,
flex: 3
}]
}, {
xtype: 'fieldcontainer',
layout: 'hbox',
Expand Down
6 changes: 6 additions & 0 deletions classic/src/view/user/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ Ext.define('MBilling.view.user.List', {
dataIndex: 'email',
flex: 4,
hidden: window.isTablet
}, {
header: t('Email') + ' 2',
dataIndex: 'email2',
flex: 4,
hidden: true,
hideable: !App.user.isClient && !App.user.isAgent
}, {
header: t('Credit'),
dataIndex: 'credit',
Expand Down
28 changes: 21 additions & 7 deletions protected/commands/DidCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $didUse->idUser->credit - $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, -$didUse->idDid->fixrate);
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
} else {
$description = Yii::t('zii', 'Monthly payment DID') . ' ' . $didUse->idDid->did;
Expand All @@ -113,7 +115,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $didUse->idUser->credit - $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, -$didUse->idDid->fixrate);
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
}
} else {
Expand All @@ -129,7 +133,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, number_format($didUse->idUser->credit, 2));
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
}
} else {
$log = $this->debug >= 1 ? MagnusLog::writeLog(LOGFILE, ' line:' . __LINE__ . " USER " . $didUse->idUser->username . " DONT HAVE ENOUGH CREDIT TO PAY FOR THE DID " . $didUse->idDid->did . " NOTIFY NOW ") : null;
Expand All @@ -145,7 +151,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, number_format($didUse->idUser->credit, 2));
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}

$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
}
Expand All @@ -166,7 +174,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $didUse->idUser->credit - $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, -$didUse->idDid->fixrate);
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
} else {
$description = Yii::t('zii', 'Monthly payment DID') . ' ' . $didUse->idDid->did;
Expand All @@ -188,7 +198,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $didUse->idUser->credit - $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, -$didUse->idDid->fixrate);
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
}
} else {
Expand Down Expand Up @@ -226,7 +238,9 @@ public function run($args)
$mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $didUse->idDid->did);
$mail->replaceInEmail(Mail::$DID_COST_KEY, $didUse->idDid->fixrate);
$mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $didUse->idUser->credit);
$mail->send();
if ($didUse->idUser->email_did == 1) {
$mail->send();
}
$mail->send($this->config['global']['admin_email']);
$sendAdmin = $this->config['global']['admin_received_email'] == 1 ? $mail->send($this->config['global']['admin_email']) : null;
}
Expand Down
5 changes: 4 additions & 1 deletion protected/commands/ServicesCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ public function notifyUser($service, $type)
$mail->replaceInEmail(Mail::$SERVICE_PRICE, $service->idServices->price);
$mail->replaceInEmail(Mail::$SERVICE_PENDING_URL, $link);
try {
@$mail->send();
if ($service->idUser->email_services == 1) {
@$mail->send();
}

} catch (Exception $e) {
//error SMTP
}
Expand Down
Loading

0 comments on commit 1ec21ca

Please sign in to comment.