inital commit

This commit is contained in:
2026-06-19 20:08:01 +06:00
commit 8a5abeeae4
13128 changed files with 3192007 additions and 0 deletions

1
.ftpquota Normal file
View File

@@ -0,0 +1 @@
9846 2388458419

115
.gitignore vendored Normal file
View File

@@ -0,0 +1,115 @@
vendor/
logs/
nbproject/
tmp/
webroot/mpdf60/
webroot/common_script_file_backup.js
webroot/contact_photo/
webroot/Staff/sertg/
config/app.settings.php
webroot/Staff/pdf/
webroot/test.pdf
webroot/imran/test1.css
webroot/imran/test.js
webroot/imran/test.css
webroot/test.docx
webroot/Staff/php.ini
tests/
webroot/Staff/composer.lock
composer.lock
node_modules/
package-lock.json
webroot/js/b87b9ba532ace76ae9f6edfe9f72ded2.ttf
webroot/js/a1a749e89f578a49306ec2b055c073da.svg
webroot/js/962a1bf31c081691065fe333d9fa8105.svg
webroot/js/8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot
webroot/js/82f60bd0b94a1ed68b1e6e309ce2e8c3.svg
webroot/AdminAccountImage/
webroot/cmsuser_logo/
webroot/new_layout/img/
config/app.settings.php
webroot/cronjob/
src/Controller/EpicvelocityController_new.php
webroot/epicvelocity/clients_docs/
webroot/epicvelocity/letters/
.idea/inspectionProfiles/profiles_settings.xml
webroot/test.css
webroot/forum/cache/
webroot/forum/install/lock
src/Controller/TestController.php
webroot/html_content/
webroot/testzip/
webroot/velocity/
webroot/rtg_optimize/
webroot/html_history_code/
webroot/epicvelocity/pdf/ringcentral/
webroot/media/
webroot/chat_attachment/
webroot/client_agreement_files/
webroot/agreenment_contents/
webroot/agreement_signed_content/
webroot/member_education_templates/
webroot/member_help_templates/
webroot/payment_vendor.zip
webroot/js.zip
webroot/css.zip
db/rtgv4_22_04_2020.sql
db/AppController.php
src.zip
webroot/api/
db/app.settings.php
webroot/Staff/sertg_export_error.txt
src/Template/Test/
webroot/test/test.pdf
scrapper/.vscode/launch.json
src/Template/Uploadhtml/creditanalysiscontent_Bk.ctp
webroot/Staff/clientfiles.txt
src/Controller/CmsusersController_bk.php
src/Controller/AppController_bk.php
webroot/forum/inc/config.php
epicvelocity/clients_docs/
epicvelocity/letters/51_1598072863evlg-pdf.zip
epicvelocity/letters/
webroot/rtg_letters/
webroot/rtg_letter_errors.txt
webroot/V2.0/rtg_letters_error.txt
webroot/imran.txt
webroot/member_email_attachment/
webroot/member_email_template_attachment/
webroot/ca.txt
vendor.zip
webroot/mpdf60.zip
db/rtg_letters_error.txt
db/rtg_letters_error_mo.txt
db/rtg_letters_error_staff.txt
webroot/credit_analysis_template/
webroot/mpdf_latest_vendor.zip
db/DashboardController.php
db/EpicvelocityController.php
db/functions.php
db/getSertgInfo.php
db/info-2021-02-25.log
db/SERTG.html
db/SERTG.php
webroot/Array/
webroot/RTG/webroot.zip
webroot/backup_resources/
webroot/member_email_template_body/
webroot/test.php
webroot/client_popup_content/
ghostdriver.log
webroot/email_queue/
webroot/certificates/img/1_bk.png
webroot/certificates/img/2_bk.png
webroot/certificates/img/3_bk.png
.idea/inspectionProfiles/Project_Default.xml
.idea/*
webroot/db_export.php
webroot/user-photo/
webroot/pdfletters/
.idea/workspace.xml
webroot/f.html
webroot/report/credit_report.json
webroot/report/credit_report2.json

13
.htaccess Normal file
View File

@@ -0,0 +1,13 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_php5.c>
php_value post_max_size 16M
php_value upload_max_filesize 5M
php_value memory_limit 128M
php_value max_execution_time 600
</IfModule>

0
=3.1.0 Normal file
View File

29
README.md Normal file
View File

@@ -0,0 +1,29 @@
# README #
This README would normally document whatever steps are necessary to get your application up and running.
### What is this repository for? ###
* Quick summary
* Version
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
### How do I get set up? ###
* Summary of set up
* Configuration
* Dependencies
* Database configuration
* How to run tests
* Deployment instructions
### Contribution guidelines ###
* Writing tests
* Code review
* Other guidelines
### Who do I talk to? ###
* Repo owner or admin
* Other community or team contact

83
api_resource/zapier.json Normal file
View File

@@ -0,0 +1,83 @@
{
"info": {
"_postman_id": "3a34dbf3-d003-47bc-b984-3f3d5091844a",
"name": "Zapier",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": " https://readytogoletters.com/Zapier?api_key=6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n\t\"confirm_password\": \"123456\",\r\n\t\"city\": \"chittagong\",\r\n\t\"first_name\": \"Imran\",\r\n\t\"last_name\": \"Dwyer\",\r\n\t\"name\": \"Imran Dwyer\",\r\n\t\"mobile\": \"01723445742\",\r\n\t\"country\": \"Albania\",\r\n\t\"phone\": \"01723445742\",\r\n\t\"state\": \"ffff\",\r\n\t\"address\": \"aaaaaaaaaaaasssssssssssss\",\r\n\t\"password\": \"Nop@ss1234\",\r\n\t\"email\": \"zapier@gmail.com\",\r\n\t\"zip_code\": \"4228\"\r\n}"
},
"url": {
"raw": "https://readytogoletters.com/Zapier?api_key=6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51",
"protocol": "https",
"host": [
"readytogoletters",
"com"
],
"path": [
"Zapier"
],
"query": [
{
"key": "api_key",
"value": "6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51"
}
]
}
},
"response": []
},
{
"name": "https://readytogoletters.com/Zapier/apiValidate?api_key=6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://readytogoletters.com/Zapier/apiValidate?api_key=6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51",
"protocol": "https",
"host": [
"readytogoletters",
"com"
],
"path": [
"Zapier",
"apiValidate"
],
"query": [
{
"key": "api_key",
"value": "6JxK95ww1v0dg8giSPugHFhqvWZqoK6S51"
}
]
}
},
"response": []
}
]
}

View File

@@ -0,0 +1,32 @@
Git repo add for RTG (test server)
====================================
1. git remote rm origin (If have already a repo on it, we need to remove it)
2. git remote add origin <repo_url> (e.g, git remote add origin https://imranchtl2019@bitbucket.org/rajibcuetcse/rtgv4.git)
3. git config master.remote origin
4. git config master.merge refs/heads/master
If above done successfully. Now your repo has been configured. you can take pull/push/commit
for pull
===========
git pull origin master
for commit
===========
git add <necessary files path> [for all files type ".", (e.g, git add .)]
git commit -m "<your message>"
for push
===========
git push origin master
deployment from test server to destination server
=====================================================
1. check destination server ip is correct from /sendtoproduction/.custom_commands.sh
2. cd /sendtoproduction (hit enter)
3. source .custom_commands.sh (hit enter)
4. deploy (hit enter)
If above done successfully. your files has been deployed

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# copies the project directory from 100 server to 98 and 114
function deploy() {
#chown root:root /var/www/html/ -R;
#find /var/www/html/ -type d -exec chmod 777 {} \;
# chmod 777 /opt/app.sipay.com.tr/storage /opt/app.sipay.com.tr/vendor /opt/app.sipay.com.tr/sipayresource -R;
rsync -avzhe ssh --owner --group --progress --recursive --files-from="include.txt" --exclude-from="exclude.txt" "/var/www/html/" "apache@45.55.43.211:/var/www/html/"
# rsync -avzhe ssh --owner --group --progress "/opt/app.sipay.com.tr/sipayresource/assets" "bruce@176.53.6.134:/opt/app.sipay.com.tr/sipayresource/assets"
#/bin/pssh -A -i -H "176.53.6.134" -l apache 'chown -R apache:apache /opt/app.sipay.com.tr/ && chmod -R 1777 /opt/app.sipay.com.tr/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/public/files && chmod -R 1777 /opt/app.sipay.com.tr/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files/* && cd /opt/app.sipay.com.tr/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/admin/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan cache:clear'
#chmod 755 /var/www/html/ -R;
}
#function deploy104() {
# chown apache:apache /opt/app.sipay.com.tr/ -R;
# find /opt/app.sipay.com.tr/ -type d -exec chmod 755 {} \;
# chmod 777 /opt/app.sipay.com.tr/storage /opt/app.sipay.com.tr/vendor /opt/app.sipay.com.tr/sipayresource -R;
# rsync -avzhe ssh --owner --group --progress --exclude-from="exclude.txt" "/opt/app.sipay.com.tr/" "bruce@176.53.34.104:/opt/app.sipay.com.tr"
# rsync -avzhe ssh --owner --group --progress "/opt/app.sipay.com.tr/sipayresource/assets" "bruce@176.53.34.104:/opt/app.sipay.com.tr/sipayresource/assets"
#
# /bin/pssh -A -i -H "176.53.34.104" -l bruce 'chown -R apache:apache /opt/app.sipay.com.tr/ && chmod -R 1777 /opt/app.sipay.com.tr/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/public/files && chmod -R 1777 /opt/app.sipay.com.tr/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files/* && cd /opt/app.sipay.com.tr/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/admin/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan cache:clear'
# chown apache:apache /opt/app.sipay.com.tr/ -R;
# chmod 777 /opt/app.sipay.com.tr/ -R;
#
#}

View File

@@ -0,0 +1,51 @@
/.idea
/vendor
/epicvelocity
/db
/api_resource
/auto_script
/logs
/tmp
/epicvelocity1
/src_OLD
/src.zip
/migrate.zip
/TestDeploymeent
/config/app.constant.php
/config/app.settings.php
/webroot/Staff/pdf
/webroot/Staff/sertg
/webroot/Staff/vendor
/webroot/Staff/dbconfig.php
/webroot/AdminAccountImage
/webroot/AdminAccountImage
/webroot/agreement_signed_content
/webroot/agreenment_contents
/webroot/attach-documents
/webroot/chat_attachment
/webroot/client_agreement_files
/webroot/cmsuser_logo
/webroot/compiles
/webroot/contact_photo
/webroot/epicvelocity/clients_docs
/webroot/epicvelocity/letters
/webroot/epicvelocity/lib
/webroot/epicvelocity/pdf
/webroot/epicvelocity/vendor
/webroot/epicvelocity/images
/webroot/file_path
/webroot/html_content
/webroot/html_history_code
/webroot/invoice-logo
/webroot/media
/webroot/member_education_templates
/webroot/member_help_templates
/webroot/mpdf60
/webroot/payment_vendor
/webroot/project-media-files
/webroot/rtg_optimize
/webroot/supportsfile
/webroot/user-photo
/webroot/velocity
/webroot/dropbox
/webroot/backend

View File

@@ -0,0 +1,17 @@
/config/app.default.php
/config/app.php
/config/bootstrap.php
/config/bootstrap_cli.php
/config/paths.php
/config/routes.php
/src/
/webroot/Staff/
/webroot/Staff/
/webroot/Staff/getSertgInfo.php
/webroot/js
/webroot/css
/webroot/rtgv3
/webroot/new_layout
/webroot/epicvelocity/css
/webroot/epicvelocity/js

40
bin/cake Normal file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env sh
################################################################################
#
# Cake is a shell script for invoking CakePHP shell commands
#
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
#
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
# @link http://cakephp.org CakePHP(tm) Project
# @since 1.2.0
# @license http://www.opensource.org/licenses/mit-license.php MIT License
#
################################################################################
# Canonicalize by following every symlink of the given name recursively
canonicalize() {
NAME="$1"
if [ -f "$NAME" ]
then
DIR=$(dirname -- "$NAME")
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
fi
while [ -h "$NAME" ]; do
DIR=$(dirname -- "$NAME")
SYM=$(readlink "$NAME")
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
done
echo "$NAME"
}
CONSOLE=$(dirname -- "$(canonicalize "$0")")
APP=$(dirname "$CONSOLE")
exec php "$CONSOLE"/cake.php "$@"
exit

27
bin/cake.bat Normal file
View File

@@ -0,0 +1,27 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Cake is a Windows batch script for invoking CakePHP shell commands
::
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
::
:: Licensed under The MIT License
:: Redistributions of files must retain the above copyright notice.
::
:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
:: @link http://cakephp.org CakePHP(tm) Project
:: @since 2.0.0
:: @license http://www.opensource.org/licenses/mit-license.php MIT License
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
SET app=%0
SET lib=%~dp0
php "%lib%cake.php" %*
echo.
exit /B %ERRORLEVEL%

33
bin/cake.php Normal file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/php -q
<?php
/**
* Command-line code generation utility to automate programmer chores.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 2.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$minVersion = '5.4.16';
if (file_exists('composer.json')) {
$composer = json_decode(file_get_contents('composer.json'));
if (isset($composer->require->php)) {
$minVersion = preg_replace('/([^0-9\.])/', '', $composer->require->php);
}
}
if (version_compare(phpversion(), $minVersion, '<')) {
fwrite(STDERR, sprintf("Minimum PHP version: %s. You are using: %s.\n", $minVersion, phpversion()));
exit(-1);
}
include dirname(__DIR__) . '/config/bootstrap.php';
exit(Cake\Console\ShellDispatcher::run($argv));

49
composer.json Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "~3.1",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"mandrill/mandrill": "1.0.*",
"stripe/stripe-php": "3.13.*",
"mpdf/mpdf": "^7.0",
"dropbox/dropbox-sdk": "1.1.*",
"spatie/dropbox-api": "^1.6",
"ringcentral/ringcentral-php": "^2.2",
"google/apiclient": "^2.0",
"profburial/wkhtmltopdf-binaries-osx": "0.12.1",
"knplabs/knp-snappy": "^1.1"
},
"require-dev": {
"psy/psysh": "@stable",
"cakephp/debug_kit": "~3.2",
"cakephp/bake": "~1.1"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "dev",
"prefer-stable": true
}

BIN
composer.phar Normal file

Binary file not shown.

602
config/app.constant.php Normal file
View File

@@ -0,0 +1,602 @@
<?php
//application constant
define("TOKEN_EXPIRED_AFTER", "+15 min");
define("PIN_EXPIRED_AFTER", "+10 min");
define("APP_DEFAULT_LANGUAGE", "en_US");
define("TRUE_CODE", "1");
define("FALSE_CODE", "0");
define("SUCCESS_CODE", "+000");
define("FAIL_CODE", "-1");
define("TOKEN_CHAR_NO", "8");
define("BULK_ACTION_DELETE", "1");
define('PROFILE_PIC_UPLOAD_DIR', 'profileImages/');
define("APP_DEFAULT_IMAGE_PATH", "default/default_image.png");
define("APP_REG_EMAIL_TEMPLATE_NAME", "registration/email");
define("APP_FORGOT_PASS_EMAIL_TEMPLATE_NAME", "forgotpass/forgot_password");
define("REGISTRATION_EMAIL_SCHEDULE_TRACKING_FILE", "registration_email_schedule.txt");
define("APP_EMAIL_FROM", "no-reply@ygtimes.com");
define("APP_EMAIL_FROM_DISPLAY_NAME", "Zeerow");
define('COPY_RIGHT_YEAR','2017-2025');
define("FA_CONFEDERATION", json_encode(['AFC','UEFA','CAF','CONCACAF','CONMEBOL','OFC']));
define("TEAM_TYPES", json_encode(['Football' , 'Futsal' , 'Beach football']));
define("TEAM_AGE_CATEGORY", json_encode(
[
'RTG-V1S8-General-Attack-to-BUREAUS-Untrue-or-Inaccurate-or-incomplete-Information_FORMAT' =>'RTG-V1S8-General-Attack-to-BUREAUS-Untrue-or-Inaccurate-or-incomplete-Information',
'RTG-V1S6-Late-Payments-BUREAUS-Volume-1-Step-6-attackto-bureaus-for-LATE-PAYMENTS_FORMAT' => 'RTG-V1S6-Late-Payments-BUREAUS-Volume-1-Step-6-attackto-bureaus-for-LATE-PAYMENTS',
'RTG-V1S4-Equifax-Bureau-Inquiries-LETTER-Volume-1-Step-4-for-direct-Equifax-bureau-attack-for-alleged-inquiries_FORMAT' => 'RTG-V1S4-Equifax-Bureau-Inquiries-LETTER-Volume-1-Step-4-for-direct-Equifax-bureau-attack-for-alleged-inquiries',
'RTG-V1S3b-TransUnion-Inquiries-LETTER-after-doing-V1S3a-FIRST-which-is-the-so-called-TU-glitch-2016-2017_FORMAT' => 'RTG-V1S3b-TransUnion-Inquiries-LETTER-after-doing-V1S3a-FIRST-which-is-the-so-called-TU-glitch-2016-2017',
'RTG-V1S2-SEA-11-for-experian-inquiries-VOLUME-1-Step-2_FORMAT' => 'RTG-V1S2-SEA-11-for-experian-inquiries-VOLUME-1-Step-2',
'RTG-V1S1-HiDC-letter-Creditor-Inquiry-Letter-Volume-1-Step-1-RTG-letter_FORMAT' => 'RTG-V1S1-HiDC-letter-Creditor-Inquiry-Letter-Volume-1-Step-1-RTG-letter',
'RTG-SL-CRA-SMART-BOMB-M2C-Method-for-Student-Loans-FIRST-round-OR-after-you-used-a-killing-fields-letter_FORMAT' => 'RTG-SL-CRA-SMART-BOMB-M2C-Method-for-Student-Loans-FIRST-round-OR-after-you-used-a-killing-fields-letter',
'rtg-NM-COLLECTIONS-creditor-M2C-CRM-LETTER-ONLY_FORMAT' => 'rtg-NM-COLLECTIONS-creditor-M2C-CRM-LETTER-ONLY',
'rtg-NM-COLLECTIONS-CRAs-M2C-CRM-LETTER-ONLY_FORMAT' => 'rtg-NM-COLLECTIONS-CRAs-M2C-CRM-LETTER-ONLY',
'RTG-med-COLLECTIONS-cra_FORMAT' => 'RTG-med-COLLECTIONS-cra',
'rtg-cra-LATE-PAYMENTs-12-pack-BUREAUs-M2C-Method_FORMAT' => 'rtg-cra-LATE-PAYMENTs-12-pack-BUREAUs-M2C-Method',
'RTG-cra-Judgments-M2CMethod_FORMAT' => 'RTG-cra-Judgments-M2CMethod',
'rtg-CHARGE-OFF-M2C-CRM-LETTER-1_FORMAT' => 'rtg-CHARGE-OFF-M2C-CRM-LETTER-1',
'RTG-CHARGEOFF-creditor-M2C-CRM-LETTER-ONLY_FORMAT' => 'RTG-CHARGEOFF-creditor-M2C-CRM-LETTER-ONLY',
'RTG-711-M2C-Crm-INQUIRY-Letter-for-BUREAUS_FORMAT' => 'RTG-711-M2C-Crm-INQUIRY-Letter-for-BUREAUS',
'GTG-V1S5-LatePayment-to-Creditor-or-Data-Furnisher-attack-LETTER_FORMAT' => 'GTG-V1S5-LatePayment-to-Creditor-or-Data-Furnisher-attack-LETTER',
'gtg-15-CrackerJack-Bureau-M2C-Method-letter-for-FIRST-ROUND-ATTACKS-contesting-FCRA-and-Metro-2-for-COMPLIANCE-Proof_FORMAT' => 'gtg-15-CrackerJack-Bureau-M2C-Method-letter-for-FIRST-ROUND-ATTACKS-contesting-FCRA-and-Metro-2-for-COMPLIANCE-Proof',
'RTG-V1S7-creditor-GENERAL-attack_FORMAT' => 'RTG-V1S7-creditor-GENERAL-attack',
'RTG-CRAPIs-all-GENERAL-BUREAUS-ATTACK-for-PERSONAL-INFORMATION_FORMAT' => 'RTG-CRAPIs-all-GENERAL-BUREAUS-ATTACK-for-PERSONAL-INFORMATION',
]));
define("GENDER", json_encode(['Men','Women']));
define("FORM_TYPE", json_encode(['1'=>'Static','2'=>'Form']));
define('LANGUAGE_CODE_ENGLISH', 'en');
define('LANGUAGE_CODE_KOREAN', 'ko');
define('STATUS_ACTIVE', 1);
define('STATUS_NOT_ACTIVE', 0);
define('SUPER_SUPER_ADMIN_ID', 1);
define('STATUS_PAUSE_MEMBERSHIP', 2);
define("RANDOM_KEY_LENGTH", 4); // key lenght for generating sharing key.
define("WIDTH_OF_IMAGE", 100); // Set the width of thumbnail image
define("MAX_FILE_SIZE",1288490190); // Set Maximum File size for content page. 1.2 GB
define('MANDRILL_TEMPLATE_USER_CREATION', 'user-creation-cms-en');
define('MANDRILL_TEMPLATE_FORGOT_PASSWORD', 'cms-forgot-password');
define('MANDRILL_TEMPLATE_REPLY_MESSAGE', 'reply-message');
define('INVOICE_TEMPLATE', 'invoice');
define('ESTIMATE_TEMPLATE', 'estimate');
define('COMPANY_ID', 8);
define('PACKAGE_ID', 1);
define('PACKAGE_WAVE_1_ID', 2);
define('PACKAGE_WAVE_2_ID', 3);
define('PACKAGE_WAVE_3_ID', 4);
define('PACKAGE_WAVE_4_ID', 5);
define('PACKAGE_WAVE_5_ID', 6);
define('PACKAGE_WAVE_6_ID', 7);
define('PACKAGE_WAVE_UPGRADE_MINIMUM_DAYS', 15);
define('USER_GET_REWARDED_FORM_WITHIN_DAYS', 15);
define('MAXIMUM_ALLOW_IP', 2);
define('ADMIN_USER_GROUP_ID', 9);
define('ADMIN_USER_ROLE_ID', 9);
define('USER_GROUP_ID', 11);
define('USER_ROLE_ID', 11);
define('UNIT', 'USD');
define('RTG_PLAN_ID', json_encode(['0'=>'R.T.G LETTER GENERATO','1'=>'$97 DOLLAR VIP ACCESS']));
define('STAFF_GROUP_ID', 12);
define('INVOICE_ACTIVE', 0);
define('INVOICE_INACTIVE', 1);
define('INVOICE_STATUS', json_encode(['Open','Paid','Sent','Partially Paid','Canceled','Accepted','Declined','Invoiced','Revised']));// 0 = Open, 1 = paid, 2 = sent, 3= PartiallyPaid, 4=Canceled, 5= Accepted,6=Declined,7=Invoiced,8=Revised
define('INVOICE_CURRENCY', json_encode(['$'=>'$','£'=>'£','€'=>'€','¥'=>'¥']));
define('DATE_FORMAT', 'Y-m-d');
define('CURRENCY_INDICATOR', '');
define('DISCOUNT_TYPE_INDICATOR', '%');
define("PERMISSION", json_encode(['Only show own tasks for non super admins','Clients can create tasks']));
define("TYPES", json_encode(['Payment' , 'Refund']));
define("REBILL", json_encode(['Yes' , 'No']));
define("ATTACHMENT", "attach-documents/");
define("INVOICE_LOGO", "invoice-logo/");
define("PROJECT_MEDIA_FILES", "project-media-files/");
define("PRIORITY", json_encode(['Low' , 'Medium','High']));
define('TASK_STATUS', json_encode(['Open','Done']));
define('TASK_TYPE', json_encode(['Not Billable','Billable','Billed']));
define('SUBSCRIPTION_FREQUENCY', json_encode([7=>'weekly',30=>'Monthly']));
define('SUBSCRIPTION_STATUS', json_encode([0=>'Inactive',1=>'Active',2=>'Ended',3=>'All']));
define('USER_STATUS', json_encode(['Active','Inactive']));
define("USER_PHOTO", "user-photo/");
define('TICKET_STATUS', json_encode(['Open','Reopen','Closed'])); //0 = open, 1 = Reopen, 2 = close
define('TICKET_BULK_ACTION', json_encode(['Close'])); //0 = open, 1 = Reopen, 2 = close
define('INVOICE_ADDPAYMENT_TYPE', json_encode(['Cash','Credit', 'Card','Paypal','Bank Transfer','Check','Direct Debit'])); //0 = open, 1 = Reopen, 2 = close
define("CONTACT_PHOTO", "contact_photo/");//latest
define("CMSUSER_LOGO", "cmsuser_logo/");//latest
define("PROJECT_RATE_TYPE", json_encode(['Fixed price','Rate per hour','Subscription pricing']));
// we have 4 types of user & they can log in separately
define('CMS_USER_INDICATOR',1);
define('CONTACT_USER_INDICATOR',3);
define('CRM_USER_INDICATOR',2);
define('STAF_USER_INDICATOR',4);
/*define('CSV_HEADING', json_encode(['Id','First Name','Last Name',
'Address','City','State',
'ZIP Code','CR D.O.B',
'Password','Email','CR CRA Report','CR First Name',
'CR Last Name','CR Street No','CR Street Name',
'CR City','CR State','CR Credit Bureau Address',
'CR Social Security No','CR Sincerely','CR Credit Company Name',
'CR Credit Company username','CR Credit Company Password'
]));*/
define('CSV_HEADING', json_encode(['Id','First Name','Last Name',
'Address','City','State',
'ZIP Code','CR D.O.B','Send Credential',
'Password','Email','Phone',
'CR CRA Report','CR First Name',
'CR Last Name','CR Street No','CR Street Name',
'CR City','CR State','CR Credit Bureau Address',
'CR Social Security No','CR Sincerely','CR Credit Company Name',
'CR Credit Company username','CR Credit Company Password'
]));
define('TICKET_PRIORITY',['-1'=>'All','0'=>'Low','1'=>'Medium','2'=>'High','3'=>'Urgent','4'=>'Very Urgent']);
define('SUPPORT_EMAIL','support');
define('SUPPORT_TEAM_MAIL',json_encode(['rajibcuetcse@gmail.com']));
define("SUPPORT_STATUS",json_encode(['All','Open','Closed'])); //2=closed,1=open,3=archieved,0=All
define('SUPPORT_STATUS_OPEN', 1);
define('SUPPORT_STATUS_CLOSED', 2);
define('SUPPORT_STATUS_ARCHIEVED', 3);
define('CLOSE_TICKET_TIME', 15); //15 days
define('ARCHIEVE_TICKET_TIME', 30); //30 days
define('SUPPORT_MESSAGE','support_reply');
define("SUPPORT_MEDIA_FILES", "media/companies/");
define('TICKET_ATTACHMENT_SIZE', 2097152);
define('CLOSE_TICKET', 'close_ticket');
define('GUEST_STATUS',json_encode(['Inactive','Active']));
define('REGISTRATION','registration'); //guest registration email template
define('ADMIN_EMAIL','m2ca@gmail.com');
define('GUEST_FORGOT_PASSWORD','guests_forgot_password'); // guest forgot password email template
define('SERTG_PACKAGE_ID',12);
define('SERTG_VELOCITY_FORM_ID',69);
define('SERTG_FORM_NAME','Velocity "Super RTG"');
define('INQUIRY_IMAGE','inquiry_image');
define('ENHANCE_IMAGE','enhance_image');
define('APP_TRANSUNION', 3);
define('APP_EXPERIAN', 1);
define('APP_EQUIFAX', 2);
define("LETTER_TYPES_NAME", json_encode(['1'=>'PI - Personal Identifiers',
'2'=>'MIQ - Multiple Inquiries',
'3'=>'DF - Data Furnisher',
'4'=>'N - Negative Items',
'5'=>'IQ - Single Item inquiries',
'6'=>'MN - Multiple Negative Items',
'7'=>'PIDF - Personal Identifiers/Data Furnisher',
'8'=>'L - Late Payment PAANL',
'9'=>'PB - Public Records',
'10'=>'CL - Collection Letter',
'11'=>'CHOFF - Charge Off',
'12'=>'SL - Student Loans',
'13'=>'STT Preset Letter',
'14'=>'AAAF - AAAF Letter',
'15'=>'SA - SAGESTREAM LETTER'
]));
define("EMAIL_EXPORT_TYPE", 1);
define("DROPBOX_EXPORT_TYPE", 2);
define("GOOGLE_DRIVE_EXPORT_TYPE", 3);
define("ZAPIER_EXPORT_TYPE", 4);
define("RINGCENTRAL_EXPORT_TYPE", 5);
define("LETTER_STREAM_TYPE", 6);
define("ONE_DRIVE_TYPE", 7);
define("MEMBER_EXPORT_OPTIONS", [
EMAIL_EXPORT_TYPE=>['name'=>'Email'],
DROPBOX_EXPORT_TYPE=>['name'=>'Dropbox'],
GOOGLE_DRIVE_EXPORT_TYPE=>['name'=>'Google Drive'],
ZAPIER_EXPORT_TYPE=>['name'=>'Zapier'],
RINGCENTRAL_EXPORT_TYPE =>['name'=>'Ring Central'],
LETTER_STREAM_TYPE =>['name'=>'Letter Stream'],
ONE_DRIVE_TYPE =>['name'=>'One Drive']
]);
// Ring central
define('RING_CENTRAL_SERVER', 'https://platform.ringcentral.com');
define('RING_CENTRAL_CLIENT_ID', '-Ux96uS4QpeTMTNhtZ2RiQ');
define('RING_CENTRAL_CLIENT_SECRET', 'dxt6akizSMeZXvJkDYqGuAoqGI88yTRTW3hPt9HAcDRw');
define('RING_CENTRAL_PASSWORD', 'NewFunnel100');
define('RING_CENTRAL_ACCOUNT_PHONE', '+16143685004');
define('RING_CENTRAL_EXTENSION', 101);
define('RING_CENTRAL_DATE_FORMAT', 'yyyy-mm-dd');
define('RING_CENTRAL_SMS_NUMBER', '+16143685004');
define('ADMIN_TO_MEMBER_EMAIL_TEMPLATE', 'admintomembers');
define('PROJECT_DIR_NAME','html');
define('CUSTOMER_USER_GROUP_ID',11);
define("MEMBER_ACTIVE_INACTIVE_LIST", [
''=>'All',
'1'=>'Member',
'2'=>'Not Member',
]);
define("MEMBER_EXPORT_CSV_HEADING", ['id','Username','Email','Member','Stripe Customer','Phone','Created on']);
/*m2cacademy@gmail.com, m2cacademy5@gmail.com, francine@m2cacademy.com, lila@m2cacademy.com, rajibcuetcse@gmail.com*/
define("GUEST_ADMIN_EMAIL",[
"m2cacademy@gmail.com",
"francine@m2cacademy.com",
"lila@m2cacademy.com",
"rajibcuetcse@gmail.com",
"kelly@m2cacademy.com"
]);
define("GUEST_ADMIN_REG_EMAIL_TEMPLATE","guest_registration_to_admin");
define("GUEST_DOWNLOAD_COUNT",5);
define("MEMBER_STATUS_LIST", [
'3'=>'All',
'1'=>'Active Member',
'2'=>'Inactive Member',
'4'=>'Trial User'
]);
define("MEMBER_CATEGORY_LIST", [
'3'=>'All',
'1'=>'Velocity activated members',
'2'=>'Velocity inactivated members'
]);
define('NEXT_SELECTION_NEAREST_DAY',3);
define("LETTER_TYPE_FOR_MAIL", [
'1'=>'First',
'2'=>'Second',
'3'=>'Third',
'4'=>'4th',
'5'=>'5th',
'6'=>'6th',
'7'=>'7th',
'8'=>'8th',
'9'=>'9th',
'10'=>'10th',
'11'=>'11th',
'12'=>'12th',
]);
define('AFFILIATE_USER_TYPE', 2);
define('AFFILIATE_TEMPLATE_USER_CREATION', 'affiliate_user_creation');
define('EPIC_VELOCITY_PACKAGE_ID',13);
define("EPIC_AND_SERTG_DROPDOWN", ['3'=>'Super RTG','1'=>'Velocity','2'=>'Epic Velocity']);
define('EPIC_VELOCITY_FORM_ID',78);
define("HTML_SAVE_COUNT", 20);
define('AUTOMATION_SCHEDULE_TYPES',['1'=>'One Time','2'=>'Recurring','3'=>'Pause','4'=>'Send Later']);
define('REPORT_SOURCE_TYPES',['1'=>'Identity IQ','2'=>"Privacy Guard",'3'=>'SmartCredit']);
define('IDENTITY_IQ_LINK', 'https://www.identityiq.com');
define('IDENTITY_IQ_LINK_FOR_MEMBER', 'http://bit.ly/IdentityIQSetup');
define('SMART_CREDIT_LINK', 'https://www.smartcredit.com/login/');
define('PRIVACY_GUARD_LINK', 'https://www.privacyguard.com/');
define('CRM_USER_VELOCITY_COUNT', 2);
define('UPLOAD_HTML_CONTROLLER_ID', 12);
define('CLIENT_CONTROLLER_ID', 3);
define('SUPPORT_CONTROLLER_ID', 13);
define('AFFILIATE_CONTROLLER_ID', 14);
define('EPICVELOCITY_CONTROLLER_ID', 15);
define('EMPLOYEE_TYPE', 1);
define('SKIP_CONTROLLER_IDS', [UPLOAD_HTML_CONTROLLER_ID,SUPPORT_CONTROLLER_ID]);
define('WAVE_1_PKG_HOW_TO_START_FORM_ID',58);
define('WAVE_2_PKG_HOW_TO_START_FORM_ID',80);
define('WAVE_1_PKG_HOW_TO_START_IMAGE_URL','images/wave_pkg_1_how_to_start.png');
define('WAVE_2_PKG_HOW_TO_START_IMAGE_URL','images/wave_pkg_2_how_to_start.png');
define('CRM_USER_MAX_INSERT', 2);
define('AUTOMATION_ACTION_TYPES',['1'=>'Delete all','2'=>'Make pause','3'=>'Make one time','4'=>'Make recurring','5'=>'Send Later']);
define('CHAT_AFFILIATE_USER', 1);
define('CHAT_CLIENT_USER', 3);
define('CHAT_MEMBER_USER', 2);
define('AGREEMENT_STATUS',['1'=>'Active','2'=>'Inactive']);
define('AUTHORIZE_DOT_NET_TYPE', 1);
define('AGREEMENT_PRIFIX', '[Prifix]');
define('AGREEMENT_CUSTOMERNAME', '[Customer Name]');
define('AGREEMENT_FIRSTNAME', '[Customer First Name]');
define('AGREEMENT_LASTNAME', '[Customer Last Name]');
define('AGREEMENT_SUFFIX', '[Suffix]');
define('AGREEMENT_SSN', '[Customer SSN]');
define('AGREEMENT_BIRTHDAY', '[Customer Birthday]');
define('AGREEMENT_ADDRESS', '[Customer Address]');
define('AGREEMENT_CITY_STATE_POSTCODE', '[Customer City State Postcode]');
define('AGREEMENT_PRICE_FOR_SERVICE', '[Price for Service]');
define('AGREEMENT_COMPANYNAME', '[Company Name]');
define('AGREEMENT_COMPANYADDRESS', '[Company Address]');
define('AGREEMENT_COMPANY_CITY_STATE_ZIP', '[Company City State Zip]');
define('AGREEMENT_COMPANYPHONE', '[Company Phone]');
define('AGREEMENT_COMPANYFAX', '[Company Fax]');
define('AGREEMENT_COMPANYWEBSITE', '[Company Website]');
define('AGREEMENT_ADMINEMAIL', '[Admin Email]');
define('AGREEMENT_TODAYDATE', '[Today Date]');
define('AGREEMENT_ACTION_TYPES', ['1'=>'Delete all','2'=>'Make all active','3'=>'Make all inactive']);
define('PUBLIC_RECORD_DROPDOWN_INFO', ['Chapter 7'=>'Chapter 7','Chapter 13'=>'Chapter 13','Chapter 11'=>'Chapter 11','Tax Lien'=>'Tax Lien']);
define('NEGATIVE_DROPDOWN_INFO', ['Late Payment'=>'Late Payment','Late Payment 30'=>'Late Payment 30','30/60'=>'30/60','30/60/90'=>'30/60/90','Charge-off'=>'Charge-off','Chargeoff/Collections'=>'Chargeoff/Collections','Collections'=>'Collections']);
define("PAYMENT_TYPES", [
'1'=>'Authorized.net',
]);
define('INVOICE_CONTROLLER_ID', 4);
define('PROFILE_IMAGE_SIZE',['height'=>600,'width'=>500]);
define('LOGO_SIZE',['height'=>1372,'width'=>2527]);
define('SUPER_RTG_ACCESS_PKG_ID', 14);
define('SETUP_MESSAGE_STATUS',['1'=>'Active','2'=>'Inactive']);
define('AUTHORIZE_DOT_NET_SIGN_UP_URL','https://account.authorize.net/'); // test
define('NMI_DOT_COM_SIGN_UP_URL','https://www.nmi.com/');
define('GUEST_REMINDER_EMAIL_TEMPLATE','guest_reminder_email');
define('CLIENT_MESSAGE_EMAIL_TEMPLATE','client_message_email');
//client upload medias type id
define('IDENTIFICATION_IMAGE_ID',1);
define('MAIL_DOC_IMAGE_ID',2);
define('SSN_IMAGE_ID',3);
define('STATE_PHOTO_IMAGE_ID',4);
define('NOTARIZED_LETTER_IMAGE_ID',5);
define('CR_REPORT_IMAGE_ID',6);
define('TROUBLE_MARK_FILE_IMAGE_ID',7);
define('ITEM_CHALLENGE_FILE_IMAGE_ID',8);
define('EPIC_VELOCITY_CLIENT_FILE_PATH','epicvelocity/letters/');
define('SOFTWARE_VERSION_STATUS',['1'=>'Active','2'=>'Inactive']);
define('SUPER_RTG_LS_FAX_PKG_ID',15);
define('AUTH_ID_FOR_DEPLOYMENT',[3,2]);
define('DEPLOYMENT_SUBMODULE_ID',3227);
define('SETUP_EMAIL_ACTION_TYPES', ['1'=>'Delete all','2'=>'Send Email']);
define('EMAIL_SENT_OUT_LIST_TYPE', 1);
define('EMAIL_TEMPLATE_LIST_TYPE', 2);
define('EMAIL_CAMPAIGN_LIST_TYPE', 3);
define('EMAIL_CAMPAIGN_SENTOUT_LIST_TYPE', 4);
define('SETUP_EMAIL_ACTION_LIST_TYPES', [
EMAIL_SENT_OUT_LIST_TYPE=>'Email Sent out List',
EMAIL_TEMPLATE_LIST_TYPE=>'Template List',
EMAIL_CAMPAIGN_LIST_TYPE=>'Campaign List',
EMAIL_CAMPAIGN_SENTOUT_LIST_TYPE=>'Campaign Sent out List',
]);
define('EMAIL_CAMPAIGN_STATUS', ['1'=>'Active','2'=>'Inactive']);
define('CRM_USER_RTG_ACCESS_COUNT',1);
define('CRA_ACCOUNT__ANALYSIS','[ACCOUNT_ANALYSIS]');
define('CRA_SUMMARY_HTML','[SUMMARY_HTML]');
define('CRA_CREDIT_SCORE','[CREDIT_SCORE]');
define('CRA_PUBLIC_RECORD','[PUBLIC_RECORD]');
define('CRA_INQUIRES','[INQUIRES]');
define('CRA_INQUIRES_COUNT','[INQUIRES_COUNT]');
define('CRA_CREDIT_UTILIZATION','[CREDIT_UTILIZATION]');
define('CRA_CREDIT_UTILIZATION_SUMMARY','[CREDIT_UTILIZATION_SUMMARY]');
define('CRA_DEROGETORY','[DEROGETORY]');
define('CRA_PUBLIC_RECORD_COUNT','[PUBLIC_RECORD_COUNT]');
define('CRA_PERSONAL_INFO','[PERSONAL_INFORMATION]');
//if(ENVIROMENT == 1){
// define('CLIENT_PORTAL_DOMAIN','https://www.secureclientportalaccess.com/');
//}else if(ENVIROMENT == 2){
// define('CLIENT_PORTAL_DOMAIN','https://test.readytogoletters.com/');
//}else{
// define('CLIENT_PORTAL_DOMAIN','http://localhost/rtgv4/');
//}
define('CLIENT_PORTAL_DOMAIN','https://www.secureclientportalaccess.com/');
define('CLIENT_PORTAL_FAVICON','images/favicon/lock_favicon.ico');
define('CLIENT_PORTAL_LOGO','/images/logo/secure_portal.svg');
define('CLIENT_PORTAL_DEFAULT_HEADER','Secure Client Portal');
define('CLIENT_PORTAL_DEFAULT_FOOTER','Secure SSL Area | This website is protected by secure portal © '.COPY_RIGHT_YEAR.' All rights reserved.');
define('UPGRADE_BUTTON_ALERT_TEXT', 'Please contact customer support for details to upgrade your account (614-547-6222)');
define('MAIN_DOMAIN_FOOTER','<strong>Secure SSL Area | This website is protected by secure portal © '.COPY_RIGHT_YEAR.' <a href="https://readytogoletters.com/" target="_blank">Clickletters/M2C Academy LLC</a>. </strong> All rights reserved.');
define('CREDIT_ANALYSIS_EMAIL_SUB','Congratulations! Your Credit Analysis is Ready');
define('CREDIT_ANALYSIS_EMAIL_BODY','Congratulations! Your Credit Analysis is Ready to View Below. Please contact us if you have any further questions');
define('CREDIT_ANALYZER_EMAIL_SUB','Congratulations! Your Credit Analyzer is Ready');
define('CREDIT_ANALYZER_EMAIL_BODY','Congratulations! Your Credit Analyzer is Ready to View Below. Please contact us if you have any further questions');
define('LIMITED_VERSION_EXCEED_MESSAGE','OOPS! You have exceeded your #_LIMITED_VERSION_CLIENT_COUNT_# Person Access Limit, If you would like to Add more People Please contact Us At 614-547-6222.');
define('SAME_AS_BY', 'same_as_by');
define('LIMITED_VERSION_PKG_ID', 16);
define('USER_TYPE_DROPDOW_LIST',['1'=>'Everyone','2'=>'Me','3'=>'Team Member','4'=>'Client']);
define('LIMITED_TIME_PKG_ID', 17);
define('LIMITED_TIME_PKG_MESSAGE',
'Your #_DAYS_#'
.' days has expired, you are now ready to upgrade to the '
. 'full version of Clickletters. Please contact our customer support '
. 'team at 614-547-622 for more assistance.');
define('CLIENT_ACTION_TYPES', ['1'=>'Delete all','2'=>'Make all Active','3'=>'Make all Inactive','4'=>'Make All Graduated/Completed','5'=>'Export All']);
define('AUTOMATION_WARRING',"This letter has automations and by deleting this account all automations will also be deleted do you want to continue ?");
define('LETTER_SET_LIST',[
'1'=>'SET 1',
'2'=>'SET 2',
'3'=>'SET 3',
'4'=>'SET 4',
'5'=>'SET 5',
'6'=>'SET 6',
'7'=>'SET 7',
'8'=>'SET 8',
'9'=>'SET 9',
'10'=>'SET 10',
'11'=>'SET 11',
'12'=>'SET 12',
]);
define('NMI_DOT_COM_TYPE', 2);
define('CLIENT_POPUPS_LIST',[
'1'=>'Image',
'2'=>'Video',
]);
define('MESSAGE_LENGTH',1000); // for client message limit.
define('LETTER_COUNT_MESSAGE','#_maxlength_# character limit, #_remlength_# remaining.');
define('EMPLOYEE_USER_TYPE_DROPDOW_LIST',['1'=>'Everyone','2'=>'Me','4'=>'Client']);
define('MEMBER_EMPLOYEE_MESSAGE_TO_CLIENT','Customer Support');
define('NEXT_DATE_INTERVAL_DAYS',['15'=>'15 days','21'=>'21 days','45'=>'45 days','65'=>'65 days']);
define('UPLOAD_MEDIA_SIZE', 1048576*3);//1MB = 1048576bytes
define('UPLOAD_MEDIA_WIDTH', 900);
define('UPLOAD_MEDIA_HEIGHT', 500);
define('UPLOAD_CLIENT_MEDIA_SIZE',UPLOAD_MEDIA_SIZE/1048576); // Size in MB
define('UPLOAD_MEDIA_MESSAGE', 'Please keep upload image size less than '.UPLOAD_CLIENT_MEDIA_SIZE.'MB and proportion '.UPLOAD_MEDIA_WIDTH.' X '.UPLOAD_MEDIA_HEIGHT);
define('NOTE_CHAR_LENGTH',2000);
define("LETTER_TYPES_SHORT_NAME", json_encode(['1'=>'PI',
'2'=>'MIQ',
'3'=>'DF',
'4'=>'N',
'5'=>'IQ',
'6'=>'MN',
'7'=>'PIDF',
'8'=>'L',
'9'=>'PB',
'10'=>'CL',
'11'=>'CHOFF',
'12'=>'SL',
'13'=>'STT'
]));
define('STT_PI_LETTER_SET',[
'13'=>'STT',
'14'=>'PI',
'1'=>'SET 1',
'2'=>'SET 2',
'3'=>'SET 3',
'4'=>'SET 4',
'5'=>'SET 5',
'6'=>'SET 6',
'7'=>'SET 7',
'8'=>'SET 8',
'9'=>'SET 9',
'10'=>'SET 10',
'11'=>'SET 11',
'12'=>'SET 12'
]);
define('CLIENT_SEND_EMAIL_ACTION_TYPES', ['1'=>'Delete all']);
define('QUEUE_MONITOR_USER_EMAIL',[
'rajibcuetcse@gmail.com'
]);
define('EPIVELOCITY_FOR_EMPLOYEES_PKG_ID',20);
define('RTG_FOR_EMPLOYEES_PKG_ID',21);
define('DATE_SELECTION_BY_DAYS',[
'15'=>'15 days',
'21'=>'21 days',
'30'=>'30 days',
'45'=>'45 days',
'60'=>'60 days',
'65'=>'65 days',
'90'=>'90 days',
'180'=>'180 days',
]);
define('LETTER_STREAM_SIGNUP_LINK','https://www.letterstream.com/ls/signup?api=m2ca&partner=');
define('LETTER_STREAM_API','https://www.letterstream.com/apis/'); //'https://secure.letterstream.com/apis/'
define('TRIAL_ACCOUNT_URL',APP_SERVER_HOST_URL."cmsusers/trialaccount/");
define('TRIAL_USER_PACKAGES',[
EPIC_VELOCITY_PACKAGE_ID,
//SUPER_RTG_LS_FAX_PKG_ID,
LIMITED_TIME_PKG_ID,
//SUPER_RTG_ACCESS_PKG_ID
]);
define('VIDEO_SETTINGS_STATUS',['1'=>'Active','0'=>'Inactive']);
define('ALREADY_CERTIFICATE_DOWNLOADED_MESSAGE','It looks like you have Already Created This Certificate, if you feel this is a mistake please contact support for more assistance at support@clickletters.com.');
define('ALREADY_TSHIRT_ORDERED_MESSAGE','You already did this. Please contact support for more assistance at support@clickletters.com.');
define('NO_REPLY_EMAIL','no-reply@readytogoletters.com');
define('TSHIRT_SIZES',[
'S'=>'Small',
'M'=>'Medium',
'L'=>'Large',
'XL'=>'Extra Large',
'XXL'=>'Extra Extra Large',
]);
define('ADMIN_IDS',[1,2,1477]);
define('NO_IMAGE_FILE_PATH',APP_SERVER_HOST_URL.'rtgv3/images/nopreview-available.jpg');
// these all are from controllers table id
define('EMPLOYEE_COMPLETED_MESSENGER_BUTTON_ID',22);
define('CLIENT_LIST_ACTION_ID',23);
define('DOWNLOAD_TEMPLATE_BUTTON_ID',24);
define('CLIENT_PORTAL_BUTTON_ID',25);
define('CLIENT_EDIT_PANEL_ID',26);
define('CLIENT_DASHBOARD_PANEL_ID',27);
define('SEND_EMAIL_POPUP_ID',28);
define('UPLOAD_MEDIA_PANEL_ID',29);
define('PROJECT_CONTROLLER_ID',2);
define('AGGREMENT_CONTROLLER_ID',2);
define('SUBSCRIPTION_CONTROLLER_ID',8);
define('CALENDER_CONTROLLER_ID',10);
define('SETUP_MEGGAGE_CONTROLLER_ID',20);
define('EVERYTHING_CONTROLLER_ID',19);
define('MEMBER_EMAIL_SENT_CONTROLLER_ID',21);
define('PAYMENT_SETUP_CONTROLLER_ID',18);
define('CREDIT_REPORT_STATUS_CONTROLLER_ID',16);
define('SECURE_PORTAL_CONTROLLER_ID',30);
define('TEAM_MESSAGING_CONTROLLER_ID',31);
define('CRMUSER_CONTROLLER_ID',11);
define('EPLOYEE_ACCESS_CONTROLLER_ID',32);
define('EPLOYEE_MESSAGING_CONTROLLER_ID',33);
define('STAISTICS_CONTROLLER_ID',1);
define('SAVE_DOWNLOAD_PRINT_LETTER_CONTROLLER_ID',34);
define('EDIT_REMINDER_TASKS_CONTROLLER_ID',35);
define('EDIT_CLIENT_INFO_CONTROLLER_ID',36);
define('EDIT_CLIENT_CREDIT_REPORT_CONTROLLER_ID',37);
define('ADD_CLIENT_CONTROLLER_ID',39);
// these all are from controllers table id
define('LETTER_DELETION_DAYS',30);
define("IQ_CALL_HISTORY_STATUS",json_encode(['All','Ip Blocked','Success'])); //2=Success,1=Ip Blocked,0=All
define("IQCALLHISTORY_EXPORT_CSV_HEADING", ['Id','Ip','Port','Page','Status Code','Status','Created on']);
define("DELETED_MEMBER_STATUS",[3,4]); //1= active , 2= in_active,3,4 = deleted member
define("DESTINATION_DIRECTORY", ROOT . DS . 'webrootcopy' . DS);
define("SOURCE_DIRECTORY", WWW_ROOT);
define("SERVER",0);
define("MAX_BANK_CLIENT_IDS",[19665,19657,37110,39574]);
?>

326
config/app.default.php Normal file
View File

@@ -0,0 +1,326 @@
<?php
return [
/**
* Debug Level:
*
* Production Mode:
* false: No error messages, errors, or warnings shown.
*
* Development Mode:
* true: Errors and warnings shown.
*/
'debug' => true,
/**
* Configure basic information about the application.
*
* - namespace - The namespace to find app classes under.
* - encoding - The encoding used for HTML + database connections.
* - base - The base directory the app resides in. If false this
* will be auto detected.
* - dir - Name of app directory.
* - webroot - The webroot directory.
* - wwwRoot - The file path to webroot.
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
* use CakePHP pretty URLs, remove these .htaccess
* files:
* /.htaccess
* /webroot/.htaccess
* And uncomment the baseUrl key below.
* - fullBaseUrl - A base URL to use for absolute links.
* - imageBaseUrl - Web path to the public images directory under webroot.
* - cssBaseUrl - Web path to the public css directory under webroot.
* - jsBaseUrl - Web path to the public js directory under webroot.
* - paths - Configure paths for non class based resources. Supports the
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
* paths for plugins, view templates and locale files respectively.
*/
'App' => [
'namespace' => 'App',
'encoding' => 'UTF-8',
'base' => false,
'dir' => 'src',
'webroot' => 'webroot',
'wwwRoot' => WWW_ROOT,
// 'baseUrl' => env('SCRIPT_NAME'),
'fullBaseUrl' => false,
'imageBaseUrl' => 'img/',
'cssBaseUrl' => 'css/',
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [APP . 'Template' . DS],
'locales' => [APP . 'Locale' . DS],
],
],
/**
* Security and encryption configuration
*
* - salt - A random string used in security hashing methods.
* The salt value is also used as the encryption key.
* You should treat it as extremely sensitive data.
*/
'Security' => [
'salt' => '__SALT__',
],
/**
* Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified.
* This is useful for busting browser caches.
*
* Set to true to apply timestamps when debug is true. Set to 'force' to always
* enable timestamping regardless of debug value.
*/
'Asset' => [
// 'timestamp' => true,
],
/**
* Configure the cache adapters.
*/
'Cache' => [
'default' => [
'className' => 'File',
'path' => CACHE,
],
/**
* Configure the cache used for general framework caching.
* Translation cache files are stored with this configuration.
*/
'_cake_core_' => [
'className' => 'File',
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+2 minutes',
],
/**
* Configure the cache for model and datasource caches. This cache
* configuration is used to store schema descriptions, and table listings
* in connections.
*/
'_cake_model_' => [
'className' => 'File',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+2 minutes',
],
],
/**
* Configure the Error and Exception handlers used by your application.
*
* By default errors are displayed using Debugger, when debug is true and logged
* by Cake\Log\Log when debug is false.
*
* In CLI environments exceptions will be printed to stderr with a backtrace.
* In web environments an HTML page will be displayed for the exception.
* With debug true, framework errors like Missing Controller will be displayed.
* When debug is false, framework errors will be coerced into generic HTTP errors.
*
* Options:
*
* - `errorLevel` - int - The level of errors you are interested in capturing.
* - `trace` - boolean - Whether or not backtraces should be included in
* logged errors/exceptions.
* - `log` - boolean - Whether or not you want exceptions logged.
* - `exceptionRenderer` - string - The class responsible for rendering
* uncaught exceptions. If you choose a custom class you should place
* the file for that class in src/Error. This class needs to implement a
* render method.
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
* extend one of the listed exceptions will also be skipped for logging.
* E.g.:
* `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
*/
'Error' => [
'errorLevel' => E_ALL & ~E_DEPRECATED,
'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
'skipLog' => [],
'log' => true,
'trace' => true,
],
/**
* Email configuration.
*
* By defining transports separately from delivery profiles you can easily
* re-use transport configuration across multiple profiles.
*
* You can specify multiple configurations for production, development and
* testing.
*
* Each transport needs a `className`. Valid options are as follows:
*
* Mail - Send using PHP mail function
* Smtp - Send using SMTP
* Debug - Do not send the email, just return the result
*
* You can add custom transports (or override existing transports) by adding the
* appropriate file to src/Mailer/Transport. Transports should be named
* 'YourTransport.php', where 'Your' is the name of the transport.
*/
'EmailTransport' => [
'default' => [
'className' => 'Mail',
// The following keys are used in SMTP transports
'host' => 'localhost',
'port' => 25,
'timeout' => 30,
'username' => 'root',
'password' => '',
'client' => null,
'tls' => null,
],
],
/**
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Network\Email\Email`
* for more information.
*/
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'you@localhost',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
],
/**
* Connection information used by the ORM to connect
* to your application's datastores.
* Drivers include Mysql Postgres Sqlite Sqlserver
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'nonstandard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'my_app',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'log' => false,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
/**
* The test connection is used during the test suite.
*/
'test' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'nonstandard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'test_myapp',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
],
/**
* Configures logging options
*/
'Log' => [
'debug' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'debug',
'levels' => ['notice', 'info', 'debug'],
],
'error' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'error',
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
],
],
/**
* Session configuration.
*
* Contains an array of settings to use for session configuration. The
* `defaults` key is used to define a default preset to use for sessions, any
* settings declared here will override the settings of the default config.
*
* ## Options
*
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
* - `cookiePath` - The url path for which session cookie is set. Maps to the
* `session.cookie_path` php.ini config. Defaults to base path of app.
* - `timeout` - The time in minutes the session should be valid for.
* Pass 0 to disable checking timeout.
* Please note that php.ini's session.gc_maxlifetime must be equal to or greater
* than the largest Session['timeout'] in all served websites for it to have the
* desired effect.
* - `defaults` - The default configuration set to use as a basis for your session.
* There are four built-in options: php, cake, cache, database.
* - `handler` - Can be used to enable a custom session handler. Expects an
* array with at least the `engine` key, being the name of the Session engine
* class to use for managing the session. CakePHP bundles the `CacheSession`
* and `DatabaseSession` engines.
* - `ini` - An associative array of additional ini values to set.
*
* The built-in `defaults` options are:
*
* - 'php' - Uses settings defined in your php.ini.
* - 'cake' - Saves session files in CakePHP's /tmp directory.
* - 'database' - Uses CakePHP's database sessions.
* - 'cache' - Use the Cache class to save sessions.
*
* To define a custom session handler, save it at src/Network/Session/<name>.php.
* Make sure the class implements PHP's `SessionHandlerInterface` and set
* Session.handler to <name>
*
* To use database sessions, load the SQL file located at config/Schema/sessions.sql
*/
'Session' => [
'defaults' => 'php',
],
];

388
config/app.php Normal file
View File

@@ -0,0 +1,388 @@
<?php
return [
/**
* Debug Level:
*
* Production Mode:
* false: No error messages, errors, or warnings shown.
*
* Development Mode:
* true: Errors and warnings shown.
*/
'debug' => APP_CONFIG_DEBUG_MODE,
/**
* Configure basic information about the application.
*
* - namespace - The namespace to find app classes under.
* - encoding - The encoding used for HTML + database connections.
* - base - The base directory the app resides in. If false this
* will be auto detected.
* - dir - Name of app directory.
* - webroot - The webroot directory.
* - wwwRoot - The file path to webroot.
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
* use CakePHP pretty URLs, remove these .htaccess
* files:
* /.htaccess
* /webroot/.htaccess
* And uncomment the baseUrl key below.
* - fullBaseUrl - A base URL to use for absolute links.
* - imageBaseUrl - Web path to the public images directory under webroot.
* - cssBaseUrl - Web path to the public css directory under webroot.
* - jsBaseUrl - Web path to the public js directory under webroot.
* - paths - Configure paths for non class based resources. Supports the
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
* paths for plugins, view templates and locale files respectively.
*/
'App' => [
'namespace' => 'App',
'encoding' => 'UTF-8',
'base' => false,
'dir' => 'src',
'webroot' => 'webroot',
'wwwRoot' => WWW_ROOT,
// 'baseUrl' => env('SCRIPT_NAME'),
'fullBaseUrl' => false,
'imageBaseUrl' => 'img/',
'cssBaseUrl' => 'css/',
'jsBaseUrl' => 'js/',
'paths' => [
'plugins' => [ROOT . DS . 'plugins' . DS],
'templates' => [APP . 'Template' . DS],
'locales' => [APP . 'Locale' . DS],
],
],
/**
* Security and encryption configuration
*
* - salt - A random string used in security hashing methods.
* The salt value is also used as the encryption key.
* You should treat it as extremely sensitive data.
*/
'Security' => [
'salt' => 'a26ac8c6a0c4277c3df4251dce80897b36ac331293a7dcdf220ca307b26e897c',
],
/**
* Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified.
* This is useful for busting browser caches.
*
* Set to true to apply timestamps when debug is true. Set to 'force' to always
* enable timestamping regardless of debug value.
*/
'Asset' => [
// 'timestamp' => true,
],
/**
* Configure the cache adapters.
*/
'Cache' => [
'default' => [
'className' => DEFAULT_CACHE,
'path' => CACHE,
],
'redis'=>[
'port'=>REDIS_PORT,
'duration'=>REDIS_DURATION,
'host '=>REDIS_HOST,
'database'=>REDIS_DB,
'password'=>REDIS_PASSWORD,
'persistent '=>REDIS_PERSISTENT,
'timeout'=>REDIS_TIMEOUT,
'unix_socket'=>REDIS_UNIX_SOCKET,
],
/**
* Configure the cache used for general framework caching.
* Translation cache files are stored with this configuration.
*/
'_cake_core_' => [
'className' => 'File',
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+2 minutes',
],
/**
* Configure the cache for model and datasource caches. This cache
* configuration is used to store schema descriptions, and table listings
* in connections.
*/
'_cake_model_' => [
'className' => 'File',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+2 minutes',
],
],
/**
* Configure the Error and Exception handlers used by your application.
*
* By default errors are displayed using Debugger, when debug is true and logged
* by Cake\Log\Log when debug is false.
*
* In CLI environments exceptions will be printed to stderr with a backtrace.
* In web environments an HTML page will be displayed for the exception.
* With debug true, framework errors like Missing Controller will be displayed.
* When debug is false, framework errors will be coerced into generic HTTP errors.
*
* Options:
*
* - `errorLevel` - int - The level of errors you are interested in capturing.
* - `trace` - boolean - Whether or not backtraces should be included in
* logged errors/exceptions.
* - `log` - boolean - Whether or not you want exceptions logged.
* - `exceptionRenderer` - string - The class responsible for rendering
* uncaught exceptions. If you choose a custom class you should place
* the file for that class in src/Error. This class needs to implement a
* render method.
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
* extend one of the listed exceptions will also be skipped for logging.
* E.g.:
* `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
*/
'Error' => [
'errorLevel' => '',
'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
'skipLog' => [],
'log' => true,
'trace' => true,
],
/**
* Email configuration.
*
* By defining transports separately from delivery profiles you can easily
* re-use transport configuration across multiple profiles.
*
* You can specify multiple configurations for production, development and
* testing.
*
* Each transport needs a `className`. Valid options are as follows:
*
* Mail - Send using PHP mail function
* Smtp - Send using SMTP
* Debug - Do not send the email, just return the result
*
* You can add custom transports (or override existing transports) by adding the
* appropriate file to src/Mailer/Transport. Transports should be named
* 'YourTransport.php', where 'Your' is the name of the transport.
*/
'EmailTransport' => [
'default' => [
'className' => APP_EMAIL_CLASS,
'host' =>APP_SMTP_HOST,
'port' => APP_SMTP_PORT,
'timeout' => APP_SMTP_TIMEOUT,
'username' => APP_SMTP_USERNAME,
'password' => APP_SMTP_PASSWORD,
'tls' => APP_SMTP_IS_TLS,
],
'Debug' => [
'className' => 'Debug'
]
],
/**
* Email delivery profiles
*
* Delivery profiles allow you to predefine various properties about email
* messages from your application and give the settings a name. This saves
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Network\Email\Email`
* for more information.
*/
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'cloudhighttest@gmail.com',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
],
/**
* Connection information used by the ORM to connect
* to your application's datastores.
* Drivers include Mysql Postgres Sqlite Sqlserver
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
*/
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => APP_DB_IS_PERSISTENT,
'host' => APP_DB_HOST,
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'nonstandard_port_number',
'username' => APP_DB_USERNAME,
'password' => APP_DB_PASSWORD,
'database' => APP_DB_DATABASE_NAME,
'encoding' => APP_DB_ENCODING,
'timezone' => 'UTC',
'cacheMetadata' => true,
'log' => true,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
'mybb' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => APP_DB_IS_PERSISTENT,
'host' => APP_DB_HOST,
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'nonstandard_port_number',
'username' => APP_DB_USERNAME,
'password' => APP_DB_PASSWORD,
'database' => MYBB_DB_NAME,
'encoding' => APP_DB_ENCODING,
'timezone' => 'UTC',
'cacheMetadata' => true,
'log' => true,
/**
* Set identifier quoting to true if you are using reserved words or
* special characters in your table or column names. Enabling this
* setting will result in queries built using the Query Builder having
* identifiers quoted when creating SQL. It should be noted that this
* decreases performance because each query needs to be traversed and
* manipulated before being executed.
*/
'quoteIdentifiers' => false,
/**
* During development, if using MySQL < 5.6, uncommenting the
* following line could boost the speed at which schema metadata is
* fetched from the database. It can also be set directly with the
* mysql configuration directive 'innodb_stats_on_metadata = 0'
* which is the recommended value in production environments
*/
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
/**
* The test connection is used during the test suite.
*/
'test' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
//'port' => 'nonstandard_port_number',
'username' => 'root',
'password' => '',
'database' => 'pdfgenerator',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
],
],
/**
* Configures logging options
*/
'Log' => [
'debug' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'debug-'.date('Y-m-d'),
'levels' => ['notice', 'info', 'debug'],
],
'error' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'error-'.date('Y-m-d'),
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
],'cli_info' => [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'info-'.date('Y-m-d'),
'levels' => [ 'info'],
],
],
/**
* Session configuration.
*
* Contains an array of settings to use for session configuration. The
* `defaults` key is used to define a default preset to use for sessions, any
* settings declared here will override the settings of the default config.
*
* ## Options
*
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
* - `cookiePath` - The url path for which session cookie is set. Maps to the
* `session.cookie_path` php.ini config. Defaults to base path of app.
* - `timeout` - The time in minutes the session should be valid for.
* Pass 0 to disable checking timeout.
* Please note that php.ini's session.gc_maxlifetime must be equal to or greater
* than the largest Session['timeout'] in all served websites for it to have the
* desired effect.
* - `defaults` - The default configuration set to use as a basis for your session.
* There are four built-in options: php, cake, cache, database.
* - `handler` - Can be used to enable a custom session handler. Expects an
* array with at least the `engine` key, being the name of the Session engine
* class to use for managing the session. CakePHP bundles the `CacheSession`
* and `DatabaseSession` engines.
* - `ini` - An associative array of additional ini values to set.
*
* The built-in `defaults` options are:
*
* - 'php' - Uses settings defined in your php.ini.
* - 'cake' - Saves session files in CakePHP's /tmp directory.
* - 'database' - Uses CakePHP's database sessions.
* - 'cache' - Use the Cache class to save sessions.
*
* To define a custom session handler, save it at src/Network/Session/<name>.php.
* Make sure the class implements PHP's `SessionHandlerInterface` and set
* Session.handler to <name>
*
* To use database sessions, load the SQL file located at config/Schema/sessions.sql
*/
'Session' => [
'defaults' => 'php',
'timeout'=>60//in minutes
],
];

211
config/bootstrap.php Normal file
View File

@@ -0,0 +1,211 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.10.8
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* Configure paths required to find CakePHP + general filepath
* constants
*/
require __DIR__ . '/paths.php';
// Use composer to load the autoloader.
require ROOT . DS . 'vendor' . DS . 'autoload.php';
require ROOT . DS . 'config' . DS . 'app.settings.php';
require ROOT . DS . 'config' . DS . 'app.constant.php';
//echo "yyy";exit;
/**
* Bootstrap CakePHP.
*
* Does the various bits of setup that CakePHP needs to do.
* This includes:
*
* - Registering the CakePHP autoloader.
* - Setting the default application paths.
*/
require CORE_PATH . 'config' . DS . 'bootstrap.php';
//echo "mmm";exit;
// You can remove this if you are confident you have intl installed.
if (!extension_loaded('intl')) {
trigger_error('You must enable the intl extension to use CakePHP.', E_USER_ERROR);
}
//echo "hello";exit;
use Cake\Cache\Cache;
use Cake\Console\ConsoleErrorHandler;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Core\Plugin;
use Cake\Database\Type;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ErrorHandler;
use Cake\Log\Log;
use Cake\Network\Email\Email;
use Cake\Network\Request;
use Cake\Routing\DispatcherFactory;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
* Read configuration file and inject configuration into various
* CakePHP classes.
*
* By default there is only one configuration file. It is often a good
* idea to create multiple configuration files, and separate the configuration
* that changes from configuration that does not. This makes deployment simpler.
*/
try {
Configure::config('default', new PhpConfig());
Configure::load('app', 'default', false);
} catch (\Exception $e) {
die($e->getMessage() . "\n");
}
// Load an environment local configuration file.
// You can use a file like app_local.php to provide local overrides to your
// shared configuration.
//Configure::load('app_local', 'default');
// When debug = false the metadata cache should last
// for a very very long time, as we don't want
// to refresh the cache while users are doing requests.
if (!Configure::read('debug')) {
Configure::write('Cache._cake_model_.duration', '+1 years');
Configure::write('Cache._cake_core_.duration', '+1 years');
}
/**
* Set server timezone to UTC. You can change it to another timezone of your
* choice but using UTC makes time calculations / conversions easier.
*/
date_default_timezone_set('UTC');
/**
* Configure the mbstring extension to use the correct encoding.
*/
mb_internal_encoding(Configure::read('App.encoding'));
/**
* Set the default locale. This controls how dates, number and currency is
* formatted and sets the default language to use for translations.
*/
ini_set('intl.default_locale', 'en_US');
/**
* Register application error and exception handlers.
*/
$isCli = php_sapi_name() === 'cli';
if ($isCli) {
(new ConsoleErrorHandler(Configure::read('Error')))->register();
} else {
(new ErrorHandler(Configure::read('Error')))->register();
}
// Include the CLI bootstrap overrides.
if ($isCli) {
require __DIR__ . '/bootstrap_cli.php';
}
/**
* Set the full base URL.
* This URL is used as the base of all absolute links.
*
* If you define fullBaseUrl in your config file you can remove this.
*/
if (!Configure::read('App.fullBaseUrl')) {
$s = null;
if (env('HTTPS')) {
$s = 's';
}
$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);
}
Cache::config(Configure::consume('Cache'));
ConnectionManager::config(Configure::consume('Datasources'));
Email::configTransport(Configure::consume('EmailTransport'));
Email::config(Configure::consume('Email'));
Log::config(Configure::consume('Log'));
Security::salt(Configure::consume('Security.salt'));
//default language
ini_set('intl.default_locale', 'en_US');
/**
* The default crypto extension in 3.0 is OpenSSL.
* If you are migrating from 2.x uncomment this code to
* use a more compatible Mcrypt based implementation
*/
// Security::engine(new \Cake\Utility\Crypto\Mcrypt());
/**
* Setup detectors for mobile and tablet.
*/
Request::addDetector('mobile', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isMobile();
});
Request::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
});
/**
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
* Connect middleware/dispatcher filters.
*/
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
* Enable default locale format parsing.
* This is needed for matching the auto-localized string output of Time() class when parsing dates.
*/
Type::build('datetime')->useLocaleParser();

33
config/bootstrap_cli.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Core\Exception\MissingPluginException;
use Cake\Core\Plugin;
/**
* Additional bootstrapping and configuration for CLI environments should
* be put here.
*/
// Set logs to different files so they don't have permission conflicts.
Configure::write('Log.cli_info.file', 'cli-info-'.date('Y-m-d'));
Configure::write('Log.debug.file', 'cli-debug');
Configure::write('Log.error.file', 'cli-error-'.date('Y-m-d'));
try {
Plugin::load('Bake');
} catch (MissingPluginException $e) {
// Do not halt if the plugin is missing
}

40
config/dynamic_domain.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
if (isset($_SERVER['HTTP_REFERER'])) {
$host_dynamic_array = parse_url($_SERVER['HTTP_REFERER']);
$host_dynamic = $host_dynamic_array["scheme"] . "://" . $host_dynamic_array["host"] . "/";
define("APP_SERVER_HOST_URL", $host_dynamic);
define("SITE_DOMAIN", $host_dynamic_array["host"]);
} else if (isset($_SERVER['HTTP_HOST'])) {
if ($_SERVER['HTTP_HOST'] == APP_DEFAULT_DOMAIN) {
define("APP_SERVER_HOST_URL", "https://" . APP_DEFAULT_DOMAIN . "/");
define('SITE_DOMAIN', APP_DEFAULT_DOMAIN);
} else {
$ssl = "http://";
if(ENVIROMENT == 1){
$ssl = "https://";
}
$host_dynamic = $ssl. $_SERVER['HTTP_HOST'] . "/";
define("APP_SERVER_HOST_URL", $host_dynamic);
define('SITE_DOMAIN', $_SERVER['HTTP_HOST']);
}
}else{
define("APP_SERVER_HOST_URL", APP_SERVER_HOST_URL_DEFAULT);
define('SITE_DOMAIN', APP_DEFAULT_DOMAIN);
}

85
config/paths.php Normal file
View File

@@ -0,0 +1,85 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* When using custom settings be sure to use the DS and do not add a trailing DS.
*/
/**
* The full path to the directory which holds "src", WITHOUT a trailing DS.
*/
define('ROOT', dirname(__DIR__));
/**
* The actual directory name for the application directory. Normally
* named 'src'.
*/
define('APP_DIR', 'src');
/**
* Path to the application's directory.
*/
define('APP', ROOT . DS . APP_DIR . DS);
/**
* Path to the config directory.
*/
define('CONFIG', ROOT . DS . 'config' . DS);
/**
* File path to the webroot directory.
*/
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
/**
* Path to the tests directory.
*/
define('TESTS', ROOT . DS . 'tests' . DS);
/**
* Path to the temporary files directory.
*/
define('TMP', ROOT . DS . 'tmp' . DS);
/**
* Path to the logs directory.
*/
define('LOGS', ROOT . DS . 'logs' . DS);
/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP . 'cache' . DS);
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
* CakePHP should always be installed with composer, so look there.
*/
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
/**
* Path to the cake directory.
*/
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'src' . DS);

167
config/routes.php Normal file
View File

@@ -0,0 +1,167 @@
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Routing\Router;
/**
* The default class to use for all routes
*
* The following route classes are supplied with CakePHP and are appropriate
* to set as the default:
*
* - Route
* - InflectedRoute
* - DashedRoute
*
* If no call is made to `Router::defaultRouteClass()`, the class used is
* `Route` (`Cake\Routing\Route\Route`)
*
* Note that `Route` does not do any inflections on URLs which will result in
* inconsistently cased URLs when used with `:plugin`, `:controller` and
* `:action` markers.
*
*/
Router::defaultRouteClass('DashedRoute');
Router::scope('/', function ($routes) {
/**
* Here, we are connecting '/' (base path) to a controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, src/Template/Pages/home.ctp)...
*/
$url = $_SERVER['REQUEST_URI'];
$exploded_url = explode("/", $url);
$params_array = [];
$cmsuser_id = 0;
$client_id = 0;
if(!empty($exploded_url)){
foreach ($exploded_url as $ex_value){
if($ex_value > 0){
$params_array[] = $ex_value;
}
}
}
if(isset($params_array[0]) && $params_array[0] > 0){
$cmsuser_id = $params_array[0];
}
if(isset($params_array[1]) && $params_array[1] > 0){
$client_id = $params_array[1];
if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1){
return $this->redirect(['controller'=>'Client','action'=>'edit',$client_id]);
}
}
if($cmsuser_id > 0 && $client_id == 0){
$routes->connect('/:pass', ['controller' => 'Cmsusers', 'action' => 'login']);
}else if($cmsuser_id > 0 && $client_id > 0){
$routes->connect('/:pass/:client_id', ['controller' => 'Cmsusers', 'action' => 'login']);
}
$routes->connect('crm/*', ['controller' => 'Mycrm', 'action' => 'display']);
$routes->connect('/', ['controller' => 'Cmsusers', 'action' => 'login']);
$routes->connect('/guest', ['controller' => 'Guest', 'action' => 'login']);
$routes->connect('/admin', ['controller' => 'Cmsusers', 'action' => 'login']);
$routes->connect('/admin/reset_password/*', ['controller' => 'Cmsusers', 'action' => 'resetPassword']);
//$routes->connect('/guest/*', ['controller' => 'Registrations', 'action' => 'guest']);
$routes->connect('/stripe/*', ['controller' => 'Registrations', 'action' => 'stripe']);
$routes->connect('/termsconditions/*', ['controller' => 'Registrations', 'action' => 'terms']);
$routes->connect('/guest/forgot_password', ['controller' => 'Guest', 'action' => 'forgotPassword']);
$routes->connect('/guest/reset_password', ['controller' => 'Guest', 'action' => 'resetPassword']);
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
$routes->connect('/users/logout/', ['controller' => 'Cmsusers', 'action' => 'logout']);
$routes->connect('/users/edit-profile/', ['controller' => 'Cmsusers', 'action' => 'editProfile']);
$routes->connect('/users/add/', ['controller' => 'Cmsusers', 'action' => 'add']);
$routes->connect('/users/forgot_password', ['controller' => 'Cmsusers', 'action' => 'forgotPassword']);
$routes->connect('/users/bulk-action', ['controller' => 'Cmsusers', 'action' => 'bulkAction']);
$routes->connect('/users/allowaction/*', ['controller' => 'Cmsusers', 'action' => 'allowaction']);
$routes->connect('/users/revokeaction/*', ['controller' => 'Cmsusers', 'action' => 'revokeaction']);
$routes->connect('/users/revokePassword/*', ['controller' => 'Cmsusers', 'action' => 'revokePassword']);
$routes->connect('/users/edit/*', ['controller' => 'Cmsusers', 'action' => 'edit']);
$routes->connect('/users/view/*', ['controller' => 'Cmsusers', 'action' => 'view']);
$routes->connect('/users/addmembership/*', ['controller' => 'Cmsusers', 'action' => 'addmembership']);
$routes->connect('/users/revokemembership/*', ['controller' => 'Cmsusers', 'action' => 'revokemembership']);
$routes->connect('/users/*', ['controller' => 'Cmsusers']);
$routes->connect('/pages/*', ['controller' => 'Pages']);
$routes->connect('/pages/edit/*', ['controller' => 'Pages', 'action' => 'edit']);
$routes->connect('/pages/add', ['controller' => 'Pages', 'action' => 'add']);
$routes->connect('/pages/delete/*', ['controller' => 'Pages', 'action' => 'delete']);
$routes->connect('/pages/bulk-action', ['controller' => 'Pages', 'action' => 'bulkAction']);
$routes->connect('/submodules/*', ['controller' => 'SubModules']);
$routes->connect('/submodules/add', ['controller' => 'SubModules', 'action' => 'add']);
$routes->connect('/submodules/edit/*', ['controller' => 'SubModules', 'action' => 'edit']);
$routes->connect('/submodules/delete/*', ['controller' => 'SubModules', 'action' => 'delete']);
$routes->connect('/submodules/bulk-action', ['controller' => 'SubModules', 'action' => 'bulkAction']);
$routes->connect('/companies/*', ['controller' => 'Companies']);
$routes->connect('/companies/add', ['controller' => 'Companies', 'action' => 'add']);
$routes->connect('/companies/edit/*', ['controller' => 'Companies', 'action' => 'edit']);
$routes->connect('/companies/delete/*', ['controller' => 'Companies', 'action' => 'delete']);
$routes->connect('/companies/view/*', ['controller' => 'Companies', 'action' => 'view']);
$routes->connect('/companies/bulk-action', ['controller' => 'Companies', 'action' => 'bulkAction']);
$routes->connect('/companies/uploadPicture', ['controller' => 'Companies', 'action' => 'uploadPicture']);
$routes->connect('/companies/companyActive', ['controller' => 'Companies', 'action' => 'companyActive']);
$routes->connect('/companies/trnsToaws/*', ['controller' => 'Companies', 'action' => 'trnsToaws']);
$routes->connect('/settings/edit/*', ['controller' => 'Settings', 'action' => 'edit']);
$routes->connect('/lg/update/*', ['controller' => 'Epicvelocity', 'action' => 'generatePdf']);
$routes->connect('/client/notelist/*', ['controller' => 'Affiliate', 'action' => 'note']);
$routes->connect('/client/note', ['controller' => 'Affiliate', 'action' => 'affiliatechat']);
$routes->connect('/client/addnote', ['controller' => 'Affiliate', 'action' => 'addnote']);
$routes->connect('/test',['controller'=>'Test','action'=>'testing']);
/**
* Connect catchall routes for all controllers.
*
* Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
* `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
* `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
*
* Any route class can be used with this method, such as:
* - DashedRoute
* - InflectedRoute
* - Route
* - Or your own route class
*
* You can remove these routes once you've connected the
* routes you want in your application.
*/
$routes->fallbacks('DashedRoute');
});
/**
* Load all plugin routes. See the Plugin documentation on
* how to customize the loading of plugin routes.
*/
Plugin::routes();

27
config/schema/i18n.sql Normal file
View File

@@ -0,0 +1,27 @@
# $Id$
#
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php)
CREATE TABLE i18n (
id int(10) NOT NULL auto_increment,
locale varchar(6) NOT NULL,
model varchar(255) NOT NULL,
foreign_key int(10) NOT NULL,
field varchar(255) NOT NULL,
content mediumtext,
PRIMARY KEY (id),
# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
# INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
# INDEX I18N_LOCALE_MODEL(locale, model),
# INDEX I18N_FIELD(model, foreign_key, field),
# INDEX I18N_ROW(model, foreign_key),
INDEX locale (locale),
INDEX model (model),
INDEX row_id (foreign_key),
INDEX field (field)
);

View File

@@ -0,0 +1,54 @@
--
-- Dumping data for table `modules`
--
INSERT INTO `modules` (`id`, `name`, `icon`, `sequence`, `created_on`, `modified_on`) VALUES
(2000, 'CRM', '<i class=\"fa fa-th-list\" aria-hidden=\"true\"></i>', 6, '2018-01-16 05:08:52', '0000-00-00 00:00:00');
--
-- Dumping data for table `sub_modules`
--
INSERT INTO `sub_modules` (`id`, `module_id`, `name`, `controller_name`, `icon`, `sequence`, `created_on`, `modified_on`) VALUES
(2100, 2000, 'Project Management', 'Project', '<i class=\"fa fa-lightbulb-o\"></i>', 1, '2018-01-16 05:12:19', '2018-01-16 06:10:31'),
(2200, 2000, 'Client Management', 'Client', '<i class=\"fa fa-building-o\" aria-hidden=\"true\"></i>', 2, '2018-01-18 11:32:58', '0000-00-00 00:00:00'),
(2300, 2000, 'Invoice Management', 'Invoice', '<i class=\"fa fa-bell\"></i>', 3, '2018-01-16 05:35:05', '2018-01-17 13:01:51'),
(2400, 2000, 'Expense Management', 'Expense', '<i class=\"fa fa-angle-double-right\"></i>', 4, '2018-01-17 05:32:17', '2018-01-19 09:42:57'),
(2500, 2000, 'Estimate Management', 'Estimate', '<i class=\"fa fa-files-o\" aria-hidden=\"true\"></i>', 5, '2018-01-18 11:27:30', '2018-01-19 09:43:12');
--
-- Dumping data for table `pages`
--
INSERT INTO `pages` (`id`, `module_id`, `sub_module_id`, `name`, `method_name`, `available_to_company`, `created_on`, `modified_on`) VALUES
(2101, 2000, 2100, 'Index', 'index', 1, '2018-01-16 05:14:05', '0000-00-00 00:00:00'),
(2102, 2000, 2100, 'View', 'view', 1, '2018-01-16 06:11:56', '0000-00-00 00:00:00'),
(2103, 2000, 2100, 'Add', 'add', 1, '2018-01-16 06:12:11', '0000-00-00 00:00:00'),
(2104, 2000, 2100, 'Edit', 'edit', 1, '2018-01-16 06:12:24', '0000-00-00 00:00:00'),
(2105, 2000, 2100, 'Delete', 'delete', 1, '2018-01-16 06:12:45', '0000-00-00 00:00:00'),
(2106, 2000, 2100, 'BulkAction', 'bulkaction', 1, '2018-01-16 06:13:04', '0000-00-00 00:00:00'),
(2201, 2000, 2200, 'Index', 'index', 1, '2018-01-18 11:33:24', '0000-00-00 00:00:00'),
(2202, 2000, 2200, 'View', 'view', 1, '2018-01-18 11:33:51', '0000-00-00 00:00:00'),
(2203, 2000, 2200, 'Add', 'add', 1, '2018-01-18 11:34:32', '0000-00-00 00:00:00'),
(2204, 2000, 2200, 'Edit', 'edit', 1, '2018-01-18 11:34:56', '0000-00-00 00:00:00'),
(2205, 2000, 2200, 'Delete', 'delete', 1, '2018-01-18 11:35:17', '0000-00-00 00:00:00'),
(2206, 2000, 2200, 'BulkAction', 'bulkaction', 1, '2018-01-18 11:35:42', '0000-00-00 00:00:00'),
(2310, 2000, 2300, 'index', 'index', 1, '2018-01-16 05:36:29', '0000-00-00 00:00:00'),
(2320, 2000, 2300, 'add', 'add', 1, '2018-01-16 05:37:22', '0000-00-00 00:00:00'),
(2330, 2000, 2300, 'edit', 'edit', 1, '2018-01-16 05:37:47', '0000-00-00 00:00:00'),
(2340, 2000, 2300, 'delete', 'delete', 1, '2018-01-16 05:39:47', '0000-00-00 00:00:00'),
(2350, 2000, 2300, 'view', 'view', 1, '2018-01-16 13:33:49', '0000-00-00 00:00:00'),
(2360, 2000, 2300, 'bulkaction', 'bulkaction', 1, '2018-01-17 07:20:53', '0000-00-00 00:00:00'),
(2401, 2000, 2400, 'Index', 'index', 1, '2018-01-17 05:33:32', '0000-00-00 00:00:00'),
(2402, 2000, 2400, 'View', 'view', 1, '2018-01-17 05:33:51', '0000-00-00 00:00:00'),
(2403, 2000, 2400, 'Add', 'add', 1, '2018-01-17 05:34:18', '0000-00-00 00:00:00'),
(2404, 2000, 2400, 'Edit', 'edit', 1, '2018-01-17 05:34:41', '0000-00-00 00:00:00'),
(2405, 2000, 2400, 'Delete', 'delete', 1, '2018-01-17 05:35:03', '0000-00-00 00:00:00'),
(2406, 2000, 2400, 'Bulk Action', 'bulkaction', 1, '2018-01-17 05:35:51', '0000-00-00 00:00:00'),
(2501, 2000, 2500, 'Index', 'index', 1, '2018-01-18 11:28:41', '0000-00-00 00:00:00'),
(2502, 2000, 2500, 'Add', 'add', 1, '2018-01-18 11:29:35', '0000-00-00 00:00:00'),
(2503, 2000, 2500, 'View', 'view', 1, '2018-01-18 11:30:06', '0000-00-00 00:00:00'),
(2504, 2000, 2500, 'Edit', 'edit', 1, '2018-01-18 11:31:52', '0000-00-00 00:00:00'),
(2505, 2000, 2500, 'Delete', 'delete', 1, '2018-01-18 11:32:29', '0000-00-00 00:00:00'),
(2506, 2000, 2500, 'Bulk Action', 'bulkaction', 1, '2018-01-18 11:32:59', '0000-00-00 00:00:00');

View File

@@ -0,0 +1,423 @@
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 19, 2018 at 01:45 PM
-- Server version: 10.1.28-MariaDB
-- PHP Version: 5.6.32
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `rtgv3`
--
-- --------------------------------------------------------
--
-- Table structure for table `crm_categories`
--
CREATE TABLE `crm_categories` (
`id` int(11) NOT NULL,
`name` varchar(150) NOT NULL COMMENT 'category name',
`created_on` date NOT NULL,
`modified_on` date NOT NULL,
`created_by` int(11) NOT NULL,
`modified_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `crm_categories`
--
INSERT INTO `crm_categories` (`id`, `name`, `created_on`, `modified_on`, `created_by`, `modified_by`) VALUES
(1, 'Accommodation', '2018-01-17', '0000-00-00', 2, 0),
(2, 'Accounting Fees', '2018-01-17', '0000-00-00', 2, 0);
-- --------------------------------------------------------
--
-- Table structure for table `expenses`
--
CREATE TABLE `expenses` (
`id` int(11) NOT NULL,
`type` tinyint(4) NOT NULL COMMENT '0=Payment and 1=Refund',
`category_id` int(11) NOT NULL COMMENT 'from categories table id',
`description` text NOT NULL,
`date` date NOT NULL,
`value` float NOT NULL,
`currency` varchar(50) NOT NULL,
`vat` float NOT NULL,
`project_id` int(11) NOT NULL COMMENT 'from projects table id',
`rebill` tinyint(4) NOT NULL COMMENT '0=yes and 1=no',
`receipt_reference` int(11) NOT NULL,
`invoice_id` int(11) NOT NULL COMMENT 'from invoice table id',
`attachment` varchar(255) NOT NULL,
`attachment_description` text NOT NULL,
`created_on` datetime NOT NULL,
`modified_on` datetime NOT NULL,
`created_by` int(11) NOT NULL,
`modified_by` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `expenses`
--
INSERT INTO `expenses` (`id`, `type`, `category_id`, `description`, `date`, `value`, `currency`, `vat`, `project_id`, `rebill`, `receipt_reference`, `invoice_id`, `attachment`, `attachment_description`, `created_on`, `modified_on`, `created_by`, `modified_by`) VALUES
(1, 1, 1, 'wetryui', '2018-01-17', 100, '$10', 5, 3, 0, 2, 0, 'flower_1.png', 'sfedgfhkjl', '2018-01-17 00:00:00', '2018-01-19 00:00:00', 51, 51),
(2, 0, 1, 'lorem ipsum', '2018-01-19', 266, '$20', 10, 4, 1, 2, 0, 'circle_2.jpg', 'sdfghmj', '2018-01-17 00:00:00', '2018-01-19 09:50:38', 51, 51),
(3, 1, 1, 'dfhgjhkjl', '2018-01-17', 150, '$89', 5, 9, 0, 1, 0, 'bookating-logo_3.png', 'asfdgfhj', '2018-01-17 00:00:00', '2018-01-18 00:00:00', 51, 2),
(4, 0, 2, 'dummy test', '2018-01-18', 250, '$10', 6, 2, 1, 4, 0, 'lion_4.jpg', 'nothing to say', '2018-01-18 00:00:00', '2018-01-18 00:00:00', 51, 2),
(11, 0, 1, 'sdfghjk', '2018-01-19', 100, '$80', 7, 3, 0, 2, 0, 'lion_11.jpg', 'esrdctvgbhnj', '2018-01-19 12:43:03', '2018-01-19 12:44:08', 51, 51);
-- --------------------------------------------------------
--
-- Table structure for table `invoices`
--
CREATE TABLE `invoices` (
`id` int(11) NOT NULL,
`reference` int(11) DEFAULT NULL,
`client_id` int(11) NOT NULL COMMENT 'id from client table',
`status` tinyint(4) NOT NULL COMMENT '0 = inactive & 1 = active',
`currency` decimal(10,0) NOT NULL,
`issue_date` datetime NOT NULL,
`due_date` datetime NOT NULL,
`sent_date` datetime DEFAULT NULL,
`paid_date` datetime DEFAULT NULL,
`terms` text NOT NULL,
`discount` decimal(10,0) NOT NULL,
`subscription_id` varchar(255) DEFAULT NULL,
`project_id` int(11) NOT NULL COMMENT 'id from project table',
`tax` decimal(10,0) NOT NULL,
`estimate` int(11) DEFAULT NULL,
`estimate_status` tinyint(4) DEFAULT NULL,
`etimate_accepted_date` datetime DEFAULT NULL,
`estimate_sent` varchar(150) DEFAULT NULL,
`sum` float NOT NULL,
`second_tax` decimal(10,0) NOT NULL,
`estimate_reference` varchar(150) DEFAULT NULL,
`paid` float DEFAULT NULL,
`outstanding` float DEFAULT NULL,
`created_on` datetime NOT NULL,
`modified_on` datetime NOT NULL,
`created_by` int(11) NOT NULL COMMENT 'id from cmsusers table',
`modified_by` int(11) NOT NULL COMMENT 'id from cmsusers table'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `invoices`
--
INSERT INTO `invoices` (`id`, `reference`, `client_id`, `status`, `currency`, `issue_date`, `due_date`, `sent_date`, `paid_date`, `terms`, `discount`, `subscription_id`, `project_id`, `tax`, `estimate`, `estimate_status`, `etimate_accepted_date`, `estimate_sent`, `sum`, `second_tax`, `estimate_reference`, `paid`, `outstanding`, `created_on`, `modified_on`, `created_by`, `modified_by`) VALUES
(1, NULL, 1, 1, '200', '2018-01-19 00:00:00', '2018-01-20 00:00:00', NULL, NULL, 'sdfghj', '5', NULL, 3, '5', NULL, NULL, NULL, NULL, 0, '10', NULL, NULL, NULL, '2018-01-19 11:01:20', '0000-00-00 00:00:00', 51, 0),
(2, NULL, 2, 1, '100', '2018-01-19 00:00:00', '2018-01-27 00:00:00', NULL, NULL, 'sdgfhjk', '5', NULL, 2, '7', NULL, NULL, NULL, NULL, 0, '9', NULL, NULL, NULL, '2018-01-19 11:02:12', '0000-00-00 00:00:00', 51, 0),
(3, NULL, 2, 1, '100', '2018-01-26 00:00:00', '2018-01-27 00:00:00', NULL, NULL, 'sdfgfhghjk', '4', NULL, 2, '7', NULL, NULL, NULL, NULL, 0, '9', NULL, NULL, NULL, '2018-01-19 11:02:49', '2018-01-19 11:04:42', 51, 51),
(4, NULL, 1, 1, '200', '2018-01-19 00:00:00', '2018-01-12 00:00:00', NULL, NULL, 'sdfghjk', '6', NULL, 3, '5', NULL, NULL, NULL, NULL, 0, '10', NULL, NULL, NULL, '2018-01-19 12:39:32', '2018-01-19 12:39:51', 51, 51);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `crm_categories`
--
ALTER TABLE `crm_categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `invoices`
--
ALTER TABLE `invoices`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `crm_categories`
--
ALTER TABLE `crm_categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `invoices`
--
ALTER TABLE `invoices`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
--
-- Table structure for table `clients`
--
CREATE TABLE `clients` (
`id` int(11) NOT NULL,
`reference` int(11) DEFAULT NULL,
`name` varchar(40) NOT NULL,
`website` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`mobile` varchar(20) DEFAULT NULL,
`address` varchar(100) DEFAULT NULL,
`zip_code` int(10) DEFAULT NULL,
`city` varchar(30) DEFAULT NULL,
`country` varchar(30) DEFAULT NULL,
`state` varchar(30) DEFAULT NULL,
`vat_number` varchar(50) DEFAULT NULL,
`inactive` tinyint(4) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `contacts`
--
CREATE TABLE `contacts` (
`id` int(11) NOT NULL,
`company_id` tinyint(4) DEFAULT NULL,
`first_name` varchar(40) DEFAULT NULL,
`last_name` varchar(40) DEFAULT NULL,
`email` varchar(60) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`mobile` varchar(50) DEFAULT NULL,
`address` varchar(255) DEFAULT NULL,
`zip_code` varchar(40) DEFAULT NULL,
`photo` varchar(255) DEFAULT NULL,
`city` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`inactive` tinyint(4) DEFAULT NULL,
`access` varchar(50) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_categories`
--
CREATE TABLE `project_categories` (
`id` int(11) NOT NULL,
`name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Dumping data for table `project_categories`
--
INSERT INTO `project_categories` (`id`, `name`) VALUES
(1, 'It/Software'),
(2, 'Finance'),
(3, 'Electronis'),
(4, 'Networking');
--
-- Table structure for table `projects`
--
CREATE TABLE `projects` (
`id` int(11) NOT NULL,
`reference` int(11) DEFAULT NULL,
`client_id` tinyint(4) NOT NULL,
`category_id` tinyint(4) NOT NULL,
`company_id` tinyint(4) DEFAULT NULL,
`rate_per_hour` decimal(10,0) DEFAULT NULL,
`progress` decimal(10,0) DEFAULT NULL,
`project_name` varchar(50) NOT NULL,
`start_date` date NOT NULL,
`deadline` date NOT NULL,
`track` int(11) DEFAULT NULL,
`time_spent` int(11) DEFAULT NULL,
`phase` varchar(255) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`progress_calculate` tinyint(4) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`sticky` enum('1','0') DEFAULT NULL,
`permission` int(11) NOT NULL COMMENT '0=Only show own tasks for non super admins,1=Clients can create tasks',
`enable_client_task` int(11) DEFAULT NULL,
`hide_task` int(11) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_activities`
--
CREATE TABLE `project_has_activities` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) DEFAULT NULL,
`user_id` tinyint(4) DEFAULT NULL,
`client_id` tinyint(4) DEFAULT NULL,
`subject` varchar(100) DEFAULT NULL,
`message` varchar(255) DEFAULT NULL,
`type` varchar(150) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_filies`
--
CREATE TABLE `project_has_filies` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) DEFAULT NULL,
`user_id` tinyint(4) DEFAULT NULL,
`client_id` tinyint(4) DEFAULT NULL,
`type` varchar(100) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`file_name` varchar(100) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`save_name` varchar(100) DEFAULT NULL,
`phase` varchar(255) DEFAULT NULL,
`download_counter` int(11) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_invoices`
--
CREATE TABLE `project_has_invoices` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) DEFAULT NULL,
`invoice` tinyint(4) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_milestones`
--
CREATE TABLE `project_has_milestones` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`start_date` datetime DEFAULT NULL,
`due_date` datetime DEFAULT NULL,
`order_index` int(11) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_tasks`
--
CREATE TABLE `project_has_tasks` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) NOT NULL,
`user_id` tinyint(4) NOT NULL,
`name` varchar(100) DEFAULT NULL,
`status` varchar(50) DEFAULT NULL,
`type` tinyint(4) DEFAULT NULL,
`public` int(11) DEFAULT NULL,
`date_time` datetime DEFAULT NULL,
`due_time` datetime DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`value` decimal(10,0) DEFAULT NULL,
`priority` smallint(6) NOT NULL,
`client_id` int(11) NOT NULL,
`milestone_id` tinyint(4) NOT NULL,
`invoice_id` tinyint(4) NOT NULL,
`track` int(11) DEFAULT NULL,
`time_spent` int(11) DEFAULT NULL,
`milestone_order` int(11) NOT NULL,
`task_order` int(11) DEFAULT NULL,
`progress` int(11) DEFAULT NULL,
`start_date` int(11) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`note` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_time_sheets`
--
CREATE TABLE `project_has_time_sheets` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) NOT NULL,
`user_id` tinyint(4) NOT NULL,
`task_id` tinyint(4) NOT NULL,
`client_id` tinyint(4) NOT NULL,
`invoice_id` tinyint(4) NOT NULL,
`time` time DEFAULT NULL,
`start_date` datetime DEFAULT NULL,
`end_date` datetime DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;
--
-- Table structure for table `project_has_workers`
--
CREATE TABLE `project_has_workers` (
`id` int(11) NOT NULL,
`project_id` tinyint(4) NOT NULL,
`user_id` tinyint(4) NOT NULL,
`created_on` datetime NOT NULL,
`created_by` tinyint(4) NOT NULL,
`modified_on` datetime NOT NULL,
`modified_by` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf32;

View File

@@ -0,0 +1,15 @@
# $Id$
#
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
# MIT License (http://www.opensource.org/licenses/mit-license.php)
CREATE TABLE sessions (
id varchar(40) NOT NULL default '',
data text,
expires INT(11) NOT NULL,
PRIMARY KEY (id)
);

32
db/cronjob.txt Normal file
View File

@@ -0,0 +1,32 @@
#*/11 * * * * cd /var/www/html && bin/cake processData failSubscription
#*/12 * * * * cd /var/www/html && bin/cake processData successCharge
#*/5 * * * * curl --request GET 'https://readytogoletters.com/dropbox/kunalupload.php'
#0 4 * * * curl --request GET 'https://readytogoletters.com/dropbox/kunalupload.php'
*/10 * * * * cd /var/www/html && bin/cake.php sendTomemberEmail sendLetterNotificationEmail
*/60 * * * * cd /var/www/html && bin/cake.php sendTomemberEmail sendToMemberEmail
*/5 * * * * cd /var/www/html && bin/cake.php Ringcentral processRCFax
#0 4 * * * cd /var/www/html && bin/cake.php ProcessBackup dropboxBackup
*/10 * * * * cd /var/www/html && bin/cake AutomationSchedule processAutomation
*/10 * * * * cd /var/www/html && bin/cake AutomationSchedule setupEmailAutomation
*/5 * * * * cd /var/www/html && bin/cake ClientPasswordChangeEmail passwordChangeEmail
*/2 * * * * cd /var/www/html && bin/cake InvoicePayment processRecurringPayments
0 */4 * * * cd /var/www/html && bin/cake SendMailToGuest processEmail
* * * * * cd /var/www/html && bin/cake EmailSender main
*/2 * * * * cd /var/www/html && bin/cake DatabaseCleaning main
0 1 * * * cd /var/www/html && bin/cake LogsCleaning main
0 5 * * * cd /var/www/html && bin/cake LogsCleaning main
0 11 * * * cd /var/www/html && bin/cake ProxyRenewalProcess main
0 22 * * * cd /var/www/html && bin/cake MemberDocumentCleaning main
0 22 * * * cd /var/www/html && bin/cake MemberDocumentCleaning main

15
db/db_change_log.txt Normal file
View File

@@ -0,0 +1,15 @@
04-07-2022
===============
INSERT INTO `controllers` (`id`, `user_type`, `sequence`, `module_name`, `contrloller_name`, `controller_url`, `icon`) VALUES ('38', '2', '3', 'Client Management', 'Client', '/client/index', '<i class=\"fa fa-file-text\"></i>');
UPDATE `controllers` SET `contrloller_name` = 'Client Management' WHERE `controllers`.`id` = 38;
UPDATE `controllers` SET `contrloller_name` = 'Client' WHERE `controllers`.`id` = 38;
INSERT INTO `controllers` (`id`, `user_type`, `sequence`, `module_name`, `contrloller_name`, `controller_url`, `icon`) VALUES ('39', '2', '3', 'Client Add', 'Client', '/client/add', '<i class=\"fa fa-file-text\"></i>');
15-07-2022 (deployed)
====================
CREATE TABLE `employee_affiliates` (`id` INT NOT NULL AUTO_INCREMENT , `employee_id` INT NOT NULL COMMENT 'from crmusers type=1' , `affiliate_id` INT NOT NULL COMMENT 'from crmusers type=2' , PRIMARY KEY (`id`)) ENGINE = InnoDB;
23-07-2022
=============
ALTER TABLE `crmusers` ADD `raw_password` INT NULL DEFAULT NULL AFTER `hashed_password`;
ALTER TABLE `crmusers` CHANGE `raw_password` `raw_password` VARCHAR(128) NULL DEFAULT NULL;

13
db/pulak.txt Normal file
View File

@@ -0,0 +1,13 @@
#28-10-2022
ALTER TABLE `crmusers` ADD `auto_assign_affiliate` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'automatically assign affiliate enable/disable 0=disable, 1=enable' AFTER `count_unread_notes`;
#22-02-2023
ALTER TABLE `cmsusers` CHANGE `is_active` `is_active` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '1 = active, 2= Paused, 0 = inactive';
#14-07-2023
ALTER TABLE `data_item_key_values` ADD `is_processed` TINYINT NOT NULL DEFAULT '0' COMMENT 'processed = 1, not processed=0' AFTER `value6`;
#17-11-2023
ALTER TABLE `data_item_key_values` ADD `is_remove_from_report` TINYINT(4) NOT NULL DEFAULT '0' COMMENT 'remove=1,not remove=0' AFTER `is_delete`;

BIN
db/rtgv4.zip Normal file

Binary file not shown.

16
index.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.10.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';

39
phpunit.xml.dist Normal file
View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="App Test Suite">
<directory>./tests/TestCase</directory>
</testsuite>
<!-- Add plugin test suites here. -->
</testsuites>
<!-- Setup a listener for fixtures -->
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>
<!-- Ignore vendor tests in code coverage reports -->
<filter>
<blacklist>
<directory suffix=".php">./vendor/</directory>
</blacklist>
</filter>
</phpunit>

1
rajibcron1.txt Normal file
View File

@@ -0,0 +1 @@
hello cron

0
satisfiable Normal file
View File

View File

@@ -0,0 +1,24 @@
def remove_and_insert_text(text_to_remove):
source_file = 'proxies.txt'
destination_file = "proxies_block_ips.txt"
with open(destination_file, 'a') as file:
file.write('\n' + text_to_remove)
with open(source_file, 'r') as file:
content = file.read()
if text_to_remove in content:
modified_content = content.replace(text_to_remove, '')
cleaned_content = '\n'.join(line.strip() for line in modified_content.splitlines() if line.strip())
with open(source_file, 'w') as file:
file.write(cleaned_content)
else:
print("remove text not found")

27
scrapper/Basic/helper.py Normal file
View File

@@ -0,0 +1,27 @@
from datetime import datetime
import requests
def check_access_denied(url):
try:
response = requests.get(url)
return response.status_code
except requests.exceptions.RequestException as e:
return f"Error: {e}"
def get_current_datetime():
now = datetime.now()
formatted_time = now.strftime("%Y-%m-%d %H:%M:%S")
return formatted_time
def read_proxies():
all_proxies = []
with open('proxies.txt', 'r') as file:
for line in file:
all_proxies.append(line.strip())
return all_proxies

View File

@@ -0,0 +1,29 @@
import logging
from datetime import datetime
import os
def get_logging():
log_dir = 'logs'
if not os.path.exists(log_dir):
os.makedirs(log_dir)
date_str = datetime.now().strftime('%Y-%m-%d')
log_filename = os.path.join(log_dir, f'app_{date_str}.log')
if not os.path.exists(log_filename):
logging.basicConfig(filename=log_filename, filemode='w', level=logging.ERROR,
format='%(asctime)s - %(levelname)s - %(message)s')
else:
logging.basicConfig(filename=log_filename, filemode='a', level=logging.ERROR,
format='%(asctime)s - %(levelname)s - %(message)s')
return logging

View File

@@ -0,0 +1,42 @@
import smtplib
from email.mime.text import MIMEText
def send_email(subject,message):
print('-- Email Sending --')
# Configuration
port = 587
smtp_server = "smtp.gmail.com"
login = "noreply.readytogoletters@gmail.com" # Your login generated by Mailtrap
password = "fymebmopnajzwkfb"
sender_email = "test.velocity@gmail.com"
# port = 587
# smtp_server = "sandbox.smtp.mailtrap.io"
# login = "b879299bf7dd9a"
# password = "3c1ee98e9ddeb7"
# sender_email = "pulak.deb@softrobotics.com.bd"
# List of recipient email addresses
receiver_emails = ["rajibcuetcse@gmail.com","bpulakd@gmail.com"]
#receiver_emails = ["bpulakd@gmail.com"]
text = f"{message}"
message = MIMEText(text, "plain") # Create MIMEText object
message["Subject"] = subject
message["From"] = sender_email
message["To"] = ", ".join(receiver_emails) # Join the list of receiver emails into a string separated by commas
# Send the email
with smtplib.SMTP(smtp_server, port) as server:
server.starttls() # Secure the connection
server.login(login, password)
# Loop through each recipient and send the email individually
for recipient in receiver_emails:
server.sendmail(sender_email, recipient, message.as_string())
print('Sent')

284
scrapper/README.md Normal file
View File

@@ -0,0 +1,284 @@
# credit-scrapper-poc
## Server setup
####Step 1 Installing Nginx
```
sudo apt update
sudo apt install nginx
```
####Step 2 Adjusting the Firewall
```
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'OpenSSH'
sudo ufw enable
sudo ufw status
```
####Step 3 Checking your Web Server
```
sudo systemctl status nginx
curl -4 icanhazip.com
```
When you have your servers IP address, enter it into your browsers address bar:
####Step 4 Installing the Components from the Ubuntu Repositories
```
sudo apt update
sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools
```
####Step 5 Clone the repository
```
git clone https://gitlab.com/sunflowerlab/Repositories/TechnologyPOCs/credit-scrapper-poc.git
```
####Step 6 Creating a Python Virtual Environment
```
sudo apt install python3-venv
cd credit-scrapper-poc
python3.6 -m venv venv
source venv/bin/activate
```
####Step 7 Setting Up an Application
```
pip install wheel
pip install uwsgi
pip install -r requirements.txt
```
####Step 8 Test the setup
```
python app.py
uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app
uwsgi --socket 0.0.0.0:8080 --protocol=http -w wsgi:app
```
####Step 9 Deactivate python environment
```
deactivate
```
####Step 10 Creating a systemd Unit File
```
sudo nano /etc/systemd/system/app.service
```
Add the following contain
```
[Unit]
Description=uWSGI instance to serve app
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/credit-scrapper-poc
Environment="PATH=/home/ubuntu/credit-scrapper-poc/venv/bin"
ExecStart=/home/ubuntu/credit-scrapper-poc/venv/bin/uwsgi --ini app.ini
[Install]
WantedBy=multi-user.target
```
Update the directory paths.
We can now start the uWSGI service we created and enable it so that it starts at boot:
```
sudo systemctl start app
sudo systemctl enable app
sudo systemctl status app
```
####Step 11 Configuring Nginx to Proxy Requests
```
sudo nano /etc/nginx/sites-available/app
```
###Step 12 - Install Javascript library
source install_phantomjs.sh
Add the following contain
```
server {
listen 80;
server_name 54.68.236.191;
location / {
proxy_read_timeout 1200s;
proxy_connect_timeout 1200s;
include uwsgi_params;
uwsgi_pass unix:/home/ubuntu/credit-scrapper-poc/app.sock;
# when a client closes the connection then keep the channel to uwsgi open. Otherwise uwsgi throws an IOError
uwsgi_ignore_client_abort on;
uwsgi_buffer_size 60M;
uwsgi_buffers 8 60M;
uwsgi_busy_buffers_size 60M;
uwsgi_read_timeout 1200;
uwsgi_send_timeout 1200;
uwsgi_connect_timeout 1200;
}
}
```
Update the directory paths and IP or domain address.
```
sudo nano /etc/nginx/conf.d/timeout.conf
```
Add the following contain
```
proxy_connect_timeout 1200;
proxy_send_timeout 1200;
proxy_read_timeout 1200;
send_timeout 1200;
```
```
sudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl restart app
```
When you have your servers IP address, enter it into your browsers address bar.
## API Details
1. Smart Credit - Get Credit Report 3B
Method - `POST`
Endpoint - `/smart-credit-credit-report-3b`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password"
}`
Response - `HTML CONTENT` or `ERROR`
2. IdentityIQ - Get most recent Credit Report
Method - `POST`
Endpoint - `/identity-iq-credit-report-html`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password",
"ssn": "last-four-digit"
}`
Response - `HTML CONTENT` or `ERROR` or `TIME_OUT`
3. IdentityIQ - Get refresh date and button type
Method - `POST`
Endpoint - `/identity-iq-report-refresh-date`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password",
"ssn": "last -four-digit"
}`
Response - `{
'refresh_date': "MM/DD/YYYY",
'button_type': 1 or 2
}`
or
`ERROR`
or
`TIME_OUT`
button_type - `1` for Purchase AND `2` for Refresh
4. IdentityIQ - To click on the refresh button.
Method - `POST`
Endpoint - `/identity-iq-click-refresh-btn`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password",
"ssn": "last -four-digit"
}`
Response - `DONE` or `ERROR` or `TIME_OUT` or `BUTTON_NOT_FOUND`
5. SmartCredit - Get refresh date and button type
Method - `POST`
Endpoint - `/smart-credit-credit-refresh-status`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password"
}`
Response - `{
'button_type': 0 or 1 or 2.,
'refresh_date': TEXT
}`
or
`ERROR`
or
`TIME_OUT`
button_type - `0` for no button AND `1` for Purchase AND `2` for Refresh
6. SmartCredit - To click on the refresh button.
Method - `POST`
Endpoint - `/smart-credit-credit-click-refresh-btn`
Content-Type - `application/json`
Payload - `{
"email": "email",
"password": "password"
}`
Response - `DONE` or `ERROR` or `TIME_OUT` or `BUTTON_NOT_FOUND`
***Reference Link*** https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uswgi-and-nginx-on-ubuntu-18-04

12
scrapper/app.ini Normal file
View File

@@ -0,0 +1,12 @@
[uwsgi]
module = wsgi:app
master = true
processes = 5
socket = app.sock
chmod-socket = 660
vacuum = true
die-on-term = true

74
scrapper/app.py Normal file
View File

@@ -0,0 +1,74 @@
from flask import Flask, request, jsonify
from werkzeug.debug import DebuggedApplication
from webistes.smart_credit.click_refresh_btn import smart_credit_click_refresh_btn
from webistes.smart_credit.credit_3b_scrapper import credit_report_3b
from webistes.smart_credit.get_refresh_btn_status import smart_credit_refresh_status
from webistes.smart_credit.credit_3b_scrapper_new import credit_report_3b_new
from webistes.identity_iq.click_refresh_btn import click_refresh_btn
from webistes.identity_iq.get_refresh_date import get_refresh_date
from webistes.identity_iq.recent_report import recent_report
from webistes.identity_iq.user_validation import user_validation
app = Flask(__name__)
app.config['DEBUG'] = True
application = DebuggedApplication(app, True)
@app.route('/')
def index():
return jsonify({'message': 'Welcome to Scrapper!'})
@app.route('/smart-credit-credit-report-3b', methods=['POST'])
def get_credit_report_3b():
data = request.get_json()
return credit_report_3b(data['email'], data['password'])
@app.route('/smart-credit-credit-refresh-status', methods=['POST'])
def get_smart_credit_refresh_status():
data = request.get_json()
return smart_credit_refresh_status(data['email'], data['password'])
@app.route('/smart-credit-credit-click-refresh-btn', methods=['POST'])
def get_smart_credit_click_refresh_btn():
data = request.get_json()
return smart_credit_click_refresh_btn(data['email'], data['password'])
@app.route('/smart-credit-credit-report-3b-json', methods=['POST'])
def get_credit_report_3b_new():
data = request.get_json()
return credit_report_3b_new(data['email'], data['password'])
@app.route('/identity-iq-credit-report-html', methods=['POST'])
def get_identity_iq_credit_report_html():
data = request.get_json()
return recent_report(data['email'], data['password'], data['ssn'])
@app.route('/identity-iq-report-refresh-date', methods=['POST'])
def get_identity_iq_credit_report_refresh_date():
data = request.get_json()
return get_refresh_date(data['email'], data['password'], data['ssn'])
@app.route('/identity-iq-click-refresh-btn', methods=['POST'])
def get_identity_iq_report_click_refresh_btn():
data = request.get_json()
return click_refresh_btn(data['email'], data['password'], data['ssn'])
@app.route('/identity-iq-user-validation', methods=['POST'])
def get_identity_iq_user_validation():
data = request.get_json()
return user_validation(data['email'], data['password'], data['ssn'])
if __name__ == '__main__':
app.run(host='0.0.0.0')

0
scrapper/app.sock Normal file
View File

Binary file not shown.

16
scrapper/dateproxies.txt Normal file
View File

@@ -0,0 +1,16 @@
45.61.116.115:6793
154.29.233.242:6003
64.64.127.184:6137
45.43.82.237:6231
104.250.201.177:6722
173.245.88.218:5521
192.177.103.95:6588
173.0.9.172:5755
107.181.154.4:5682
206.41.169.26:5606
171.22.248.68:5960
45.43.83.48:6331
136.0.207.63:6640
198.37.99.152:5943
206.232.13.104:5770
216.19.217.75:6315

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env fish
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~ || exit
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
phantomjs --version

3
scrapper/proxies.txt Normal file
View File

@@ -0,0 +1,3 @@
166.88.195.82:5714
31.58.20.24:5708

1
scrapper/proxies1.txt Normal file
View File

@@ -0,0 +1 @@
206.206.124.81:6662

View File

@@ -0,0 +1 @@
45.41.176.106:6404

View File

@@ -0,0 +1,8 @@
107.181.141.230:6627
142.147.129.124:5733
173.239.237.123:5769
173.239.237.236:5882
198.23.147.141:5156
107.181.142.229:5822
192.186.172.180:9180
38.170.159.196:6787

View File

@@ -0,0 +1,7 @@
requests~=2.23.0
beautifulsoup4~=4.9.1
lxml
flask~=1.1.2
selenium~=3.141.0
pyvirtualdisplay
Werkzeug~=1.0.1

View File

View File

@@ -0,0 +1,165 @@
import traceback
import time
import random
from flask import jsonify
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from Basic.helper import read_proxies
from Basic.log_manager import get_logging
from Basic.add_remove_text import remove_and_insert_text
from Basic.helper import get_current_datetime
from Basic.helper import check_access_denied
from Basic.send_email import send_email
def click_refresh_btn(email, password, ssn):
logger = get_logging()
all_proxies = read_proxies()
proxy_address = random.choice(all_proxies)
print("proxy_address:---", proxy_address)
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument(f'--proxy-server={proxy_address}')
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.implicitly_wait(10)
try:
driver.find_element_by_id("close-pc-btn-handler").click()
except:
pass
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 60
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address, "page_code":200, "status_code": 1003, "data": "ACCOUNT_LOCKED"}
return jsonify(response)
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address, "page_code":200, "status_code":1002 , "data": "INVALID_LOGIN"}
return jsonify(response)
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
# element_present = ec.presence_of_element_located((By.CLASS_NAME, 'chakra-skeleton'))
# WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
if driver.current_url == url + 'Dashboard.aspx':
driver.get(url + 'Dashboard.aspx')
element_present = ec.presence_of_element_located((By.CLASS_NAME, 'chakra-skeleton'))
WebDriverWait(driver, timeout).until(element_present)
try:
element_click = driver.find_element(By.CLASS_NAME, 'chakra-modal__close-btn')
element_click.click()
except NoSuchElementException:
pass
try:
element_btn = wait.until(ec.element_to_be_clickable((By.XPATH, "//button[contains(., 'Refresh Report')]")))
driver.execute_script("arguments[0].click();", element_btn)
driver.quit()
response = {"page":'Dashboard.aspx', "ip":proxy_address, "page_code":200, "status_code":200 , "data": "DONE"}
return jsonify(response)
except NoSuchElementException:
driver.quit()
response = {"page":'Dashboard.aspx', "ip":proxy_address,"page_code":200, "status_code":400 , "data": "BUTTON_NOT_FOUND"}
return jsonify(response)
driver.quit()
traceback.format_exc()
response = {"page":'security-question.aspx', "ip":proxy_address,"page_code":403, "status_code":405 , "data": "ERROR"}
return jsonify(response)
except TimeoutException:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
result = check_access_denied(url+ 'Dashboard.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on Dashboard.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
driver.quit()
response = {"page":'Dashboard.aspx', "ip":proxy_address, "page_code":result, "status_code":408, "data": "TIME_OUT"}
return jsonify(response)
except Exception:
traceback.format_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
result = check_access_denied(url+ 'login.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on login.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
response = {"page":'login.aspx', "ip":proxy_address,"page_code":result, "status_code":404, "data": "ERROR"}
return jsonify(response)

View File

@@ -0,0 +1,190 @@
import traceback
import time
import random
from bs4 import BeautifulSoup
from flask import jsonify
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from Basic.helper import read_proxies
from Basic.log_manager import get_logging
from Basic.add_remove_text import remove_and_insert_text
from Basic.helper import get_current_datetime
from Basic.helper import check_access_denied
from Basic.send_email import send_email
def get_refresh_date(email, password, ssn):
logger = get_logging()
all_proxies = read_proxies()
proxy_address = random.choice(all_proxies)
print("proxy_address:---", proxy_address)
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument(f'--proxy-server={proxy_address}')
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.implicitly_wait(10)
try:
driver.find_element_by_id("close-pc-btn-handler").click()
except:
pass
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 60
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address, "page_code":200, "status_code": 1003, "data": "ACCOUNT_LOCKED"}
return jsonify(response)
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address,"page_code":200, "status_code":1002 , "data": "INVALID_LOGIN"}
return jsonify(response)
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
# element_present = ec.presence_of_element_located((By.TAG_NAME, 'dashboard-layout'))
# WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
if driver.current_url == url + 'Dashboard.aspx':
#driver.get(url + 'Dashboard.aspx')
element_present = ec.presence_of_element_located((By.ID,'chakra-toast-manager-top'))
WebDriverWait(driver, timeout).until(element_present)
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
driver.implicitly_wait(10)
time.sleep(5)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
try:
element_click = driver.find_element(By.CLASS_NAME,'chakra-modal__close-btn')
element_click.click()
except NoSuchElementException:
pass
try:
element = driver.find_element(By.CLASS_NAME,'chakra-skeleton')
response = {
'refresh_date': element.text,
'button_type': 1,
"ip":proxy_address,
"status_code":200,
"page":"Dashboard.aspx",
"page_code":200,
}
if 'Refresh Report' in element.text:
response['button_type'] = 2
except NoSuchElementException:
response = {
'refresh_date': 'Not Found',
'button_type': 1,
"ip":proxy_address,
"status_code":200,
"page":"Dashboard.aspx",
"page_code":200,
}
driver.quit()
return jsonify(response)
driver.quit()
result = check_access_denied(url+ 'Dashboard.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on Dashboard.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email)
response = {"page":'Dashboard.aspx', "ip":proxy_address, "page_code":result, "status_code":405, "data": "ERROR"}
return jsonify(response)
except TimeoutException:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
result = check_access_denied(url+ 'Dashboard.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on Dashboard.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
driver.quit()
response = {"page":'Dashboard.aspx', "ip":proxy_address,"page_code":result, "status_code":408, "data": "TIME_OUT"}
return jsonify(response)
except Exception:
traceback.format_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
result = check_access_denied(url+ 'login.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on login.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address,"page_code":result, "status_code":404, "data": "ERROR"}
return jsonify(response)

View File

@@ -0,0 +1,230 @@
import time
import requests
import traceback
import random
from flask import jsonify
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException,NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from Basic.helper import read_proxies
from Basic.log_manager import get_logging
from Basic.add_remove_text import remove_and_insert_text
from Basic.helper import get_current_datetime
from Basic.helper import check_access_denied
from Basic.send_email import send_email
def recent_report(email, password, ssn):
logger = get_logging()
all_proxies = read_proxies()
proxy_address = random.choice(all_proxies)
print("proxy_address:---", proxy_address)
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
# chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument(f'--proxy-server={proxy_address}')
option.add_argument('--headless') # Run Chrome in headless mode
option.add_argument('--disable-gpu') # Disable GPU acceleration
option.add_argument('--no-sandbox') # Bypass OS security model
option.add_argument('--disable-dev-shm-usage') # Overcome limited resource problems
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path)
driver.get(url + 'login.aspx')
#driver.save_screenshot("server_screenshot_login.png")
driver.implicitly_wait(10)
try:
driver.find_element_by_id("close-pc-btn-handler").click()
except:
pass
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 120
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address, "status_code": 1003, "page_code":200, "data": "ACCOUNT_LOCKED"}
return jsonify(response)
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
response = {"page":'login.aspx', "ip":proxy_address, "status_code":1002 ,"page_code":200, "data": "INVALID_LOGIN"}
return jsonify(response)
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
#driver.save_screenshot("server_screenshot_security_question.png")
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
#element_present = ec.presence_of_element_located((By.ID, 'hdnMemberID'))
#WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
#print('Dashboard success')
if driver.current_url == url + 'Dashboard.aspx':
response = requests.get(url + 'Dashboard.aspx')
if response.status_code == 200:
print("Access successful!")
elif response.status_code == 403:
print("Access forbidden. Your IP might be blocked.")
elif response.status_code == 401:
print("Unauthorized. You may need to log in.")
else:
print(f"Received status code {response.status_code}. Something")
#driver.save_screenshot("server_screenshot_security_Dashboard.png")
driver.get(url + 'CreditReport.aspx')
#print('CreditReport success')
#driver.save_screenshot("server_screenshot_CreditReport.png")
try:
element_present = ec.presence_of_element_located((By.ID, 'reportTop'))
WebDriverWait(driver, timeout).until(element_present)
#driver.save_screenshot("server_screenshot_final.png")
#print('element_present success')
except:
pass
#print('element not present')
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
#driver.save_screenshot("server_screenshot_final.png")
xpath_value = ''
try:
driver.find_element_by_xpath("//b[contains(., '***SECURITY FREEZE')]")
xpath_value = '//*[@id="ctrlCreditReport"]/transunion-report/div[2]/div[10]/div[2]/address-history/div/ng-repeat[1]'
except NoSuchElementException:
xpath_value = '//*[@id="ctrlCreditReport"]/transunion-report/div[2]/div[9]/div[2]/address-history/div/ng-repeat[1]'
try:
element_present = ec.presence_of_element_located(( By.XPATH,xpath_value))
WebDriverWait(driver, timeout).until(element_present)
except TimeoutException:
pass
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(5)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
element = driver.find_element(By.ID, "ctrlCreditReport")
soup = BeautifulSoup(str(element.get_attribute('outerHTML')), 'lxml')
driver.quit()
soup.html.insert(0, soup.new_tag('head'))
target = soup.find('head')
css_list = '''
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet" />
<link href="https://member.identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css"
rel="stylesheet" />
<link href="https://member.identityiq.com/css/CRDownload.css" rel="stylesheet" />
<script src="https://member.identityiq.com/Scripts/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="https://member.identityiq.com/Scripts/angular.js" type="text/javascript" ></script>
<script src="https://member.identityiq.com/Scripts/CRDownload.js" type="text/javascript" ></script>
'''
target.insert(0, BeautifulSoup(css_list, 'lxml').find('head'))
for div in soup.findAll('div', {'class': "link_header"}):
div.decompose()
for span in soup.findAll('span', {'class': "return_topSpan"}):
span.decompose()
for img in soup.findAll('img'):
img['src'] = 'https://www.member.identityiq.com' + str(img['src'])
response = { "ip":proxy_address, "page_code":200, "page":"CreditReport.aspx", "status_code":200, "data": soup.prettify()}
return jsonify(response)
driver.quit()
response = {"page":'security-question.aspx', "ip":proxy_address, "page_code":403, "status_code":405, "data": "ERROR"}
return jsonify(response)
except TimeoutException:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
result = check_access_denied(url+ 'CreditReport.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on CreditReport.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
driver.quit()
#return traceback.format_exc()
response = {"page":'CreditReport.aspx', "ip":proxy_address, "page_code":result, "status_code":408, "data": "TIME_OUT"}
return jsonify(response)
except Exception :
logger.error("email: "+email+ " "+traceback.format_exc())
traceback.print_exc()
result = check_access_denied(url+ 'login.aspx')
subject = f"RTG-IQ-IP {proxy_address} is Blocked on login.aspx page error_code:{result}"
if(result == 403):
remove_and_insert_text(proxy_address)
send_email(subject, get_current_datetime() + " "+ email +" "+traceback.format_exc())
driver.quit()
#return traceback.format_exc()
response = {"page":'login.aspx', "ip":proxy_address, "page_code":result, "status_code":404, "data": "ERROR"}
return jsonify(response)

View File

@@ -0,0 +1,107 @@
import traceback
import random
import time
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from Basic.helper import read_proxies
from Basic.log_manager import get_logging
def user_validation(email, password, ssn):
logger = get_logging()
all_proxies = read_proxies()
proxy_address = random.choice(all_proxies)
print("proxy_address:---", proxy_address)
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/bin/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument(f'--proxy-server={proxy_address}')
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.implicitly_wait(10)
try:
driver.find_element_by_id("close-pc-btn-handler").click()
except:
pass
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 10
time.sleep(5)
try:
driver.find_element(By.CLASS_NAME, "chakra-modal__header")
driver.quit()
return "ACCOUNT_LOCKED"
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
return "INVALID_LOGIN"
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
WebDriverWait(driver, timeout).until( ec.url_to_be(url + 'Dashboard.aspx'))
if driver.current_url == url + 'Dashboard.aspx':
driver.quit()
return "DONE"
driver.quit()
logger.error("email: "+email+ " "+traceback.format_exc())
return "ERROR"
except TimeoutException:
logger.error("email: "+email+ " "+traceback.format_exc())
driver.quit()
return "TIME_OUT"
except Exception:
logger.error("email: "+email+ " "+traceback.format_exc())
return "ERROR"

View File

@@ -0,0 +1,114 @@
import traceback
import time
from flask import jsonify
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
def click_refresh_btn(email, password, ssn):
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 120
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
return "ACCOUNT_LOCKED"
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
return "INVALID_LOGIN"
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
# element_present = ec.presence_of_element_located((By.CLASS_NAME, 'chakra-skeleton'))
# WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
if driver.current_url == url + 'Dashboard.aspx':
driver.get(url + 'Dashboard.aspx')
element_present = ec.presence_of_element_located((By.CLASS_NAME, 'chakra-skeleton'))
WebDriverWait(driver, timeout).until(element_present)
try:
element_click = driver.find_element(By.CLASS_NAME, 'chakra-modal__close-btn')
element_click.click()
except NoSuchElementException:
pass
try:
element_btn = wait.until(ec.element_to_be_clickable((By.XPATH, "//button[contains(., 'Refresh Report')]")))
driver.execute_script("arguments[0].click();", element_btn)
driver.quit()
return "DONE"
except NoSuchElementException:
driver.quit()
return "BUTTON_NOT_FOUND"
driver.quit()
return traceback.format_exc()
return "ERROR"
except TimeoutException:
driver.quit()
return "TIME_OUT"
except Exception:
return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,134 @@
import traceback
import time
from bs4 import BeautifulSoup
from flask import jsonify
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
def get_refresh_date(email, password, ssn):
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 120
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
return "ACCOUNT_LOCKED"
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
return "INVALID_LOGIN"
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
# element_present = ec.presence_of_element_located((By.TAG_NAME, 'dashboard-layout'))
# WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
if driver.current_url == url + 'Dashboard.aspx':
#driver.get(url + 'Dashboard.aspx')
element_present = ec.presence_of_element_located((By.ID,'chakra-toast-manager-top'))
WebDriverWait(driver, timeout).until(element_present)
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
driver.implicitly_wait(10)
time.sleep(5)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
try:
element_click = driver.find_element(By.CLASS_NAME,'chakra-modal__close-btn')
element_click.click()
except NoSuchElementException:
pass
try:
element = driver.find_element(By.CLASS_NAME,'chakra-skeleton')
response = {
'refresh_date': element.text,
'button_type': 1
}
if 'Refresh Report' in element.text:
response['button_type'] = 2
except NoSuchElementException:
response = {
'refresh_date': 'Not Found',
'button_type': 1
}
driver.quit()
return jsonify(response)
driver.quit()
return traceback.format_exc()
return "ERROR"
except TimeoutException:
driver.quit()
return "TIME_OUT"
except Exception:
return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,157 @@
import time
import traceback
from flask import jsonify
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException,NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
def recent_report(email, password, ssn):
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
# chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.find_element_by_id('txtUsername').send_keys(email)
driver.find_element_by_id('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 120
time.sleep(5)
try:
ele_acc_lock = driver.find_element(By.CLASS_NAME, "chakra-modal__header")
error_text = ele_acc_lock.text
driver.quit()
return "ACCOUNT_LOCKED"
except:
element_login = driver.find_element(By.CLASS_NAME, "chakra-text")
if element_login.text == 'Invalid login attempt':
driver.quit()
return "INVALID_LOGIN"
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'security-question') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'security-question') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'security-question':
element_present = ec.presence_of_element_located(
(By.NAME, 'userSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('userSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
#element_present = ec.presence_of_element_located((By.ID, 'hdnMemberID'))
#WebDriverWait(driver, timeout).until(element_present)
driver.get(url + 'Dashboard.aspx')
if driver.current_url == url + 'Dashboard.aspx':
driver.get(url + 'CreditReport.aspx')
element_present = ec.presence_of_element_located((By.ID, 'reportTop'))
WebDriverWait(driver, timeout).until(element_present)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
xpath_value = ''
try:
driver.find_element_by_xpath("//b[contains(., '***SECURITY FREEZE')]")
xpath_value = '//*[@id="ctrlCreditReport"]/transunion-report/div[2]/div[10]/div[2]/address-history/div/ng-repeat[1]'
except NoSuchElementException:
xpath_value = '//*[@id="ctrlCreditReport"]/transunion-report/div[2]/div[9]/div[2]/address-history/div/ng-repeat[1]'
try:
element_present = ec.presence_of_element_located(( By.XPATH,xpath_value))
WebDriverWait(driver, timeout).until(element_present)
except TimeoutException:
pass
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(5)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
element = driver.find_element(By.ID, "ctrlCreditReport")
soup = BeautifulSoup(str(element.get_attribute('outerHTML')), 'lxml')
driver.quit()
soup.html.insert(0, soup.new_tag('head'))
target = soup.find('head')
css_list = '''
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet" />
<link href="https://member.identityiq.com/CreditReportContent/DEFAULT/style.DEFAULT.css"
rel="stylesheet" />
<link href="https://member.identityiq.com/css/CRDownload.css" rel="stylesheet" />
<script src="https://member.identityiq.com/Scripts/jquery-3.6.0.min.js" type="text/javascript"></script>
<script src="https://member.identityiq.com/Scripts/angular.js" type="text/javascript" ></script>
<script src="https://member.identityiq.com/Scripts/CRDownload.js" type="text/javascript" ></script>
'''
target.insert(0, BeautifulSoup(css_list, 'lxml').find('head'))
for div in soup.findAll('div', {'class': "link_header"}):
div.decompose()
for span in soup.findAll('span', {'class': "return_topSpan"}):
span.decompose()
for img in soup.findAll('img'):
img['src'] = 'https://www.member.identityiq.com' + str(img['src'])
return soup.prettify()
driver.quit()
# return traceback.format_exc()
return "ERROR"
except TimeoutException:
traceback.print_exc()
driver.quit()
return traceback.format_exc()
return "TIME_OUT"
except Exception :
traceback.print_exc()
return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,76 @@
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
def user_validation(email, password, ssn):
try:
url = "https://member.identityiq.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
#driver = webdriver.Chrome(chrome_path,options=option)
driver = webdriver.Chrome(chrome_local_path,options=option)
#phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
#driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login.aspx')
driver.find_element_by_name('txtUsername').send_keys(email)
driver.find_element_by_name('txtPassword').send_keys(password)
driver.find_element_by_id("imgBtnLogin").click()
timeout = 10
try:
wait = WebDriverWait(driver, timeout)
WebDriverWait(driver, timeout).until(
ec.url_to_be(url + 'SecurityQuestions.aspx') or ec.url_to_be(url + 'Dashboard.aspx')
)
wait.until(
lambda driver: driver.current_url != (url + 'SecurityQuestions.aspx') or (url + 'Dashboard.aspx')
)
if driver.current_url == url + 'SecurityQuestions.aspx':
element_present = ec.presence_of_element_located(
(By.NAME, 'FBfbforcechangesecurityanswer$txtSecurityAnswer')
)
WebDriverWait(driver, timeout).until(element_present)
driver.find_element_by_name('FBfbforcechangesecurityanswer$txtSecurityAnswer').send_keys(ssn)
driver.find_element_by_id("FBfbforcechangesecurityanswer_ibtSubmit").click()
element_present = ec.presence_of_element_located((By.ID, 'hdnMemberID'))
WebDriverWait(driver, timeout).until(element_present)
if driver.current_url == url + 'Dashboard.aspx':
element_present = ec.presence_of_element_located((By.ID, 'Fbscore_divDt'))
WebDriverWait(driver, timeout).until(element_present)
try:
driver.find_element(By.ID, "Fbscore_ibtnRefresh").click()
except NoSuchElementException:
return "BUTTON_NOT_FOUND"
driver.quit()
return "DONE"
driver.quit()
return "ERROR"
except TimeoutException:
driver.quit()
return "TIME_OUT"
except Exception:
return "ERROR"

View File

@@ -0,0 +1,96 @@
import traceback
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support.wait import WebDriverWait
from Basic.log_manager import get_logging
def smart_credit_click_refresh_btn(email, password):
logger = get_logging()
try:
url = "https://www.smartcredit.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
#driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
#phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login/')
driver.find_element_by_name('j_username').send_keys(email)
driver.find_element_by_name('j_password').send_keys(password)
driver.find_element_by_xpath('//*[@id="login-form"]/div[1]/div/button').click()
timeout = 10
time.sleep(5)
try:
alert_div = driver.find_element_by_class_name("alert-danger")
paragraph_element = alert_div.find_element_by_tag_name("p")
error_text = paragraph_element.text
driver.quit()
return "INVALID_LOGIN"
except:
pass
try:
WebDriverWait(driver, timeout).until(ec.url_to_be(url + 'member/home/'))
if driver.current_url == url + 'member/home/':
driver.get(url + 'member/credit-report/3b/')
try:
element_present = ec.presence_of_element_located(
(By.CSS_SELECTOR, '.alert.alert-warning.fade.in.text-center.mb-2')
)
WebDriverWait(driver, timeout).until(element_present)
except TimeoutException:
driver.quit()
return "ERROR"
driver.get(url + 'member/credit-report/3b/confirm.htm')
driver.maximize_window()
try:
checkbox = WebDriverWait(driver, 10).until(
ec.element_to_be_clickable((By.NAME, "isConfirmedTerms"))
)
if not checkbox.is_selected():
driver.execute_script("arguments[0].click();", checkbox)
driver.find_element(By.XPATH, '//*[@id="confirm-3b-form"]/div[4]/div/div/button').click()
except NoSuchElementException:
return "BUTTON_NOT_FOUND"
driver.quit()
return "DONE"
driver.quit()
return "ERROR"
except TimeoutException:
logger.error("email: "+email+ " "+traceback.format_exc())
driver.quit()
return "TIME_OUT"
except Exception:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
#return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,143 @@
import sys, traceback
import time
from flask import jsonify
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.wait import WebDriverWait
from Basic.log_manager import get_logging
def credit_report_3b(email, password):
logger = get_logging()
try:
url = "https://www.smartcredit.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
print(chrome_local_path)
option = webdriver.ChromeOptions()
#option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
#driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login/')
password = str(password)
driver.find_element_by_name('j_username').send_keys(email)
driver.find_element_by_name('j_password').send_keys(password)
driver.find_element_by_xpath('//*[@id="login-form"]/div[1]/div/button').click()
timeout = 10
time.sleep(5)
try:
alert_div = driver.find_element_by_class_name("alert-danger")
paragraph_element = alert_div.find_element_by_tag_name("p")
error_text = paragraph_element.text
driver.quit()
return "INVALID_LOGIN"
except:
pass
try:
WebDriverWait(driver, timeout).until(ec.url_to_be(url + 'member/home/'))
if driver.current_url == url + 'member/home/':
try:
driver.get(url + 'member/credit-report/3b/simple.htm?format=HTML')
element = driver.find_element(By.ID, "reportTop")
except Exception as e:
driver.get(url + 'member/credit-report/3b/')
try:
element_present = ec.presence_of_element_located((By.XPATH, '//*[@id="TokenDisplay"]/table[1]'))
WebDriverWait(driver, timeout).until(element_present)
except TimeoutException:
pass
element = driver.find_element(By.ID, "reportTop")
soup = BeautifulSoup(str(element.get_attribute('outerHTML')), 'lxml')
driver.quit()
soup.html.insert(0, soup.new_tag('head'))
target = soup.find('head')
css_list = '''
<link rel="stylesheet" type="text/css" href="https://www.smartcredit.com/resources/css/sc/pages/member/credit-report/3b/base.css"
charset="utf-8">
<style>
td#personalInfo {
width: 100%;
}
#reportTop table{
width: 100%;
}
</style>
'''
target.insert(0, BeautifulSoup(css_list, 'lxml').find('head'))
alert_box = soup.find('div', {'class': "alert alert-warning fade in text-center"})
if alert_box:
alert_box.decompose()
alert_box1 = soup.find('div', {'class': "alert alert-warning fade in text-center mb-2"})
if alert_box1:
alert_box1.decompose()
try:
soup.find('td', {'class': "backtoTopText"}).string = ""
except Exception:
pass
heading_sublink = soup.find('span', {'class': "heading-sublink"})
if heading_sublink:
heading_sublink.decompose()
report_history_loading = soup.find('div', {'id': "report-history-loading"})
if report_history_loading:
report_history_loading.decompose()
for td_right in soup.findAll('td', {'align': "right"}):
td_right.decompose()
for img in soup.findAll('img'):
img['src'] = 'https://www.smartcredit.com' + str(img['src'])
return soup.prettify()
driver.quit()
return "ERROR"
except TimeoutException:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
driver.quit()
# return traceback.format_exc()
return "TIME_OUT"
except Exception as e:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
# return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,96 @@
import sys, traceback
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.wait import WebDriverWait
from Basic.log_manager import get_logging
def credit_report_3b_new(email, password):
logger = get_logging()
try:
url = "https://www.smartcredit.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
#driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
#phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login/')
password = str(password)
driver.find_element_by_name('j_username').send_keys(email)
driver.find_element_by_name('j_password').send_keys(password)
driver.find_element_by_xpath('//*[@id="login-form"]/div[1]/div/button').click()
timeout = 10
time.sleep(5)
try:
alert_div = driver.find_element_by_class_name("alert-danger")
paragraph_element = alert_div.find_element_by_tag_name("p")
error_text = paragraph_element.text
driver.quit()
return "INVALID_LOGIN"
except:
pass
try:
WebDriverWait(driver, timeout).until(ec.url_to_be(url + 'member/home/'))
if driver.current_url == url + 'member/home/':
driver.get(url + 'member/credit-report/3b/simple.htm?format=JSON')
element = driver.find_element(By.ID, "reportTop")
try:
element_present = ec.presence_of_element_located((By.XPATH, '//*[@id="TokenDisplay"]/table[1]'))
WebDriverWait(driver, timeout).until(element_present)
except TimeoutException:
pass
soup = BeautifulSoup(str(element.get_attribute('outerHTML')), 'lxml')
data = driver.find_element(By.ID, "TokenDisplay").text
driver.quit()
return data
driver.quit()
return "ERROR"
except TimeoutException:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
driver.quit()
return "TIME_OUT"
except Exception as e:
traceback.print_exc()
logger.error("email: "+email+ " "+traceback.format_exc())
#return traceback.format_exc()
return "ERROR"

View File

@@ -0,0 +1,110 @@
import traceback
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from selenium.webdriver.support.wait import WebDriverWait
from Basic.log_manager import get_logging
def smart_credit_refresh_status(email, password):
logger = get_logging()
try:
url = "https://www.smartcredit.com/"
chrome_path = "/usr/lib/chromium-browser/chromedriver"
#chrome_local_path = "D:\\scrapper\\chromedriver_win32\\chromedriver.exe"
chrome_local_path = "D:\\scrapper\\chromedriver_win64\\chromedriver.exe"
option = webdriver.ChromeOptions()
option.add_argument('--headless')
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-sh-usage')
#driver = webdriver.Chrome(chrome_path,options=option)
#driver = webdriver.Chrome(chrome_local_path,options=option)
phantomjs_server_path = "/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs"
phantomjs_local_path = "D:\\scrapper\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe"
driver = webdriver.PhantomJS(executable_path= phantomjs_server_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
#driver = webdriver.PhantomJS(executable_path= phantomjs_local_path,service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
driver.get(url + 'login/')
driver.find_element_by_name('j_username').send_keys(email)
driver.find_element_by_name('j_password').send_keys(password)
driver.find_element_by_xpath('//*[@id="login-form"]/div[1]/div/button').click()
timeout = 10
time.sleep(5)
try:
alert_div = driver.find_element_by_class_name("alert-danger")
paragraph_element = alert_div.find_element_by_tag_name("p")
driver.quit()
return "INVALID_LOGIN"
except:
pass
try:
WebDriverWait(driver, timeout).until(ec.url_to_be(url + 'member/home/'))
if driver.current_url == url + 'member/home/':
driver.get(url + 'member/credit-report/3b/')
btn_text = None
try:
element_present = ec.presence_of_element_located(
(By.CSS_SELECTOR, '.alert.alert-warning.fade.in.text-center.mb-2')
)
WebDriverWait(driver, timeout).until(element_present)
btn_text = driver.find_element(
By.CSS_SELECTOR, '.alert.alert-warning.fade.in.text-center.mb-2'
).text
except TimeoutException:
pass
driver.get(url + 'member/credit-report/3b/confirm.htm')
driver.maximize_window()
response = {
'button_type': 0,
'refresh_date': btn_text
}
try:
driver.find_element(By.ID, "toggle-marketing")
btn_text = driver.find_element(By.ID, "toggle-marketing").text
if btn_text and str(btn_text).lower().strip() == 'order your 3-bureau report & scores':
response['button_type'] = 1
response['refresh_date'] = btn_text
except NoSuchElementException:
pass
try:
driver.find_element(By.NAME, "isConfirmedTerms")
btn_text = driver.find_element(By.XPATH, '//*[@id="confirm-3b-form"]/div[4]/div/div/button').text
if btn_text and str(btn_text).lower().strip() == 'place order now':
response['button_type'] = 2
response['refresh_date'] = btn_text
except NoSuchElementException:
pass
driver.quit()
return response
driver.quit()
return "ERROR"
except TimeoutException:
logger.error("email: "+email+ " "+traceback.format_exc())
driver.quit()
return "TIME_OUT"
except Exception:
logger.error("email: "+email+ " "+traceback.format_exc())
traceback.print_exc()
#return traceback.format_exc()
return "ERROR"

5
scrapper/wsgi.py Normal file
View File

@@ -0,0 +1,5 @@
from app import app
if __name__ == "__main__":
app.run()

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# copies the project directory from 100 server to 98 and 114
function deploy() {
#chown root:root /var/www/html/ -R;
#find /var/www/html/ -type d -exec chmod 777 {} \;
rsync -avzhe ssh --owner --group --progress --recursive --files-from="include.txt" --exclude-from="exclude.txt" "/var/www/html/" "root@45.55.43.211:/var/www/html/"
pssh -A -i -H "45.55.43.211" -l root 'chown -R www-data:www-data /var/www/html && chmod -R 1777 /var/www/html/webroot && chmod -R 1777 /var/www/html/webroot/*'
}

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# copies the project directory from 100 server to 98 and 114
function deploy() {
chown apache:apache /opt/app.sipay.com.tr/ -R;
find /opt/app.sipay.com.tr/ -type d -exec chmod 755 {} \;
# find /opt/app.sipay.com.tr/ -type f -exec chmod 644 {} \;
chmod 777 /opt/app.sipay.com.tr/storage /opt/app.sipay.com.tr/vendor /opt/app.sipay.com.tr/sipayresource -R;
while IFS= read -r dest; do
### mysql -uappadmin -pAdmin#902117 -h176.53.34.98 sipay_new < /opt/app.sipay.com.tr/sipay.sql
rsync -avzhe ssh --owner --group --progress --exclude-from="exclude.txt" "/opt/app.sipay.com.tr/" "$dest:/opt/app.sipay.com.tr"
rsync -avzhe ssh --owner --group --progress "/opt/app.sipay.com.tr/sipayresource/assets" "$dest:/opt/app.sipay.com.tr/sipayresource/assets"
# echo "testing24"
#
done <destfile.txt
#
## echo "" > /opt/app.sipay.com.tr/sipay_sql.sql;
#pssh --hosts hosts.txt --user root -i -A 'cd /opt/app.sipay.com.tr && php artisan view:clear && php artisan config:cache && php artisan cache:clear && php artisan route:clear && cd admin && php artisan view:clear && php artisan config:cache && php artisan cache:clear && php artisan route:clear'
#
/bin/pssh -A -i -H "176.53.34.104" -l bruce 'chown -R apache:apache /opt/app.sipay.com.tr/ && chmod -R 1777 /opt/app.sipay.com.tr/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/public/files && chmod -R 1777 /opt/app.sipay.com.tr/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files/* && cd /opt/app.sipay.com.tr/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/admin/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan cache:clear'
/bin/pssh -A -i -H "176.53.6.134" -l bruce 'chown -R apache:apache /opt/app.sipay.com.tr/ && chmod -R 1777 /opt/app.sipay.com.tr/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/public/files && chmod -R 1777 /opt/app.sipay.com.tr/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files && chmod -R 1777 /opt/app.sipay.com.tr/admin/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files && chmod -R 1777 /opt/app.sipay.com.tr/merchant/public/files/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/bootstrap/cache/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/storage/ && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files && chmod -R 1777 /opt/app.sipay.com.tr/ccpayment/public/files/* && cd /opt/app.sipay.com.tr/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/admin/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/admin/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/merchant/ && php72 artisan cache:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan config:cache && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan view:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan route:clear && cd /opt/app.sipay.com.tr/ccpayment/ && php72 artisan cache:clear'
chown apache:apache /opt/app.sipay.com.tr/ -R;
chmod 777 /opt/app.sipay.com.tr/ -R;
}

View File

@@ -0,0 +1,2 @@
bruce@176.53.34.104
bruce@176.53.6.134

View File

@@ -0,0 +1,72 @@
/.idea
/vendor
/epicvelocity
/db
/api_resource
/auto_script
/logs
/tmp
/epicvelocity1
/src_OLD
/src.zip
/migrate.zip
/TestDeploymeent
/config/app.settings.php
/webroot/rtg_letters
/webroot/member_email_attachment
/webroot/member_email_template_attachment
/webroot/credit_analysis_template
/webroot/credit_analysis_pdf
/webroot/Staff/pdf
/webroot/Staff/rtg_letters_error.txt
/webroot/V2.0/rtg_letters_error.txt
/webroot/V2.0/rtg_client_ids_error.txt
/webroot/Staff/rtg_client_ids_error.txt
/webroot/Staff/sertg_export_error.txt
/webroot/Staff/rtg_sertg_export_error.txt
/webroot/V2.0/rtg_sertg_export_error.txt
/webroot/V1.0/rtg_sertg_export_error.txt
/webroot/V3.0/rtg_sertg_export_error.txt
/webroot/rtg_sertg_export_error.txt
/webroot/Staff/sertg_log.txt
/webroot/forum/inc/config.php
/webroot/Staff/sertg
/webroot/Staff/vendor
/webroot/AdminAccountImage
/webroot/AdminAccountImage
/webroot/agreement_signed_content
/webroot/agreenment_contents
/webroot/attach-documents
/webroot/chat_attachment
/webroot/client_agreement_files
/webroot/cmsuser_logo
/webroot/compiles
/webroot/contact_photo
/webroot/epicvelocity/clients_docs
/webroot/epicvelocity/letters
/webroot/epicvelocity/lib
/webroot/epicvelocity/pdf
/webroot/epicvelocity/vendor
/webroot/epicvelocity/images
/webroot/file_path
/webroot/html_content
/webroot/html_history_code
/webroot/invoice-logo
/webroot/media
/webroot/member_education_templates
/webroot/member_help_templates
/webroot/mpdf60
/webroot/payment_vendor
/webroot/project-media-files
/webroot/rtg_optimize
/webroot/supportsfile
/webroot/user-photo
/webroot/velocity
/webroot/dropbox
/webroot/backend
/webroot/backup_resources
/webroot/member_email_template_body
/webroot/client_popup_content
/webroot/email_queue
/webroot/certificates/pdf
/webroot/pdfletters

View File

@@ -0,0 +1,2 @@
104.sipay.com.tr
134.sipay.com.tr

View File

@@ -0,0 +1,36 @@
/config/app.default.php
/config/app.constant.php
/config/app.php
/config/bootstrap.php
/config/bootstrap_cli.php
/config/paths.php
/config/routes.php
/src/
/webroot/Staff/
/webroot/Staff/dbconfig.php
/webroot/common_script_file.js
/webroot/common_image_file.php
/webroot/rtg_ls_fax_common.php
/webroot/common_file.php
/webroot/V2.0/
/webroot/Staff/
/webroot/Staff/getSertgInfo.php
/webroot/js
/webroot/css
/webroot/images
/webroot/admin_lte
/webroot/rtgv3
/webroot/new_layout
/webroot/epicvelocity/css
/webroot/epicvelocity/js
/webroot/functions.php
/config/dynamic_domain.php
/webroot/RTG
/webroot/V3.0
/webroot/df.json
/webroot/Redis/Cache.php
/webroot/dropbox/success.php
/webroot/certificates/img/
/webroot/certificates/fonts/
/webroot/GlobalLogic.php

View File

@@ -0,0 +1,14 @@
1. copy sendtoproduction folder to user home directory
cd sendtoproduction
2. edit the hosts.txt, destfile.txt, exclude.txt as you need:
hosts.txt file holds the host servers IPs,
destfile.txt file holds user name with host IPs,
exclude.txt file is the the files to ignore from deploying.
3. type in terminal and it will enable the command:
source .custom_commands.sh
4. type in terminal and it will run the code and deploy to servers when you provide passwords:
deploy

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Auth;
use Cake\Auth\AbstractPasswordHasher;
/**
* Created by PhpStorm.
* User: jse
* Date: 28/09/2015
* Time: 15:33
*/
class CmsPasswordHasher extends AbstractPasswordHasher
{
/**
* Generates password hash.
*
* @param string|array $password Plain text password to hash or array of data
* required to generate password hash.
* @return string Password hash
*/
public function hash($password)
{
return md5($password);
}
/**
* Check hash. Generate hash from user provided password string or data array
* and check against existing hash.
*
* @param string|array $password Plain text password to hash or data array.
* @param string $hashedPassword Existing hashed password.
* @return bool True if hashes match else false.
*/
public function check($password, $hashedPassword)
{
return md5($password) === $hashedPassword;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Common;
class CorePermission{
protected static function isPermittedFromSessionByControllerId($controller_id){
$result = false;
$access_controllers = $_SESSION['access_controller'];
if (!empty($access_controllers)) {
foreach ($access_controllers as $controller) {
if ($controller['id'] == $controller_id) {
$result = true;
break;
}
}
}
return $result;
}
}

465
src/Common/PDFLetters.php Normal file
View File

@@ -0,0 +1,465 @@
<?php
namespace App\Common;
use App\Helper\commonLogic;
use App\Utility\Common;
use App\Utility\createDirZip;
use Aws\CloudFront\Exception\Exception;
use ZipArchive;
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
class PDFLetters
{
const ROOT_FORDER = 'pdfletters';
const ZIP_FORDER = 'zip';
private function dbopen() {
$dbhost = APP_DB_HOST;
$dbuser = APP_DB_USERNAME;
$dbpass = APP_DB_PASSWORD;
$dbname = APP_DB_DATABASE_NAME;
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$conn->set_charset("utf8");
// Check connection
if (mysqli_connect_errno()) {
//echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
return $conn;
}
public static function storePdfLetter($inputData){
$connection = self::dbopen();
$connection->begin_transaction();
$result = [];
try {
$current_date_time = self::getSystemCurrentTimeStamp();
$client_id = $inputData['client_id'];
$velocity_id = $inputData['velocity_id'];
$velocity_type = $inputData['velocity_type'];
$file_path = $inputData['file_path'];
$global_create_new_sertg_id = $inputData['global_create_new_sertg_id'];
list($member_id, $user_id, $user_type) = self::getAuthUserIdAndType();
$root_folder = __DIR__.'/../../webroot/'.self::ROOT_FORDER;
$velocity_type_array = EPIC_AND_SERTG_DROPDOWN;
$deleteCondition['velocity_id'] = $velocity_id;
$deleteCondition['velocity_type'] = $velocity_type;
self::deletepdf($deleteCondition);
$previous_file = $root_folder . "/" . $velocity_type_array[$velocity_type] . "/" . $member_id . "/" . $client_id . "/" . $velocity_id;
self::deleteDir($previous_file);
$insertDataArray = [];
$insertData['client_id'] = $client_id;
$insertData['velocity_id'] = $velocity_id;
$insertData['velocity_type'] = $velocity_type;
$insertData['file_path'] = basename($file_path);
$insertData['member_id'] = $member_id;
$insertData['created_by'] = $user_id;
$insertData['user_type'] = $user_type;
$insertData['personal_info'] = $inputData['personal_info'];
$insertData['dob'] = $inputData['dob'];
$insertData['ssn'] = $inputData['ssn'];
$insertData['letter_types'] = $inputData['letter_types'];
$insertData['next_action_date'] = $inputData['next_action_date'] ?? null;
$final_day = LETTER_DELETION_DAYS;
$insertData['file_remove_date'] = date('Y-m-d', strtotime($current_date_time. ' + '.$final_day.' days'));
$insertDataArray[] = $insertData;
if(!empty($global_create_new_sertg_id) && $global_create_new_sertg_id > 0 && $global_create_new_sertg_id != $velocity_id){
$insertData['velocity_id'] = $global_create_new_sertg_id;
$insertDataArray[] = $insertData;
}
if (!empty(self::insertPdf($insertDataArray))) {
$result = $insertDataArray;
if (!is_dir($previous_file)) {
mkdir($previous_file, 0777, true);
}
copy($file_path,$previous_file . "/" . basename($file_path));
if(is_file($previous_file . "/" . basename($file_path))){
$connection->commit();
@unlink($file_path);
$response['message'] = "Letter has been saved for ".LETTER_DELETION_DAYS." days";
$response['url'] = APP_SERVER_HOST_URL_DEFAULT."pdf-letters";
$response['url'] = '<br/><br/><a style="text-decoration:underline; color:green" target="_blank" href="'.$response['url'].'">Click here to see letters</a>';
echo json_encode($response);
exit;
}else{
throw new \Exception('File not uploaded');
}
}
}catch (\Exception $ex){
$result['errors'] = $ex->getMessage();
$connection->rollback();
}
return false;
}
public static function rcopy($src, $dst){
$files = scandir($src);
foreach ($files as $file) {
if ($file != "." && $file != "..") {
rcopy("$src/$file", "$dst/$file");
}
}
}
public static function insertpdf($inputData){
$conn = self::dbopen();
$result = false;
if (!empty($inputData)) {
$current_date_time = self::getSystemCurrentTimeStamp();
$sql = "";
foreach ($inputData as $data) {
$data['created_at'] = $current_date_time;
$column_string = "";
$data_string = "";
foreach ($data as $column => $data){
if(!empty($column_string)){
$column_string .= ",".$column;
}else{
$column_string = $column;
}
if(!empty($data_string)){
$data_string .= ",'{$data}'";
}else{
$data_string = "'{$data}'";
}
}
$stmt = "(".$data_string.")";
if(!empty($sql)){
$sql .= ",".$stmt;
}else{
$sql = $stmt;
}
}
if(!empty($column_string)) {
$sql = "INSERT INTO `pdf_letters` ($column_string) VALUES ".$sql;
}
/*echo($sql);
echo("<pre>");
print_r($inputData);
exit;*/
if($conn->query($sql)){
$result = true;
}
}
return $result;
}
public static function updatepdf($id,$fields){
$conn = self::dbopen();
$result = false;
$data_string = "";
if (!empty($fields)) {
foreach ($fields as $column => $data) {
if (!empty($data_string)) {
$data_string .= "," . $column . " = '" . $data."'";
} else {
$data_string = $column . " = '" . $data."'";
}
}
}
if(!empty($data_string)){
$sql = "UPDATE `pdf_letters` SET ".$data_string." WHERE id = ".$id;
$result = $conn->query($sql);
}
return $result;
}
public static function deletepdf($condition)
{
$connection = self::dbopen();
$result = false;
$condition_string = "";
if (!empty($condition)) {
foreach ($condition as $column => $data){
if(!empty($condition_string)){
$condition_string .= " AND ".$column." = ".$data;
}else{
$condition_string = $column." = ".$data;
}
}
$sql = 'DELETE FROM `pdf_letters` WHERE '.$condition_string;
if($connection->query($sql)){
$result = true;
}
}
return $result;
}
public function getSystemCurrentTimeStamp($formate = '', $time_zone = '')
{
if (!empty($time_zone)) {
date_default_timezone_set($time_zone);
} else {
$current_time_zone = $_SESSION['Auth']['User']['time_zone'];
if (!empty($current_time_zone)) {
date_default_timezone_set($current_time_zone);
} else {
date_default_timezone_set("UTC");
}
}
if ($formate == '') {
return date("Y-m-d H:i:s");
} else {
return date($formate);
}
}
private static function getAuthUserIdAndType(){
$user_type = 0;
$user_id = 0;
$member_id = $_SESSION['Auth']['User']['id'];
if ($_SESSION['userType'] == CMS_USER_INDICATOR) {
$user_id = $member_id;
$user_type = 1;
} else if ($_SESSION['userType'] == CRM_USER_INDICATOR) {
$user_id = $_SESSION['Auth']['User']['user_id'];
$user_type = 2;
}
return [$member_id,$user_id,$user_type];
}
public static function deleteDir($dirPath) {
$result = false;
try {
if (!is_dir($dirPath)) {
return ;
}
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
self::deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
$result =true;
} catch (\Exception $ex){
}
return $result;
}
public static function fileDownloadById($id){
$conn = self::dbopen();
$final_result = false;
$member_id = $_SESSION['Auth']['User']['id'];
$sql = "select * from pdf_letters where member_id = $member_id AND id = $id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$file_path = WWW_ROOT.self::ROOT_FORDER.'/'.EPIC_AND_SERTG_DROPDOWN[$row['velocity_type']]."/".$row['member_id']."/".$row['client_id']."/".$row['velocity_id'];
$file_path .= "/".$row['file_path'];
if(is_file($file_path)) {
$updateData['download_count'] = ++$row['download_count'];
$updateData['updated_at'] = self::getSystemCurrentTimeStamp();
self::updatepdf($row['id'],$updateData);
$zipname = WWW_ROOT . self::ROOT_FORDER . "/" . self::ZIP_FORDER . "/" . $row['member_id'] . "/";
if (!is_dir($zipname)) {
mkdir($zipname, 0777, true);
}
$zipname .= time() . '.zip';
$file_array[] = $file_path;
if(self::createzipByfiles($file_array,$zipname)){
self::downloadheader($zipname);
@unlink($zipname);
$final_result = true;
}
}
}
}
return $final_result;
}
public static function multiplefileDownloadById($ids){
$conn = self::dbopen();
$conn->begin_transaction();
$final_result = false;
$member_id = $_SESSION['Auth']['User']['id'];
if(!empty($ids)) {
$sql = "select * from pdf_letters where member_id = $member_id AND id IN (".implode(",",$ids).")";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$current_date_time = self::getSystemCurrentTimeStamp();
$file_array = [];
while ($row = $result->fetch_assoc()) {
$file_path = self::ROOT_FORDER.'/' . EPIC_AND_SERTG_DROPDOWN[$row['velocity_type']] . "/" . $row['member_id'] . "/" . $row['client_id'] . "/" . $row['velocity_id'];
$file_path .= "/" . $row['file_path'];
if (is_file($file_path)) {
$updateData['download_count'] = ++$row['download_count'];
$updateData['updated_at'] = $current_date_time;
self::updatepdf($row['id'], $updateData);
$file_array[] = $file_path;
}
}
}
if(!empty($file_array)) {
$zipname = WWW_ROOT . self::ROOT_FORDER . "/" . self::ZIP_FORDER . "/" . $member_id . "/";
if (!is_dir($zipname)) {
mkdir($zipname, 0777, true);
}
$zipname .= time() . '.zip';
if(self::createzipByfiles($file_array,$zipname)){
$conn->commit();
self::downloadheader($zipname);
@unlink($zipname);
$final_result = true;
}else{
$conn->rollback();
}
}
}
return $final_result;
}
public function createzipByfiles($files,$file_name){
$zipname = $file_name;
$zip = new ZipArchive;
$zip->open($zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
foreach ($files as $file) {
$zip->addFile($file,basename($file));
}
return $zip->close();
}
public function downloadheader($file_path){
/*header('Content-Description: File Transfer');
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.basename($file_path).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file_path));
readfile($file_path);*/
ob_clean();
ob_end_flush(); // more important function - (without - error corrupted zip)
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . basename($file_path) . "\"");
header('Content-Length: ' . filesize($file_path));
readfile($file_path);
}
public static function preparePersonalInfo($personal_info_decode){
$address = "";
// street no
if(!empty($personal_info_decode['street_no'])){
$address = $personal_info_decode['street_no'];
}
// street name
if(!empty($personal_info_decode['street_name'])){
if(!empty($address)){
$address .= ", ".$personal_info_decode['street_name'];
}else{
$address = $personal_info_decode['street_name'];
}
}
// city
if(!empty($personal_info_decode['city'])){
if(!empty($address)){
$address .= ", ".$personal_info_decode['city'];
}else{
$address = $personal_info_decode['city'];
}
}
// state
if(!empty($personal_info_decode['state'])){
if(!empty($address)){
$address .= ", ".$personal_info_decode['state'];
}else{
$address = $personal_info_decode['state'];
}
}
$name = "";
if(!empty($personal_info_decode['first_name'])){
$name = $personal_info_decode['first_name'];
}
if(!empty($personal_info_decode['last_name'])){
if(!empty($name)){
$name .= " ".$personal_info_decode['last_name'];
}else{
$name = $personal_info_decode['last_name'];
}
}
if(!empty($name)){
$personal_info = $name;
}
if(!empty($address)){
if(!empty($personal_info)){
$personal_info .= "<br/>".$address;
}else{
$name = $address;
}
}
if(!empty($personal_info_decode['name_address'])){
if(empty($personal_info)){
$personal_info = $personal_info_decode['name_address'];
}
}
return $personal_info;
}
public static function getRowsClass($from_date, $to_date){
$from_date = date('Y-m-d',strtotime($from_date));
$to_date = date('Y-m-d',strtotime($to_date));
$days = Common::daysBetweenDate($from_date,$to_date);
$css = "";
if ($days <= 0){
$css = "red";
}else if($days > 0 && $days <= 3){
$css = "yellow";
}else if($days > 3){
$css = "green";
}
/*echo $days;
echo "<br/>";
echo $from_date."====".$to_date;
echo "<br/>";*/
return $css;
}
}

83
src/Common/Permission.php Normal file
View File

@@ -0,0 +1,83 @@
<?php
namespace App\Common;
use App\Utility\Common;
class Permission extends CorePermission
{
public static function isPermitted($controller_id = 0)
{
$result = false;
$common = new Common();
$user_type_name = $common->getCurrentUserInfo();
if ($user_type_name == "MEMBER" || self::isEmployeeAsAdmin()) {
$result = true;
} else if ($user_type_name == "EMPLOYEE") {
$result = self::isEmployeePermitted($controller_id);
} else if ($user_type_name == "AFFILIATE") {
$result = self::isAffiliatePermitted($controller_id);
} else if ($user_type_name == "CLIENT") {
$client_allow_array = [CREDIT_REPORT_STATUS_CONTROLLER_ID];
$result = in_array($controller_id,$client_allow_array);
}
return $result;
}
public static function isEmployeeAsAdmin(){
$result = false;
$common = new Common();
$user_type_name = $common->getCurrentUserInfo();
if ($user_type_name == "EMPLOYEE" && $_SESSION['Auth']['User']['is_admin_access'] == 1) {
$result = true;
}
return $result;
}
/*
for employe permission check
*/
public static function isEmployeePermitted($controller_id)
{
$result = false;
$allowed_list = [
SECURE_PORTAL_CONTROLLER_ID,
CLIENT_DASHBOARD_PANEL_ID,
UPLOAD_MEDIA_PANEL_ID,
CLIENT_PORTAL_BUTTON_ID,
ADD_CLIENT_CONTROLLER_ID
];
if (self::isPermittedFromSessionByControllerId($controller_id) || in_array($controller_id,$allowed_list)) {
$result = true;
}
return $result;
}
/*
for Affiliate permission check
*/
public static function isAffiliatePermitted($controller_id)
{
$result = false;
if (self::isPermittedFromSessionByControllerId($controller_id)) {
$result = true;
}
return $result;
}
public static function setPermissionForEmployee($controller_id)
{
unset($_SESSION['hasEpicVelocity']);
if (self::isPermittedFromSessionByControllerId($controller_id) && $_SESSION['has_epic_for_employee']) {
$_SESSION['hasEpicVelocity'] = true;
}
}
}

192
src/Console/Installer.php Normal file
View File

@@ -0,0 +1,192 @@
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace App\Console;
use Composer\Script\Event;
use Exception;
/**
* Provides installation hooks for when this application is installed via
* composer. Customize this class to suit your needs.
*/
class Installer
{
/**
* Does some routine installation tasks so people don't have to.
*
* @param \Composer\Script\Event $event The composer event object.
* @throws \Exception Exception raised by validator.
* @return void
*/
public static function postInstall(Event $event)
{
$io = $event->getIO();
$rootDir = dirname(dirname(__DIR__));
static::createAppConfig($rootDir, $io);
static::createWritableDirectories($rootDir, $io);
// ask if the permissions should be changed
if ($io->isInteractive()) {
$validator = function ($arg) {
if (in_array($arg, ['Y', 'y', 'N', 'n'])) {
return $arg;
}
throw new Exception('This is not a valid answer. Please choose Y or n.');
};
$setFolderPermissions = $io->askAndValidate(
'<info>Set Folder Permissions ? (Default to Y)</info> [<comment>Y,n</comment>]? ',
$validator,
10,
'Y'
);
if (in_array($setFolderPermissions, ['Y', 'y'])) {
static::setFolderPermissions($rootDir, $io);
}
} else {
static::setFolderPermissions($rootDir, $io);
}
static::setSecuritySalt($rootDir, $io);
if (class_exists('\Cake\Codeception\Console\Installer')) {
\Cake\Codeception\Console\Installer::customizeCodeceptionBinary($event);
}
}
/**
* Create the config/app.php file if it does not exist.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function createAppConfig($dir, $io)
{
$appConfig = $dir . '/config/app.php';
$defaultConfig = $dir . '/config/app.default.php';
if (!file_exists($appConfig)) {
copy($defaultConfig, $appConfig);
$io->write('Created `config/app.php` file');
}
}
/**
* Create the `logs` and `tmp` directories.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function createWritableDirectories($dir, $io)
{
$paths = [
'logs',
'tmp',
'tmp/cache',
'tmp/cache/models',
'tmp/cache/persistent',
'tmp/cache/views',
'tmp/sessions',
'tmp/tests'
];
foreach ($paths as $path) {
$path = $dir . '/' . $path;
if (!file_exists($path)) {
mkdir($path);
$io->write('Created `' . $path . '` directory');
}
}
}
/**
* Set globally writable permissions on the "tmp" and "logs" directory.
*
* This is not the most secure default, but it gets people up and running quickly.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function setFolderPermissions($dir, $io)
{
// Change the permissions on a path and output the results.
$changePerms = function ($path, $perms, $io) {
// Get current permissions in decimal format so we can bitmask it.
$currentPerms = octdec(substr(sprintf('%o', fileperms($path)), -4));
if (($currentPerms & $perms) == $perms) {
return;
}
$res = chmod($path, $currentPerms | $perms);
if ($res) {
$io->write('Permissions set on ' . $path);
} else {
$io->write('Failed to set permissions on ' . $path);
}
};
$walker = function ($dir, $perms, $io) use (&$walker, $changePerms) {
$files = array_diff(scandir($dir), ['.', '..']);
foreach ($files as $file) {
$path = $dir . '/' . $file;
if (!is_dir($path)) {
continue;
}
$changePerms($path, $perms, $io);
$walker($path, $perms, $io);
}
};
$worldWritable = bindec('0000000111');
$walker($dir . '/tmp', $worldWritable, $io);
$changePerms($dir . '/tmp', $worldWritable, $io);
$changePerms($dir . '/logs', $worldWritable, $io);
}
/**
* Set the security.salt value in the application's config file.
*
* @param string $dir The application's root directory.
* @param \Composer\IO\IOInterface $io IO interface to write to console.
* @return void
*/
public static function setSecuritySalt($dir, $io)
{
$config = $dir . '/config/app.php';
$content = file_get_contents($config);
$newKey = hash('sha256', $dir . php_uname() . microtime(true));
$content = str_replace('__SALT__', $newKey, $content, $count);
if ($count == 0) {
$io->write('No Security.salt placeholder to replace.');
return;
}
$result = file_put_contents($config, $content);
if ($result) {
$io->write('Updated Security.salt value in config/app.php');
return;
}
$io->write('Unable to update Security.salt value.');
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,176 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
use App\Helper\commonLogic;
/**
* AffiliateDashboard Controller
*
*
* @method \App\Model\Entity\AffiliateDashboard[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class AffiliateDashboardController extends AppController
{
public function initialize() {
parent::initialize();
$this->setUserType();
if($this->setAffiliateControllerAccess() || ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1 && !Permission::isEmployeeAsAdmin())){
$this->Auth->allow(['index']);
}
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$this->loadModel('MemberNotes');
$this->loadModel('MemberReminders');
$affiliate_user_id = $this->Auth->user('user_id');
$member_id = $this->Auth->user('id');
$client_id = 0;
$limit = 5;
$user_type_for_note_and_reminder = 2;
$this->memberReminderNoteActions($affiliate_user_id,$client_id);
$this->loadModel('Notes');
$latest_notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$affiliate_user_id,$limit);
$member_notes = $this->MemberNotes->getMemberNotesByClientIdWithMemberId($affiliate_user_id,$client_id,$user_type_for_note_and_reminder);
$member_reminders = $this->MemberReminders->getRemindersByClientIdWithMemberId($affiliate_user_id,$client_id,$user_type_for_note_and_reminder);
$this->set(compact('latest_notes','member_notes','member_reminders'));
}
private function memberReminderNoteActions($member_id,$client_id){
$this->loadModel('MemberNotes');
$this->loadModel('MemberReminders');
if($this->request->is('ajax')){
$request = $this->request->getData();
$common = new commonLogic();
$common->memberReminderNoteAjaxActions($request);
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
$request = $_POST;
$member_note_title = $request['member_note_title'];
$member_note_desc = $request['member_note_desc'];
$member_reminder_title = $request['member_reminder_title'];
$member_reminder_desc = $request['member_reminder_desc'];
$member_remainder_date = $request['remainder_date'];
if(!empty($member_note_title) && !empty($member_note_desc)){
$noteData['title'] = $member_note_title;
$noteData['description'] = $member_note_desc;
$noteData['member_id'] = $member_id;
$noteData['client_id'] = $client_id;
$noteData['user_type'] = 2;
$response = $this->MemberNotes->addMemberNote($noteData);
if($response){
$this->Flash->success(__('A new note successfully added.'));
}else{
$this->Flash->error(__('Note has not been added.Please try again.'));
}
}else if(!empty($member_reminder_title) && !empty($member_reminder_desc) && !empty($member_remainder_date)){
$reminderData['title'] = $member_reminder_title;
$reminderData['description'] = $member_reminder_desc;
$reminderData['member_id'] = $member_id;
$reminderData['client_id'] = $client_id;
$reminderData['remainder_date'] = $member_remainder_date;
$reminderData['user_type'] = 2;
$response = $this->MemberReminders->addMemberReminder($reminderData);
if($response){
$this->Flash->success(__('A new reminder successfully added.'));
return $this->redirect($this->referer());
}else{
$this->Flash->error(__('Reminder has not been added.Please try again.'));
}
}
}
}
/**
* View method
*
* @param string|null $id Affiliate Dashboard id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$affiliateDashboard = $this->AffiliateDashboard->get($id, [
'contain' => []
]);
$this->set('affiliateDashboard', $affiliateDashboard);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$affiliateDashboard = $this->AffiliateDashboard->newEntity();
if ($this->request->is('post')) {
$affiliateDashboard = $this->AffiliateDashboard->patchEntity($affiliateDashboard, $this->request->getData());
if ($this->AffiliateDashboard->save($affiliateDashboard)) {
$this->Flash->success(__('The affiliate dashboard has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The affiliate dashboard could not be saved. Please, try again.'));
}
$this->set(compact('affiliateDashboard'));
}
/**
* Edit method
*
* @param string|null $id Affiliate Dashboard id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$affiliateDashboard = $this->AffiliateDashboard->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$affiliateDashboard = $this->AffiliateDashboard->patchEntity($affiliateDashboard, $this->request->getData());
if ($this->AffiliateDashboard->save($affiliateDashboard)) {
$this->Flash->success(__('The affiliate dashboard has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The affiliate dashboard could not be saved. Please, try again.'));
}
$this->set(compact('affiliateDashboard'));
}
/**
* Delete method
*
* @param string|null $id Affiliate Dashboard id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$affiliateDashboard = $this->AffiliateDashboard->get($id);
if ($this->AffiliateDashboard->delete($affiliateDashboard)) {
$this->Flash->success(__('The affiliate dashboard has been deleted.'));
} else {
$this->Flash->error(__('The affiliate dashboard could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,378 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Helper\commonLogic;
use App\Utility\Common;
/**
* Agreement Controller
*
*
* @method \App\Model\Entity\Agreement[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class AgreementController extends AppController
{
public function initialize() {
parent::initialize();
$this->checkRTGuser(); // is RTG User or not
$this->setUserType();
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('user_permission', $user_permissions);
if($this->employeeAccessMethod()){
$this->Auth->allow(['index','add','edit','delete']);
}
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$search = [];
$this->loadModel('AgreementFormats');
$member_id =$this->Auth->user('id');
$requestparams = $this->request->query();
$page_limit = 10;
if($this->request->is('post')){
$request = $this->request->getData();
if(isset($request['agreement_action_types'])){
$selected_agreement_format_ids = [];
if(!empty($request['selected_content'])){
$selected_agreement_format_ids = explode(',', $request['selected_content']);
}
if($request['agreement_action_types'] == 1){ // delete all
$result = $this->deleteSelectedAgreement($selected_agreement_format_ids);
if($result){
$this->Flash->success(__('The selected agreement(s) has been deleted.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if($request['agreement_action_types'] == 2){ // make active
$status = 1;
$result = $this->AgreementFormats->updateStatusByIdList($selected_agreement_format_ids,$status);
if($result){
$this->Flash->success(__('The selected agreement(s) has been made active.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if($request['agreement_action_types'] == 3){ // make inactive
$status = 2;
$result = $this->AgreementFormats->updateStatusByIdList($selected_agreement_format_ids,$status);
if($result){
$this->Flash->success(__('The selected agreement(s) has been made inactive.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}
}
}
$search['status'] = 1;
if(!empty($requestparams)){
$search = $requestparams;
}
if(isset($search['page_limit']) && !empty($search['page_limit'])){
$page_limit = $search['page_limit'];
}
$this->paginate = [
'limit' => $page_limit
];
$cols = ['id','title','status','created_at','updated_at'];
$agreements = $this->AgreementFormats->getAgreementByMemberId($member_id,$search);
if(!empty($agreements)){
$agreements = $this->paginate($agreements);
}
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$this->set(compact('agreements','search','page_limit'));
}
/**
* View method
*
* @param string|null $id Agreement id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$agreement = $this->Agreement->get($id, [
'contain' => []
]);
$this->set('agreement', $agreement);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$this->loadModel('Clients');
$this->loadModel('PredefinedAgreementFormats');
$step_name = 'is_agreement';
if($this->request->is('ajax')){
$request = $this->request->getData();
if($request['action'] == "GET_TEMPLATE"){
$template['id'] = $request['template_id'];
$agreementsTemplates = $this->PredefinedAgreementFormats->getAgreementTemplateById($template['id']);
//pr($agreementsTemplates);exit;
$response['title'] = $agreementsTemplates->title;
$response['content'] = $agreementsTemplates->content;
}
echo json_encode($response);
exit;
}
if($this->request->is('post')){
$this->loadModel('AgreementFormats');
$this->loadModel('AgreementAssignments');
$request = $this->request->getData();
$step_status = $request['step_status'];
if($step_status == 0){
$this->loadModel('CmsuserStatus');
$this->CmsuserStatus->upgradeCmsuserStatus($this->Auth->user('id'), $step_name);
}
$inputData['member_id'] = $this->Auth->user('id');
$inputData['title'] = $request['title'];
$common = new Common;
$file_path = "agreenment_contents/".$inputData['member_id'];
$inputData['content'] = $common->htmlFilewrite($request['content'], $file_path);
$inputData['status'] = $request['status'];
$result = $this->AgreementFormats->insertAgreementFormat($inputData);
if(!empty($result)){
if(!empty($request['client_ids'])){
$commonLogic = new commonLogic;
foreach($request['client_ids'] as $client_id){
$assignment['current_values'] = $commonLogic->saveAgreementInfo($inputData['member_id'],$client_id);
$assignment['agreement_format_id'] = $result->id;
$assignment['client_id'] = $client_id;
$assignment['member_id'] = $inputData['member_id'];
$this->AgreementAssignments->insertAgreementAssignment($assignment);
}
}
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = SAME_AS_BY;
$everythinData['action_on_name'] = SAME_AS_BY;
$everythinData['event_name'] = "agreement_add";
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
//add_log
$logData['action'] = "AGREEMENT_ADD";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$logData['input_data']["id"] = $result->id;
$this->appLog($logData);
$this->Flash->success(__('The agreement has been added successfully.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The agreement has not been added.Please try again.'));
}else{
$this->setSteps($step_name, $this->Auth->user('id'));
}
$member_id = $this->Auth->user('id');
$clientList = $this->Clients->getClientList($member_id);
$template['status'] = 1;
$templateCols = ['id','title'];
$agreementsTemplates = $this->PredefinedAgreementFormats->getAllAgreementTemplates($template,$templateCols);
$templateList = [];
if(!empty($agreementsTemplates->toArray())){
foreach ($agreementsTemplates as $temp){
$templateList[$temp->id] = $temp->title;
}
}
$this->set(compact('clientList','templateList'));
}
/**
* Edit method
*
* @param string|null $id Agreement id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$member_id = $this->Auth->user('id');
$this->loadModel('AgreementFormats');
$this->loadModel('AgreementAssignments');
$this->loadModel('PredefinedAgreementFormats');
$this->loadModel('Clients');
$content_path = "agreenment_contents/".$member_id."/";
if($this->request->is('ajax')){
$request = $this->request->getData();
if($request['action'] == "GET_TEMPLATE"){
$template['id'] = $request['template_id'];
$agreementsTemplates = $this->PredefinedAgreementFormats->getAgreementTemplateById($template['id']);
//pr($agreementsTemplates);exit;
$response['title'] = $agreementsTemplates->title;
$response['content'] = $agreementsTemplates->content;
}
echo json_encode($response);
exit;
}
if($this->request->is('post')){
$request = $this->request->getData();
$inputData['id'] = $id;
$inputData['member_id'] = $member_id;
$inputData['title'] = $request['title'];
$inputData['content'] = $request['content'];
$inputData['status'] = $request['status'];
$result = $this->AgreementFormats->updateAgreementFormat($inputData);
if(!empty($result)){
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = SAME_AS_BY;
$everythinData['action_on_name'] = SAME_AS_BY;
$everythinData['event_name'] = "agreement_edit";
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
//add_log
$logData['action'] = "AGREEMENT_EDIT";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$logData['input_data']["id"]=$id;
$this->appLog($logData);
$this->Flash->success(__('The agreement has been updated successfully.'));
return $this->redirect(['action' => 'index']);
// $this->AgreementAssignments->deleteAll(['agreement_format_id'=>$id]);
// if(!empty($request['client_ids'])){
// foreach($request['client_ids'] as $client_id){
// $assignment['agreement_format_id'] = $id;
// $assignment['client_id'] = $client_id;
// $assignment['member_id'] = $inputData['member_id'];
// $this->AgreementAssignments->insertAgreementAssignment($assignment);
// }
// }
//
// $this->Flash->success(__('The agreement has been updated successfully.'));
// return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The agreement has not been updated.Please try again.'));
}
$agreement = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
$agreement->content = file_get_contents($content_path.$agreement->content);
$selected_client_idList = $this->AgreementAssignments->getClientIdListByIdAgreementFormatId($id);
$clientList = $this->Clients->getClientList($member_id);
$template['status'] = 1;
$templateCols = ['id','title'];
$agreementsTemplates = $this->PredefinedAgreementFormats->getAllAgreementTemplates($template,$templateCols);
$templateList = [];
if(!empty($agreementsTemplates->toArray())){
foreach ($agreementsTemplates as $temp){
$templateList[$temp->id] = $temp->title;
}
}
$this->set(compact('agreement','clientList','selected_client_idList','templateList'));
}
/**
* Delete method
*
* @param string|null $id Agreement id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$this->loadModel('AgreementFormats');
$this->loadModel('AgreementAssignments');
$member_id = $this->Auth->user('id');
$agreements = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
if($agreements->status == 1){
$isExistClient = $this->AgreementAssignments->isExistClient($id);
if($isExistClient){
$status = 2;
$this->AgreementFormats->updateStatusById($id,$status);
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = SAME_AS_BY;
$everythinData['action_on_name'] = SAME_AS_BY;
$everythinData['event_name'] = "agreement_delete";
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
//add_log
$logData['action'] = "AGREEMENT_DELETE";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$logData['input_data']["id"]=$id;
$this->appLog($logData);
$this->Flash->success(__('The agreement has been deleted.'));
return $this->redirect(['action' => 'index']);
}
}
$result = $this->AgreementFormats->deleteAgreementById($id);
if($result){
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = SAME_AS_BY;
$everythinData['action_on_name'] = SAME_AS_BY;
$everythinData['event_name'] = "agreement_delete";
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
$this->Flash->success(__('The agreement has been deleted.'));
} else {
$this->Flash->error(__('The agreement could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
private function deleteSelectedAgreement($idList){
$member_id = $this->Auth->user('id');
$this->loadModel('AgreementFormats');
$this->loadModel('AgreementAssignments');
$finalResult = false;
if(!empty($idList)){
foreach ($idList as $id){
$agreements = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
if($agreements->status == 1){
$isExistClient = $this->AgreementAssignments->isExistClient($id);
if($isExistClient){
$status = 2;
$this->AgreementFormats->updateStatusById($id,$status);
}
}else if($agreements->status == 2){
$this->AgreementFormats->deleteAgreementById($id);
}
}
$finalResult = true;
}
return $finalResult;
}
}

View File

@@ -0,0 +1,143 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* AgreementTemplate Controller
*
*
* @method \App\Model\Entity\AgreementTemplate[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class AgreementTemplateController extends AppController
{
public function initialize() {
parent::initialize();
$this->loadModel('PredefinedAgreementFormats');
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('user_permission', $user_permissions);
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$search = [];
$requestparams = $this->request->query();
$page_limit = 10;
if(!empty($requestparams)){
$search = $requestparams;
}
if(isset($search['page_limit']) && !empty($search['page_limit'])){
$page_limit = $search['page_limit'];
}
$this->paginate = [
'limit' => $page_limit
];
$agreements = $this->PredefinedAgreementFormats->getAllAgreementTemplates($search);
if(!empty($agreements)){
$agreements = $this->paginate($agreements);
}
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$this->set(compact('agreements','search','page_limit'));
}
/**
* View method
*
* @param string|null $id Agreement Template id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$agreementTemplate = $this->AgreementTemplate->get($id, [
'contain' => []
]);
$this->set('agreementTemplate', $agreementTemplate);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
if($this->request->is('post')){
$request = $this->request->getData();
$inputData['member_id'] = $this->Auth->user('id');
$inputData['title'] = $request['title'];
$inputData['content'] = $request['content'];
$inputData['status'] = $request['status'];
$result = $this->PredefinedAgreementFormats->insertAgreementFormat($inputData);
if(!empty($result)){
$this->Flash->success(__('The agreement template has been added successfully.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The agreement template has not been added.Please try again.'));
}
}
/**
* Edit method
*
* @param string|null $id Agreement Template id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$member_id = $this->Auth->user('id');
$this->loadModel('AgreementFormats');
$this->loadModel('AgreementAssignments');
$this->loadModel('Clients');
if($this->request->is('post')){
$request = $this->request->getData();
$inputData['id'] = $id;
$inputData['member_id'] = $member_id;
$inputData['title'] = $request['title'];
$inputData['content'] = $request['content'];
$inputData['status'] = $request['status'];
$result = $this->PredefinedAgreementFormats->updateAgreementFormat($inputData);
if(!empty($result)){
$this->Flash->success(__('The agreement template has been updated successfully.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The agreement template has not been updated.Please try again.'));
}
$agreement = $this->PredefinedAgreementFormats->getAgreementTemplateById($id);
$this->set(compact('agreement'));
}
/**
* Delete method
*
* @param string|null $id Agreement Template id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$result = $this->PredefinedAgreementFormats->deleteAgreementTemplateById($id);
if($result){
$this->Flash->success(__('The agreement template has been deleted.'));
} else {
$this->Flash->error(__('The agreement template could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,467 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
/**
* AutomationSchedule Controller
*
*
* @method \App\Model\Entity\AutomationSchedule[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class AutomationScheduleController extends AppController {
public function initialize() {
parent::initialize();
if (Permission::isEmployeeAsAdmin()) {
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
}
$this->set('user_permission', $this->request->session()->read('user_permissions'));
$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
// $this->loadModel('MemberPackages');
// $isVelocityUser = $this->MemberPackages->isVelocityuser($this->Auth->user('id'));
// if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
//
// }else{
// return $this->redirect($this->referer());
// }
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index() {
$this->loadModel('AutomationSchedules');
$this->loadModel('Automationsetup');
$this->loadModel('Sertg');
$this->loadModel('LetterExtras');
$this->loadModel('Clients');
$requestparams = $this->request->query();
$sertgList = [];
$letterList = [];
$sertg_personal_info = [];
$letter_personal_info = [];
$member_id = $this->Auth->user('id');
$automation_id_list = [];
$search = [];
$export_type = 1;
$automation_type = "";
$client_id = "";
$searchText = "";
if(!empty($requestparams)){
$search = $requestparams;
}
$auttomation_table_condition = "";
$page_limit = 10;
if (isset($this->request->query['page_limit'])) {
$page_limit = $this->request->query('page_limit');
}
$this->paginate = [
'limit' => $page_limit
];
if(isset($search['file_type']) && !empty($search['file_type'])){
$export_type = $search['file_type'];
}else{
$search['file_type'] = $export_type;
}
//echo $export_type;exit;
if(isset($search['automation_type']) && !empty($search['automation_type'])){
$automation_type = $search['automation_type'];
}
if(isset($search['client_id']) && !empty($search['client_id'])){
$client_id = $search['client_id'];
}
if(isset($search['search']) && !empty($search['search'])){
$searchText = $search['search'];
}
if($this->request->is('post')){
$request = $this->request->getData();
$request['automations'] = [];
if(!empty($request['selected_content'])){
$request['automations'] = explode(",",$request['selected_content']);
}
//pr($request);exit;
if($request['automation_action_type'] == 1){
$isDeleted = $this->AutomationSchedules->automationDeleteByIds($request['automations']);
if($isDeleted){
$this->Flash->success(__('The selected automation schedule has been deleted.'));
// return $this->redirect(['action' => 'index']);
}else{
$this->Flash->error(__('The selected automation schedule could not be deleted. Please, try again.'));
}
} else if($request['automation_action_type'] == 2){
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],3);
if($isDeleted){
$this->Flash->success(__('The selected automation schedule has been paused.'));
//return $this->redirect(['action' => 'index']);
}else{
$this->Flash->error(__('The selected automation schedule could not be paused. Please, try again.'));
}
}else if($request['automation_action_type'] == 3){
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],1);
if($isDeleted){
$this->Flash->success(__('The selected automation schedule has been one time.'));
//return $this->redirect(['action' => 'index']);
}else{
$this->Flash->error(__('The selected automation schedule could not be one time. Please, try again.'));
}
}else if($request['automation_action_type'] == 4){
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],2);
if($isDeleted){
$this->Flash->success(__('The selected automation schedule has been recurring.'));
//return $this->redirect(['action' => 'index']);
}else{
$this->Flash->error(__('The selected automation schedule could not be recurring. Please, try again.'));
}
}else if($request['automation_action_type'] == 5){
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],4);
if($isDeleted){
$this->Flash->success(__('The selected automation schedule has been twice.'));
//return $this->redirect(['action' => 'index']);
}else{
$this->Flash->error(__('The selected automation schedule could not be twice. Please, try again.'));
}
}
}
$automationSchedules = $this->AutomationSchedules->getAutomationScheduleListBymemberId($member_id,$search);
$automation_info = [];
$automation_schedule_id_list = [];
if($automationSchedules){
foreach($automationSchedules as $automationSchedule){
if($automationSchedule->velocity_type == 1){
$sertgList[] = $automationSchedule->sertg_id;
}else if($automationSchedule->velocity_type == 2){
$letterList[] = $automationSchedule->sertg_id;
}else if($automationSchedule->velocity_type == 3){
$rtgLetterList[] = $automationSchedule->sertg_id;
}
if($automationSchedule->is_enable == 1){
$automation_id_list[] = $automationSchedule->automation_id;
$automation_schedule_id_list[$automationSchedule->id][] = $automationSchedule->automation_id;
}
}
if(!empty($automation_id_list)){
$automation_id_list = array_unique($automation_id_list);
$automation_info_list = $this->Automationsetup->getAutomationByIdList($automation_id_list);
if(!empty($automation_schedule_id_list)){
foreach ($automation_schedule_id_list as $schedule_id => $schlist){
if(!empty($schlist)){
foreach($schlist as $slist){
if(!empty($automation_info[$schedule_id])){
$automation_info[$schedule_id] .= ", ".$automation_info_list[$slist];
}else{
$automation_info[$schedule_id] = $automation_info_list[$slist];
}
}
}
}
}
}
}
if(!empty($automationSchedules)){
$automationSchedule = $this->paginate($automationSchedules->distinct('AutomationSchedules.id'));
}else{
$automationSchedule = [];
}
$clientList = $this->Clients->getClientList($member_id);
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('user_permission', $user_permissions);
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
$this->set('nav_arr', $nav_arr);
$this->set(compact('page_limit','search','clientList','export_type','automationSchedules','letter_personal_info','sertg_personal_info','automation_info'));
}
/**
* View method
*
* @param string|null $id Automation Schedule id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$automationSchedule = $this->AutomationSchedule->get($id, [
'contain' => []
]);
$this->set('automationSchedule', $automationSchedule);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
private function generateEpicVelocityModal($member_id) {
$this->loadModel('Letters');
$this->loadModel('LetterExtras');
$letterInfo = $this->LetterExtras->getAllLettersListByMemberId($member_id);
$allShortName = json_decode(LETTER_TYPES_SHORT_NAME);
if (!empty($letterInfo)) {
foreach ($letterInfo as $letter) {
//pr($client);exit;
$res['id'] = $letter->letter->id;
$res['dob'] = date('d/m/Y', strtotime($letter->dob));
$personal_info = json_decode($letter->personal_info, true);
$res['personal_info'] = $personal_info['client_name'] . "<br/>" . $personal_info['address'];
$res['ssn'] = $letter->ssn;
$res['client_id'] = $letter->client_id;
$res['slected_letter'] = "";
if (isset($letter->letter_types) && !empty($letter->letter_types)) {
$letter->letter_types = explode(',', $letter->letter_types);
foreach ($letter->letter_types as $type) {
if (!empty($res['slected_letter'])) {
$res['slected_letter'] .= ", " . $allShortName->{$type};
} else {
$res['slected_letter'] = $allShortName->{$type};
}
}
}
$res['letter_id'] = $res['id'];
$res['created_on'] = isset($letter->created_on) ? date('Y-m-d', strtotime($letter->created_on)) : ""; //$clientInfo['client']->dob;
$res['next_section_date'] = isset($letter->next_action_date) ? $letter->next_action_date : ""; //$clientInfo['client']->dob;
$response[] = $res;
}
}
return $response;
}
public function generateSertgModal($member_id) {
$response = [];
if ($member_id > 0) {
$allShortName = json_decode(LETTER_TYPES_SHORT_NAME);
$this->loadModel('Sertg');
$sertgList = $this->Sertg->getSertgByMemberId($member_id);
if (!empty($sertgList)) {
foreach ($sertgList as $sertg) {
$res['id'] = $sertg->id;
$res['dob'] = $sertg->dob;
$res['personal_info'] = $sertg->personal_info;
$res['ssn'] = $sertg->ssn;
$res['slected_letter'] = "";
$res['client_id'] = $sertg->client_id;
if (isset($sertg->lettertypes) && !empty($sertg->lettertypes)) {
$sertg->lettertypes = explode(',', $sertg->lettertypes);
foreach ($sertg->lettertypes as $type) {
if (!empty($res['slected_letter'])) {
$res['slected_letter'] .= ", " . $allShortName->{$type};
} else {
$res['slected_letter'] = $allShortName->{$type};
}
}
}
$res['letter_id'] = $res['id'];
$res['created_on'] = isset($sertg->created_on) ? date('Y-m-d', strtotime($sertg->created_on)) : ""; //$clientInfo['client']->dob;
$res['next_section_date'] = isset($sertg->next_section_date) ? $letter->next_section_date : ""; //$clientInfo['client']->dob;
$response[] = $res;
}
}
}
return $response;
}
public function add() {
$member_id = $this->Auth->user('id');
if ($this->request->is('ajax')) {
$request = $this->request->getData();
$member_id = $this->Auth->user('id');
if ($request['action'] == 'GET_CLIENT_FILES_LIST_POPUP') {
$velocity_type = $request['velocity_type'];
if($velocity_type == 2){
$response = $this->generateEpicVelocityModal($member_id);
}else if($velocity_type == 1){
$response = $this->generateSertgModal($member_id);
}
}
echo json_encode($response);
exit;
}
if($this->request->is('post')){
$request = $this->request->getData();
$this->loadModel('AutomationSchedules');
$this->loadModel('AutomationScheduleExports');
$automationSchedule['sertg_id'] = $request['sertg_id'];
$automationSchedule['member_id'] = $this->Auth->user('id');
$automationSchedule['client_id'] = $request['client_id'];
$automationSchedule['type'] = $request['type'];
$automationSchedule['velocity_type'] = $request['velocity_type'];
$automationSchedule['day_value'] = $request['number_of_day'];
$automation = $this->AutomationSchedules->addSchedule($automationSchedule);
if($automation){
$scheduleExport['automation_schedule_id'] = $automation->id;
$scheduleExport['automation_schedule_id'] = $scheduleExport['automation_schedule_id'];
$scheduleExport['automation_id_list'] = $request['export_type'];
$this->AutomationScheduleExports->insertScheduleExports($scheduleExport);
$this->Flash->success(__('The automation schedule has been saved.'));
}else{
$this->Flash->error(__('The automation schedule could not be saved. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}else{
$this->loadModel('Automationsetup');
$automation_info = $this->Automationsetup->getMemberExportsByMemberId($member_id);
$this->set(compact('automation_info'));
}
}
/**
* Edit method
*
* @param string|null $id Automation Schedule id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null) {
$member_id = $this->Auth->user('id');
// if ($this->request->is('ajax')) {
// $request = $this->request->getData();
// if ($request['action'] == 'GET_CLIENT_FILES_LIST_POPUP') {
// $velocity_type = $request['velocity_type'];
// if($velocity_type == 2){
// $response = $this->generateEpicVelocityModal($member_id);
// }else if($velocity_type == 1){
// $response = $this->generateSertgModal($member_id);
// }
// }
//
// echo json_encode($response);
// exit;
// }
$this->loadModel('AutomationSchedules');
$this->loadModel('AutomationScheduleExports');
if ($this->request->is(['patch', 'post', 'put'])) {
$request = $this->request->getData();
$automationSchedule['sertg_id'] = $request['sertg_id'];
$automationSchedule['member_id'] = $this->Auth->user('id');
$automationSchedule['client_id'] = $request['client_id'];
$automationSchedule['type'] = $request['type'];
//$automationSchedule['velocity_type'] = $request['velocity_type'];
$automationSchedule['day_value'] = $request['number_of_day'];
$automationSchedule = $this->AutomationSchedules->updateSchedule($automationSchedule,$id);
if ($automationSchedule) {
//$this->AutomationScheduleExports->deleteScheduleExportByAutomationScheduleId($id);
$scheduleExport['automation_schedule_id'] = $id;
$all_exports_ids = [];
if(!empty($request['all_export_ids'])){
$all_exports_ids = json_decode($request['all_export_ids'],true);
}
$scheduleExport['selected_export_ids'] = $request['export_type'];
$scheduleExport['all_export_ids'] = $all_exports_ids;
$this->AutomationScheduleExports->updateScheduleExportsById($scheduleExport);
//add_log
$logData['action'] = "AUTOMATIONSCHEDULE_EDIT";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('The automation schedule has been saved.'));
}else{
$this->Flash->error(__('The automation schedule could not be saved. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}else{
$this->loadModel('Sertg');
$this->loadModel('Automationsetup');
$this->loadModel('LetterExtras');
$selected_export_type = [];
$all_selected_export_type = [];
$assosAutomationExportByAutomationId = [];
$automation_schedule = $this->AutomationSchedules->getAutomationScheduleById($id,$member_id);
$velcity_type = $automation_schedule->velocity_type;
if(!empty($automation_schedule->automation_schedule_exports)){
foreach($automation_schedule->automation_schedule_exports as $export){
if($export->is_enable == 1){
$selected_export_type[] = $export->automation_id;
}
$all_selected_export_type[] = $export->automation_id;
$assosAutomationExportByAutomationId[$export->automation_id] = $export->id;
}
}
//$automation_info = $this->Automationsetup->getMemberExportsByMemberId($member_id);
$automation_info = $this->Automationsetup->getAutomationByIdList($all_selected_export_type);
$sertg_id = $automation_schedule->sertg_id;
if($velcity_type == 1){
$velocity = $this->Sertg->getSertgById($sertg_id,$member_id);
$personal_info = $velocity->personal_info;
}else if($velcity_type == 2){
$velocity = $this->LetterExtras->getLetterById($sertg_id,$member_id);
$personal_info = json_decode($velocity->personal_info, true);
$personal_info = $personal_info['client_name'] . "<br/>" . $personal_info['address'];
}
$this->set(compact('assosAutomationExportByAutomationId','personal_info','automation_schedule','selected_export_type','automation_info'));
}
}
/**
* Delete method
*
* @param string|null $id Automation Schedule id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
if($this->request->is('post')){
$this->loadModel('AutomationSchedules');
$this->loadModel('AutomationScheduleExports');
if ($this->AutomationSchedules->deleteAutomationScheduleById($id)) {
$this->AutomationScheduleExports->deleteScheduleExportByAutomationScheduleId($id);
//add_log
$logData['action'] = "AUTOMATIONSCHEDULE_DELETE";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('The automation schedule has been deleted.'));
} else {
$this->Flash->error(__('The automation schedule could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
}

View File

@@ -0,0 +1,420 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
use App\Utility\DropboxAuthorize;
use Cake\I18n\I18n;
use RingCentral\SDK\SDK;
use Cake\ORM\TableRegistry;
use GuzzleHttp\Client as GuzzleHttpClient;
use Krizalys\Onedrive\Client;
use Microsoft\Graph\Graph;
/**
* MemberExports Controller
*
* @property \App\Model\Table\MemberExportsTable $MemberExports
*
* @method \App\Model\Entity\MemberExport[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class AutomationsetupController extends AppController {
public function initialize() {
parent::initialize();
$_SESSION["crm_url_active"] = 2;
$this->viewBuilder()->layout("new_dashboard");
I18n::locale('en_US');
$this->Auth->allow(['sendbox','paymentsetup']);
//pr($this->request->session()->read('user_permissions'));exit;
$this->set('user_permission', $this->request->session()->read('user_permissions'));
$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
$this->checkAutomationSetupPermission();
}
private function checkAutomationSetupPermission() {
if(Permission::isEmployeeAsAdmin()){
$this->Auth->allow('index');
return ;
}
//$this->loadModel('MemberPackages');
//$isVelocityUser = $this->MemberPackages->isVelocityuser($this->Auth->user('id'));
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity'] || $_SESSION['hasLS_Fax_Rtg_user']){
}else{
$this->Flash->error(__("You don't have permission for Automation Setup"));
return $this->redirect($this->referer());
}
}
public function sendbox() {
if ($this->request->is('ajax')) {
$this->loadModel('Ringcentral');
$inputData = $this->request->getData();
$credentials['account_phone'] = $inputData['ring_account'];
$credentials['extension'] = !empty($inputData['ring_extension']) ? $inputData['ring_extension'] : 101;
$credentials['password'] = $inputData['ring_password'];
$credentials['clientId'] = $inputData['ring_client_id'];
$credentials['clientsecret'] = $inputData['ring_client_secret'];
$credentials['server'] = $inputData['ring_server'];
$credentials['sender_number'] = $inputData['ring_account'];
$credentials['dateFrom'] = 'yyyy-mm-dd';
$credentials['dateTo'] = 'yyyy-mm-dd';
$credentials['smsText'] = 'This is a Test SMS from RTG';
$credentials['receiverFaxNo'] = $inputData['ring_fax_default_number'];
$credentials['mobileNumber'] = $inputData['ring_mobile_no_sender'];
//pr($credentials);exit;
$fileToFax = realpath('dummy1.pdf');
if ($inputData['type'] == 1) {
$response['type'] = 1;
$status = $this->Ringcentral->sendSMSbyRingCentral($credentials['mobileNumber'], $credentials['smsText'], $credentials);
if ($status['status']) {
$response['status'] = "success";
} else {
$response['status'] = "notsuccess";
}
} elseif ($inputData['type'] == 2) {
$res = $this->Ringcentral->sendBoxFax($credentials, $fileToFax);
if ($res == "success") {
$response['type'] = 2;
}
$response['status'] = $res;
}
$response['data'] = $this->ringCentralIntoDB($inputData, $response['status']);
echo json_encode($response);
exit;
} else {
$member_id = $this->Auth->user('id');
$ringcentralSandboxTable = TableRegistry::get('rincentral_sandbox');
$ringcentralSandboxInfo = $ringcentralSandboxTable->find()->where(['member_id' => $member_id])->first();
//pr($ringcentralSandboxInfo);exit;
$this->set(compact('ringcentralSandboxInfo'));
}
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index() {
$page_limit = 10;
if (isset($this->request->query['page_limit'])) {
$page_limit = $this->request->query('page_limit');
}
$this->paginate = [
'limit' => $page_limit,
'order' => [
'Automationsetup.id' => 'desc'
]
];
$searchText = '';
$searchString = "";
$export_type = "";
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
$searchText = $this->request->query['search'];
$searchString = "(name LIKE '%" . $searchText . "%')";
}
if (isset($this->request->query['export_id']) && !empty($this->request->query['export_id'])) {
$export_type = $this->request->query['export_id'];
if (!empty($searchString)) {
$searchString .= " AND export_id = " . $export_type;
} else {
$searchString = "export_id = " . $export_type;
}
}
$memberExports = $this->Automationsetup->find()->where(['member_id' => $this->Auth->user('id'), $searchString]);
$memberExports = $this->paginate($memberExports);
//$this->set('searchText', $search);
$this->set(compact('memberExports', 'page_limit', 'searchText', 'export_type'));
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
}
/**
* View method
*
* @param string|null $id Member Export id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$memberExport = $this->Automationsetup->get($id);
$this->set('memberExport', $memberExport);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add() {
$step_name = 'is_automation';
if ($this->request->is('post')) {
$requestData = $this->request->getData();
$requestData['email_body'] = nl2br($this->request->getData('email_body'));
$requestData = array_filter($requestData);
if ($saved = $this->Automationsetup->create($requestData)) {
$step_status = $this->request->data['step_status'];
if($step_status == 0){
$this->loadModel('CmsuserStatus');
$this->CmsuserStatus->upgradeCmsuserStatus($this->Auth->user('id'), $step_name);
}
$this->Flash->success(__('The member export has been saved.'));
if($requestData['export_id'] == 2) {
return $this->redirect(['action' => 'edit',$saved->id]);
}
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The member export could not be saved. Please, try again.'));
}else{
$this->setSteps($step_name, $this->Auth->user('id'));
}
//$members = $this->MemberExports->Members->find('list', ['limit' => 200]);
//$exports = $this->MemberExports->Exports->find('list', ['limit' => 200]);
$cmsuser_id = $this->Auth->user('id');
$auth_email = $this->Auth->user('email');
$this->set(compact('memberExport', 'cmsuser_id', 'auth_email'));
}
/**
* Edit method
*
* @param string|null $id Member Export id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null) {
$exportData = [];
$exportData['zap_required'] = "";
$exportData['google_required'] = "";
$exportData['dropbox_required'] = "";
$exportData['email_required'] = "";
$exportData['ring_fax_required'] = "";
$exportData['email_subject'] = "";
$exportData['email_body'] = "";
$exportData['ring_isEmailReceived'] = "";
$exportData['letter_stream_required'] = "";
$memberExport = $this->Automationsetup->get($id);
$export_id = $memberExport->export_id;
$db_member_id = $memberExport->member_id;
$auth_user_id = $this->Auth->user('id');
if($this->verifyUser($db_member_id, $auth_user_id)){
return $this->redirect(['action' => 'index']);
}
$json_data = json_decode($memberExport->input_json);
//pr($json_data);exit;
if ($export_id == 1) {
$exportData['email'] = $json_data->email;
$exportData['email_required'] = "required";
$exportData['email_subject'] = $json_data->email_subject;
$exportData['email_body'] = $json_data->email_body;
} else if ($export_id == 2) {
$exportData['dropbox_user_name'] = $json_data->user_name;
$exportData['dropbox_password'] = $json_data->password;
$exportData['dropbox_refresh_token'] = $json_data->dropbox_refresh_token;
//$exportData['dropbox_token'] = $json_data->dropbox_token;
$dropboxAuthorize = DropboxAuthorize::getAuthorizeDropboxButton($exportData['dropbox_user_name'],$exportData['dropbox_password']);
$exportData['authorize_button'] = $dropboxAuthorize['button'];
$exportData['authorize_url'] = $dropboxAuthorize['url'];
$_SESSION['db_id'] = $id;
$exportData['dropbox_required'] = "required";
} else if ($export_id == 3) {
$exportData['google_client_id'] = $json_data->google_client_id;
$exportData['google_client_secret'] = $json_data->google_client_secret;
$exportData['google_token'] = $json_data->google_token;
$exportData['google_refresh_token'] = $json_data->google_refresh_token;
$exportData['google_required'] = "required";
} else if ($export_id == 4) {
$exportData['zap_access_key'] = $json_data->access_key;
$exportData['zap_required'] = "required";
} else if ($export_id == RINGCENTRAL_EXPORT_TYPE) {
$exportData['ring_client_id'] = $json_data->ring_client_id;
$exportData['ring_client_secret'] = $json_data->ring_client_secret;
$exportData['ring_account'] = $json_data->ring_account;
$exportData['ring_password'] = $json_data->ring_password;
$exportData['ring_server'] = $json_data->ring_server;
$exportData['ring_extension'] = $json_data->ring_extension;
$exportData['ring_mobile_no_sender'] = $json_data->ring_mobile_no_sender;
$exportData['ring_fax_default_number'] = $json_data->ring_fax_default_number;
$exportData['ring_fax_trans_number'] = $json_data->ring_fax_trans_number;
if(!empty($json_data->ring_fax_trans_number)){
$exportData['ring_fax_trans_number'] = explode(',',$json_data->ring_fax_trans_number);
}
$exportData['ring_fax_equifax_number'] = $json_data->ring_fax_equifax_number;
if(!empty($json_data->ring_fax_equifax_number)){
$exportData['ring_fax_equifax_number'] = explode(',',$json_data->ring_fax_equifax_number);
}
$exportData['ring_fax_experian_number'] = $json_data->ring_fax_experian_number;
if(!empty($json_data->ring_fax_experian_number)){
$exportData['ring_fax_experian_number'] = explode(',',$json_data->ring_fax_experian_number);
}
$exportData['ring_fax_innovis_number'] = $json_data->ring_fax_innovis_number;
$exportData['ring_fax_lexisnexis_number'] = $json_data->ring_fax_lexisnexis_number;
$exportData['ring_fax_sagestream_number'] = $json_data->ring_fax_sagestream_number;
$exportData['ring_fax_chex_systems_number'] = $json_data->ring_fax_chex_systems_number;
$exportData['ring_fax_mib_inc_number'] = $json_data->ring_fax_mib_inc_number;
$exportData['ring_factor_inc_number'] = $json_data->ring_factor_inc_number;
$exportData['ring_data_furnishers_number'] = $json_data->ring_data_furnishers_number;
$exportData['ring_other_number'] = $json_data->ring_other_number;
$exportData['ring_fax_required'] = "required";
if (isset($json_data->ring_isEmailReceived) && $json_data->ring_isEmailReceived == 1) {
$exportData['ring_isEmailReceived'] = "checked";
}
}else if($export_id == LETTER_STREAM_TYPE){
$exportData['letter_stream_required'] = "required";
$exportData['letter_stream_api_key'] = $json_data->letter_stream_api_key;
$exportData['letter_stream_api_id'] = $json_data->letter_stream_api_id;
$exportData['letter_stream_name_1'] = $json_data->letter_stream_name_1;
$exportData['letter_stream_name_2'] = $json_data->letter_stream_name_2;
$exportData['letter_stream_address_1'] = $json_data->letter_stream_address_1;
$exportData['letter_stream_address_2'] = $json_data->letter_stream_address_2;
$exportData['letter_stream_city'] = $json_data->letter_stream_city;
$exportData['letter_stream_state'] = $json_data->letter_stream_state;
$exportData['letter_stream_zip'] = $json_data->letter_stream_zip;
}else if ($export_id == ONE_DRIVE_TYPE) {
$exportData['one_drive_client_id'] = $json_data->one_drive_client_id;
$exportData['one_drive_client_secret'] = $json_data->one_drive_client_secret;
$exportData['one_drive_code'] = $json_data->one_drive_code;
$exportData['one_drive_required'] = "required";
}
if ($this->request->is(['patch', 'post', 'put'])) {
$this->request->data['email_body'] = nl2br($this->request->getData('email_body'));
$memberExport = $this->Automationsetup->patchEntity($memberExport, $this->request->getData());
$data = $this->request->getData();
if (!empty($data['ring_fax_trans_number'])) {
$data['ring_fax_trans_number'] = implode(",", $data['ring_fax_trans_number']);
}
if (!empty($data['ring_fax_equifax_number'])) {
$data['ring_fax_equifax_number'] = implode(",", $data['ring_fax_equifax_number']);
}
if (!empty($data['ring_fax_experian_number'])) {
$data['ring_fax_experian_number'] = implode(",", $data['ring_fax_experian_number']);
}
$data = array_map('trim', $data);
$memberExport->input_json = json_encode($data);
if ($this->Automationsetup->save($memberExport)) {
$this->Flash->success(__('The member export has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The member export could not be saved. Please, try again.'));
}
$cmsuser_id = $this->Auth->user('id');
$this->set(compact('memberExport', 'cmsuser_id', 'exportData'));
}
/**
* Delete method
*
* @param string|null $id Member Export id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
$auth_user_id = $this->Auth->user('id');
$this->request->allowMethod(['post', 'delete']);
$this->loadModel('AutomationScheduleExports');
$hasSchedule = $this->AutomationScheduleExports->hasAutomation($id);
if($hasSchedule){
$this->Flash->error(__('This automation has already used for automation schedule. You cannot delete it.'));
return $this->redirect(['action' => 'index']);
}
$memberExport = $this->Automationsetup->get($id);
$db_member_id = $memberExport->member_id;
if($this->verifyUser($db_member_id, $auth_user_id)){
return $this->redirect(['action' => 'index']);
}
if ($this->Automationsetup->delete($memberExport)) {
$this->Flash->success(__('The member export has been deleted.'));
} else {
$this->Flash->error(__('The member export could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
private function ringCentralIntoDB($inputData, $isSuccess) {
$current_dateTime = date('Y-m-d H:i:s');
$member_id = $this->Auth->user('id');
$ringcentralSandboxTable = TableRegistry::get('rincentral_sandbox');
$ringcentralSandboxInfo = $ringcentralSandboxTable->find()->where(['member_id' => $member_id])->first();
if (!empty($ringcentralSandboxInfo)) {
$ringcentralSandbox = $ringcentralSandboxTable->get($ringcentralSandboxInfo->id);
} else {
$ringcentralSandbox = $ringcentralSandboxTable->newEntity();
$ringcentralSandbox->created_on = $current_dateTime;
}
$ringcentralSandbox->member_id = $member_id;
$ringcentralSandbox->username = $inputData['ring_account'];
$ringcentralSandbox->extension = !empty($inputData['ring_extension']) ? $inputData['ring_extension'] : 101;
$ringcentralSandbox->password = $inputData['ring_password'];
$ringcentralSandbox->client_id = $inputData['ring_client_id'];
$ringcentralSandbox->client_secret = $inputData['ring_client_secret'];
$ringcentralSandbox->api_server_url = $inputData['ring_server'];
$ringcentralSandbox->sms_receiver_num = $inputData['ring_mobile_no_sender'];
$ringcentralSandbox->fax_receiver_num = $inputData['ring_fax_default_number'];
$ringcentralSandbox->modified_on = $current_dateTime;
$ringcentralSandbox->fax_receiver_num = $inputData['ring_fax_default_number'];
if ($isSuccess == "success") {
if ($inputData['type'] == 1) {
if (is_int($ringcentralSandbox->sms_sent)) {
$ringcentralSandbox->sms_sent = $ringcentralSandbox->sms_sent + 1;
} else {
$ringcentralSandbox->sms_sent = 1;
}
} else if ($inputData['type'] == 2) {
if (is_int($ringcentralSandbox->fax_sent)) {
$ringcentralSandbox->fax_sent = $ringcentralSandbox->fax_sent + 1;
} else {
$ringcentralSandbox->fax_sent = 1;
}
}
}
$result = $ringcentralSandboxTable->save($ringcentralSandbox);
return $result;
}
}

View File

@@ -0,0 +1,267 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use Cake\Datasource\ConnectionManager;
use ModuleConstants;
use PagesConstants;
use SubModuleConstants;
use Cake\I18n\I18n;
use App\Helper\commonLogic;
/**
* Users Controller
*
* @property \App\Model\Table\UsersTable $Users
*/
class CalendarController extends AppController {
public function initialize()
{
parent::initialize();
$this->loadModel('Clients');
$this->viewBuilder()->layout("new_dashboard");
I18n::locale('en_US');
$this->Auth->allow(['upgrade']);
$this->Auth->allow(['addEvent']);
$this->Auth->allow(['editEvent']);
$this->Auth->allow(['deleteEvent']);
$this->Auth->allow(['getAllEvent']);
$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
}
/**
* Index method
*
* @return void
*/
public function index($date = "") {
$this->loadModel('CalenderNotification');
$this->loadModel('AutomationSchedules');
$this->loadModel('App');
$cmsuser_id = $this->Auth->user('id');
$commonLogic = new commonLogic;
$color_assoc = $commonLogic->getcalendarBackgroundAndFontColorAssoc();
if ($this->request->is('ajax')) {
$request = $this->request->getData();
$response = $commonLogic->calenderAjaxRequest($request);
echo json_encode($response);
exit;
}
$first_date_of_month = date('Y-m-01');
$last_date_of_month = date('Y-m-t');
$search_params['from_date'] =$first_date_of_month;
$search_params['to_date'] = $last_date_of_month;
$notificationList = $this->CalenderNotification->getCalenderNotificationByMemberId($cmsuser_id,[]);
if(!empty($notificationList)){
foreach($notificationList as $date => $notification){
$calender_result[] = [
'title' => $notification['title'],
'start' => $date,
'constraint' => $notification['description'],
'backgroundColor' => $notification['color'],
'textColor' => $color_assoc[$notification['color']]
];
}
}
$calender_result_json = null;
if(!empty($calender_result)){
$calender_result_json = json_encode($calender_result);
}
$today = $this->App->getSystemCurrentTimeStamp('Y-m-d');
//pr($this->request->query['month']);exit;
if(isset($this->request->query['date'])){
$date = $this->request->query['date'];
$today = date('Y-m-d',strtotime($date));
}
$calender_form_id = 'calender-area-form';
$this->set(compact('calender_result_json','today','calender_form_id'));
$this->render('calender');
//pr($calender_result_json);exit;
}
/**
* View method
*
* @param string|null $id User id.
* @return void
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function view($id = null) {
// $client = $this->Clients->get($id);
// $this->set('client', $client);
// $this->set('_serialize', ['client']);
//
// $user_permissions = $this->request->session()->read('user_permissions');
// $this->set('languages', $this->languages);
// $this->set('module_pages', $this->getPages());
// $this->set('user_permission', $user_permissions);
// //$this->viewBuilder()->layout("custom_layout");
}
/**
* Add method
*
* @return void Redirects on successful add, renders view otherwise.
*/
public function addEvent(){
$request = $this->request->data();
if($this->request->is('ajax')){
$user_id=$this->Auth->user('user_id');
if(!isset($user_id)){
$user_id = $this->Auth->user('id');
}
$calendarsTable = TableRegistry::get('calendars');
$calendar = $calendarsTable->newEntity();
//$calendar->cmsuser_id = $user_id;
$calendar->user_id = $user_id;
$calendar->user_type = $_SESSION['userType'];
$calendar->name = $request['name'];
$calendar->description = '';
$calendar->color_class = $request['color'];
$calendar->start_date = $request['start_date'];
$calendar->end_date = $request['end_date'];
$calendar->created_on = date("Y-m-d h:i:s");
$calendar->created_by = $user_id;
if(isset($request['description'])){
$calendar->description = $request['description'];
}
//$id = $request['project_id'];
//pr($projectMilestone);exit;
if($calendarsTable->save($calendar))
{
echo json_encode($this->Flash->success(__('The event has been saved.')));
die();
} else {
die();
}
}
}
/**
* Edit method
*
* @param string|null $id User id.
* @return void Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function editEvent(){
$request = $this->request->data();
if($this->request->is('ajax')){
$user_id=$this->Auth->user('user_id');
if(!isset($user_id)){
$user_id = $this->Auth->user('id');
}
//$cmsuser_id = $this->Auth->user('id');
$calendarsTable = TableRegistry::get('calendars');
$calendar = $calendarsTable->get($request['event_id']);
//$calendar->cmsuser_id = $cmsuser_id;
$calendar->user_id = $user_id;
$calendar->name = $request['name'];
$calendar->description = '';
$calendar->color_class = $request['color'];
$calendar->start_date = $request['start_date'];
$calendar->end_date = $request['end_date'];
$calendar->created_on = date("Y-m-d h:i:s");
$calendar->created_by = $user_id;
if(isset($request['description'])){
$calendar->description = $request['description'];
}
if($calendarsTable->save($calendar))
{
echo json_encode($this->Flash->success(__('The event has been updated.')));
die();
} else {
die();
}
}
}
/**
* Delete method
*
* @param string|null $id User id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function delete($id = null) {
// $this->request->allowMethod(['post', 'delete']);
// $manageClient = $this->Clients->get($id);
// if ($this->Clients->delete($manageClient)) {
// $this->Flash->success(__('The Company has been deleted.'));
// } else {
// $this->Flash->error(__('The Company could not be deleted. Please, try again.'));
// }
//
// return $this->redirect(['action' => 'index']);
}
public function deleteEvent() {
$request = $this->request->data();
if ($this->request->is('ajax')) {
$calendarTable = TableRegistry::get('calendars');
$calendar = $calendarTable->get($request['event_id']);
//$id = $request['project_id'];
if ($calendarTable->delete($calendar)) {
echo json_encode($this->Flash->success(__('The event has been deleted.')));
die();
} else {
exit();
}
}
}
public function getAllEvent() {
if ($this->request->is('ajax')) {
$id = $this->Auth->user('user_id');
if (!isset($id)) {
$id = $this->Auth->user('id');
}
$event = TableRegistry::get('calendars')
->find('all')
->where(['user_id' => $id, 'user_type' => $_SESSION['userType']])
->toArray();
echo json_encode($event);
die();
}
}
private function deleteAll($companies) {
// foreach ($companies as &$companyIdWithPrefix) {
// $clientId = str_replace('content_', '', $companyIdWithPrefix);
// pr($clientId);exit();
// $client = $this->Clients->get($clientId);
// $this->Clients->delete($client);
// }
}
}

View File

@@ -0,0 +1,204 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\I18n\I18n;
use Cake\ORM\TableRegistry;
use DateTime;
use Cake\ORM\Query;
/**
* Categories Controller
*
* @property \App\Model\Table\CategoriesTable $Categories
*/
class CategoriesController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$page_limit=10;
if (isset($this->request->query['page_limit'])) {
$page_limit= $this->request->query('page_limit');
}
$this->paginate = [
'limit' => $page_limit,
'sortWhitelist' => [
'Categories.created_on', 'Categories.id', 'Categories.name', 'Categories.modified_on'
],
'order' => [
'Categories.created_on' => 'desc'
]
];
$search = '';
if (isset($this->request->query['search'])) {
$search = $this->request->query('search');
}
$categories = $this->Categories->find('all')->where([
'Categories.name LIKE' => '%' . $search . '%'
]);
$categories = $this->paginate($categories);
$this->set(compact('categories'));
$this->set('_serialize', ['categories']);
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('module_pages', $this->getPages());
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
$this->set('current_module', $this->getModules());
$this->set('sub_modules', $this->getSubModules());
$this->set('user_permission', $user_permissions);
$this->set('searchText', $search);
$this->set('page_limit', $page_limit);
$this->viewBuilder()->layout("custom_layout");
}
/**
* View method
*
* @param string|null $id Category id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$category = $this->Categories->get($id, [
'contain' => []
]);
$this->set('category', $category);
$this->set('_serialize', ['category']);
}
/**
* Add method
*
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
*/
public function add()
{
$category = $this->Categories->newEntity();
if ($this->request->is('post')) {
$category = $this->Categories->patchEntity($category, $this->request->data);
$category->created_on = date('Y-m-d h:i:s');
$category->status = 1;
if ($this->Categories->save($category)) {
$this->Flash->success(__('The category has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The category could not be saved. Please, try again.'));
}
}
$this->set(compact('category'));
$this->set('_serialize', ['category']);
$ModulesTable = TableRegistry::get('modules');
$modules = $ModulesTable->find('list');
// $subModules = $this->Pages->SubModules->find('list', ['limit' => 200]);
$this->set(compact('page', 'subModules','modules'));
// // $this->set('_serialize', ['page']);
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('module_pages', $this->getPages());
$this->set('current_module', $this->getModules());
$this->set('sub_modules', $this->getSubModules());
$this->set('user_permission', $user_permissions);
$this->viewBuilder()->layout("custom_layout");
}
/**
* Edit method
*
* @param string|null $id Category id.
* @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$category = $this->Categories->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$category = $this->Categories->patchEntity($category, $this->request->data);
$category->modified_on = date('Y-m-d h:i:s');
if ($this->Categories->save($category)) {
$this->Flash->success(__('The category has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The category could not be saved. Please, try again.'));
}
}
$this->set(compact('category'));
$this->set('_serialize', ['category']);
$ModulesTable = TableRegistry::get('modules');
$modules = $ModulesTable->find('list');
// $subModules = $this->Pages->SubModules->find('list', ['limit' => 200]);
$this->set(compact('page', 'subModules','modules'));
// // $this->set('_serialize', ['page']);
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('module_pages', $this->getPages());
$this->set('current_module', $this->getModules());
$this->set('sub_modules', $this->getSubModules());
$this->set('user_permission', $user_permissions);
$this->viewBuilder()->layout("custom_layout");
}
/**
* Delete method
*
* @param string|null $id Category id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
// check for subCategories
$subCategories = [];
$subCategoriesTable = TableRegistry::get('SubCategories');
$subCategories = $subCategoriesTable->find('all')->where([
'SubCategories.category_id' => $id
])->toArray();
// check for Forms
$forms = [];
$formsTable = TableRegistry::get('Forms');
$forms = $formsTable->find('all')->where([
'Forms.category_id' => $id
])->toArray();
if(empty($subCategories))
{
if(empty($forms))
{
$this->request->allowMethod(['post', 'delete']);
$category = $this->Categories->get($id);
if ($this->Categories->delete($category)) {
$this->Flash->success(__('The category has been deleted.'));
} else {
$this->Flash->error(__('The category could not be deleted. Please, try again.'));
}
} else {
$this->Flash->error(__('The category is assigned to a Form so could not be deleted.'));
}
} else {
$this->Flash->error(__('The category is assigned to a Sub-Category so could not be deleted.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,191 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Utility\Certificate;
use Cake\View\View;
/**
*Certificate Controller
* *
* @method \App\Model\Entity\Certificate[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */
class CertificateController extends AppController
{
/**
* Links
*
* @certificate/CHC/ehcplmmdgujaoerzhhhfglwkqakdeqzx --- Credit Hacker Challenge
* @certificate/CRS01/yihjpcxejusqlrwtfkxhvjydmjoiiclh --- Credit Repair Software/Business Essentials
* @certificate/M2CM01/jikhyrpbxljiyncvecixilkluvjbkalq --- Metro 2 Compliance Method
*/
public function initialize()
{
parent::initialize();
$this->Auth->allow(['CHC', 'CRS', 'M2CM']);
if ($this->Auth->user()) {
$this->Auth->allow(['getcertificatelistbymemberId']);
}
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function CHC($unique_string)
{
$this->loadModel('Certificates');
$certificate = $this->Certificates->getCertificateByUniqueString('CHC', $unique_string);
if (!empty($certificate)) {
$_SESSION['member_certificate'] = [
'certificate_id' => $certificate->id,
'name' => $certificate->name
];
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
}
die('Invalid Request');
}
public function CRS($unique_string)
{
$this->loadModel('Certificates');
$certificate = $this->Certificates->getCertificateByUniqueString('CRS', $unique_string);
if (!empty($certificate)) {
$_SESSION['member_certificate'] = [
'certificate_id' => $certificate->id,
'name' => $certificate->name
];
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
}
die('Invalid Request');
}
public function M2CM($unique_string)
{
$this->loadModel('Certificates');
$certificate = $this->Certificates->getCertificateByUniqueString('M2CM', $unique_string);
if (!empty($certificate)) {
$_SESSION['member_certificate'] = [
'certificate_id' => $certificate->id,
'name' => $certificate->name
];
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
}
die('Invalid Request');
}
/**
* View method
*
* @param string|null $idCertificate id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function generatecertificate()
{
$request = $this->request->getData();
if($this->request->is('ajax')){
if($request['action'] == "session_unset"){
if($request['session_unset'] == "1"){
unset($_SESSION['member_certificate']);
$response['status'] = true;
$response['message'] = "Certificate session unset successfully";
}
}
echo json_encode($response);
die();
}
$inputData['member_id'] = $this->Auth->user('id');
$inputData['certificate_id'] = 0;
if($_SESSION['member_certificate']['certificate_id'] > 0){
$inputData['certificate_id'] = $_SESSION['member_certificate']['certificate_id'];
}
$certificate_name = $_SESSION['member_certificate']['name'];
$inputData['member_name'] = trim($request['fname'] . " " . $request['lname']);
$this->loadModel('MemberCertificates');
if($inputData['certificate_id'] > 0 && $this->MemberCertificates->updateOrInsertMemberCertificate($inputData['member_id'], $inputData['certificate_id'], $inputData)) {
$pdf_file_path = Certificate::certificate_generate_for_pdf($inputData);
$pdf_file_path = WWW_ROOT.$pdf_file_path;
$templateContent['certificate_name'] = $_SESSION['member_certificate']['name'];
$templateContent['content'] = $inputData['member_name'];
$templateContent['company_name'] = "Admin";
$templateContent['company_email'] = NO_REPLY_EMAIL;
$subject = Certificate::CERTIFICATE_EMAIL_SUBJECTS[$inputData['certificate_id']];
$this->sendEmail('certificate_email', $templateContent, $request['email'], $subject, $pdf_file_path);
$download_name = str_replace(' ', '_', $certificate_name);
$this->downloadFile($pdf_file_path,"pdf", $download_name);
unset($_SESSION['member_certificate']);
}
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
}
private function downloadFile($file_path,$extension,$download_name){
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . "{$download_name}.{$extension}" . "\"");
readfile($file_path);
unlink($file_path);
}
public function getcertificatelistbymemberId()
{
if ($this->request->is('ajax')) {
$response = [];
$request = $this->request->getData();
$this->loadModel('MemberCertificates');
if ($request['action'] == "GET_CERTIFICATE_LIST") {
$member_id = $request['member_id'];
$certificates = $this->MemberCertificates->getCertificateListByMemberId($member_id);
$view = new View($this->request, $this->response);
$response['html'] = $view->element('certificate/certificate_list', ['memberCertificates' => $certificates]);
} else if ($request['action'] == "UPDATE_DOWNLOAD_STATUS") {
$member_certificate_id = $request['member_certificate_id'];
$status = $request['status'];
$response['status'] = $this->MemberCertificates->updateById($member_certificate_id, ['downloaded' => $status]);
$member_id = $request['member_id'];
$certificates = $this->MemberCertificates->getCertificateListByMemberId($member_id);
$view = new View($this->request, $this->response);
$response['html'] = $view->element('certificate/certificate_list', ['memberCertificates' => $certificates]);
$response['message'] = "Certificate download revoked successfully";
if ($response['status']) {
$response['message'] = "Certificate download permitted successfully";
}
}
echo json_encode($response);
exit;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,749 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
use App\Helper\commonLogic;
use App\Utility\Common;
use App\Utility\PasswordCreator;
/**
* ClientCreditreport Controller
*
*
* @method \App\Model\Entity\ClientCreditreport[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientCreditreportController extends AppController
{
public function initialize() {
parent::initialize();
if($this->setClientControllerAccess()){
$this->Auth->allow(['index','clearMedia']);
}
if($this->employeeAccessMethod() || ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2)){
$this->Auth->allow(['clientcreditreportlist']);
}
if($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2){
$this->Auth->allow(['creditreportstatus']);
}
$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
// $this->Auth->allow(['creditreportstatus']);
$this->isUserPermitted(CREDIT_REPORT_STATUS_CONTROLLER_ID);
}
public function clientcreditreportlist(){
$page_limit = 10;
$status = '';
$selected_status = '';
$client_type = 1;
$affiliate_client_id = 0;
$employee_id = 0;
$affiliate_client_list = [];
$$emlpoyee_list = [];
$affiliate_condition = "";
$this->loadModel('Contacts');
$is_show_all_clients = $this->Auth->user('is_show_all_clients');
if (isset($this->request->query['page_limit'])) {
$page_limit = $this->request->query('page_limit');
}
if (isset($this->request->query['client_type'])) {
$client_type = $this->request->query('client_type');
}
if (isset($this->request->query['affiliate_client_id'])) {
$affiliate_client_id = $this->request->query('affiliate_client_id');
}
if (isset($this->request->query['employee_id'])) {
$employee_id = $this->request->query('employee_id');
}
if (isset($this->request->query['status']) && !empty($this->request->query['status'])) {
$status = "Clients.status = " . $this->request->query('status');
$selected_status = $this->request->query('status');
}
$this->paginate = [
'limit' => $page_limit,
'order' => [
'Clients.id' => 'desc',
'Contacts.id' => 'desc'
]
];
$cmsuser_id = $this->Auth->user('id');
$search = '';
if ($this->isAffiliateUser()) {
$affiliate_client_id = $this->Auth->user('user_id');
$affiliate_condition = "Clients.crmuser_id = " . $affiliate_client_id;
} else {
//$affiliate_condition = "Clients.crmuser_id = 0";
if ($affiliate_client_id == -1) {
$affiliate_condition = "Clients.crmuser_id > 0";
} else if ($affiliate_client_id > 0) {
$affiliate_condition = "Clients.crmuser_id = " . $affiliate_client_id;
}
if($employee_id == -1){
if(!empty($affiliate_condition)){
$affiliate_condition .= " AND Clients.employee_id > 0";
}else{
$affiliate_condition = " Clients.employee_id > 0";
}
}else if($employee_id > 0){
if(!empty($affiliate_condition)){
$affiliate_condition .= " AND Clients.employee_id = " . $employee_id;
}else{
$affiliate_condition = " Clients.employee_id = " . $employee_id;
}
}
list($affiliate_client_list,$emlpoyee_list,$employee_affiliate_list) = $this->generateAffiliateList($employee_id);
}
$is_source = 0;
if ($this->request->params['action'] == 'clientonboarding') {
$is_source = 1;
}
if (!empty($affiliate_condition)) {
$affiliate_condition .= " AND Clients.is_source = " . $is_source;
} else {
$affiliate_condition = "Clients.is_source = " . $is_source;
}
if($is_show_all_clients == 2){
$auth_employee_id = $this->Auth->user('user_id');
if (!empty($affiliate_condition)) {
$affiliate_condition .= " AND Clients.employee_id = ".$auth_employee_id;
} else {
$affiliate_condition = "Clients.employee_id = ".$auth_employee_id;
}
}
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
$search = $this->request->query('search');
$condition = ' ( Clients.name LIKE ' . "'%" . $search . "%' OR Clients.phone LIKE '%" . $search . "%' OR Clients.website LIKE '%" . $search . "%'"
. "OR Contacts.first_name LIKE '%" . $search . "%' OR Contacts.last_name LIKE '%" . $search . "%') ";
$clients = $this->Contacts->find('all')->contain(['Clients'])
->where([$affiliate_condition, 'Clients.cmsuser_id' => $cmsuser_id, $condition, $clientId, $status]);
} else {
$clients = $this->Contacts->find('all')->contain(['Clients'])
->where([$affiliate_condition, 'Contacts.is_primary_contact' => 1,
'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status]);
}
$user_permissions = $this->request->session()->read('user_permissions');
$this->loadModel('Sertg');
$paginated_clients = [];
foreach ($this->paginate($clients) as $client) {
$client->sertg_file = $sertg_file;
$paginated_clients[] = $client;
}
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
$isVelocityUser = true;
}
$this->set('client_type', $client_type);
$this->set('affliliate_client_id', $affiliate_client_id);
$this->set('affiliate_client_list', $affiliate_client_list);
$this->set('employee_affiliate_list', $employee_affiliate_list);
$this->set('employee_list', $emlpoyee_list);
$this->set('employee_id', $employee_id);
$this->set('isAffitliate', $this->isAffiliateUser());
$this->set('status', $selected_status);
$this->set('user_permission', $user_permissions);
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
$this->set('clients', $paginated_clients); //$this->paginate($clients));
$this->set('searchText', $search);
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
$this->set('nav_arr', $nav_arr);
$this->set('page_limit', $page_limit);
$this->set('isVelocityUser', $isVelocityUser);
$this->set("is_source", $is_source);
}
public function creditreportstatus($client_id){
$isAffliliate = false;
if($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2){
$isAffliliate = true;
}
if($isAffliliate){
$this->loadModel('Clients');
$crmuser_id = $this->Auth->user('user_id');
$result = $this->Clients->isAffliliateHasClient($crmuser_id,$client_id);
if(!$result){
$this->redirect(['action'=>'clientcreditreportlist']);
}
}
$page = 1;
$page_limit = 10;
$search_contain = "";
$source_type = "";
if($this->request->is('ajax')){
$ajaxData = $this->request->getData();
$response = "";
if($ajaxData['action']== "ITEM_CHANGE"){
$response = $this->itemChange($ajaxData);
}else if($ajaxData['action']== "ACCOUNT_TYPE_CHANGE"){
$response = $this->accountTypeChange($ajaxData);
}
echo json_encode($response);
exit;
}
$commonLogic = new commonLogic;
$data = $commonLogic->commonCreditReportStatus($this->request->query,$client_id);
$data['isEditmode'] = true;
//pr($data);exit;
$this->set($data);
$this->render('/Client/creditreportstatus');
}
private function accountTypeChange($inputData){
$result = false;
if($inputData['type'] == "PB"){
$this->loadModel('DataPublicRecords');
$result = $this->DataPublicRecords->changePublicRecordValueById($inputData);
}else if($inputData['type'] == "ACC"){
$this->loadModel('DataItemKeyValues');
$result =$this->DataItemKeyValues->changeItemkeyValueById($inputData);
}
return $result;
}
private function itemChange($inputData){
$result = false;
if($inputData['item_type'] == "ACC"){
$this->loadModel('DataItemKeyValues');
$result =$this->DataItemKeyValues->updateItemValueById($inputData);
}else if($inputData['item_type'] == "PB"){
$this->loadModel('DataPublicRecords');
$result = $this->DataPublicRecords->updatePublicRecordValueById($inputData);
}else if($inputData['item_type'] == "INQ"){
$this->loadModel('DataInquiries');
$result = $this->DataInquiries->updateInquiryValueById($inputData);
}else if($inputData['item_type'] == "PI"){
$this->loadModel('DataBasicKeyValues');
$result =$this->DataBasicKeyValues->updateItemValueById($inputData);
}
return $result;
}
private function isAffiliateUser() {
$result = false;
if ($this->Auth->user('type') == AFFILIATE_USER_TYPE) {
$result = true;
}
return $result;
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$passcreator = new PasswordCreator;
$identity_iq_link = $this->Auth->user('identity_iq_link');
$smart_credit_link = $this->Auth->user('smart_credit_link');
$this->loadModel('Cmsusers');
$this->loadModel('Personalizes');
$this->loadModel('ClientImagesHistory');
$user = $this->Auth->user();
if(!empty($user)){
if(!empty($user['identity_iq_link'])){
$credit_report_dropdown[1] = REPORT_SOURCE_TYPES[1];
}
if(!empty($user['smart_credit_link'])){
$credit_report_dropdown[3] = REPORT_SOURCE_TYPES[3];
}
}
$this->loadModel('CreditReports');
if ($_SESSION['userType'] == CONTACT_USER_INDICATOR) {
if (empty($id)) {
$id = $this->Auth->user('client_id');
}
}
if (empty($id) || $id == "undefined") {
return $this->redirect($this->referer());
}
if (isset($id)) {
$client_id = $id;
} else {
$user_id = $this->Auth->user('user_id');
$user_row = TableRegistry::get('contacts')->find('all')->where(['id' => $user_id])->toArray();
//pr($user_row);exit();
$client_id = $user_row[0]['client_id'];
}
$is_photo_upload_section = false;
$request = $this->request->getData();
// dd($request,$client_id);exit;
//is_client_info
if($request['is_client_info'] == 0 && $this->request->is('post')){
if (isset($this->request->data['uploadmedia']['identification'])) {
$rtg_letter_image_id = 1;
$image_path = 'identification';
} elseif (isset($this->request->data['uploadmedia']['mail_doc'])) {
$rtg_letter_image_id = 2;
$image_path = 'mail_doc';
} elseif (isset($this->request->data['uploadmedia']['ssn'])) {
$rtg_letter_image_id = 3;
$image_path = 'ssn';
} elseif (isset($this->request->data['uploadmedia']['state_photo_id']) && !empty($this->request->data['uploadmedia']['state_photo_id'])) {
$rtg_letter_image_id = 4;
$image_path = 'state_photo_id';
} elseif (isset($this->request->data['uploadmedia']['notarized_letter'])) {
$rtg_letter_image_id = 5;
$image_path = 'notarized_letter';
} elseif (isset($this->request->data['uploadmedia']['cr_report'])) {
$rtg_letter_image_id = 6;
$image_path = 'cr_report';
} elseif (isset($this->request->data['uploadmedia']['trouble_mark_file'])) {
$rtg_letter_image_id = 7;
$image_path = 'trouble_mark_file';
} elseif (isset($this->request->data['uploadmedia']['item_challenge_file'])) {
$rtg_letter_image_id = 8;
$image_path = 'item_challenge_file';
}
if (isset($this->request->data['image_id']) && !empty($this->request->data['uploadmedia'][$image_path])) {
$is_photo_upload_section = true;
$image_id = $this->request->data['image_id'];
$uploadmediaTable = TableRegistry::get('uploadmedias');
$uploadmedia = $uploadmediaTable->get($image_id);
$image = $this->request->data['uploadmedia'][$image_path];
//$unique_name = uniqid() . '.jpg';
$pos = strpos($image, ';');
$extension = end(explode("/",explode(':', substr($image, 0, $pos))[1]));
$unique_name = uniqid().$uploadmedia->rtg_letter_image_id. '.'.$extension;
if ($this->uploadFile($image, $unique_name, $client_id)) {
unlink(CONTACT_PHOTO . $uploadmedia->image_path);
$uploadmedia->image_path = $client_id . '/' . $unique_name;
$uploadmedia->modified_on = date("Y-m-d h:i:s");
if ($saved_data = $uploadmediaTable->save($uploadmedia)) {
//add_log
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
$logData['status'] = "success";
$logData['input_data']["id"] = $saved_data->id;
$logData['input_data'] = $this->request->getData();
$logData['input_data']['uploadmedia'][$image_path] = "IMAGE_BASE_64";
$this->appLog($logData);
$this->Flash->success(__('Media has been updated Successfully!.'));
$historyUpdate['client_id'] = $client_id;
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
$historyUpdate['action_type'] = 1;
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
} else {
$this->Flash->error(__('Media has not been updated!.'));
}
return $this->redirect($this->referer());
}
} else {
if (!empty($this->request->data['uploadmedia'][$image_path])) {
$is_photo_upload_section = true;
$uploadmediaTable = TableRegistry::get('uploadmedias');
$uploadmedia = $uploadmediaTable->newEntity();
$uploadmedia->client_id = $client_id;
//pr($rtg_letter_image_id);exit;
$uploadmedia->rtg_letter_image_id = $rtg_letter_image_id;
$image = $this->request->data['uploadmedia'][$image_path];
//var_dump($image); exit;
$pos = strpos($image, ';');
$extension = end(explode("/",explode(':', substr($image, 0, $pos))[1]));
$unique_name = uniqid() . '.'.$extension;
//$unique_name = uniqid() . '.jpg';
if ($saved_data = $this->uploadFile($image, $unique_name, $client_id)) {
$uploadmedia->image_path = $client_id . '/' . $unique_name;
$uploadmedia->created_on = date("Y-m-d h:i:s");
$uploadmedia->modified_on = date("Y-m-d h:i:s");
if ($uploadmediaTable->save($uploadmedia)) {
// client image history add
$this->loadModel('ClientImagesHistory');
$historyUpdate['client_id'] = $client_id;
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
$historyUpdate['action_type'] = 1;
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
//add_log
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
$logData['status'] = "success";
$logData['input_data']["id"] = $saved_data->id;
$logData['input_data'] = $this->request->getData();
$logData['input_data']['uploadmedia'][$image_path] = "IMAGE_BASE_64";
$this->appLog($logData);
$this->Flash->success(__('Media has been uploaded.'));
} else {
$this->Flash->error(__('Media has not been uploaded.'));
}
return $this->redirect($this->referer());
}
}
}
}
//pr($client_id);exit;
$creditreport = TableRegistry::get('creditreportsetups')->find('all')->where(['client_id' => $client_id])->toArray();
if (empty($this->request->data['creditreport']['cra_report'])) {
$this->request->data['creditreport']['cra_report'] = "N/A";
}
if (count($creditreport) > 0) {
if (!$is_photo_upload_section && $this->request->is('post')) {
$creditreport = $creditreport[0];
$creditreport->cra_report = $this->request->data['creditreport']['cra_report'];
$creditreport->credit_bureau_address = $this->request->data['creditreport']['credit_bureau_address'];
$creditreport->credit_report_company_type = $this->request->data['creditreport']['company_type'];
$creditreport->first_name = $this->request->data['creditreport']['first_name'];
$creditreport->last_name = $this->request->data['creditreport']['last_name'];
$creditreport->street_no = $this->request->data['creditreport']['street_no'];
$creditreport->street_name = $this->request->data['creditreport']['street_name'];
$creditreport->city = $this->request->data['creditreport']['city'];
$creditreport->state = $this->request->data['creditreport']['state'];
$creditreport->social_secuirty_no = $this->request->data['creditreport']['ssn'];
$creditreport->sincerely = $this->request->data['creditreport']['sincerely'];
$creditreport->birth_date = $this->request->data['creditreport']['birth_date'];
$creditreport->credit_report_company_name = $this->request->data['creditreport']['credit_report_company_name'];
$creditreport->credit_report_company_username = $this->request->data['creditreport']['credit_report_company_username'];
$creditreport->credit_report_company_password = $this->request->data['creditreport']['credit_report_company_password'];
$creditreport->client_id = $client_id;
$creditreport->modified_on = date("Y-m-d H:i:s");
$creditreportEntity = $this->CreditReports->patchEntity($creditreport, $this->request->data['creditreport']);
$error = $creditreportEntity->errors();
if (!empty($error)) {
$this->set('errors', $error);
} else {
if ($saved_data = $this->CreditReports->save($creditreportEntity)) {
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = $client_id;
$everythinData['action_on_name'] = $creditreport->first_name." ".$creditreport->last_name;
$everythinData['event_name'] = "creditreportsetup_updated_by_client";
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
//add_log
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
$logData['status'] = "success";
$logData['input_data']["id"] = $saved_Data->id;
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('The Credit Report has been updated.'));
return $this->redirect($this->referer());
} else {
$this->Flash->error(__('The Credit Report is not updated'));
}
}
}
$creditreport[0]->credit_report_company_password = $passcreator->customEncryptionDecryption($creditreport[0]->credit_report_company_password, 'decrypt');
//dd($creditreport[0]);
$this->set('creditreport', $creditreport[0]);
} else {
if($request['is_client_info'] == 1&& $this->request->is('post')) {
$creditreporttable = TableRegistry::get('creditreportsetups');
$creditreport = $creditreporttable->newEntity();
if ($_SESSION['userType'] != CONTACT_USER_INDICATOR) {
$creditreport->cra_report = $this->request->data['creditreport']['cra_report'];
$creditreport->credit_bureau_address = $this->request->data['creditreport']['credit_bureau_address'];
}
$creditreport->credit_report_company_type = $this->request->data['creditreport']['company_type'];
$creditreport->first_name = $this->request->data['creditreport']['first_name'];
$creditreport->last_name = $this->request->data['creditreport']['last_name'];
$creditreport->street_no = $this->request->data['creditreport']['street_no'];
$creditreport->street_name = $this->request->data['creditreport']['street_name'];
$creditreport->city = $this->request->data['creditreport']['city'];
$creditreport->state = $this->request->data['creditreport']['state'];
$creditreport->social_secuirty_no = $this->request->data['creditreport']['ssn'];
$creditreport->sincerely = $this->request->data['creditreport']['sincerely'];
$creditreport->birth_date = $this->request->data['creditreport']['birth_date'];
$creditreport->credit_report_company_name = $this->request->data['creditreport']['credit_report_company_name'];
$creditreport->credit_report_company_username = $this->request->data['creditreport']['credit_report_company_username'];
$creditreport->credit_report_company_password = $this->request->data['creditreport']['credit_report_company_password'];
$creditreport->client_id = $client_id;
$creditreport->created_on = date("Y-m-d H:i:s");
$creditreport->modified_on = date("Y-m-d H:i:s");
$creditreportEntity = $this->CreditReports->patchEntity($creditreport, $this->request->data['creditreport']);
$error = $creditreportEntity->errors();
if (!empty($error)) {
$this->set('errors', $error);
} else {
if ($saved_data = $creditreporttable->save($creditreportEntity)) {
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = $client_id;
$everythinData['action_on_name'] = $creditreport->first_name." ".$creditreport->last_name;
$everythinData['event_name'] = "creditreportsetup_updated_by_client";
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
//add_log
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
$logData['status'] = "success";
$logData['input_data']["id"] = $saved_data->id;
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('The Credit Report has been updated.'));
return $this->redirect($this->referer());
} else {
$this->Flash->error(__('The Credit Report is not updated'));
}
}
}
}
//setting the video tutorial
$identification = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 1])->toArray();
$mail_doc = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 2])->toArray();
$ssn = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 3])->toArray();
$state_photo_id = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 4])->toArray();
$notarized_letter = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 5])->toArray();
$cr_report = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 6])->toArray();
$trouble_mark_file = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 7])->toArray();
$item_challenge_file = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 8])->toArray();
//pr($state_photo_id);exit;
if (count($identification) > 0) {
$this->set('identification', $identification[0]);
}
if (count($mail_doc) > 0) {
$this->set('mail_doc', $mail_doc[0]);
}
if (count($ssn) > 0) {
$this->set('ssn', $ssn[0]);
}
if (count($state_photo_id) > 0) {
$this->set('state_photo_id', $state_photo_id[0]);
}
if (count($notarized_letter) > 0) {
$this->set('notarized_letter', $notarized_letter[0]);
}
if (count($cr_report) > 0) {
$this->set('cr_report', $cr_report[0]);
}
if (count($trouble_mark_file) > 0) {
$this->set('trouble_mark_file', $trouble_mark_file[0]);
}
if (count($item_challenge_file) > 0) {
$this->set('item_challenge_file', $item_challenge_file[0]);
}
$formsTable = TableRegistry::get('Forms');
$result = $formsTable->get(66);
$this->set('result', $result);
$this->set('credit_report_dropdown', $credit_report_dropdown);
$this->set(compact('identity_iq_link','smart_credit_link','privacy_guard_link'));
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('languages', $this->languages); // var $languages member variable of App Controler
$this->set('module_pages', $this->getPages());
$this->set('user_permission', $user_permissions);
}
/**
* View method
*
* @param string|null $id Client Creditreport id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientCreditreport = $this->ClientCreditreport->get($id, [
'contain' => []
]);
$this->set('clientCreditreport', $clientCreditreport);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$clientCreditreport = $this->ClientCreditreport->newEntity();
if ($this->request->is('post')) {
$clientCreditreport = $this->ClientCreditreport->patchEntity($clientCreditreport, $this->request->getData());
if ($this->ClientCreditreport->save($clientCreditreport)) {
$this->Flash->success(__('The client creditreport has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client creditreport could not be saved. Please, try again.'));
}
$this->set(compact('clientCreditreport'));
}
/**
* Edit method
*
* @param string|null $id Client Creditreport id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$clientCreditreport = $this->ClientCreditreport->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientCreditreport = $this->ClientCreditreport->patchEntity($clientCreditreport, $this->request->getData());
if ($this->ClientCreditreport->save($clientCreditreport)) {
$this->Flash->success(__('The client creditreport has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client creditreport could not be saved. Please, try again.'));
}
$this->set(compact('clientCreditreport'));
}
/**
* Delete method
*
* @param string|null $id Client Creditreport id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientCreditreport = $this->ClientCreditreport->get($id);
if ($this->ClientCreditreport->delete($clientCreditreport)) {
$this->Flash->success(__('The client creditreport has been deleted.'));
} else {
$this->Flash->error(__('The client creditreport could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
private function uploadFile($image, $unique_name, $client_id) {
$extension = pathinfo($unique_name, PATHINFO_EXTENSION);
if (!is_dir('contact_photo/' . $client_id)) {
mkdir('contact_photo/' . $client_id, 0777, true);
}
$target_dir = 'contact_photo/' . $client_id . '/';
$target_file = $target_dir . basename($unique_name);
if (is_array($image) && isset($image["tmp_name"]) && !empty($image["tmp_name"])) {
move_uploaded_file($image["tmp_name"], $target_file);
$image_size = $image["size"];
} else {
$default_base_64_string = 'data:image/jpeg;base64,';
$extension = strtolower($extension);
if($extension == "png"){
$default_base_64_string = 'data:image/png;base64,';
}else if($extension == "jpg" || $extension == "jpeg"){
$default_base_64_string = 'data:image/jpeg;base64,';
}else if($extension == "bmp"){
$default_base_64_string = 'data:image/bmp;base64,';
}
$data = str_replace($default_base_64_string, '', $image);
$data = base64_decode($data);
// $data = str_replace('data:image/jpeg;base64,', '', $image);
// $data = base64_decode($data);
file_put_contents($target_file, $data);
$image_size = filesize($target_file);
}
if ($image_size > UPLOAD_MEDIA_SIZE) {
unlink($target_file);
$this->Flash->error(__('Sorry your file size is greater than '.UPLOAD_MEDIA_SIZE.' Mb.'));
return false;
} else {
//file_put_contents($target_file, $data);
return true;
}
}
public function clearMedia($image_id = Null) {
//echo $image_id;exit;
//$this->request->allowMethod(['post', 'delete']);
//$image_id = $this->request->data['image_id'];
$uploadmediaTable = TableRegistry::get('uploadmedias');
$uploadmedia = $uploadmediaTable->get($image_id);
//pr($uploadmedia);exit;
if ($uploadmediaTable->delete($uploadmedia)) {
unlink(CONTACT_PHOTO . $uploadmedia->image_path);
//add_log
$logData['action'] = "CLIENTREPORT_DELETE";
$logData['status'] = "success";
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('Media has been deleted successfully!.'));
$this->loadModel('ClientImagesHistory');
$historyUpdate['client_id'] = $uploadmedia->client_id;
$historyUpdate['image_type_id'] = $uploadmedia->rtg_letter_image_id;
$historyUpdate['action_type'] = 2;
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
return $this->redirect($this->referer());
} else {
$this->Flash->error(__('Media has not been deleted!.'));
}
}
}

View File

@@ -0,0 +1,136 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Helper\commonLogic;
/**
* ClientFiles Controller
*
*
* @method \App\Model\Entity\ClientFile[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientFilesController extends AppController
{
public function initialize() {
parent::initialize();
if($this->setClientControllerAccess()){
$this->Auth->Allow(['agreementfiles']);
}
$this->setUserType();
}
public function agreementfiles($assignment_id = ""){
if($assignment_id > 0){
$this->agreementdownload($assignment_id);
}
$member_id = $this->Auth->user('id');
$client_id = $this->Auth->user('client_id');
$this->loadModel('AgreementAssignments');
$extras['status'] = 1;
$extras['isFirst'] = false;
$extras['colums'] = ['id','AgreementFormats.title'];
$agreements = $this->AgreementAssignments->getAgreementFormatWithClientAssignmentByMemberIdAndClientId($member_id,$client_id,$extras);
$this->set(compact('agreements'));
}
private function agreementdownload($assignment_id = ""){
if($this->request->is('post') && $this->Auth->user()){
if($assignment_id > 0){
$common = new commonLogic();
$common->downloadAgreementByAssignmentId($assignment_id);
}
}
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$clientFiles = $this->paginate($this->ClientFiles);
$this->set(compact('clientFiles'));
}
/**
* View method
*
* @param string|null $id Client File id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientFile = $this->ClientFiles->get($id, [
'contain' => []
]);
$this->set('clientFile', $clientFile);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$clientFile = $this->ClientFiles->newEntity();
if ($this->request->is('post')) {
$clientFile = $this->ClientFiles->patchEntity($clientFile, $this->request->getData());
if ($this->ClientFiles->save($clientFile)) {
$this->Flash->success(__('The client file has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client file could not be saved. Please, try again.'));
}
$this->set(compact('clientFile'));
}
/**
* Edit method
*
* @param string|null $id Client File id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$clientFile = $this->ClientFiles->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientFile = $this->ClientFiles->patchEntity($clientFile, $this->request->getData());
if ($this->ClientFiles->save($clientFile)) {
$this->Flash->success(__('The client file has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client file could not be saved. Please, try again.'));
}
$this->set(compact('clientFile'));
}
/**
* Delete method
*
* @param string|null $id Client File id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientFile = $this->ClientFiles->get($id);
if ($this->ClientFiles->delete($clientFile)) {
$this->Flash->success(__('The client file has been deleted.'));
} else {
$this->Flash->error(__('The client file could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,269 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\View\View;
/**
* ClientNote Controller
*
*
* @method \App\Model\Entity\ClientNote[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientNoteController extends AppController
{
public function initialize() {
parent::initialize();
if($this->setClientControllerAccess()){
$this->Auth->Allow(['note','clientchat','addnote']);
}
$this->setUserType();
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function note($crmuser_id = null, $user_name = ""){
$member_id = $this->Auth->user('id');
$client_id = $this->Auth->user('client_id');
if($this->request->is('ajax')){
$request = $this->request->getData();
$request['client_id'] = $client_id;
$response = $this->getChatAjax($request);
echo json_encode($response);
exit;
}
$page_limit = 10;
$this->loadModel('Notes');
$this->paginate = [
'limit' => $page_limit,
'order' => [
'Notes.id' => 'desc'
]
];
if($this->request->params['_matchedRoute'] == "/client/notelist/*"){
}else{
//$notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$crmuser_id);
}
$note_category = [1,2,4];
$notes = $this->Notes->getNotesByClientIdWithMemberId($member_id,$client_id,0,$note_category);
if(!empty($notes)){
$notes = $this->paginate($notes);
}
$ajax_url = '/ClientNote/note/'.$crmuser_id;
$this->set(compact('notes','crmuser_id','ajax_url','user_name'));
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('user_permission', $user_permissions);
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
$this->set('nav_arr', $nav_arr);
$this->set('page_limit', $page_limit);
}
private function getChatAjax($inputData){
$response = null;
$member_id = $this->Auth->user('id');
$client_id = $this->Auth->user('client_id');
$this->loadModel('NoteDetails');
$this->loadModel('Notes');
$this->loadModel('Crmusers');
$this->loadModel('Clients');
$userType = 3;
$parent_name = $_SESSION['Auth']['User']['member_name'];
$child_name = $_SESSION['Auth']['User']['client_name'];
if($inputData['action'] == 'GET_REPLY_DATA'){
$note_id = $inputData['note_id'];
$notes = $this->NoteDetails->getNotesDetailsByNoteIdWithMemberId($member_id,$note_id);
$first_note_info = $notes[0];
if($first_note_info->note_type == 4){
$employee_id = $first_note_info->note->crmuser_id;
$parent_info = $this->Crmusers->find()->where(['id'=>$employee_id])->first();
$parent_name = $parent_info->first_name." ".$parent_info->last_name;
}
$noteData['status'] = 1;
$noteData['note_id'] = $note_id;
$this->NoteDetails->updateAll(['status'=>1],['note_id'=>$note_id]);
$count_reply = 0;
$view = new View($this->request, $this->response);
$view->viewPath = 'ClientNote';
$view->layout = false;
$title = $inputData['title'];
$view->set(compact('notes','title','note_id','parent_name','child_name'));
$html = $view->render('chat_layout');
$response = $html;
} else if($inputData['action'] == 'SEND_REPLY_MESSAGE'){
$note_id = $inputData['note_id'];
$data['note_id'] = $note_id;
$data['note_type'] = $userType;
$data['status'] = 2;
$data['note'] = $inputData['note'];
if(!empty($inputData['attachment'])){
$new_name = uniqid().time().".jpg";
$file_name = $this->chatAttachmentUpload($inputData['attachment'],$new_name);
$data['attachment'] = $file_name;
}
$note = $this->NoteDetails->addNoteDetail($data);
$noteData['note_id'] = $note_id;
$noteData['status'] = 2;
$this->Notes->updateNote($noteData);
$view = new View($this->request, $this->response);
$view->viewPath = 'ClientNote';
$view->layout = false;
$view->set(compact('note'));
$html = $view->render('chat_msg');
$response = $html;
$this->Clients->updateNoteStatusById($client_id,1);
}
return $response;
}
public function clientchat(){
$member_id = $this->Auth->user('id');
$crmuser_id = $this->Auth->user('user_id');
$client_id = 0;
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
$client_id = $this->Auth->user('client_id');
}
if($this->request->is('ajax')){
$request = $this->request->getData();
//pr($request);exit;
$request['crmuser_id'] = $crmuser_id;
if($client_id > 0){
$request['client_id'] = $client_id;
$request['crmuser_id'] = 0;
}
$response = $this->getChatAjax($request);
echo json_encode($response);
exit;
}
$page_limit = 10;
$this->loadModel('Notes');
$this->paginate = [
'limit' => $page_limit,
'order' => [
'Notes.id' => 'desc'
]
];
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
$notes = $this->Notes->getNotesByClientIdWithMemberId($member_id,$client_id);
$crmuser_id = $client_id;
}else{
$notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$crmuser_id);
}
if(!empty($notes)){
$notes = $this->paginate($notes);
}
$ajax_url = '/ClientNote/clientchat/';
$this->set(compact('notes','crmuser_id','ajax_url'));
$user_permissions = $this->request->session()->read('user_permissions');
$this->set('user_permission', $user_permissions);
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
$this->set('nav_arr', $nav_arr);
$this->set('page_limit', $page_limit);
$this->render('note');
}
public function addnote() {
$member_id = $this->Auth->user('id');
$employee_id = $this->Auth->user('employee_id');
$crmuser_id = $employee_id;
$this->loadModel('Clients');
$client_id = $this->Auth->user('client_id');
$note_type = 3;
if($this->request->is('post')){
$request = $this->request->getData();
$actionName = '/ClientNote/clientchat';
$count_reply = 1;
$this->loadModel('Notes');
$this->loadModel('NoteDetails');
$this->loadModel('Crmusers');
if(!empty($request['title']) && !empty($request['message'])){
$noteData['note'] = $request['message'];
$noteData['title'] = $request['title'];
$noteData['cmsuser_id'] = $member_id;
$noteData['crmuser_id'] = $crmuser_id;
$noteData['client_id'] = $client_id;
$noteData['title'] = $request['title'];
$noteData['status'] = 2;
if(!empty($request['attachment'])){
$new_name = uniqid().time().".jpg";
$file_name = $this->chatAttachmentUpload($request['attachment'],$new_name);
$noteData['attachment'] = $file_name;
}
$result = $this->Notes->addNote($noteData);
$noteData['note_id'] = $result->id;
$noteData['note_type'] = $note_type;
$noteData['status'] = 2;
$result1 = $this->NoteDetails->addNoteDetail($noteData);
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
$this->Clients->updateNoteStatusById($client_id,$count_reply);
$actionName = '/ClientNote/addnote';
}else {
$this->Crmusers->updateNoteStatusById($crmuser_id,$count_reply);
}
if(!empty($result1)){
//add_log
$logData['action'] = "NOTES_ADD";
$logData['status'] = "success";
$logData['input_data']["id"]=$result1->id;
$logData['input_data'] = $this->request->getData();
$this->appLog($logData);
$this->Flash->success(__('Note has been sent successfully.'));
return $this->redirect('/ClientNote/note');
}
}else{
$this->Flash->error(__('Note has not been sent.Please try again.'));
}
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
return $this->redirect($this->referer());
}
return $this->redirect($actionName);
}
}
private function chatAttachmentUpload($file,$new_name){
$member_id = $this->Auth->user('id');
$dir = "chat_attachment/".$member_id;
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$target_file = $dir."/".$new_name;
if(!empty($file)){
//$data = str_replace('data:image/jpeg;base64,', '', $file);
//$data = base64_decode($data);
$exploded_string = explode(',',$file);
$data = base64_decode($exploded_string[1]);
file_put_contents($target_file, $data);
}
return $target_file;
}
}

View File

@@ -0,0 +1,149 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
/**
* ClientPopups Controller
*
*
* @method \App\Model\Entity\ClientPopup[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientPopupsController extends AppController
{
public function initialize() {
parent::initialize();
if (Permission::isEmployeeAsAdmin()) {
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
}
$this->checkRTGuser(); // is RTG User or not
$this->setUserType();
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$member_id = $this->Auth->user('id');
$this->loadModel('ClientPopups');
if($this->request->is('ajax')){
$request = $this->request->getData();
$response['status'] = false;
$response['message'] = "";
if($request['action'] == "CLEAR_CONTENT"){
$member_id = $request['member_id'];
if($response['status'] = $this->ClientPopups->removeContentById($member_id)){
$response['message'] = "Content has been removed.";
}
}
echo json_encode($response);
die();
}
if($this->request->is('post')){
$request = $this->request->getData();
$request['member_id'] = $member_id;
if($this->ClientPopups->insertOrUpdateCientPopups($request)){
$this->Flash->success(__('Client Popups has been saved.'));
}
}
$client_popup = $this->ClientPopups->getClientPopupByMemberId($member_id);
$content_path = "/images/no_image.png";
if(file_exists($client_popup->content_path)){
$content_path = "/".$client_popup->content_path;
}
$this->set(compact('client_popup','content_path'));
}
/**
* View method
*
* @param string|null $id Client Popup id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientPopup = $this->ClientPopups->get($id, [
'contain' => [],
]);
$this->set('clientPopup', $clientPopup);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$clientPopup = $this->ClientPopups->newEntity();
if ($this->request->is('post')) {
$clientPopup = $this->ClientPopups->patchEntity($clientPopup, $this->request->getData());
if ($this->ClientPopups->save($clientPopup)) {
$this->Flash->success(__('The client popup has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client popup could not be saved. Please, try again.'));
}
$this->set(compact('clientPopup'));
}
/**
* Edit method
*
* @param string|null $id Client Popup id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$clientPopup = $this->ClientPopups->get($id, [
'contain' => [],
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientPopup = $this->ClientPopups->patchEntity($clientPopup, $this->request->getData());
if ($this->ClientPopups->save($clientPopup)) {
$this->Flash->success(__('The client popup has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client popup could not be saved. Please, try again.'));
}
$this->set(compact('clientPopup'));
}
/**
* Delete method
*
* @param string|null $id Client Popup id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientPopup = $this->ClientPopups->get($id);
if ($this->ClientPopups->delete($clientPopup)) {
$this->Flash->success(__('The client popup has been deleted.'));
} else {
$this->Flash->error(__('The client popup could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,741 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
use App\Helper\commonLogic;
use Cake\Controller\Controller;
/**
*ClientSecurePortalLogin Controller
* *
* @method \App\Model\Entity\ClientSecurePortalLogin[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */
class ClientSecurePortalLoginController extends AppController
{
public function initialize()
{
parent::initialize();
$this->checkRTGuser(); // is RTG User or not
$this->setUserType();
/*if ($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
$isAllclients = $this->isAccessAllClients();
if ($isAllclients) {
$employee_id = $this->Auth->user('user_id');
$client_id = $this->request->params['pass'][0];
if (!empty($client_id) && !empty($employee_id)) {
if (!$this->isValidEmployee($employee_id, $client_id) && $this->request->params['action'] != "index") {
return $this->redirect(['action' => 'index']);
}
}
}
}*/
$isPermitted = Permission::isPermitted(SECURE_PORTAL_CONTROLLER_ID);
if($isPermitted){
$this->Auth->allow(['index']);
}
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$this->clientList();
}
private function clientList() {
$member_id = $this->Auth->user('id');
$userTypeName = $this->getCurrentUserType();
$this->loadModel('Clients');
$affiliate_type = 0;
if ($this->request->is('ajax')) {
$inputData = $this->request->getData();
$this->loadModel('ClientAssignments');
$member_id = $this->Auth->user('id');
if ($inputData['action'] == 'CLIENT_STATUS_UPDATE') {
$message = "Status has not been updated.";
$response = $this->Clients->statusUpdateById($inputData['client_id'], $inputData['status']);
if ($response) {
$message = "Status has been updated successfully.";
}
} else if($inputData['action'] == 'CLIENT_SHIFT'){
$check_type = $inputData['check_type'];
$employee_id = 0;
$affiliate_id = 0;
$employee_list = $inputData['employee_list'];
$employee_affiliate_list = $inputData['employee_affiliate_list'];
$affiliateList = $inputData['affiliateList'];
if(!empty($employee_list)){
$employee_list = json_decode($employee_list,true);
}
if(!empty($employee_affiliate_list)){
$employee_affiliate_list = json_decode($employee_affiliate_list,true);
}
if(!empty($affiliateList)){
$affiliateList = json_decode($affiliateList,true);
}
$organizedData = $this->organizeClientShifting($inputData);
extract($organizedData);
$client_name = $inputData['client_name'];
$message = 'The Client "' . $client_name . '" has not been moved succesfully.';
$final_assoc = $inputData['final_assoc'];
//pr($final_assoc);exit;
$crmuser_id = $inputData['crmuser_id'];
$client_id = $inputData['client_id'];
$this->loadModel('ReminderNotification');
if($check_type == "unchecked"){
if($crmuser_id > 0){
$response = $this->ClientAssignments->deleteRelation($client_id,$crmuser_id);
$crmuserRefferenceIds = $this->Crmusers->getCrmUsersByIdsWithRefference([$crmuser_id]);
if(!empty($crmuserRefferenceIds)){
$updateData = current($crmuserRefferenceIds);
$updateData['client_id'] = $client_id;
$this->ReminderNotification->reminderNotificationStatusUpdate($updateData,0); // 0 = in active reminder
}
}else{
$response = $this->ClientAssignments->deleteMemberRelation($client_id,$member_id);
}
}else if($check_type == "checked"){
if($crmuser_id > 0){
$this->loadModel('Crmusers');
$crmuserRefferenceIds = $this->Crmusers->getCrmUsersByIdsWithRefference([$crmuser_id]);
if(!empty($crmuserRefferenceIds)){
$updateData = current($crmuserRefferenceIds);
$updateData['client_id'] = $client_id;
$this->ReminderNotification->reminderNotificationStatusUpdate($updateData,1); // 1 = active reminder
}
}else{
$crmuserRefferenceIds[] = ['refference_id'=>$member_id,'refference_type'=>1]; // 1 = member type
}
$this->loadModel('Clients');
$this->Clients->moveClient($inputData['client_id'],0); // 0 = move to main client list
$response = $this->ClientAssignments->updateClientRelation($inputData['client_id'],$crmuserRefferenceIds);
}
//$response = $this->Clients->assignAffiliateOrEmployee($inputData['client_id'],$employee_id,$affiliate_id);
if($response){
if(!empty($client_name)){
$message = 'The Client "' . $client_name . '" has been moved succesfully.';
}else{
$message = 'Client has been moved succesfully.';
}
}
}else if($inputData['action'] == 'EMPLOYEE_AFFILIATE_LIST'){
$commonLogic = new commonLogic();
$message = $commonLogic->clientsFilteringByMemberOREmployees($inputData);
}else if($inputData['action'] == 'GET_AGREEMENT_LIST'){
$message = $this->getAgrementListByClientId($inputData);
}else if($inputData['action'] == "ASSIN_AGREEMENT"){
$message = $this->assignAgreementByClientId($inputData);
}elseif ($inputData['action'] == "DELETE_AGREEMENT_FORMAT") {
$message = $this->deleteAgreementFormatById($inputData);
}else if($inputData['action'] == "AGREEMENT_REASSIGNED"){
$inputData['member_id'] = $member_id;
$message = $this->reassignedAgreement($inputData);
$message['html'] = $this->getAgrementListByClientId($inputData);
}else if($inputData['action'] == "REVOKE_AGREEMENT_REASSIGNED"){
$this->loadModel('AgreementAssignments');
$status = 1;
$inputData['member_id'] = $member_id;
$res = $this->AgreementAssignments->makeReAssignedAgreement($inputData,$status);
$message['status'] = false;
$message['message'] = "Revoked is not succesfull.";
if($res){
$message['status'] = true;
$message['message'] = "Successfully revoked re-assigned.";
$message['html'] = $this->getAgrementListByClientId($inputData);
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = SAME_AS_BY;
$everythinData['action_on_name'] = SAME_AS_BY;
$everythinData['event_name'] = "agreement_revoked_reassign";
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
}
}else if ($inputData['action'] == 'GET_CLIENT_EMAIL') {
// pr($inputData);exit;
$client_id = $inputData['client_id'];
$client_info = $this->Contacts->getPrimaryClientInfoByClientId($client_id);
$message['client_info'] = $client_info;
}else if ($inputData['action'] == 'SEND_CLIENT_EMAIL') {
$this->loadModel('SendEmailToClients');
$user_type = $this->getCurrentUserType();
$client_id = $inputData['client_id'];
$email_subject = $inputData['client_email_subject'];
$to_email = trim($inputData['client_email']);
$email_body = nl2br($inputData['client_email_body']);
$member_contact_name= $this->Auth->user('contact_name');
$member_contact_company= $this->Auth->user('company_name');
if($user_type == 'MEMBER'){
$inputData['sender_id'] = $this->Auth->User('id');
$inputData['sender_type'] = 1;
}else if($user_type == 'EMPLOYEE'){
$inputData['sender_id'] = $this->Auth->User('user_id');
$inputData['sender_type'] = 2;
}
$client_send_email = $this->SendEmailToClients->insertClientSendEmail($inputData);
// pr($inputData);exit;
if((!empty($member_contact_name) && !empty($member_contact_company))){
$client_regards = "Regards,<br/>".$member_contact_name.','.$member_contact_company;
}elseif (!empty($member_contact_name)){
$client_regards = "Regards,<br/>".$member_contact_name;
}elseif (!empty($member_contact_company)){
$client_regards = "Regards,<br/>".$member_contact_company;
}else{
$client_regards = "Regards<br/>";
}
$commonlogic = new commonLogic;
$personalize = $commonlogic->personalizeInfo();
$templateContent = [
'regards' => $client_regards,
'email_body' => $email_body
];
if(!empty($personalize['email_signature'])){
$templateContent['email_signature'] = $personalize['email_signature'];
}
$this->sendEmail('send_email_to_client', $templateContent, $to_email, $email_subject, "", $personalize['personalize']);
$message['status'] = true;
}else if ($inputData['action'] == 'SEND_CLIENT_LOGIN_CREDENTIAL') {
$password = $inputData['password'];
$c_password = $inputData['c_password'];
$contact_id = $inputData['contact_id'];
$message = "";
if($password == $c_password){
$this->loadModel('Contacts');
$contact_data['password'] = md5($password);
$contact_data['raw_password'] = $password;
if($this->Contacts->updateContactById($contact_id,$contact_data)){
$contact = $this->Contacts->getContactsById($contact_id);
$email = $contact->email;
if(!empty($email)) {
$message = 'Client login credential sent successfully.';
$member_contact_name = $this->Auth->user('contact_name');
$member_contact_company = $this->Auth->user('company_name');
if ((!empty($member_contact_name) && !empty($member_contact_company))) {
$client_regards = "Regards,<br/>" . $member_contact_name . ',' . $member_contact_company;
} elseif (!empty($member_contact_name)) {
$client_regards = "Regards,<br/>" . $member_contact_name;
} elseif (!empty($member_contact_company)) {
$client_regards = "Regards,<br/>" . $member_contact_company;
} else {
$client_regards = "Regards,<br/>";
}
$commonlogic = new commonLogic;
$personalize = $commonlogic->personalizeInfo();
$loginurl = $personalize['login_url'];
$templateContent = [
'firstname' => $contact->first_name . " " . $contact->last_name,
'loginurl' => $loginurl,
'user_email' => $email,
'password' => $contact->raw_password,
'member_name' => $this->Auth->user('email'),
'regards' => $client_regards
];
if (!empty($personalize['email_signature'])) {
$templateContent['email_signature'] = $personalize['email_signature'];
}
$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $templateContent, $email, "Client Portal Credential", "", $personalize['personalize']);
}
}
}
}
echo json_encode($message);
exit;
}
if ($this->request->is('post')){
$request = $this->request->getData();
if(isset($request['client_action_types']) && $request['client_action_types'] > 0){
$selected_client_ids = [];
if(!empty($request['selected_content'])){
$selected_client_ids = explode(',', $request['selected_content']);
}
if( $request['client_action_types'] == 1){ // For Delete All
$result = $this->Clients->deleteClientRelatedInfoByClientId($member_id,$selected_client_ids);
if($result){
$this->Flash->success(__('The selected clients has been deleted.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if( $request['client_action_types'] == 2){//For Make All Active
$status = 1;
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
if($result){
$this->Flash->success(__('The selected clients has been made active.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if( $request['client_action_types'] == 3){//For Make All InActive
$status = 2;
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
// print_r($result);exit;
if($result){
$this->Flash->success(__('The selected clients has been made Inactive.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if( $request['client_action_types'] == 4){//For Make All Graduated/Completed
$status = 3;
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
// print_r($result);exit;
if($result){
$this->Flash->success(__('The selected clients has been made Inactive.'));
} else {
$this->Flash->error(__('The action could not be executed. Please, try again.'));
}
}else if( $request['client_action_types'] == 5){//For Export All
if(!empty($selected_client_ids) && is_array($selected_client_ids)){
$export_condition = "Clients.id in (".implode(",",$selected_client_ids).")";
$this->query_to_csv($export_condition, $member_id);
}
}
}else if(isset($request['selected_reference_ids']) && !empty($request['selected_reference_ids'])){
$selected_reference_ids = json_decode($request['selected_reference_ids'],true);
$selected_client_ids = [];
$final_assoc = [];
if(!empty($request['selected_content'])){
$selected_client_ids = explode(',', $request['selected_content']);
}
if(!empty($selected_client_ids)){
$this->loadModel('ClientAssignments');
foreach($selected_client_ids as $c_id){
if(!empty($selected_reference_ids)){
foreach($selected_reference_ids as $r_id => $r_type){
if($r_type == 1 && $r_id == 0){
$r_id = $member_id;
}
$final_assoc[] = [
'client_id'=>$c_id,
'refference_id'=>$r_id,
'refference_type'=>$r_type
];
$this->ClientAssignments->deleteMemberRelation($c_id, $r_id, $r_type);
}
}
}
}
if(!empty($final_assoc)){
if($this->ClientAssignments->insertClientAssignMents($final_assoc)){
$this->Flash->success(__('The selected clients has been assigned.'));
}
}
//pr($final_assoc);exit;
}
}
$clientId = "";
if ($_SESSION['userType'] == CONTACT_USER_INDICATOR) {
$client_id = $_SESSION['global_client_id'];
$clientId = 'id =' . $client_id;
return $this->redirect('/client/view/' . $client_id);
}
$page_limit = 10;
$selected_status = 1; // for ui select active
$status = "Clients.status = ".$selected_status; // default active client
$client_type = 1;
$affiliate_client_id = 0;
$employee_id = 0;
$affiliate_client_list = [];
$emlpoyee_list = [];
$affiliate_condition = "";
if(isset($this->request->query['show_client_checkbox'])){
$this->set('show_client_checkbox',1);
}
$is_show_all_clients = $this->Auth->user('is_show_all_clients');
if (isset($this->request->query['page_limit'])) {
$page_limit = $this->request->query('page_limit');
}
if (isset($this->request->query['client_type'])) {
$client_type = $this->request->query('client_type');
}
if (isset($this->request->query['affiliate_client_id'])) {
$affiliate_client_id = $this->request->query('affiliate_client_id');
}
if (isset($this->request->query['employee_id'])) {
$employee_id = $this->request->query('employee_id');
}
if (isset($this->request->query['status']) && !empty($this->request->query['status'])) {
$status = "Clients.status = " . $this->request->query('status');
$selected_status = $this->request->query('status');
if($selected_status == "all"){
$status = "";
}
}
$this->paginate = [
'limit' => $page_limit,
'order' => [
'Clients.id' => 'desc',
'Contacts.id' => 'desc'
],
'maxLimit'=>500
];
$cmsuser_id = $this->Auth->user('id');
$search = '';
if (false) { // is affiliate user check
$affiliate_client_id = $this->Auth->user('user_id');
$affiliate_type = 2;
if($this->Auth->user('is_employee_affiliate')){
$affiliate_type = 4;
}
} else {
$is_employee = false;
if ($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
$is_employee = true;
}
list($affiliate_client_list,$emlpoyee_list,$employee_affiliate_list) = $this->generateAffiliateList($employee_id,$is_employee);
}
$is_source = 0;
if ($this->request->params['action'] == 'clientonboarding') {
$is_source = 1;
}
if($userTypeName != "AFFILIATE"){
if (!empty($affiliate_condition)) {
$affiliate_condition .= " AND Clients.is_source = " . $is_source;
} else {
$affiliate_condition = "Clients.is_source = " . $is_source;
}
}
if($is_show_all_clients == 2){
$auth_employee_id = $this->Auth->user('user_id');
}
// echo $affiliate_condition;exit;
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
$search = $this->request->query('search');
$condition = ' ( Clients.name LIKE ' . "'%" . $search . "%' OR Clients.phone LIKE '%" . $search . "%' OR Clients.website LIKE '%" . $search . "%'"
. "OR Contacts.first_name LIKE '%" . $search . "%' OR Contacts.last_name LIKE '%" . $search ."%'"
." OR CONCAT(Contacts.first_name, ' ' , Contacts.last_name) LIKE '%" . $search ."%'"
." OR Contacts.email LIKE '%" . $search ."%'"
. ") ";
}
if($_SESSION['userType'] == CMS_USER_INDICATOR
|| ($_SESSION['userType'] == STAF_USER_INDICATOR && $this->Auth->user('is_employee_to_member'))
|| ($_SESSION['userType']== CRM_USER_INDICATOR)){
$clients = $this->Contacts->find('all')
->contain(['Clients']);
$is_filtering = true;
/*
For All Employee $employee_id = -1
For A single employee $employee_id > 0
For All Affiliate $affiliate_client_id = -1
For A single Affiliate $affiliate_client_id > 0
*/
$reference_type_array = [];
$reference_id_array = [];
if($userTypeName == "EMPLOYEE"){
if($this->Auth->user('is_show_all_clients') == 1){
$is_filtering = false;
}else{
$reference_type_array[] = 3;
$reference_id_array[] = $this->Auth->user('user_id');
}
}
if($employee_id == -1){
$reference_type_array[] = 3;
}else if($employee_id > 0){
$reference_type_array[] = 3;
$reference_id_array[] = $employee_id;
}
if ($affiliate_client_id == -1 || $affiliate_client_id == -2) {
$reference_type_array[] = 2;
$reference_type_array[] = 4;
} else if ($affiliate_client_id > 0) {
if($affiliate_type == 0){
$this->loadModel('Crmusers');
$crmusers = $this->Crmusers->find()->where(['Crmusers.id' => $affiliate_client_id])->first();
$affiliate_type = 2;
if($crmusers->employee_id > 0){
$affiliate_type = 4;
}
}
if($affiliate_type > 0){
$reference_id_array[] = $affiliate_client_id;
$reference_type_array[] = $affiliate_type;
}else{
$reference_type_array[] = 2;
$reference_type_array[] = 4;
}
}
$new_dynamic_condition = "";
if(!empty($reference_type_array)){
$reference_type_array = array_unique($reference_type_array);
$new_dynamic_condition = 'CAT.refference_type in('.implode(",",$reference_type_array).")";
}
if(!empty($reference_id_array)){
$reference_id_array = array_unique($reference_id_array);
$current_condition = 'CAT.refference_id in('.implode(",",$reference_id_array).")";
if(!empty($new_dynamic_condition)){
$new_dynamic_condition .= " AND ".$current_condition;
}else{
$new_dynamic_condition = $current_condition;
}
}
if($is_filtering && !empty($new_dynamic_condition)){
$clients = $clients->join([
'table' => 'client_assignments',
'alias' => 'CAT',
'type' => 'INNER',
'conditions' => [
'Contacts.client_id = CAT.client_id',
$new_dynamic_condition
]
]);
}
$clients = $clients
->where([$condition,$affiliate_condition,'Contacts.is_primary_contact' => 1,
'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status])
->distinct('Contacts.client_id');
}else if($_SESSION['userType']== CRM_USER_INDICATOR){
$this->loadModel('ClientAssignments');
$CRM_AUTH_ID = $this->Auth->user('user_id');
$u_type = "refference_type = 1";
if($_SESSION['Auth']['User']['type'] == 1){
$u_type = "refference_type = 3";
}else if($_SESSION['Auth']['User']['type'] == 2){
$u_type = "refference_type = 2 OR refference_type = 4";
if($this->Auth->user('is_employee_affiliate')){
$u_type = "refference_type = 4";
}
}
if(!empty($u_type)){
$emp_client_ids = $this->ClientAssignments->getClientsByUserTypeIdAndCondition($CRM_AUTH_ID,$u_type);
}
$clients = [];
if(!empty($emp_client_ids)){
$clients = $this->Contacts->find('all')->contain(['Clients'])
->where(['Clients.id IN'=>$emp_client_ids, 'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status]);
}
}
//}
$user_permissions = $this->request->session()->read('user_permissions');
$this->loadModel('Sertg');
$paginated_clients = $clients;
$paginated_clients = $this->paginate($paginated_clients);
$client_ids = [];
$client_employee_relations = [];
$client_letter_set_assoc = [];
if(!empty($client_ids)){
$this->loadModel('ClientAssignments');
$user_type = 0;
if ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
$user_type = 4;
}
$client_employee_relationsData = $this->ClientAssignments->getClientsRealtionsByClientIds($client_ids, $user_type);
$client_employee_relations = $client_employee_relationsData['employees'];
}
// pr($client_employee_relationsData);
// pr($client_employee_relations);exit;
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
$isVelocityUser = true;
}
$this->loadModel('Notes');
$noteList = $this->Notes->getNotesByMemberIdWithNoteList($cmsuser_id);
$this->set('noteList', $noteList);
$this->set('client_type', $client_type);
$this->set('affliliate_client_id', $affiliate_client_id);
$this->set('affiliate_client_list', $affiliate_client_list);
$this->set('employee_affiliate_list', $employee_affiliate_list);
$this->set('employee_list', $emlpoyee_list);
$this->set('employee_id', $employee_id);
$this->set('status', $selected_status);
$this->set('user_permission', $user_permissions);
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
$this->set('clients', $paginated_clients); //$this->paginate($clients));
$this->set('searchText', $search);
$this->set('current_module', $this->getModules());
$this->set('page_list', $this->getPages());
$this->set('module_pages', $this->getPages());
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
$this->set('nav_arr', $nav_arr);
$this->set('page_limit', $page_limit);
$this->set('isVelocityUser', $isVelocityUser);
$this->set("is_source", $is_source);
$this->set("client_employee_relations", $client_employee_relations);
$this->set("client_employee_relationsData", $client_employee_relationsData);
$this->set("client_letter_set_assoc", $client_letter_set_assoc);
//$this->viewBuilder()->layout("custom_layout");
}
/**
* View method
*
* @param string|null $idClient Secure Portal Login id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id, [
'contain' => []
]);
$this->set('clientSecurePortalLogin', $clientSecurePortalLogin);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->newEntity();
if ($this->request->is('post')) {
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->patchEntity($clientSecurePortalLogin, $this->request->getData());
if ($this->ClientSecurePortalLogin->save($clientSecurePortalLogin)) {
$this->Flash->success(__('Theclient secure portal login has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Theclient secure portal login could not be saved. Please, try again.'));
}
$this->set(compact('clientSecurePortalLogin'));
}
/**
* Edit method
*
* @param string|null $idClient Secure Portal Login id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->patchEntity($clientSecurePortalLogin, $this->request->getData());
if ($this->ClientSecurePortalLogin->save($clientSecurePortalLogin)) {
$this->Flash->success(__('Theclient secure portal login has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Theclient secure portal login could not be saved. Please, try again.'));
}
$this->set(compact('clientSecurePortalLogin'));
}
/**
* Delete method
*
* @param string|null $idClient Secure Portal Login id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id);
if ($this->ClientSecurePortalLogin->delete($clientSecurePortalLogin)) {
$this->Flash->success(__('Theclient secure portal login has been deleted.'));
} else {
$this->Flash->error(__('Theclient secure portal login could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,202 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Utility\Common;
use App\Utility\CreditAnalysis;
use App\Utility\PdfWriter;
use Cake\Routing\Router;
use App\Helper\commonLogic;
use Cake\View\View;
/**
* ClientStatus Controller
*
*
* @method \App\Model\Entity\ClientStatus[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientStatusController extends AppController
{
public function initialize() {
parent::initialize();
if($this->setClientControllerAccess()){
$this->Auth->allow(['creditreportstatus']);
}
//$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
}
private function itemChange($inputData){
$result = false;
if($inputData['item_type'] == "ACC"){
$this->loadModel('DataItemKeyValues');
$result =$this->DataItemKeyValues->updateItemValueById($inputData);
}else if($inputData['item_type'] == "PB"){
$this->loadModel('DataPublicRecords');
$result = $this->DataPublicRecords->updatePublicRecordValueById($inputData);
}else if($inputData['item_type'] == "INQ"){
$this->loadModel('DataInquiries');
$result = $this->DataInquiries->updateInquiryValueById($inputData);
}
return $result;
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index()
{
$clientStatus = $this->paginate($this->ClientStatus);
$this->set(compact('clientStatus'));
}
public function creditreportstatus(){
$client_id = $this->Auth->user('client_id');
if ($this->request->is('ajax')) {
$ajaxData = $this->request->getData();
$action = $ajaxData['action'];
$this->showclientshtml($action,$client_id);
}
$client_id = $this->Auth->user('client_id');
$commonLogic = new commonLogic;
$data = $commonLogic->commonCreditReportStatus($this->request->query,$client_id);
$data['isEditmode'] = false;
$this->set($data);
$this->render('/Client/creditreportstatus');
}
public function challengeHistory(){
}
/**
* View method
*
* @param string|null $id Client Status id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientStatus = $this->ClientStatus->get($id, [
'contain' => []
]);
$this->set('clientStatus', $clientStatus);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$clientStatus = $this->ClientStatus->newEntity();
if ($this->request->is('post')) {
$clientStatus = $this->ClientStatus->patchEntity($clientStatus, $this->request->getData());
if ($this->ClientStatus->save($clientStatus)) {
$this->Flash->success(__('The client status has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client status could not be saved. Please, try again.'));
}
$this->set(compact('clientStatus'));
}
/**
* Edit method
*
* @param string|null $id Client Status id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null)
{
$clientStatus = $this->ClientStatus->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientStatus = $this->ClientStatus->patchEntity($clientStatus, $this->request->getData());
if ($this->ClientStatus->save($clientStatus)) {
$this->Flash->success(__('The client status has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The client status could not be saved. Please, try again.'));
}
$this->set(compact('clientStatus'));
}
/**
* Delete method
*
* @param string|null $id Client Status id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientStatus = $this->ClientStatus->get($id);
if ($this->ClientStatus->delete($clientStatus)) {
$this->Flash->success(__('The client status has been deleted.'));
} else {
$this->Flash->error(__('The client status could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
public function showclientshtml($action,$client_id) {
$this->loadModel('HtmlCodeHistories');
if($action == "GET_ANALYZER"){
$result = [];
$this->loadModel('CreditAnalyzerReports');
$client_info = $this->HtmlCodeHistories->getClientInfo($client_id);
if(!empty($client_info)) {
$HtmlCodeHistories = $this->HtmlCodeHistories->getHistoryCreditScoreById($client_info['id']);
$data = $this->CreditAnalyzerReports->getData($client_info['member_id'], $client_id, $client_info['id']);
$result['status'] = false;
if (!empty($data)) {
$creditanalysis = new CreditAnalysis();
$analyzer = $creditanalysis->creditAnalyzerReportData($data);
$response = $creditanalysis->getnerateAnalyzerReportFromDB($analyzer);
if (!empty($response['content'])) {
$result['status'] = true;
$result['credit_score'] = $response['credit_score'];
//pr($result['credit_score']);exit;
$result['html'] = $response['content'];
$score_data = [];
$score_data['trans'] = $HtmlCodeHistories['trans'];
$score_data['exp'] = $HtmlCodeHistories['exp'];
$score_data['equif'] = $HtmlCodeHistories['equif'];
//pr($score_data);exit;
$view = new View($this->request, $this->response);
$view->viewPath = 'Client';
$view->layout = false;
//$view->set('data',$score_data);
$history_credit_points = $this->HtmlCodeHistories->getLastTwoHistoryPointsByMemberId($member_id, $client_id);
$chart = $view->element('js_chart', ['data' => $score_data, 'credit_points' => $history_credit_points]);
$result['html'] = str_replace(CRA_CREDIT_SCORE, $chart, $result['html']);
}
}
}
}
echo json_encode($result);
exit;
}
}

View File

@@ -0,0 +1,133 @@
<?php
namespace App\Controller;
use App\Common\Permission;
use App\Controller\AppController;
/**
*ClientStatusTypes Controller
* * @property \App\Model\Table\ClientStatusTypesTable $ClientStatusTypes *
* @method \App\Model\Entity\ClientStatusType[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientStatusTypesController extends AppController
{
public function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
if (Permission::isEmployeeAsAdmin()) {
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
}
$this->checkRTGuser(); // is RTG User or not
$this->setUserType();
}
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$member_id = $this->Auth->user('id');
$result = $this->ClientStatusTypes->getClientStatusWithClients($member_id);
// dd($result);
$this->set(compact('result'));
}
/**
* View method
*
* @param string|null $idClient Status Type id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$clientStatusType = $this->ClientStatusTypes->get($id, [
'contain' => []
]);
$this->set('clientStatusType', $clientStatusType);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$member_id = $this->Auth->user('id');
if($this->request->is('post')){
$request = $this->request->getData();
if(!isset($request['status'])){
$request['status'] = 0;
}
$validated = $this->ClientStatusTypes->newEntity($request);
if(empty($validated->errors())){
$inputData[] = [
'name'=>$request['name'],
'color'=>$request['color'],
'status'=>$request['status'],
'member_id'=>$member_id
];
if($this->ClientStatusTypes->add($inputData)){
$this->Flash->success('The client status type has been saved.');
$this->setClientStatus();
return $this->redirect(['action' => 'index']);
}
}else{
$this->set('errors',$validated->errors());
}
}
}
/**
* Edit method
*
* @param string|null $idClient Status Type id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$clientStatusType = $this->ClientStatusTypes->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientStatusType = $this->ClientStatusTypes->patchEntity($clientStatusType, $this->request->getData());
if ($this->ClientStatusTypes->save($clientStatusType)) {
$this->Flash->success(__('Theclient status type has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Theclient status type could not be saved. Please, try again.'));
}
$this->set(compact('clientStatusType'));
}
/**
* Delete method
*
* @param string|null $idClient Status Type id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$clientStatusType = $this->ClientStatusTypes->get($id);
if ($this->ClientStatusTypes->delete($clientStatusType)) {
$this->Flash->success(__('Theclient status type has been deleted.'));
} else {
$this->Flash->error(__('Theclient status type could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

View File

@@ -0,0 +1,449 @@
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Helper\commonLogic;
use App\Utility\PasswordCreator;
use Cake\Routing\Router;
/**
* Clientdashboard Controller
*
*
* @method \App\Model\Entity\Clientdashboard[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
*/
class ClientdashboardController extends AppController {
public function initialize() {
parent::initialize();
if($this->setClientControllerAccess()){
$this->Auth->allow(['index','creditreport','clientsignature','agreementdownload']);
}
$this->checkRTGuser(); // is RTG User or not
$this->setUserType(); // Set CRM/CMS/Contacts user
//pr($this->Auth->user());exit;
}
public function clientsignature(){
if(!isset($_SESSION['has_agreement'])){
return $this->redirect(['controller'=>'Clientdashboard','action'=>'index']);
}
$this->loadModel('AgreementAssignments');
$this->viewBuilder()->layout("client_signature");
$contact_id = $this->Auth->user('user_id');
$client_id = $this->Auth->user('client_id');
$member_id = $this->Auth->user('id');
$commonLogic = new commonLogic;
if($this->request->is('post')){
$request = $this->request->getData();
$sign = $request['sign'];
$sign_name = $request['name'];
$inputData['id'] = $contact_id;
$inputData['signature_name'] = $sign_name;
$inputData['signature_value'] = $sign;
$inputData['status'] = 1;
$inputData['id'] = $request['agreement_assignment_id']; //current_content_path
$inputData['current_content_path'] = $request['current_content']; //current_content_path
$inputData['member_id'] = $member_id; //current_content_path
$default_sign = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADICAYAAABS39xVAAAFz0lEQVR4Xu3UAQkAAAwCwdm/9HI83BLIOdw5AgQIRAQWySkmAQIEzmB5AgIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiDwGVgAyc5eaH0AAAAASUVORK5CYII=";
if(empty($inputData['signature_name']) && $inputData['signature_value'] == $default_sign){
return $this->redirect($this->referer());
}
//$result = $this->Contacts->setSignByContactId($inputData);
$result = $this->AgreementAssignments->assignmentUpdateById($inputData);
if($result){
$member_email = $this->Auth->user('member_email');
$templateContent = [
'title'=>$request['title'],
'client_name'=>$this->Auth->user('client_name')
];
$file_path = $commonLogic->createAgrementPdf($inputData['id']);
$personalize = $commonLogic->personalizeInfo();
$subject = $templateContent['client_name']." has signed agreement.";
$this->sendEmail('agreement', $templateContent, $member_email,$subject,$file_path,$personalize['personalize']);
@unlink($file_path);
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
$everything = new \App\Utility\Everythings();
$everythinData['action_on_id'] = $this->Auth->user('client_id');
$everythinData['action_on_name'] = $this->Auth->user('client_name');
$everythinData['event_name'] = "agreement_signed";
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
$everything->everythingWrapper($this->Auth->user(), $everythinData);
// Everything Insertion
}
}
$extras['status'] = 0;
$extras['isFirst'] = true;
$agreements = $this->AgreementAssignments->getAgreementFormatWithClientAssignmentByMemberIdAndClientId($member_id,$client_id,$extras);
//pr($agreements);exit;
$extra['today'] = $agreements->agreement_format->created_at;
if(empty($agreements)){
unset($_SESSION['has_agreement']);
return $this->redirect(['controller'=>'Clientdashboard','action'=>'index']);
}
$file_path = "agreenment_contents/".$agreements->agreement_format->member_id."/".$agreements->agreement_format->content;
$content = file_get_contents($file_path);
$content = $commonLogic->agreementHTMLreplace($content,$agreements->current_values);
$this->set(compact('agreements','content'));
}
/**
* Index method
*
* @return \Cake\Http\Response|null
*/
public function index() {
$client_id = $this->Auth->user('client_id');
$this->loadModel('HtmlCodeHistories');
$this->loadModel('Uploadmedias');
$this->loadModel('Creditreportsetups');
$client_text="CLIENT_";
if($this->request->is('ajax')){
$request = $this->request->getData();
$auth = $this->Auth->user();
$member_id = $auth['id'];
$request['creditreport']['client_id'] = $client_id;
if($request['action'] == "SEND_EMAIL"){
$this->loadModel('Personalizes');
$personalize = $this->Personalizes->getPersonalizeByMemberId($member_id);
$templateContent['subject'] = $request['subject'];
$templateContent['body'] = nl2br($request['body']);
$templateContent['email_signature'] = $auth['member_email'];
if(!empty($personalize->email_signature)){
$templateContent['email_signature'] = $personalize->email_signature;
}
$to = $request['to'];
$this->sendEmail('client_member_email', $templateContent, $to,$templateContent['subject'],"",$personalize);
$response = TRUE;
}else if($request['action'] == "CREDIT_MONITORING"){
$passcreator = new PasswordCreator;
$creditreport = $request['creditreport'];
$creditreport['client_id'] = $client_id;
$creditreport['credit_report_company_name'] = $request['credit_report']['credit_report_company_name'];
$creditreport['credit_report_company_type'] = $creditreport['company_type'];
$creditreport['credit_report_company_password'] = $passcreator->customEncryptionDecryption($creditreport['credit_report_company_password'], 'encrypt');
if(!empty($creditreport)){
$response = $this->Creditreportsetups->insertOrUpdateCreditReport($creditreport);
}
}else if($request['action'] == "UPLOAD_DRIVING_LICENSE"){
if(isset($request['creditreport']['photo_id']) && !empty($request['creditreport']['photo_id'])){
$inputData['action'] = $request['action'];
$inputData['creditreport']['client_id'] = $client_id;
$inputData['creditreport']['state_photo_id'] = $request['creditreport']['photo_id'];
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
$this->addClientImageHistory($client_id,4);
$logData['action'] = $client_text.$request['action'];
$logData['response'] = $response;
$logData['input_data'] = $this->request->getData();
$logData['client_id'] = $client_id;
$this->appLog($logData);
}
}else if($request['action'] == "UPLOAD_UTILITY_BILL"){
if(isset($request['creditreport']['proof_address']) && !empty($request['creditreport']['proof_address'])){
$inputData['action'] = $request['action'];
$inputData['creditreport']['client_id'] = $client_id;
$inputData['creditreport']['mail_doc'] = $request['creditreport']['proof_address'];
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
$this->addClientImageHistory($client_id,2);
$logData['action'] = $client_text.$request['action'];
$logData['response'] = $response;
$logData['input_data'] = $this->request->getData();
$logData['client_id'] = $client_id;
$this->appLog($logData);
}
}else if($request['action'] == "UPLOAD_SSN_PHOTO"){
if(isset($request['creditreport']['ssn_photo']) && !empty($request['creditreport']['ssn_photo'])){
$inputData['action'] = $request['action'];
$inputData['creditreport']['client_id'] = $client_id;
$request['creditreport']['ssn'] = $request['creditreport']['ssn_photo'];
$inputData['creditreport']['ssn'] = $request['creditreport']['ssn_photo'];
//unset($request['creditreport']['ssn_photo']);
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
$this->addClientImageHistory($client_id,3);
$logData['action'] = $client_text.$request['action'];
$logData['response'] = $response;
$logData['input_data'] = $this->request->getData();
$logData['client_id'] = $client_id;
$this->appLog($logData);
}
}
$client_steps = $this->popupcondition();
$final_response['message'] = false;
$final_response['status'] = false;
if($response){
$final_response['status'] = true;
if($client_steps['is_steps_completed']){
$final_response['message'] = "You have completed your steps.";
}
}
echo json_encode($final_response);
exit;
}
$this->popupcondition();
$common = new commonLogic();
$member_id = $this->Auth->user('id');
$client_id = $this->Auth->user('client_id');
$rq_query = $this->request->query();
$result = $common->clientDashboardByClientIdAndMemberId($member_id,$client_id,$rq_query);
extract($result);
$this->loadModel('Crmusers');
$employee_id = $this->Auth->user('employee_id');
$employees = [];
if($employee_id > 0){
$employees = $this->Crmusers->getEmployeeByEmployeeId($employee_id);
}
$diff_month = 3;
if(isset($rq_query['diff_month'])){
$diff_month = $rq_query['diff_month'];
}
$linechartData = $this->HtmlCodeHistories->getCreditScoreByMonthDifference($diff_month,$member_id,$client_id);
//pr($_SESSION);exit;
// $identity_iq_link = $this->Auth->user('identity_iq_link');
// $smart_credit_link = $this->Auth->user('smart_credit_link');
// $privacy_guard_link = "";
// //echo $identity_iq_link;exit;
// $this->set(compact('identity_iq_link','smart_credit_link','privacy_guard_link'));
$this->getAffiliateInfoForClient($client_id);
$this->set(compact('diff_month','linechartData','employees','export_type','all_remain','deleted_items','all_challenged_item','crs_data','pre_negative_item','pre_public_records','pre_inquiries','deleted_item','remain','challenged_item','percent','summary'));
}
private function getAffiliateInfoForClient($client_id){
$email = "";
$name = "";
$phone = "";
$searchData = ['client_id'=>$client_id,'refference_type' => 2]; // for affiliate type = 2
// get affiliate id by client id
$affiliate_id=$this->loadModel('ClientAssignments')->getAffiliateByClientId($searchData);
// get affiliate user info by affiliate id
if(!empty($affiliate_id)) {
$affiliate_infoData= $this->loadModel('Crmusers')->getCrmuserInfoById($affiliate_id['refference_id']);
$email=$affiliate_infoData['email'];
$name=$affiliate_infoData['first_name'].' '.$affiliate_infoData['last_name'];
$phone=$affiliate_infoData['phone'];
}
$affiliate_info = [
'name' => $name,
'email'=> $email,
'phone'=> $phone
];
$this->set(compact('affiliate_info'));
}
private function addClientImageHistory($client_id,$rtg_letter_image_id){
$this->loadModel('ClientImagesHistory');
$historyUpdate['client_id'] = $client_id;
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
$historyUpdate['action_type'] = 1;
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
}
public function agreementdownload($assignment_id = ""){
if($this->request->is('post') && $this->Auth->user()){
if($assignment_id > 0){
$common = new commonLogic();
$common->downloadAgreementByAssignmentId($assignment_id);
}
}
}
private function popupcondition() {
$user = $this->Auth->user();
$client_id = $this->Auth->user('client_id');
$this->loadModel('Uploadmedias');
$this->loadModel('Creditreportsetups');
$passcreator = new PasswordCreator;
//pr($_SESSION);exit;
$popup_steps[0] = true;
$popup_steps[1] = true;
$popup_steps[2] = true;
$popup_steps[3] = true;
$popup_steps[4] = true;
$popup_steps[5] = true;
$utility_image_url = '/images/client_modal/utility.png';
$photo_id_image_url = '/images/client_modal/driver_lc.jpg';
$ssn_image_url = '/images/client_modal/ssn.jpg';
$this->loadModel('Cmsusers');
$this->loadModel('ClientPopups');
$client_popup_info = $this->ClientPopups->getClientPopupByMemberId($user['id']);
$member = $this->Cmsusers->getCmsuserById($user['id']);
if(!empty($member['identity_iq_link'])){
$credit_report_dropdown[1] = REPORT_SOURCE_TYPES[1];
$identity_iq_link = $member['identity_iq_link'];
}
if(!empty($member['smart_credit_link'])){
$credit_report_dropdown[3] = REPORT_SOURCE_TYPES[3];
$smart_credit_link = $member['smart_credit_link'];
}
$medias = $this->Uploadmedias->getUploadMediaByClientId($client_id);
//pr($medias);exit;
$creditreport = $this->Creditreportsetups->getCreditReportByClientId($client_id);
$image_type_id_list = [];
if(!empty($medias)){
foreach ($medias as $m){
$image_type_id_list[] = $m->rtg_letter_image_id;
$image_path = "contact_photo/".$m->image_path;
if(file_exists($image_path)){
if($m->rtg_letter_image_id == 2){
$utility_image_url = "/".$image_path;
}else if($m->rtg_letter_image_id == 4){
$photo_id_image_url = "/".$image_path;
}else if($m->rtg_letter_image_id == 3){
$ssn_image_url = "/".$image_path;
}
}
}
}
if(in_array(2, $image_type_id_list)){ //For utility bill 2
$popup_steps[5] = false;
}
if(in_array(4, $image_type_id_list) || in_array(1, $image_type_id_list)){ // For photo id 4
$popup_steps[3] = false;
}
if(in_array(3, $image_type_id_list)){ //For ssn 3
$popup_steps[4] = false;
}
if(!empty($creditreport)){
$popup_steps[2] = false;
}
$is_steps_completed = true;
if($popup_steps[2] || $popup_steps[3] || $popup_steps[4] || $popup_steps[5]){
$is_steps_completed = false;
}
// pr($client_popup_info);exit;
$this->set(
compact(
'client_popup_info',
'photo_id_image_url',
'ssn_image_url',
'utility_image_url',
'creditreport',
'popup_steps',
'credit_report_dropdown',
'identity_iq_link',
'smart_credit_link',
'is_steps_completed'
)
);
// return [
// 'is_steps_completed' => $is_steps_completed
// ];
}
/**
* View method
*
* @param string|null $id Clientdashboard id.
* @return \Cake\Http\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null) {
$clientdashboard = $this->Clientdashboard->get($id, [
'contain' => []
]);
$this->set('clientdashboard', $clientdashboard);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add() {
$clientdashboard = $this->Clientdashboard->newEntity();
if ($this->request->is('post')) {
$clientdashboard = $this->Clientdashboard->patchEntity($clientdashboard, $this->request->getData());
if ($this->Clientdashboard->save($clientdashboard)) {
$this->Flash->success(__('The clientdashboard has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The clientdashboard could not be saved. Please, try again.'));
}
$this->set(compact('clientdashboard'));
}
/**
* Edit method
*
* @param string|null $id Clientdashboard id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function edit($id = null) {
$clientdashboard = $this->Clientdashboard->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$clientdashboard = $this->Clientdashboard->patchEntity($clientdashboard, $this->request->getData());
if ($this->Clientdashboard->save($clientdashboard)) {
$this->Flash->success(__('The clientdashboard has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The clientdashboard could not be saved. Please, try again.'));
}
$this->set(compact('clientdashboard'));
}
/**
* Delete method
*
* @param string|null $id Clientdashboard id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']);
$clientdashboard = $this->Clientdashboard->get($id);
if ($this->Clientdashboard->delete($clientdashboard)) {
$this->Flash->success(__('The clientdashboard has been deleted.'));
} else {
$this->Flash->error(__('The clientdashboard could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}

Some files were not shown because too many files have changed in this diff Show More