mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-25 08:44:42 -04:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc4db6553e | ||
|
|
1487afb19b | ||
|
|
6e6cfb3fb1 | ||
|
|
04e3c13dd1 | ||
|
|
cd209d50f3 | ||
|
|
9556500813 | ||
|
|
18517c47e8 | ||
|
|
6663de83f8 | ||
|
|
a1b2d99581 | ||
|
|
0a2b6e2d41 | ||
|
|
5ef5006577 | ||
|
|
4ca452ef12 | ||
|
|
249274e5f5 | ||
|
|
37e4eb8bd2 | ||
|
|
2ce140f6d3 | ||
|
|
40cecaf571 | ||
|
|
1c6e44af0f | ||
|
|
b6012ae2ca | ||
|
|
6ff1cb007c | ||
|
|
eeb01a3717 | ||
|
|
490f0c89dd | ||
|
|
faaf2b4e99 | ||
|
|
0742a666b1 | ||
|
|
1b61af783c |
7
.bowerrc
7
.bowerrc
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"directory": "public/bower_components",
|
||||
"scripts": {
|
||||
"postinstall": "grunt default genlicense",
|
||||
"postuninstall": "grunt default genlicense"
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
node_modules
|
||||
tmp
|
||||
application/config/email.php
|
||||
*.patch
|
||||
patches/
|
||||
.idea/
|
||||
git-svn-diff.py
|
||||
*.bash
|
||||
.swp
|
||||
.buildpath
|
||||
.project
|
||||
.settings/*
|
||||
*.swp
|
||||
*.rej
|
||||
*.orig
|
||||
*~
|
||||
*.~
|
||||
*.log
|
||||
application/sessions/*
|
||||
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -1,3 +0,0 @@
|
||||
dist/ merge=ours
|
||||
application/language/**/*.php merge=ours
|
||||
text=auto
|
||||
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
||||
github: jekkos
|
||||
custom: ["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MUN6AEG7NY6H8"]
|
||||
29
.github/ISSUE_TEMPLATE.md
vendored
29
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,29 +0,0 @@
|
||||
### Background information
|
||||
|
||||
__IMPORTANT: If you choose to ignore this issue report template, your issue will be closed as we cannot help without the requested information.__
|
||||
|
||||
Please make sure you tick (add an x between the square brackets with no spaces) the following check boxes:
|
||||
|
||||
- [] Reporting an issue of an unmodified OSPOS installation
|
||||
- [] Checked [open and closed issues](https://github.com/opensourcepos/opensourcepos/issues?utf8=%E2%9C%93&q=is%3Aissue) and no similar issue was already reported (please make sure you searched!)
|
||||
- [] Read [README](https://github.com/opensourcepos/opensourcepos/blob/master/README.md), [WHATS_NEW](https://github.com/opensourcepos/opensourcepos/blob/master/WHATS_NEW.txt), [INSTALL.md](https://github.com/opensourcepos/opensourcepos/blob/master/INSTALL.md) and [UPGRADE](https://github.com/opensourcepos/opensourcepos/blob/master/UPGRADE.txt)
|
||||
- [] Read the [FAQ](https://github.com/opensourcepos/opensourcepos#faq) for any known install and/or upgrade gotchas (in specific PHP extensions installed)
|
||||
- [] Read the [wiki](https://github.com/opensourcepos/opensourcepos/wiki)
|
||||
- [] Executed any database upgrade scripts if an upgrade pre 3.0.0 (e.g. database/2.4_to_3.0.sql)
|
||||
- [] Aware the installation code that [GitHub master](https://github.com/opensourcepos/opensourcepos/tree/master) is for [developers only](https://github.com/opensourcepos/opensourcepos/wiki/Development-setup) and therefore not complete nor stable.
|
||||
|
||||
### Installation information
|
||||
|
||||
- OSPOS version is:
|
||||
- OSPOS git commit hash is:
|
||||
- PHP version is:
|
||||
- MySQL or MariaDB version is:
|
||||
- OS and version is:
|
||||
- WebServer is:
|
||||
- Selected language is:
|
||||
- (If applicable) Docker installation:
|
||||
- (If applicable) Installation package for the LAMP/LEMP stack is:
|
||||
|
||||
### Issue / Bug / Question / New Feature
|
||||
|
||||
Please write your issue here. If a bug, please make sure to provide as much information as possible including configuration settings (e.g. Decimals set, Tax mode), language and steps to reproduce the bug.
|
||||
18
.github/stale.yml
vendored
18
.github/stale.yml
vendored
@@ -1,18 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- enhancement
|
||||
- needsowner
|
||||
- bug
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
71
.github/workflows/codeql-analysis.yml
vendored
71
.github/workflows/codeql-analysis.yml
vendored
@@ -1,71 +0,0 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '21 12 * * 3'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
91
.gitignore
vendored
91
.gitignore
vendored
@@ -1,90 +1,13 @@
|
||||
# Dependency directories
|
||||
/node_modules
|
||||
/vendor
|
||||
/public/bower_components
|
||||
|
||||
# Logs
|
||||
/application/logs/*
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Build generated
|
||||
/tmp
|
||||
/public/license/.licenses
|
||||
/public/license/bower.LICENSES
|
||||
/public/dist
|
||||
|
||||
# Docker
|
||||
!/docker/.env
|
||||
/docker/data/database/db/*
|
||||
/docker/data/certbot/conf/*
|
||||
/docker/data/ospos/app/*
|
||||
|
||||
# Database
|
||||
/database/database.sql
|
||||
/database/migrate_phppos_dist.sql
|
||||
|
||||
# Use files
|
||||
/application/config/email.php
|
||||
/application/sessions/*
|
||||
/application/uploads/*
|
||||
|
||||
# Editors
|
||||
## SublimeText
|
||||
*.tmlanguage.cache
|
||||
*.tmPreferences.cache
|
||||
*.stTheme.cache
|
||||
*.sublime-workspace
|
||||
|
||||
## VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
## Vim
|
||||
*.sw[a-p]
|
||||
|
||||
## WebStorm/IntelliJ
|
||||
/.idea
|
||||
modules.xml
|
||||
*.ipr
|
||||
*.iml
|
||||
|
||||
# System files
|
||||
*.DS_Store
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
._*
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Other
|
||||
/generate_langauges.php
|
||||
/dist
|
||||
/docs
|
||||
/patches
|
||||
/translations
|
||||
/.buildpath
|
||||
/.project
|
||||
/.settings/*
|
||||
application/config/database.php
|
||||
*.patch
|
||||
patches/
|
||||
git-svn-diff.py
|
||||
*.bash
|
||||
.swp
|
||||
*.sh
|
||||
*.swp
|
||||
.buildpath
|
||||
.project
|
||||
.settings/*
|
||||
*.swp
|
||||
*.rej
|
||||
*.orig
|
||||
*~
|
||||
*.~
|
||||
.env
|
||||
auth.json
|
||||
|
||||
72
.htaccess
72
.htaccess
@@ -1,72 +0,0 @@
|
||||
# redirect to public page
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_URI} !^public$
|
||||
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
|
||||
RewriteRule "^(.*)$" "/public/" [R=301,L]
|
||||
</IfModule>
|
||||
|
||||
# disable directory browsing
|
||||
# For security reasons, Option all cannot be overridden.
|
||||
Options +SymLinksIfOwnerMatch -Indexes
|
||||
|
||||
# prevent folder listing
|
||||
IndexIgnore *
|
||||
|
||||
<IfModule mod_headers.c>
|
||||
Header always set X-Frame-Options "SAMEORIGIN"
|
||||
</Ifmodule>
|
||||
|
||||
# Apache 2.4
|
||||
<IfModule authz_core_module>
|
||||
# secure htaccess file
|
||||
<Files .htaccess>
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
# prevent access to PHP error log
|
||||
<Files error_log>
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
# prevent access to LICENSE
|
||||
<Files LICENSE>
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
# prevent access to csv, txt and md files
|
||||
<FilesMatch "\.(csv|txt|md|yml|json|lock)$">
|
||||
Require all denied
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.2
|
||||
<IfModule !authz_core_module>
|
||||
# secure htaccess file
|
||||
<Files .htaccess>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy all
|
||||
</Files>
|
||||
|
||||
# prevent access to PHP error log
|
||||
<Files error_log>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy all
|
||||
</Files>
|
||||
|
||||
# prevent access to LICENSE
|
||||
<Files LICENSE>
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy all
|
||||
</Files>
|
||||
|
||||
# prevent access to csv, txt and md files
|
||||
<FilesMatch "\.(csv|txt|md|yml|json|lock)$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy all
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
67
.travis.yml
67
.travis.yml
@@ -1,67 +0,0 @@
|
||||
sudo: required
|
||||
|
||||
branches:
|
||||
except:
|
||||
- weblate
|
||||
services:
|
||||
- docker
|
||||
before_install:
|
||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
- sudo apt-get update
|
||||
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||
- docker --version
|
||||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||
- chmod +x docker-compose
|
||||
- sudo mv docker-compose /usr/local/bin
|
||||
|
||||
script:
|
||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
- docker run --rm -v $(pwd):/app jekkos/composer composer install
|
||||
- docker run --rm -v $(pwd):/app jekkos/composer php bin/install.php translations develop
|
||||
- sed -i "s/'\(dev\)'/'$rev'/g" application/config/config.php
|
||||
- version=$(grep application_version application/config/config.php | sed "s/.*=\s'\(.*\)';/\1/g")
|
||||
- echo "$version-$branch-$rev"
|
||||
- npm version "$version-$branch-$rev" --force || true
|
||||
- docker run --rm -it -v $(pwd):/app -w /app opensourcepos/node-grunt-bower
|
||||
sh -c "npm install && bower install && grunt package"
|
||||
- docker build . --target ospos -t ospos
|
||||
- docker-compose -f docker-compose.test.yml up --abort-on-container-exit
|
||||
- docker build database/ -t jekkos/opensourcepos:sqlscript
|
||||
env:
|
||||
global:
|
||||
- DOCKER_COMPOSE_VERSION=1.29.1
|
||||
- BRANCH=$(echo ${TRAVIS_BRANCH} | sed s/feature\\///)
|
||||
- date=`date +%Y%m%d%H%M%S` && branch=${TRAVIS_BRANCH} && rev=`git rev-parse --short=6 HEAD`
|
||||
after_success:
|
||||
- TAG=${TRAVIS_TAG:-$BRANCH}
|
||||
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker tag "ospos:latest"
|
||||
"jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:sqlscript"
|
||||
- sudo mv dist/opensourcepos.tgz "dist/opensourcepos.$version.$rev.tgz"
|
||||
before_deploy:
|
||||
- npm set //npm.pkg.github.com/:_authToken "$NPM_TOKEN"
|
||||
deploy:
|
||||
- provider: npm
|
||||
file: dist/opensourcepos.$version.$rev.tgz
|
||||
registry: npm.pkg.github.com
|
||||
email: jeroen@steganos.dev
|
||||
skip_cleanup: true
|
||||
api_key:
|
||||
secure: "bmOfMoGBi+wTEdTbIB7wPenNTCZrmHAa05xZnMxZSOjxplZpnZSO4Tvnnkihz9LpbF3xT1hm76AJJuZonu2HKtUez+6L4Fg+i/jS8Ij/BZlbvKBVTeB+2yN09ncXNmObnl1bShtm90d2WYQJKk3NJGuEboFQNxwJLYJXg33iMhc="
|
||||
|
||||
on:
|
||||
all_branches: true
|
||||
- provider: releases
|
||||
file: dist/opensourcepos.$version.$rev.tgz
|
||||
name: "OpensourcePos $version"
|
||||
release_notes_file: WHATS_NEW.txt
|
||||
prerelease: true
|
||||
skip_cleanup: true
|
||||
|
||||
user: jekkos
|
||||
overwrite: true
|
||||
api_key:
|
||||
secure: Ax25mMRDfHVf/HjRwqxYJe2oMnWC4sc2aKIiUxAOviVJJSCl4GMWhcFlUNnFsDcKIg2ofEGMVD6b9cTBuOwPDvymUDFnLNCCgDWve+vRDdWaTkTipn77Qk4c9UO9VvuzlPSKopChefPHlQ0n1rEmAMiKIXuqjUlNGqybW4FLP4E=
|
||||
on:
|
||||
tags: true
|
||||
branch: master
|
||||
373
CHANGELOG.md
373
CHANGELOG.md
@@ -1,373 +0,0 @@
|
||||
[unreleased]: https://github.com/opensourcepos/opensourcepos/compare/3.3.7...HEAD
|
||||
[3.3.6]: https://github.com/opensourcepos/opensourcepos/compare/3.3.6...3.3.7
|
||||
[3.3.5]: https://github.com/opensourcepos/opensourcepos/compare/3.3.4...3.3.5
|
||||
[3.3.4]: https://github.com/opensourcepos/opensourcepos/compare/3.3.3...3.3.4
|
||||
[3.3.3]: https://github.com/opensourcepos/opensourcepos/compare/3.3.2...3.3.3
|
||||
[3.3.2]: https://github.com/opensourcepos/opensourcepos/compare/3.3.1...3.3.2
|
||||
[3.3.1]: https://github.com/opensourcepos/opensourcepos/compare/3.3.0...3.3.1
|
||||
[3.3.0]: https://github.com/opensourcepos/opensourcepos/compare/3.2.3...3.3.0
|
||||
[3.2.3]: https://github.com/opensourcepos/opensourcepos/compare/3.2.2...3.2.3
|
||||
[3.2.2]: https://github.com/opensourcepos/opensourcepos/compare/3.2.1...3.2.2
|
||||
[3.2.1]: https://github.com/opensourcepos/opensourcepos/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/opensourcepos/opensourcepos/compare/3.1.1...3.2.0
|
||||
[3.1.1]: https://github.com/opensourcepos/opensourcepos/compare/3.1.0...3.1.1
|
||||
[3.1.0]: https://github.com/opensourcepos/opensourcepos/compare/3.0.2...3.1.0
|
||||
[3.0.2]: https://github.com/opensourcepos/opensourcepos/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/opensourcepos/opensourcepos/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/opensourcepos/opensourcepos/compare/2.4.0...3.0.0
|
||||
[2.4.0]: https://github.com/opensourcepos/opensourcepos/compare/2.3.4...2.4.0
|
||||
[2.3.4]: https://github.com/opensourcepos/opensourcepos/compare/2.3.3...2.3.4
|
||||
[2.3.3]: https://github.com/opensourcepos/opensourcepos/compare/2.3.2...2.3.3
|
||||
[2.3.2]: https://github.com/opensourcepos/opensourcepos/compare/2.3.1...2.3.2
|
||||
[2.3.1]: https://github.com/opensourcepos/opensourcepos/compare/2.3.0...2.3.1
|
||||
[2.3.0]: https://github.com/opensourcepos/opensourcepos/compare/2.2.2...2.3.0
|
||||
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented here.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
List of changes in the `master` branch.
|
||||
|
||||
- N/A
|
||||
|
||||
## [3.3.7] - 2022-04-26
|
||||
|
||||
- Translation updates (Thai, Indonesian, Swedish, Italian)
|
||||
- XSS fixes in bootstrap datatables
|
||||
- Invoice numbering fixes
|
||||
- Docker compose database scripts are now mounted from a container volume
|
||||
|
||||
## [3.3.6] - 2022-01-08
|
||||
|
||||
- Translation updates (Hungarian, Indonesian, Bosnian, Ukranian, Vietnamese, Spanish)
|
||||
- Make footer revision clickable (ref to github)
|
||||
- Minor reporting adjustments
|
||||
- Introduced new global keyboard shortcuts (see overview below)
|
||||
|
||||
### Fixes
|
||||
|
||||
- reCaptcha issue fix
|
||||
- Username verification bugfix
|
||||
- Clickjacking security mitigations
|
||||
- Fixes for the payment summary after refresh
|
||||
- Hardening against XSS by introducing a CSP header in the HTTP headers
|
||||
- Several CSRF and XSS fixes
|
||||
- Type juggling password fix for old logins
|
||||
|
||||
|
||||
## [3.3.5] - 2021-08-26
|
||||
|
||||
- Translation updates (Romanian, Ukrainian, Vietnamese, Thai, Polish, Swedish, Portuguese, Arabic, French, Chinese, Dutch, Tamil, Turkish, Spanish)
|
||||
- New responsive login page based on Bootstrap `5`
|
||||
- Translation fallback to English when a string is untranslated for the selected language
|
||||
- Database and performance optimizations
|
||||
- Grunt/CI updates
|
||||
- CSV item import improvements
|
||||
|
||||
### Fixes
|
||||
|
||||
- Username verification fix on employee insert/update
|
||||
- Minor report fixes
|
||||
- Attribute encoding fix
|
||||
- Decimal render fix
|
||||
- Fixes for Docker to make it run on Windows
|
||||
- Blind SQL injection fix
|
||||
|
||||
## [3.3.4] - 2021-04-18
|
||||
|
||||
- Translation updates (Hungarian, Indonesian, Bosnian, Ukrainian, Vietnamese, Spanish)
|
||||
- Prevent data wipeout when calling GET directly on the save endpoint
|
||||
- Cleanup `.htaccess`
|
||||
- Docker compose usability improvements
|
||||
- Cookie secure flag fix for Chrome (you can enable CSRF protection again now)
|
||||
- Use LONGBLOB for session storage. This should fix issues preventing a user from adding a large number of items to register
|
||||
- Cash rounding bugfixes
|
||||
- Fix daily overview cash sale totals
|
||||
- Show sale count in the transaction report
|
||||
- Button disable to prevent double submission
|
||||
- Add barcode field to item kits
|
||||
- Fix discount register parsing in some specific locales
|
||||
|
||||
## [3.3.3] - 2020-12-31
|
||||
|
||||
- PHP `7.4` support
|
||||
- Set PHP `7.2` to be the minimum level due to older version deprecations
|
||||
- Added email CC and BCC (see `config/email.php`)
|
||||
- Cash rounding to nearest 5 cents
|
||||
- Updated composer packages and JS plugins
|
||||
- Improved security (CSRF protection)
|
||||
- Various small improvements and bug fixes
|
||||
|
||||
## [3.3.2] - 2020-09-02
|
||||
|
||||
- Fixed `only_full_group_by` issue with MySQL/MariaDB
|
||||
- Fixed POS transaction return failure if items were deleted
|
||||
- Various bug fixes
|
||||
|
||||
## [3.3.1] - 2019-12-04
|
||||
|
||||
- Various bug fixes (please disable `only_full_group_by` option from MySQL/MariaDB to avoid issues)
|
||||
|
||||
## [3.3.0] - 2019-09-29
|
||||
|
||||
- New logo
|
||||
- Upgrade CodeIgniter to version `3.1.11`
|
||||
- PHP `7.3` support
|
||||
- Attributes feature (allows extensibility of items replacing old custom fields)
|
||||
- India GST tax support + various tax support improvements
|
||||
- Cash up feature
|
||||
- Temporary items feature
|
||||
- Fixed sales discount
|
||||
- Supplier category feature
|
||||
- Improved items import and CSV file generation (to contain additional attributes)
|
||||
- Improved Docker installation with NGINX reverse proxy using Let's Encrypt TLS certificate
|
||||
- Database performance improvements
|
||||
- Added and udated translations
|
||||
- Fixed various reports issues
|
||||
- Fixed rounding issues
|
||||
- Fixed CSRF issues
|
||||
- Fixed database upgrade script issues
|
||||
- Various bug fixes
|
||||
|
||||
## [3.2.3] - 2018-06-13
|
||||
|
||||
- Upgrade CodeIgniter to version `3.1.9`
|
||||
- Further revert of CSRF change causing regression
|
||||
|
||||
## [3.2.2] - 2018-06-06
|
||||
|
||||
- Revert CSRF change causing regression
|
||||
|
||||
## [3.2.1] - 2018-06-04
|
||||
|
||||
- Support for GDPR
|
||||
- CSRF simplifications
|
||||
- Translation upgrades
|
||||
- Various bug fixes
|
||||
|
||||
## [3.2.0] - 2018-04-14
|
||||
|
||||
- Upgrade CodeIgniter to version `3.1.8`
|
||||
- PHP `7.2` support (use OpenSSL and not MCrypt)
|
||||
- Automatic database upgrades from `3.0.0` at first login (no more SQL scripts)
|
||||
- Home and (back)office menu switch (top menu can be organized in two views)
|
||||
- Expenses feature
|
||||
- Quote and work order features
|
||||
- Improved invoice support
|
||||
- Sale suspend, soft delete, complete as the state not as different tables or hard delete
|
||||
- Restore deleted sales
|
||||
- Improved item kits
|
||||
- Export tables all records and export to PDF
|
||||
- Table sticky header (headers visible during scrolling)
|
||||
- Allow duplicate barcodes (config option)
|
||||
- Search suggestion formatting (config option)
|
||||
- Define print and email checkboxes behavior (config option)
|
||||
- Edit customer from sales register
|
||||
- Added and updated translations
|
||||
- Various jQuery plugins upgrade
|
||||
- Fixed permission issues (e.g. password change)
|
||||
- Fixed various reports issues and renamed Sales to Transactions
|
||||
- Various bug fixes (e.g. tax, rounding, library circular dependency)
|
||||
|
||||
## [3.1.1] - 2017-09-09
|
||||
|
||||
- Updated en-US and en-GB translations, better grammar, and consistency
|
||||
- Fixed database migration issue with VAT tax included
|
||||
- Fixed database backup bug
|
||||
- Fixed gift card error
|
||||
- Fixed database `upgrade to 3.1.x` script (now it's to `3.1.1` and there is no `3.1.0` anymore)
|
||||
- Fixed old database upgrade scripts for people upgrading from `2.x` versions
|
||||
- Fixed `.htaccess` file in OSPOS root dir (it was not forwarding to `public` subdir)
|
||||
- Fixed few jQuery `2.0` upgrade issues
|
||||
|
||||
## [3.1.0] - 2017-09-02
|
||||
|
||||
- MySQL `5.7` and PHP `7.x` support
|
||||
- Advanced tax support with customer tax categories and more
|
||||
- Better horeca use case support with dinner table sale tagging
|
||||
- Customer rewards support
|
||||
- Added quote support and better invoice support
|
||||
- Added integration with Mailchimp to connect customer list with Mailchimp list
|
||||
- Prevent inserting two customers with the same email address
|
||||
- Customer total spending and stats
|
||||
- Added Google reCAPTCHA option for the login page to increase protection from brute force attacks
|
||||
- Added due payment for credit sale support
|
||||
- Gift card numbering with two options: series and random
|
||||
- Extended item kits functionality
|
||||
- Employees are allowed to change their own password by clicking their name in the top bar
|
||||
- Cash rounding support, extended decimals
|
||||
- Reworked item pictures, file names, and storing
|
||||
- Financial year start date and selection from date range pickers
|
||||
- Date time range filters can be date and time or date only
|
||||
- Added two new Bootswatch themes
|
||||
- Receipts font size support
|
||||
- Fix automatically people's name first capital letter, emails in lower case only
|
||||
- Fixes to Receiving
|
||||
- Various amendments to database script updates from older versions
|
||||
- Added dotenv support
|
||||
- Updates to language translations (split English to American English and British English)
|
||||
- Various Dockers support improvements
|
||||
- Minor bugfixes
|
||||
|
||||
## [3.0.2] - 2016-12-31
|
||||
|
||||
- Fixed error when performing scans multiple times in a row
|
||||
- Fixed summary reports
|
||||
- Protect employee privacy by printing just the first letter of the family name
|
||||
- Updates to language translations
|
||||
- Various Dockers support improvements
|
||||
- Minor bugfixes
|
||||
|
||||
## [3.0.1] - 2016-11-27
|
||||
|
||||
- Upgrade CodeIgniter to version `3.1.2`
|
||||
- Substantial database performance improvements
|
||||
- Improved security: email and SMS passwords encryption, removed `phpinfo.php`
|
||||
- Set code to be production and not development in `index.php`
|
||||
- Reports improvements, fixed table sorting, tax calculation and made profit to be net profit
|
||||
- Better Apache `2.4` support in `.htaccess`
|
||||
- Updates to language translations
|
||||
- Fixed excel template download links
|
||||
- Fixed employee name in sale receipt and invoice reprinting
|
||||
- Fixed `2.3.2_to_2.3.3.sql` database upgrade script mistake
|
||||
- Fixed `phppos to ospos` database migration script
|
||||
- Minor bug fixes and some general code clean up
|
||||
|
||||
## [3.0.0] 2016-10-21
|
||||
|
||||
- Upgrade CodeIgniter to version `3.1.0`
|
||||
- Major UI overhaul based on Bootstrap `3.0` and Bootswatch Themes
|
||||
- New tabular views with advanced filtering using Bootstrap Tables
|
||||
- New graphical reports with no more Adobe Flash dependency
|
||||
- Redesign of all modal dialogs
|
||||
- Updated Sales register with simplified payment flow
|
||||
- Improved security: MySQL injection, XSS, CSFR, BCrypt password encryption, safer project layout
|
||||
- Support for text messaging (interfacing to specific support required)
|
||||
- Email configuration
|
||||
- Improved Localisation support
|
||||
- Improved Store Config page
|
||||
- Docker container ready for cloud installation
|
||||
- Composer PHP support
|
||||
- More languages and integration with Weblate for continuous translation
|
||||
- About 280 closed issues under `3.0.0` release label, too many to produce a meaningful list
|
||||
- Various code cleanup, refactoring, optimization and etc.
|
||||
|
||||
## [2.4.0] - 2016-04-02
|
||||
|
||||
- Upgrade CodeIgniter to version `3.0.5`
|
||||
- Fix for spurious logouts
|
||||
- Apache `.htaccess` `mod_expiry` caching and security optimizations
|
||||
- Bulk item edit fixes (category, tax, and supplier fields)
|
||||
- Remove f-key shortcuts used for module navigation
|
||||
- Allow using custom invoice numbers when suspending a sale
|
||||
- PHP `7` fixes
|
||||
- Specific warnings to distinguish between reorder level and out of stock situation in sales
|
||||
- Fix malware detection issues due to usage of `base64` encoding for storing session variables
|
||||
- Improve language generation scripts (use PHP builtin functionality)
|
||||
- Add extra buttons for navigation and printing to receipt and invoice
|
||||
- Improve print layout for invoices
|
||||
- Make layout consistent for items between receipt and invoice templates
|
||||
- Minor bugfixes
|
||||
|
||||
## [2.3.4] - 2016-02-08
|
||||
|
||||
- Migration script fixes
|
||||
- Improved continuous integration setup
|
||||
- More integration tests
|
||||
- Virtualized container setup (`docker install`)
|
||||
- Live clock functionality and favicon
|
||||
- Improved PHP `7` compatibility
|
||||
- Added de_CH (German) as language
|
||||
- Minor code cleanup
|
||||
- Removal of annoying backup prompt on logout
|
||||
|
||||
## [2.3.3] - 2016-01-05
|
||||
|
||||
- Item kit fixes (search, list, ...)
|
||||
- Add date picker widgets in sale/receiving edit forms
|
||||
- Add date filter in items module
|
||||
- Add barcode generation logic for EAN8, EAN13
|
||||
- Add barcode validation and fallback logic for EAN8, EAN13
|
||||
- New config option to generate barcodes if `item_number` is empty
|
||||
- Add cost and count to inventory reports
|
||||
- Gift card fixes
|
||||
- Refactor sales overview (added date filtering + search options)
|
||||
- Better locale config support
|
||||
- Improve PHP compatibility
|
||||
- Fix invoice numbering bug on suspending a sale
|
||||
- Add configurable locale-dependent date format
|
||||
- Add grunt-cache-breaker plugin
|
||||
- Suspend button appears before adding a payment
|
||||
- Searching of deleted items, filtering part is removed
|
||||
- Remove infamous `0` after leaving sale or receiving comments empty
|
||||
- Add SQL script to clean zeroes in sales/receivings comments
|
||||
- Numerous other bug fixes
|
||||
|
||||
## [2.3.2] - 2015-07-15
|
||||
|
||||
- Nominatim (OpenStreetMap) customer address autocompletion
|
||||
- Sale invoice templating
|
||||
- Configurable barcode generation for items
|
||||
- Stock location filtering in detailed sales and receivings reports
|
||||
- Gift cards fixes
|
||||
- Proper pagination support for most modules
|
||||
- Language updates
|
||||
- Fix for decimal tax rates
|
||||
- Add gender and company name attributes to customer
|
||||
- Stock location config screen refactor
|
||||
- Basic Travis CI and PhantomJS setup
|
||||
- Database backup on admin logout
|
||||
- Modifiable item thumbnails
|
||||
- Email invoice PDF generation using DomPDF
|
||||
- Modifiable company logo
|
||||
- jQuery upgrade (`1.2` -> `1.8.3`)
|
||||
- JavaScript minification (using Grunt)
|
||||
- Numerous bugfixes
|
||||
|
||||
## [2.3.1] - 2015-02-11
|
||||
|
||||
- Extra report permissions (this includes a refactoring of the database model - new grants table)
|
||||
- Tax inclusive/exclusive pricing
|
||||
- Receivings amount multiplication (can be configured in items section)
|
||||
- Customizable sale and receiving numbering
|
||||
- Gift card improvements
|
||||
- Fix item import through CSV
|
||||
- Bug fixes for reports
|
||||
|
||||
## [2.3.0] - 2014-08-19
|
||||
|
||||
- Support for multiple stock locations
|
||||
|
||||
## 2.2.2 - 2014-08-19
|
||||
|
||||
- French language added
|
||||
- Thai language added
|
||||
- Upgrade CodeIgniter to version `2.2.0`
|
||||
- Database types for amounts all changed to decimal types (this will fix rounding errors in the sales and receivings reports)
|
||||
- Fix duplicated session cookies in HTTP headers (this broke the application when running on Nginx)
|
||||
|
||||
## 2.1.1
|
||||
|
||||
- Barcodes on the order receipt were not generated correctly
|
||||
- Sales edit screen for detailed sales reports is now available with ThickBox as in the rest of the application
|
||||
- Indonesian language files updated (Oktafianus)
|
||||
- Default language set to `en` in `config.php`
|
||||
- Fixed some CSS bugs in the suspended sales section
|
||||
- Default cookie `sess_time_expire` set to `86400` (24h)
|
||||
|
||||
## 2.1.0
|
||||
|
||||
- Various upgrades, too numerous to list here
|
||||
- Removed dependency on ofc upload library due to vulnerability found
|
||||
|
||||
## 2.0.2
|
||||
|
||||
- Fixed multiple gift cards issue per Bug #4 reported on Sourceforge where a second gift card added would have its balance set to `0` even if the sale did not require the total of the second gift card to pay the remaining amount due
|
||||
- Small code cleanup
|
||||
|
||||
## 2.1.0
|
||||
|
||||
- Upgrade CodeIgniter to version `2.1.0`
|
||||
- Various small improvements
|
||||
@@ -1,53 +0,0 @@
|
||||
# package.json
|
||||
|
||||
## scripts
|
||||
|
||||
`npm run scriptname`
|
||||
|
||||
- `clean` - wipe the dependencies downloaded by Composer, Bower, and npm
|
||||
```
|
||||
grunt clean:composer & grunt clean:bower & grunt clean:npm
|
||||
```
|
||||
- `install` - automatically runs the Composer and Bower install commands after installing the npm dependencies
|
||||
```
|
||||
composer install & bower install
|
||||
```
|
||||
- `update` - updates Composer and the dependencies downloaded by Composer and npm
|
||||
```
|
||||
npm update & composer self-update & composer update
|
||||
```
|
||||
|
||||
## devDependencies
|
||||
|
||||
- `grunt` - used for copying files downloaded by npm
|
||||
- `grunt-contrib-clean` - Grunt plugin to clean files before copying
|
||||
- `grunt-contrib-copy` - Grunt plugin to copy files downloaded by npm
|
||||
- `npm` - downloads project dependencies
|
||||
- the others are unlisted for now, because this will probably change pretty significantly in the near future
|
||||
|
||||
## dependencies
|
||||
|
||||
- `bootstrap` - main CSS framework used
|
||||
- `bootswatch` - themes for the UI
|
||||
|
||||
## devDependencies (global)
|
||||
|
||||
- `bower` - for the time being, Bower is still necessary
|
||||
|
||||
|
||||
# composer.json
|
||||
|
||||
## require
|
||||
|
||||
- `php` - this application runs on PHP
|
||||
- `codeigniter/framework` - the CodeIgniter PHP framework this application is build on
|
||||
- `dompdf/dompdf` - no description
|
||||
- `tamtamchik/namecase` - no description
|
||||
- `paragonie/random_compat` - no description
|
||||
- `vlucas/phpdotenv` - no description
|
||||
|
||||
## require-dev
|
||||
|
||||
- `mikey179/vfsstream` - no description
|
||||
- `phpunit/phpunit` - no description
|
||||
- `kenjis/ci-phpunit-test` - no description
|
||||
39
Dockerfile
39
Dockerfile
@@ -1,39 +0,0 @@
|
||||
FROM php:7.4-apache AS ospos
|
||||
LABEL maintainer="jekkos"
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libicu-dev \
|
||||
libgd-dev \
|
||||
openssl
|
||||
|
||||
RUN a2enmod rewrite headers
|
||||
RUN docker-php-ext-install mysqli bcmath intl gd
|
||||
RUN echo "date.timezone = \"\${PHP_TIMEZONE}\"" > /usr/local/etc/php/conf.d/timezone.ini
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN ln -s /app/*[^public] /var/www && rm -rf /var/www/html && ln -nsf /app/public /var/www/html
|
||||
RUN chmod -R 750 /app/public/uploads /app/application/logs && chown -R www-data:www-data /app/public /app/application
|
||||
|
||||
FROM ospos AS ospos_test
|
||||
|
||||
COPY --from=composer /usr/bin/composer /usr/bin/composer
|
||||
|
||||
RUN apt-get install -y libzip-dev wget git
|
||||
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /bin/wait-for-it.sh && chmod +x /bin/wait-for-it.sh
|
||||
RUN docker-php-ext-install zip
|
||||
RUN composer install -d/app
|
||||
RUN php /app/vendor/kenjis/ci-phpunit-test/install.php -a /app/application -p /app/vendor/codeigniter/framework
|
||||
RUN sed -i 's/backupGlobals="true"/backupGlobals="false"/g' /app/application/tests/phpunit.xml
|
||||
RUN sed -i '13,17d' /app/application/tests/controllers/Welcome_test.php
|
||||
WORKDIR /app/application/tests
|
||||
|
||||
CMD ["/app/vendor/phpunit/phpunit/phpunit"]
|
||||
|
||||
FROM ospos AS ospos_dev
|
||||
|
||||
RUN mkdir -p /app/bower_components && ln -s /app/bower_components /var/www/html/bower_components
|
||||
RUN yes | pecl install xdebug \
|
||||
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
|
||||
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
|
||||
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
|
||||
306
Gruntfile.js
306
Gruntfile.js
@@ -1,306 +0,0 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
wiredep: {
|
||||
task: {
|
||||
ignorePath: '../../../public/',
|
||||
src: ['application/views/partial/header.php']
|
||||
}
|
||||
},
|
||||
bower_concat: {
|
||||
all: {
|
||||
mainFiles: {
|
||||
'bootstrap-table': [
|
||||
"dist/bootstrap-table.min.js",
|
||||
"dist/bootstrap-table.css",
|
||||
"dist/extensions/export/bootstrap-table-export.min.js",
|
||||
"dist/extensions/mobile/bootstrap-table-mobile.min.js",
|
||||
"dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js",
|
||||
"dist/extensions/sticky-header/bootstrap-table-sticky-header.css"
|
||||
],
|
||||
'chartist-plugin-axistitle': [ "./dist/chartist-plugin-axistitle.min.js"]
|
||||
},
|
||||
dest: {
|
||||
'js': 'tmp/opensourcepos_bower.js',
|
||||
'css': 'tmp/opensourcepos_bower.css'
|
||||
}
|
||||
}
|
||||
},
|
||||
bowercopy: {
|
||||
options: {
|
||||
report: false
|
||||
},
|
||||
targetdistjqueryui: {
|
||||
options: {
|
||||
srcPrefix: 'public/bower_components/jquery-ui',
|
||||
destPrefix: 'public/dist'
|
||||
},
|
||||
files: {
|
||||
'jquery-ui': 'themes/base/jquery-ui.min.css'
|
||||
}
|
||||
},
|
||||
targetdistbootswatch: {
|
||||
options: {
|
||||
srcPrefix: 'public/bower_components/bootswatch',
|
||||
destPrefix: 'public/dist'
|
||||
},
|
||||
files: {
|
||||
bootswatch: '*/'
|
||||
}
|
||||
},
|
||||
targetlicense: {
|
||||
options: {
|
||||
srcPrefix: './'
|
||||
},
|
||||
files: {
|
||||
'public/license': 'LICENSE'
|
||||
}
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
themes: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap/dist/css',
|
||||
src: ['bootstrap.css', 'bootstrap.min.css'],
|
||||
dest: 'public/dist/bootswatch-5/bootstrap/',
|
||||
filter: 'isFile'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootswatch/dist',
|
||||
src: ['**/bootstrap.css', '**/bootstrap.min.css'],
|
||||
dest: 'public/dist/bootswatch-5/',
|
||||
filter: 'isFile'
|
||||
}
|
||||
],
|
||||
},
|
||||
licenses: {
|
||||
files: [{
|
||||
expand: true,
|
||||
src: 'LICENSE',
|
||||
dest: 'public/license/',
|
||||
filter: 'isFile',},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootstrap',
|
||||
src: 'LICENSE',
|
||||
dest: 'public/license/',
|
||||
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootstrap-5.license'); },
|
||||
filter: 'isFile'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'node_modules/bootswatch',
|
||||
src: 'LICENSE',
|
||||
dest: 'public/license/',
|
||||
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootswatch-5.license'); },
|
||||
filter: 'isFile'
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
cssmin: {
|
||||
target: {
|
||||
files: {
|
||||
'public/dist/opensourcepos.min.css': ['tmp/opensourcepos_bower.css', 'public/css/*.css', '!public/css/login.css', '!public/css/login.min.css', '!public/css/invoice_email.css', '!public/css/barcode_font.css', '!public/css/darkly.css'],
|
||||
'public/css/login.min.css': ['public/css/login.css']
|
||||
}
|
||||
}
|
||||
},
|
||||
concat: {
|
||||
js: {
|
||||
options: {
|
||||
separator: ';'
|
||||
},
|
||||
files: {
|
||||
'tmp/opensourcepos.js': ['public/dist/jquery/jquery.js', 'tmp/opensourcepos_bower.js', 'public/js/*.js']
|
||||
}
|
||||
},
|
||||
sql: {
|
||||
options: {
|
||||
banner: '-- >> This file is autogenerated from tables.sql and constraints.sql. Do not modify directly << --'
|
||||
},
|
||||
files: {
|
||||
'database/database.sql': ['database/tables.sql', 'database/constraints.sql'],
|
||||
'database/migrate_phppos_dist.sql': ['database/tables.sql', 'database/phppos_migrate.sql', 'database/constraints.sql']
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! opensourcepos <%= grunt.template.today("dd-mm-yyyy") %> */\n'
|
||||
},
|
||||
dist: {
|
||||
files: {
|
||||
'public/dist/opensourcepos.min.js': ['tmp/opensourcepos.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
files: ['Gruntfile.js', 'public/js/*.js'],
|
||||
options: {
|
||||
// options here to override JSHint defaults
|
||||
globals: {
|
||||
jQuery: true,
|
||||
console: true,
|
||||
module: true,
|
||||
document: true
|
||||
}
|
||||
}
|
||||
},
|
||||
tags: {
|
||||
css_header: {
|
||||
options: {
|
||||
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
|
||||
openTag: '<!-- start css template tags -->',
|
||||
closeTag: '<!-- end css template tags -->',
|
||||
ignorePath: '../../../public/'
|
||||
},
|
||||
src: ['public/css/*.css', '!public/css/login.css', '!public/css/login.min.css', '!public/css/invoice_email.css', '!public/css/barcode_font.css', '!public/css/darkly.css'],
|
||||
dest: 'application/views/partial/header.php',
|
||||
},
|
||||
mincss_header: {
|
||||
options: {
|
||||
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
|
||||
openTag: '<!-- start mincss template tags -->',
|
||||
closeTag: '<!-- end mincss template tags -->',
|
||||
ignorePath: '../../../public/'
|
||||
},
|
||||
// jquery-ui must be first or at least before opensourcepos.min.css
|
||||
src: ['public/dist/jquery-ui/*.css', 'public/dist/*.css'],
|
||||
dest: 'application/views/partial/header.php',
|
||||
},
|
||||
css_login: {
|
||||
options: {
|
||||
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
|
||||
openTag: '<!-- start css template tags -->',
|
||||
closeTag: '<!-- end css template tags -->',
|
||||
ignorePath: '../../public/'
|
||||
},
|
||||
src: 'public/css/login.min.css',
|
||||
dest: 'application/views/login.php'
|
||||
},
|
||||
js: {
|
||||
options: {
|
||||
scriptTemplate: '<script type="text/javascript" src="{{ path }}"></script>',
|
||||
openTag: '<!-- start js template tags -->',
|
||||
closeTag: '<!-- end js template tags -->',
|
||||
ignorePath: '../../../public/'
|
||||
},
|
||||
src: ['public/dist/bootstrap/js/*.min.js', 'public/js/jquery*', 'public/js/*.js'],
|
||||
dest: 'application/views/partial/header.php'
|
||||
},
|
||||
minjs: {
|
||||
options: {
|
||||
scriptTemplate: '<script type="text/javascript" src="{{ path }}"></script>',
|
||||
openTag: '<!-- start minjs template tags -->',
|
||||
closeTag: '<!-- end minjs template tags -->',
|
||||
ignorePath: '../../../public/'
|
||||
},
|
||||
src: ['public/dist/*min.js'],
|
||||
dest: 'application/views/partial/header.php'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
files: ['<%= jshint.files %>'],
|
||||
tasks: ['jshint']
|
||||
},
|
||||
cachebreaker: {
|
||||
dev: {
|
||||
options: {
|
||||
match: [ {
|
||||
'opensourcepos.min.js': 'public/dist/opensourcepos.min.js',
|
||||
'opensourcepos.min.css': 'public/dist/opensourcepos.min.css'
|
||||
} ],
|
||||
replacement: 'md5'
|
||||
},
|
||||
files: {
|
||||
src: ['application/views/partial/header.php', 'application/views/login.php']
|
||||
}
|
||||
}
|
||||
},
|
||||
clean: {
|
||||
bower: ["public/bower_components"],
|
||||
composer: ["vendor"],
|
||||
license: ['public/bower_components/**/bower.json'],
|
||||
npm: ["node_modules"]
|
||||
},
|
||||
license: {
|
||||
all: {
|
||||
// Target-specific file lists and/or options go here.
|
||||
options: {
|
||||
// Target-specific options go here.
|
||||
directory: 'public/bower_components',
|
||||
output: 'public/license/bower.LICENSES'
|
||||
}
|
||||
}
|
||||
},
|
||||
'bower-licensechecker': {
|
||||
options: {
|
||||
/*directory: 'path/to/bower',*/
|
||||
acceptable: [ 'MIT', 'BSD', 'LICENSE.md' ],
|
||||
printTotal: true,
|
||||
warn: {
|
||||
nonBower: true,
|
||||
noLicense: true,
|
||||
allGood: true,
|
||||
noGood: true
|
||||
},
|
||||
log: {
|
||||
outFile: 'public/license/.licenses',
|
||||
nonBower: true,
|
||||
noLicense: true,
|
||||
allGood: true,
|
||||
noGood: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
compress: {
|
||||
main: {
|
||||
options: {
|
||||
mode: 'tar',
|
||||
archive: 'dist/opensourcepos.tgz',
|
||||
level: 2
|
||||
},
|
||||
files: [
|
||||
{
|
||||
src: [
|
||||
'public/**',
|
||||
'vendor/**',
|
||||
'application/**',
|
||||
'!/application/tests',
|
||||
'!/public/images/menubar/png/',
|
||||
'!/public/dist/bootswatch/',
|
||||
'/public/dist/bootswatch/*/*.css',
|
||||
'!/public/dist/bootswatch-5/',
|
||||
'/public/dist/bootswatch-5/*/*.css',
|
||||
'database/**',
|
||||
'*.txt',
|
||||
'*.md',
|
||||
'LICENSE',
|
||||
'docker*',
|
||||
'docker/**',
|
||||
'Dockerfile',
|
||||
'**/.htaccess',
|
||||
'*.csv'
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
grunt.loadNpmTasks('grunt-composer');
|
||||
grunt.loadNpmTasks('grunt-contrib-compress');
|
||||
|
||||
grunt.registerTask('default', ['wiredep', 'bower_concat', 'bowercopy', 'copy', 'concat', 'uglify', 'cssmin', 'tags', 'cachebreaker']);
|
||||
grunt.registerTask('update', ['composer:update', 'bower:update']);
|
||||
grunt.registerTask('genlicense', ['clean:license', 'license', 'bower-licensechecker']);
|
||||
grunt.registerTask('package', ['default', 'compress']);
|
||||
grunt.registerTask('packages', ['composer:update']);
|
||||
|
||||
};
|
||||
65
INSTALL.md
65
INSTALL.md
@@ -1,65 +0,0 @@
|
||||
## Server Requirements
|
||||
|
||||
- PHP version `7.2` to `7.4` are supported, PHP version `≤5.6` and `8.0` are NOT supported. Please note that PHP needs to have the extensions `php-gd`, `php-bcmath`, `php-intl`, `php-openssl`, `php-mbstring` and `php-curl` installed and enabled.
|
||||
- MySQL `5.5`, `5.6` and `5.7` are supported, also MariaDB replacement `10.x` is supported and might offer better performance.
|
||||
- Apache `2.2` and `2.4` are supported. Nginx should work fine too, see [wiki page here](https://github.com/opensourcepos/opensourcepos/wiki/Local-Deployment-using-LEMP).
|
||||
- Raspberry PI based installations proved to work, see [wiki page here](<https://github.com/opensourcepos/opensourcepos/wiki/Installing-on-Raspberry-PI---Orange-PI-(Headless-OSPOS)>).
|
||||
- For Windows based installations please read [the wiki](https://github.com/opensourcepos/opensourcepos/wiki). There are closed issues about this subject, as this topic has been covered a lot.
|
||||
|
||||
## Local install
|
||||
|
||||
First of all, if you're seeing the message `system folder missing` after launching your browser, that most likely means you have cloned the repository and have not built the project.
|
||||
|
||||
1. Download the a [pre-release for a specific branch](https://github.com/opensourcepos/opensourcepos/packages/1047637) or the latest stable [from GitHub here](https://github.com/opensourcepos/opensourcepos/releases). A repository clone will not work unless know how to build the project.
|
||||
2. Create/locate a new MySQL database to install Open Source Point of Sale into.
|
||||
3. Execute the file `database/database.sql` to create the tables needed.
|
||||
4. Unzip and upload Open Source Point of Sale files to the web-server.
|
||||
5. Open `application/config/database.php` and modify credentials to connect to your database if needed.
|
||||
6. Open `application/config/config.php` and swap the encryption key with your own.
|
||||
7. Go to your install `public` dir via the browser.
|
||||
8. Log in using
|
||||
- Username: admin
|
||||
- Password: pointofsale
|
||||
9. Enjoy!
|
||||
10. Oops, an issue? Please make sure you read the FAQ, wiki page, and you checked open and closed issues on GitHub. PHP `display_errors` is disabled by default. Create an` application/config/.env` file from the `.env.example` to enable it in a development environment.
|
||||
|
||||
## Local install using Docker
|
||||
|
||||
OSPOS can be deployed using Docker on Linux, Mac, and Windows. Locally or on a host (server).
|
||||
This setup dramatically reduces the number of possible issues as all setup is now done in a Dockerfile.
|
||||
Docker runs natively on Mac and Linux. Windows requires WSL2 to be installed. Please refer to the Docker documentation for instructions on how to set it up on your platform.
|
||||
|
||||
**Be aware that this setup is not suited for production usage! Change the default passwords in the compose file before exposing the containers publicly.**
|
||||
|
||||
Start the containers using the following command
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
## Nginx install using Docker
|
||||
|
||||
Since OSPOS version `3.3.0` the Docker installation offers a reverse proxy based on Nginx with a Let's Encrypt TLS certificate termination (aka HTTPS connection).
|
||||
Let's Encrypt is a free certificate issuer, requiring a special installation that this Docker installation would take care of for you.
|
||||
Any Let's Encrypt TLS certificate renewal will be managed automatically, therefore there is no need to worry about those details.
|
||||
|
||||
Before starting your installation, you should edit the `docker/.env` file and configure it to contain the correct MySQL/MariaDB and phpMyAdmin passwords (don't use the defaults!).
|
||||
You will also need to register to Let's Encrypt. Configure your host domain name and Let's Encrypt email address in the `docker/.env` file.
|
||||
The variable `STAGING` needs to be set to `0` when you are confident your configuration is correct so that Let's Encrypt will issue a final proper TLS certificate.
|
||||
|
||||
Follow local install steps, but instead use
|
||||
|
||||
```
|
||||
docker/install-nginx.sh
|
||||
```
|
||||
|
||||
Do **not** use below command on live deployments unless you want to tear everything down. All your disk content will be wiped!
|
||||
|
||||
```
|
||||
docker/uninstall.sh
|
||||
```
|
||||
|
||||
## Cloud install
|
||||
|
||||
If you choose DigitalOcean:
|
||||
[Through this link](https://m.do.co/c/ac38c262507b), you will get a [**free $100, 60-day credit**](https://m.do.co/c/ac38c262507b). [Check the wiki](https://github.com/opensourcepos/opensourcepos/wiki/Getting-Started-installations) for further instructions on how to install the necessary components.
|
||||
61
LICENSE
61
LICENSE
@@ -1,55 +1,20 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2021 jekkos
|
||||
Copyright (c) 2015-2021 FrancescoUK (aka daN4cat)
|
||||
Copyright (c) 2017-2021 Steve Ireland
|
||||
Copyright (c) 2017-2021 objecttothis
|
||||
Copyright (c) 2017-2021 odiea
|
||||
Copyright (c) 2017-2021 WebShells
|
||||
Copyright (c) 2020-2021 Andriux1990
|
||||
Copyright (c) 2021 BudsieBuds
|
||||
Copyright (c) 2019 Loyd Jayme (aka loydjayme25)
|
||||
Copyright (c) 2018 Erasto Marroquin (aka Erastus)
|
||||
Copyright (c) 2018 Nathan Sas (aka nathanzky)
|
||||
Copyright (c) 2018 Emilio Silva (aka emi-silva)
|
||||
Copyright (c) 2017 Jesus Guerrero Botella (aka i92guboj)
|
||||
Copyright (c) 2017 Deep Shah (aka deepshah)
|
||||
Copyright (c) 2017 Joshua Fernandez (aka joshua1234511)
|
||||
Copyright (c) 2017 asadjaved63
|
||||
Copyright (c) 2016-2017 Ramkrishna Mondal (aka RamkrishnaMondal)
|
||||
Copyright (c) 2016-2017 Jorge Colmenarez (aka jlctmaster), frontuari.com
|
||||
Copyright (c) 2016 Rinaldy@dbarber (aka rnld26)
|
||||
Copyright (c) 2015 Aamir Shahzad (aka asakpke), RoshanTech.com
|
||||
Copyright (c) 2015 Toni Haryanto (aka yllumi)
|
||||
Copyright (c) 2013 Rob Garrison
|
||||
Copyright (c) 2013 Parq
|
||||
Copyright (c) 2013 Ramel
|
||||
Copyright (c) 2012-2014 pappastech
|
||||
Copyright (c) 2012 Alain
|
||||
Copyright (c) 2014 pappastech
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Additionally, you cannot claim copyright or ownership of the Software.
|
||||
|
||||
The footer signatures with version, hash and URL link to the official website
|
||||
of the project MUST BE RETAINED, MUST BE VISIBLE IN EVERY PAGE and CANNOT BE
|
||||
MODIFIED.
|
||||
Footer signatures are in the format
|
||||
"© 2010 - current year · opensourcepos.org · version - commit"
|
||||
or "Open Source Point of Sale".
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
156
README.md
156
README.md
@@ -1,143 +1,17 @@
|
||||
<p align="center"><img src="branding/emblem.svg" alt="Open Source Point of Sale Logo" width="auto" height="200"></p>
|
||||
<h3 align="center">Open Source Point of Sale</h3>
|
||||
Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.
|
||||
|
||||
<p align="center">
|
||||
<a href="#-introduction">Introduction</a> · <a href="#-live-demo">Demo</a> · <a href="#-installation">Installation</a> ·
|
||||
<a href="#-contributing">Contributing</a> · <a href="#-reporting-bugs">Bugs</a> · <a href="#-faq">FAQ</a> ·
|
||||
<a href="#-keep-the-machine-running">Donate</a> · <a href="#-license">License</a> · <a href="#-credits">Credits</a>
|
||||
</p>
|
||||
How to Install
|
||||
--------------
|
||||
1. Create/locate a new mysql database to install open source point of sale into
|
||||
2. Execute the file database/database.sql to create the tables needed
|
||||
3. unzip and upload Open Source Point of Sale files to web server
|
||||
4. Copy application/config/database.php.tmpl to application/config/database.php
|
||||
5. Modify application/config/database.php to connect to your database
|
||||
6. Modify application/config/config.php encryption key with your own
|
||||
7. Go to your point of sale install via the browser
|
||||
8. LOGIN using
|
||||
username: admin
|
||||
password:pointofsale
|
||||
9. Enjoy
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/opensourcepos/opensourcepos" target="_blank"><img src="https://travis-ci.com/opensourcepos/opensourcepos.svg?branch=master" alt="Build Status"></a>
|
||||
<a href="https://gitter.im/opensourcepos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" target="_blank"><img src="https://badges.gitter.im/jekkos/opensourcepos.svg" alt="Join the chat at https://gitter.im/opensourcepos"></a>
|
||||
<a href="https://badge.fury.io/gh/jekkos%2Fopensourcepos" target="_blank"><img src="https://badge.fury.io/gh/jekkos%2Fopensourcepos.svg" alt="Project Version"></a>
|
||||
<a href="http://translate.opensourcepos.org/engage/opensourcepos/?utm_source=widget" target="_blank"><img src="http://translate.opensourcepos.org/widgets/opensourcepos/-/svg-badge.svg" alt="Translation Status"></a>
|
||||
</p>
|
||||
|
||||
## 👋 Introduction
|
||||
|
||||
Open Source Point of Sale is a web-based point of sale system. The application is written in PHP, it uses MySQL (or MariaDB) as data storage back-end and has a simple but intuitive user interface.
|
||||
|
||||
The latest `3.x` version is a complete overhaul of the original software. It uses CodeIgniter 3 as a framework and is based on Bootstrap 3 using Bootswatch themes. Along with improved functionality and security.
|
||||
|
||||
The features include:
|
||||
|
||||
- Stock management (items and kits with an extensible list of attributes)
|
||||
- VAT, GST, customer, and multi tiers taxation
|
||||
- Sale register with transactions logging
|
||||
- Quotation and invoicing
|
||||
- Expenses logging
|
||||
- Cash up function
|
||||
- Printing and emailing of receipts, invoices and quotations
|
||||
- Barcode generation and printing
|
||||
- Database of customers and suppliers
|
||||
- Multiuser with permission control
|
||||
- Reporting on sales, orders, expenses, inventory status and more
|
||||
- Receivings
|
||||
- Gift cards
|
||||
- Rewards
|
||||
- Restaurant tables
|
||||
- Messaging (SMS)
|
||||
- Multilanguage
|
||||
- Selectable Bootstrap based UI theme with Bootswatch
|
||||
- Mailchimp integration
|
||||
- Optional Google reCAPTCHA to protect login page from brute force attacks
|
||||
- GDPR ready
|
||||
|
||||
## 🧪 Live Demo
|
||||
|
||||
We've got a live version of our latest master running for you to play around with and test everything out. It's a containerized install that will reinitialize when new functionality is merged into our code repository.
|
||||
|
||||
You can [find the demo here](https://demo.opensourcepos.org/) and log in with these credentials.
|
||||
👤 Username `admin`
|
||||
🔒 Password `pointofsale`
|
||||
|
||||
If you bump into an issue, please check [the status page here](https://status.opensourcepos.org/) to confirm if the server is up and running.
|
||||
|
||||
## 🖥️ Development Demo
|
||||
|
||||
Besides the demo of the latest master, we also have a development server that builds when there's a new commit to our repository. It's mainly used for testing out new code before merging it into the master. [It can be found here](https://dev.opensourcepos.org/).
|
||||
|
||||
The log in credentials are the same as the regular live demo.
|
||||
|
||||
## 💾 Installation
|
||||
|
||||
Please **refrain from creating issues** about installation problems before having read the FAQ and going through existing GitHub issues. We have a build pipeline that checks the sanity of our latest repository commit, and in case the application itself is broken then our build will be as well.
|
||||
|
||||
This application can be set up in _many_ different ways and we only support the ones described in [the INSTALL.md file](INSTALL.md).
|
||||
|
||||
For more information and recommendations on support hardware, like receipt printers and barcode scanners, read [this page](https://github.com/opensourcepos/opensourcepos/wiki/Supported-hardware-datasheet) on our wiki.
|
||||
|
||||
## ✨ Contributing
|
||||
|
||||
Everyone is more than welcome to help us improve this project. If you think you've got something to help us go forward, feel free to open a [pull request]().
|
||||
|
||||
Want to help translate Open Source Point of Sale in your language? You can find [our Weblate here](https://translate.opensourcepos.org), sign up, and start translating. You can subscribe to different languages to receive a notification once a new string is added or needs updating. Have a look at our [guidelines](https://github.com/opensourcepos/opensourcepos/wiki/Adding-translations) below to help you get started.
|
||||
|
||||
Only with the help of the community, we can keep language translations up to date. Thanks!
|
||||
|
||||
## 🐛 Reporting Bugs
|
||||
|
||||
Before creating a new issue, you'll need copy and include the info under the `System Info` tab in the configuration section in most cases. If that information is not provided in full, your issue might be tagged as pending.
|
||||
|
||||
If you're reporting a potential security issue, please refer to our security policy found in the [SECURITY.md](SECURITY.md) file.
|
||||
|
||||
NOTE: If you're running non-release code, please make sure you always run the latest database upgrade script and you download the latest master code.
|
||||
|
||||
## 📖 FAQ
|
||||
|
||||
- If you get the message `system folder missing`, then you have cloned the source using git and you need to run a build first. Check [INSTALL.md](INSTALL.md) for instructions or download latest zip file from [GitHub releases](https://github.com/opensourcepos/opensourcepos/releases) instead.
|
||||
|
||||
- If at login time you read `The installation is not correct, check your php.ini file.`, please check the error_log in `public` folder to understand what's wrong and make sure you read the [INSTALL.md](INSTALL.md). To know how to enable `error_log`, please read the comment in [issue #1770](https://github.com/opensourcepos/opensourcepos/issues/1770#issuecomment-355177943).
|
||||
|
||||
- If you installed your OSPOS under a web server subdir, please edit `public/.htaccess` and go to the lines with the comments `if in web root` or `if in subdir`, uncomment one and replace `<OSPOS path>` with your path and follow the instruction on the second comment line. If you face more issues, please read [issue #920](https://github.com/opensourcepos/opensourcepos/issues/920) for more information.
|
||||
|
||||
- Apache server configurations are SysAdmin issues and not strictly related to OSPOS. Please make sure you can show a "Hello world" HTML page before pointing to OSPOS public directory. Make sure `.htaccess` is correctly configured.
|
||||
|
||||
- If the avatar pictures are not shown in items or at item save you get an error, please make sure your `public` and subdirs are assigned to the correct owner and the access permission is set to `750`.
|
||||
|
||||
- If you install OSPOS in Docker behind a proxy that performs `ssloffloading`, you can enable the URL generated to be HTTPS instead of HTTP, by activating the environment variable `FORCE_HTTPS = 1`.
|
||||
|
||||
- If you have suhosin installed and face an issue with CSRF, please make sure you read [issue #1492](https://github.com/opensourcepos/opensourcepos/issues/1492).
|
||||
|
||||
- PHP 8.0 is not currently supported, see [issue #3051](https://github.com/opensourcepos/opensourcepos/issues/3051).
|
||||
|
||||
- PHP 5.5 and 5.6 are no longer supported due to the fact that they have been deprecated and not safe to use from security point of view.
|
||||
|
||||
## 🏃 Keep the Machine Running
|
||||
|
||||
If you like our project, please consider buying us a coffee through the button below so we can keep adding features.
|
||||
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MUN6AEG7NY6H8)\
|
||||
Or refer to the [FUNDING.yml](.github/FUNDING.yml) file.
|
||||
|
||||
If you choose to deploy OSPOS in the cloud, you can contribute to the project by using DigitalOcean and signing up through our referral link. You'll receive a [free $100, 60-day credit](https://m.do.co/c/ac38c262507b) if you run OSPOS in a DigitalOcean droplet through [our referral link](https://m.do.co/c/ac38c262507b).
|
||||
|
||||
## 📄 License
|
||||
|
||||
Open Source Point of Sale is licensed under MIT terms with an important addition:
|
||||
|
||||
The footer signature "© 2010 - _current year_ · opensourcepos.org · 3.x.x - _hash_" including the version, hash and link our website MUST BE RETAINED, MUST BE VISIBLE IN EVERY PAGE and CANNOT BE MODIFIED.
|
||||
|
||||
Also worth noting:
|
||||
|
||||
_The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software._
|
||||
|
||||
For more details please read the [LICENSE](LICENSE) file.
|
||||
|
||||
It's important to understand that although you are free to use the application the copyright has to stay and the license agreement applies in all cases. Therefore any actions like:
|
||||
|
||||
- Removing LICENSE and/or any license files is prohibited
|
||||
- Authoring the footer notice replacing it with your own or even worse claiming the copyright is absolutely prohibited
|
||||
- Claiming full ownership of the code is prohibited
|
||||
|
||||
In short, you are free to use the application but you cannot claim any property on it.
|
||||
|
||||
Any person or company found breaching the license agreement might find a bunch of monkeys at the door ready to destroy their servers.
|
||||
|
||||
## 🙏 Credits
|
||||
|
||||
| <div align="center">JetBrains</div> | <div align="center">Travis CI</div> |
|
||||
|--- | --- |
|
||||
| <div align="center"><img src="https://upload.wikimedia.org/wikipedia/commons/9/9c/IntelliJ_IDEA_Icon.svg" alt="IntelliJ IDEA Logo" height="50"></div> | <div align="center"><img src="https://secrethub.io/img/travis-ci.svg" alt="Travis CI Logo" height="50"></div> |
|
||||
| Many thanks to [JetBrains](https://www.jetbrains.com/) for providing a free license of [IntelliJ IDEA](https://www.jetbrains.com/idea/) to kindly support the development of OSPOS. | Many thanks to [Travis CI](https://travis-ci.org) for providing a free continuous integration service for open source projects. |
|
||||
A more extensive setup guide can be found at [this site](http://www.opensourceposguide.com/guide/gettingstarted/installation)
|
||||
|
||||
24
SECURITY.md
24
SECURITY.md
@@ -1,24 +0,0 @@
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
|
||||
|
||||
- [Security Policy](#security-policy)
|
||||
- [Supported Versions](#supported-versions)
|
||||
- [Reporting a Vulnerability](#reporting-a-vulnerability)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
We release patches for security vulnerabilities. Which versions are eligible to receive such patches depend on the CVSS v3.0 Rating:
|
||||
|
||||
| CVSS v3.0 | Supported Versions |
|
||||
| --------- | -------------------------------------------------- |
|
||||
| 7.3 | 3.3.5 |
|
||||
| 9.8 | 3.3.6 |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report (suspected) security vulnerabilities to **[jekkos@opensourcepos.org](mailto:jekkos@opensourcepos.org)**. You will receive a response from us within 48 hours. If the issue is confirmed, we will release a patch as soon as possible depending on complexity but historically within a few days.
|
||||
17
UPGRADE.md
17
UPGRADE.md
@@ -1,17 +0,0 @@
|
||||
## How to Upgrade
|
||||
|
||||
1. Back up all your current database and OSPOS code.
|
||||
2. Make sure you have a copy of `application/config/config.php` and `application/config/database.php`.
|
||||
3. Remove all directories.
|
||||
4. Install the new OSPOS.
|
||||
5. (Only applicable if upgrading from pre `3.0.0`) Run the database upgrade scripts from `database` dir (check which ones you need according to the version you are upgrading from).
|
||||
6. Take the saved old `config.php` and upgrade the new `config.php` with any additional changes you made in the old.
|
||||
Take time to understand if new config rules require some changes (e.g. encryption keys).
|
||||
7. Take the saved old `database.php` and change the new `database.php` to contain all the configurations you had in the old setup.
|
||||
Please try not to use the old layout, use the new one and copy the content of the config variables.
|
||||
8. Restore the content of the old `uploads` folder into `public/uploads` one.
|
||||
9. Once the new code is in place, the database is manually updated, and the config files are in place, you're good to go.
|
||||
10. The first login will take longer because OSPOS post `3.0.0` will upgrade automatically to the latest version.
|
||||
11. If everything went according to plan, you'll be able to use your upgraded version of OSPOS.
|
||||
12. Still have issues? Please check the [README](README.md) and [GitHub issues](https://github.com/opensourcepos/opensourcepos/issues).
|
||||
Maybe a similar issue has already been reported, and you can find your answer there.
|
||||
4
UPGRADE.txt
Normal file
4
UPGRADE.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
How to Upgrade
|
||||
-------------------------
|
||||
1. Replace all code from your point of sale installation with the code downloaded
|
||||
2. Run the necessary database upgrades from the database folder
|
||||
33
WHATS_NEW.txt
Normal file
33
WHATS_NEW.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
Version 2.2.2
|
||||
-------------
|
||||
+ French language added
|
||||
+ Thai language added
|
||||
+ Upgrade to CodeIgniter 2.2 (contains several security fixes)
|
||||
+ Database types for amounts all changed to decimal types (this will fix rounding errors in the sales and receivings reports) the rest of the application
|
||||
+ Fix duplicated session cookies in http headers (this broke the application when running on nginx)
|
||||
|
||||
Version 2.1.1
|
||||
-------------
|
||||
+ Barcodes on the order receipt weren't generated correctly
|
||||
+ Sales edit screen for detailed sales reports is now available with thickbox as in the rest of the application
|
||||
+ Indonesian language files updated (Oktafianus)
|
||||
+ Default language set to 'en' in config.php
|
||||
+ Fix some css bugs in suspended sales section
|
||||
+ Default cookie sess_time_expire set to 86400 (24h)
|
||||
|
||||
Version 2.1.0
|
||||
-------------
|
||||
+ Various upgrades, too numerous to list here.
|
||||
+ Removed dependancy on ofc upload library due to vulnerability found.
|
||||
|
||||
Version 2.0.2
|
||||
-------------
|
||||
+ Fixed multiple giftcards issue per Bug #4 reported on Sourceforge where a
|
||||
second giftcard added would have its balance set to $0 even if the sale did
|
||||
not require the total of the second giftcard to pay the remaining amount due.
|
||||
+ Small code cleanup
|
||||
|
||||
Version 2.1.0
|
||||
-------------
|
||||
* Upgrade to CodeIgniter 2.1.0
|
||||
* Various small improvements
|
||||
@@ -1,6 +1 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
Deny from all
|
||||
7
application/cache/.htaccess
vendored
7
application/cache/.htaccess
vendored
@@ -1,6 +1 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
deny from all
|
||||
3
application/cache/index.html
vendored
3
application/cache/index.html
vendored
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,8 +0,0 @@
|
||||
CI_ENV="development"
|
||||
#CI_ENV="production"
|
||||
|
||||
#Database Settings
|
||||
MYSQL_HOST_NAME="localhost"
|
||||
MYSQL_USERNAME="admin"
|
||||
MYSQL_PASSWORD="pointofsale"
|
||||
MYSQL_DB_NAME="ospos"
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| AUTO-LOADER
|
||||
@@ -22,64 +20,40 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
|
||||
| 1. Packages
|
||||
| 2. Libraries
|
||||
| 3. Drivers
|
||||
| 4. Helper files
|
||||
| 5. Custom config files
|
||||
| 6. Language files
|
||||
| 7. Models
|
||||
| 3. Helper files
|
||||
| 4. Custom config files
|
||||
| 5. Language files
|
||||
| 6. Models
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Packages
|
||||
| Auto-load Packges
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
||||
|
|
||||
*/
|
||||
|
||||
$autoload['packages'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Libraries
|
||||
| -------------------------------------------------------------------
|
||||
| These are the classes located in system/libraries/ or your
|
||||
| application/libraries/ directory, with the addition of the
|
||||
| 'database' library, which is somewhat of a special case.
|
||||
| These are the classes located in the system/libraries folder
|
||||
| or in your application/libraries folder.
|
||||
|
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['libraries'] = array('database', 'email', 'session');
|
||||
|
|
||||
| You can also supply an alternative library name to be assigned
|
||||
| in the controller:
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
|
||||
*/
|
||||
$autoload['libraries'] = array('database', 'form_validation', 'session', 'user_agent', 'pagination', 'encryption');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Drivers
|
||||
| -------------------------------------------------------------------
|
||||
| These classes are located in system/libraries/ or in your
|
||||
| application/libraries/ directory, but are also placed inside their
|
||||
| own subdirectory and they extend the CI_Driver_Library class. They
|
||||
| offer multiple interchangeable driver options.
|
||||
|
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['drivers'] = array('cache');
|
||||
|
|
||||
| You can also supply an alternative property name to be assigned in
|
||||
| the controller:
|
||||
|
|
||||
| $autoload['drivers'] = array('cache' => 'cch');
|
||||
|
|
||||
*/
|
||||
$autoload['drivers'] = array();
|
||||
$autoload['libraries'] = array('database','form_validation','session','user_agent', 'pagination');
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -89,7 +63,9 @@ $autoload['drivers'] = array();
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array('form', 'url', 'tabular', 'text', 'locale', 'html', 'download', 'directory', 'migration', 'importfile');
|
||||
|
||||
$autoload['helper'] = array('form','url','table','text','currency', 'html', 'download', 'directory');
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -103,8 +79,10 @@ $autoload['helper'] = array('form', 'url', 'tabular', 'text', 'locale', 'html',
|
||||
| config files. Otherwise, leave it blank.
|
||||
|
|
||||
*/
|
||||
|
||||
$autoload['config'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Language files
|
||||
@@ -117,47 +95,22 @@ $autoload['config'] = array();
|
||||
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
||||
|
|
||||
*/
|
||||
|
||||
$autoload['language'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Models
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['model'] = array('first_model', 'second_model');
|
||||
| $autoload['model'] = array('model1', 'model2');
|
||||
|
|
||||
| You can also supply an alternative model name to be assigned
|
||||
| in the controller:
|
||||
|
|
||||
| $autoload['model'] = array('first_model' => 'first');
|
||||
*/
|
||||
$autoload['model'] = array(
|
||||
'Appconfig',
|
||||
'Person',
|
||||
'Customer',
|
||||
'Employee',
|
||||
'Module',
|
||||
'Item',
|
||||
'Item_taxes',
|
||||
'Sale',
|
||||
'Supplier',
|
||||
'Inventory',
|
||||
'Receiving',
|
||||
'Giftcard',
|
||||
'Item_kit',
|
||||
'Item_kit_items',
|
||||
'Stock_location',
|
||||
'Item_quantity',
|
||||
'Dinner_table',
|
||||
'Customer_rewards',
|
||||
'Rewards',
|
||||
'Expense_category',
|
||||
'Expense',
|
||||
'Cashup',
|
||||
'Attribute',
|
||||
'Tax',
|
||||
'Tax_category',
|
||||
'Tax_code',
|
||||
'Tax_jurisdiction'
|
||||
);
|
||||
|
||||
$autoload['model'] = array('Appconfig','Person','Customer','Employee','Module','Item', 'Item_taxes', 'Sale', 'Sale_suspended', 'Supplier','Inventory','Receiving','Giftcard', 'Item_kit', 'Item_kit_items','Stock_locations','Item_quantities');
|
||||
|
||||
|
||||
/* End of file autoload.php */
|
||||
/* Location: ./application/config/autoload.php */
|
||||
@@ -1,50 +1,18 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Code Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the version of Open Source Point of Sale you're running
|
||||
|
|
||||
|
|
||||
*/
|
||||
$config['application_version'] = '3.3.7';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Commit sha1
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the commit hash for the version you are currently using
|
||||
|
|
||||
|
|
||||
*/
|
||||
$config['commit_sha1'] = 'dev';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Internal to OSPOS XSS Clean
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is to indicated whether we want XSS clean to be performed or not
|
||||
| By default it's enabled as it's assumed the installation has Internet access and needs to be protected,
|
||||
| however intranet only installations may not need this so they can set FALSE to improve performance
|
||||
|
|
||||
*/
|
||||
$config['ospos_xss_clean'] = TRUE;
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable database query logging hook
|
||||
| Code Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Logs are stored in application/logs
|
||||
| This is the version of Open Source Point of Sale you're running
|
||||
|
|
||||
|
|
||||
*/
|
||||
$config['db_log_enabled'] = FALSE;
|
||||
$config['application_version'] = '2.3';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Base Site URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
@@ -53,22 +21,13 @@ $config['db_log_enabled'] = FALSE;
|
||||
|
|
||||
| http://example.com/
|
||||
|
|
||||
| WARNING: You MUST set this value!
|
||||
|
|
||||
| If it is not set, then CodeIgniter will try guess the protocol and path
|
||||
| your installation, but due to security concerns the hostname will be set
|
||||
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
|
||||
| The auto-detection mechanism exists only for convenience during
|
||||
| development and MUST NOT be used in production!
|
||||
|
|
||||
| If you need to allow multiple domains, remember that this file is still
|
||||
| a PHP script and you can easily do that on your own.
|
||||
| If this is not set then CodeIgniter will guess the protocol, domain and
|
||||
| path to your installation.
|
||||
|
|
||||
*/
|
||||
$config['https_on'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_ENV['FORCE_HTTPS']) && $_ENV['FORCE_HTTPS'] == 'true');
|
||||
$config['base_url'] = $config['https_on'] ? 'https' : 'http';
|
||||
$config['base_url'] .= '://' . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost') ;
|
||||
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
|
||||
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
|
||||
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
|
||||
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -80,7 +39,7 @@ $config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERV
|
||||
| variable so that it is blank.
|
||||
|
|
||||
*/
|
||||
$config['index_page'] = '';
|
||||
$config['index_page'] = 'index.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -88,16 +47,17 @@ $config['index_page'] = '';
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item determines which server global should be used to retrieve the
|
||||
| URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
| URI string. The default setting of 'AUTO' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
|
|
||||
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
$config['uri_protocol'] = 'REQUEST_URI';
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -107,8 +67,9 @@ $config['uri_protocol'] = 'REQUEST_URI';
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/urls.html
|
||||
| http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
|
||||
$config['url_suffix'] = '';
|
||||
|
||||
/*
|
||||
@@ -121,7 +82,7 @@ $config['url_suffix'] = '';
|
||||
| than english.
|
||||
|
|
||||
*/
|
||||
$config['language'] = 'english';
|
||||
$config['language'] = 'en';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -131,8 +92,6 @@ $config['language'] = 'english';
|
||||
| This determines which character set is used by default in various methods
|
||||
| that require a character set to be provided.
|
||||
|
|
||||
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
||||
|
|
||||
*/
|
||||
$config['charset'] = 'UTF-8';
|
||||
|
||||
@@ -147,6 +106,7 @@ $config['charset'] = 'UTF-8';
|
||||
*/
|
||||
$config['enable_hooks'] = TRUE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Extension Prefix
|
||||
@@ -155,56 +115,33 @@ $config['enable_hooks'] = TRUE;
|
||||
| This item allows you to set the filename/classname prefix when extending
|
||||
| native libraries. For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/core_classes.html
|
||||
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
| http://codeigniter.com/user_guide/general/core_classes.html
|
||||
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer auto-loading
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enabling this setting will tell CodeIgniter to look for a Composer
|
||||
| package auto-loader script in application/vendor/autoload.php.
|
||||
|
|
||||
| $config['composer_autoload'] = TRUE;
|
||||
|
|
||||
| Or if you have your vendor/ directory located somewhere else, you
|
||||
| can opt to set a specific path as well:
|
||||
|
|
||||
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
||||
|
|
||||
| For more information about Composer, please visit http://getcomposer.org/
|
||||
|
|
||||
| Note: This will NOT disable or override the CodeIgniter-specific
|
||||
| autoloading (application/config/autoload.php)
|
||||
*/
|
||||
$config['composer_autoload'] = realpath(APPPATH . '../vendor/autoload.php');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify which characters are permitted within your URLs.
|
||||
| When someone tries to submit a URL with disallowed characters they will
|
||||
| get a warning message.
|
||||
| This lets you specify with a regular expression which characters are permitted
|
||||
| within your URLs. When someone tries to submit a URL with disallowed
|
||||
| characters they will get a warning message.
|
||||
|
|
||||
| As a security measure you are STRONGLY encouraged to restrict URLs to
|
||||
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
||||
|
|
||||
| Leave blank to allow all characters -- but only if you are insane.
|
||||
|
|
||||
| The configured value is actually a regular expression character group
|
||||
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
||||
|
|
||||
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
||||
|
|
||||
*/
|
||||
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Query Strings
|
||||
@@ -230,17 +167,19 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||
| use segment based URLs.
|
||||
|
|
||||
*/
|
||||
$config['allow_get_array'] = TRUE;
|
||||
$config['allow_get_array'] = TRUE;
|
||||
$config['enable_query_strings'] = FALSE;
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd';
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you have enabled error logging, you can set an error threshold to
|
||||
| determine what gets logged. Threshold options are:
|
||||
| You can enable error logging by setting a threshold over zero. The
|
||||
| threshold determines what gets logged. Threshold options are:
|
||||
|
|
||||
@@ -250,10 +189,6 @@ $config['directory_trigger'] = 'd';
|
||||
| 3 = Informational Messages
|
||||
| 4 = All Messages
|
||||
|
|
||||
| You can also pass an array with threshold levels to show individual error types
|
||||
|
|
||||
| array(2) = Debug Messages, without Error Messages
|
||||
|
|
||||
| For a live site you'll usually only enable Errors (1) to be logged otherwise
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
@@ -266,37 +201,11 @@ $config['log_threshold'] = 0;
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/logs/ directory. Use a full server path with trailing slash.
|
||||
| application/logs/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default filename extension for log files. The default 'php' allows for
|
||||
| protecting the log files via basic scripting, when they are to be stored
|
||||
| under a publicly accessible directory.
|
||||
|
|
||||
| Note: Leaving it blank will default to 'php'.
|
||||
|
|
||||
*/
|
||||
$config['log_file_extension'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Permissions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The file system permissions to be applied on newly created log files.
|
||||
|
|
||||
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||
| integer notation (i.e. 0700, 0644, etc.)
|
||||
*/
|
||||
$config['log_file_permissions'] = 0640;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Date Format for Logs
|
||||
@@ -308,152 +217,71 @@ $config['log_file_permissions'] = 0640;
|
||||
*/
|
||||
$config['log_date_format'] = 'Y-m-d H:i:s';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Views Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/views/errors/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['error_views_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/cache/ directory. Use a full server path with trailing slash.
|
||||
| system/cache/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Include Query String
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to take the URL query string into consideration when generating
|
||||
| output cache files. Valid options are:
|
||||
|
|
||||
| FALSE = Disabled
|
||||
| TRUE = Enabled, take all query parameters into account.
|
||||
| Please be aware that this may result in numerous cache
|
||||
| files generated for the same page over and over again.
|
||||
| array('q') = Enabled, but only take into account the specified list
|
||||
| of query parameters.
|
||||
|
|
||||
*/
|
||||
$config['cache_query_string'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class, you must set an encryption key.
|
||||
| See the user guide for more info.
|
||||
|
|
||||
| https://codeigniter.com/user_guide/libraries/encryption.html
|
||||
| If you use the Encryption class or the Session class you
|
||||
| MUST set an encryption key. See the user guide for info.
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = getenv('ENCRYPTION_KEY') ? getenv('ENCRYPTION_KEY') : '';
|
||||
$config['encryption_key'] = 'PUT_YOUR_ENCRYPTION_KEY_HERE';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_driver'
|
||||
|
|
||||
| The storage driver to use: files, database, redis, memcached
|
||||
|
|
||||
| 'sess_cookie_name'
|
||||
|
|
||||
| The session cookie name, must contain only [0-9a-z_-] characters
|
||||
|
|
||||
| 'sess_expiration'
|
||||
|
|
||||
| The number of SECONDS you want the session to last.
|
||||
| Setting to 0 (zero) means expire when the browser is closed.
|
||||
|
|
||||
| 'sess_save_path'
|
||||
|
|
||||
| The location to save sessions to, driver dependent.
|
||||
|
|
||||
| For the 'files' driver, it's a path to a writable directory.
|
||||
| WARNING: Only absolute paths are supported!
|
||||
|
|
||||
| For the 'database' driver, it's a table name.
|
||||
| Please read up the manual for the format with other session drivers.
|
||||
|
|
||||
| IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
|
|
||||
| 'sess_match_ip'
|
||||
|
|
||||
| Whether to match the user's IP address when reading the session data.
|
||||
|
|
||||
| WARNING: If you're using the database driver, don't forget to update
|
||||
| your session table's PRIMARY KEY when changing this setting.
|
||||
|
|
||||
| 'sess_time_to_update'
|
||||
|
|
||||
| How many seconds between CI regenerating the session ID.
|
||||
|
|
||||
| 'sess_regenerate_destroy'
|
||||
|
|
||||
| Whether to destroy session data associated with the old session ID
|
||||
| when auto-regenerating the session ID. When set to FALSE, the data
|
||||
| will be later deleted by the garbage collector.
|
||||
|
|
||||
| Other session cookie settings are shared with the rest of the application,
|
||||
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| when the browser window is closed
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_driver'] = 'database';
|
||||
$config['sess_cookie_name'] = 'ospos_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_save_path'] = 'sessions';
|
||||
$config['sess_match_ip'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
$config['sess_regenerate_destroy'] = FALSE;
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 0;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = TRUE;
|
||||
$config['sess_table_name'] = 'ospos_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = FAlSE;
|
||||
$config['sess_time_to_update'] = 86400;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
|
||||
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
|
||||
| 'cookie_path' = Typically will be a forward slash
|
||||
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
|
||||
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
||||
|
|
||||
| Note: These settings (with the exception of 'cookie_prefix' and
|
||||
| 'cookie_httponly') will also affect sessions.
|
||||
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
|
||||
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
|
||||
| 'cookie_path' = Typically will be a forward slash
|
||||
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = '';
|
||||
$config['cookie_domain'] = '';
|
||||
$config['cookie_path'] = '/';
|
||||
$config['cookie_secure'] = $config['https_on'];
|
||||
$config['cookie_httponly'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Standardize newlines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether to standardize newline characters in input data,
|
||||
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
||||
|
|
||||
| This is particularly useful for portability between UNIX-based OSes,
|
||||
| (usually \n) and Windows (\r\n).
|
||||
|
|
||||
*/
|
||||
$config['standardize_newlines'] = FALSE;
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -463,9 +291,6 @@ $config['standardize_newlines'] = FALSE;
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['global_xss_filtering'] = FALSE;
|
||||
|
||||
@@ -480,15 +305,11 @@ $config['global_xss_filtering'] = FALSE;
|
||||
| 'csrf_token_name' = The token name
|
||||
| 'csrf_cookie_name' = The cookie name
|
||||
| 'csrf_expire' = The number in seconds the token should expire.
|
||||
| 'csrf_regenerate' = Regenerate token on every submission
|
||||
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
|
||||
*/
|
||||
$config['csrf_protection'] = TRUE;
|
||||
$config['csrf_token_name'] = 'csrf_ospos_v3';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_ospos_v3';
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
$config['csrf_regenerate'] = TRUE;
|
||||
$config['csrf_exclude_uris'] = array('login');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -500,9 +321,6 @@ $config['csrf_exclude_uris'] = array('login');
|
||||
| Even if it does, however, not all browsers support compression
|
||||
| so enable only if you are reasonably sure your visitors can handle it.
|
||||
|
|
||||
| Only used if zlib.output_compression is turned off in your php.ini.
|
||||
| Please do not use it together with httpd-level output compression.
|
||||
|
|
||||
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
|
||||
| means you are prematurely outputting something to your browser. It could
|
||||
| even be a line of whitespace at the end of one of your scripts. For
|
||||
@@ -512,20 +330,20 @@ $config['csrf_exclude_uris'] = array('login');
|
||||
*/
|
||||
$config['compress_output'] = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Master Time Reference
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Options are 'local' or any PHP supported timezone. This preference tells
|
||||
| the system whether to use your server's local time as the master 'now'
|
||||
| reference, or convert it to the configured one timezone. See the 'date
|
||||
| helper' page of the user guide for information regarding date handling.
|
||||
| Options are 'local' or 'gmt'. This pref tells the system whether to use
|
||||
| your server's local time as the master 'now' reference, or convert it to
|
||||
| GMT. See the 'date helper' page of the user guide for information
|
||||
| regarding date handling.
|
||||
|
|
||||
*/
|
||||
$config['time_reference'] = 'local';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Rewrite PHP Short Tags
|
||||
@@ -535,25 +353,23 @@ $config['time_reference'] = 'local';
|
||||
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
|
||||
| in your view files. Options are TRUE or FALSE (boolean)
|
||||
|
|
||||
| Note: You need to have eval() enabled for this to work.
|
||||
|
|
||||
*/
|
||||
$config['rewrite_short_tags'] = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverse Proxy IPs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a reverse proxy, you must whitelist the proxy
|
||||
| IP addresses from which CodeIgniter should trust headers such as
|
||||
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
|
||||
| the visitor's IP address.
|
||||
| If your server is behind a reverse proxy, you must whitelist the proxy IP
|
||||
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
|
||||
| header in order to properly identify the visitor's IP address.
|
||||
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
||||
|
|
||||
| You can use both an array or a comma-separated list of proxy addresses,
|
||||
| as well as specifying whole subnets. Here are a few examples:
|
||||
|
|
||||
| Comma-separated: '10.0.1.200,192.168.5.0/24'
|
||||
| Array: array('10.0.1.200', '192.168.5.0/24')
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
|
||||
/* End of file config.php */
|
||||
/* Location: ./application/config/config.php */
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Display Debug backtrace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to TRUE, a backtrace will be displayed along with php errors. If
|
||||
| error_reporting is disabled, the backtrace will not display, regardless
|
||||
| of this setting
|
||||
|
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -26,10 +13,10 @@ defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
| always be used to set the mode correctly.
|
||||
|
|
||||
*/
|
||||
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
|
||||
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
|
||||
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
|
||||
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
||||
define('FILE_READ_MODE', 0644);
|
||||
define('FILE_WRITE_MODE', 0666);
|
||||
define('DIR_READ_MODE', 0755);
|
||||
define('DIR_WRITE_MODE', 0777);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -39,119 +26,16 @@ defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
|
||||
| These modes are used when working with fopen()/popen()
|
||||
|
|
||||
*/
|
||||
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
|
||||
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
|
||||
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
|
||||
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
/*
|
||||
| Attribute Related Constants.
|
||||
*/
|
||||
define('GROUP', 'GROUP');
|
||||
define('DROPDOWN', 'DROPDOWN');
|
||||
define('DECIMAL', 'DECIMAL');
|
||||
define('DATE', 'DATE');
|
||||
define('TEXT', 'TEXT');
|
||||
define('CHECKBOX', 'CHECKBOX');
|
||||
define('NO_DEFINITION_ID', 0);
|
||||
define('CATEGORY_DEFINITION_ID', -1);
|
||||
define('FOPEN_READ', 'rb');
|
||||
define('FOPEN_READ_WRITE', 'r+b');
|
||||
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
define('FOPEN_WRITE_CREATE', 'ab');
|
||||
define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
|
||||
const DEFINITION_TYPES = [GROUP, DROPDOWN, DECIMAL, TEXT, DATE, CHECKBOX];
|
||||
|
||||
|
||||
/*
|
||||
| Item Related Constants.
|
||||
*/
|
||||
define('HAS_STOCK', 0);
|
||||
define('HAS_NO_STOCK', 1);
|
||||
|
||||
define('ITEM', 0);
|
||||
define('ITEM_KIT', 1);
|
||||
define('ITEM_AMOUNT_ENTRY', 2);
|
||||
define('ITEM_TEMP', 3);
|
||||
define('NEW_ITEM', -1);
|
||||
|
||||
define('PRINT_ALL', 0);
|
||||
define('PRINT_PRICED', 1);
|
||||
define('PRINT_KIT', 2);
|
||||
|
||||
define('PRINT_YES', 0);
|
||||
define('PRINT_NO', 1);
|
||||
|
||||
define('PRICE_ALL', 0);
|
||||
define('PRICE_KIT', 1);
|
||||
define('PRICE_KIT_ITEMS', 2);
|
||||
|
||||
define('PRICE_OPTION_ALL', 0);
|
||||
define('PRICE_OPTION_KIT', 1);
|
||||
define('PRICE_OPTION_KIT_STOCK', 2);
|
||||
|
||||
define('NAME_SEPARATOR', ' | ');
|
||||
|
||||
/*
|
||||
| Sale Related Constants.
|
||||
*/
|
||||
define('COMPLETED', 0);
|
||||
define('SUSPENDED', 1);
|
||||
define('CANCELED', 2);
|
||||
|
||||
|
||||
define('SALE_TYPE_POS', 0);
|
||||
define('SALE_TYPE_INVOICE', 1);
|
||||
define('SALE_TYPE_WORK_ORDER', 2);
|
||||
define('SALE_TYPE_QUOTE', 3);
|
||||
define('SALE_TYPE_RETURN', 4);
|
||||
|
||||
define('PERCENT', 0);
|
||||
define('FIXED', 1);
|
||||
|
||||
define('PRICE_MODE_STANDARD', 0);
|
||||
define('PRICE_MODE_KIT', 1);
|
||||
|
||||
define('PAYMENT_TYPE_UNASSIGNED', '--');
|
||||
|
||||
define('CASH_ADJUSTMENT_TRUE', 1);
|
||||
define('CASH_ADJUSTMENT_FALSE', 0);
|
||||
define('CASH_MODE_TRUE', 1);
|
||||
define('CASH_MODE_FALSE', 0);
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| DATABASE CONNECTIVITY SETTINGS
|
||||
| -------------------------------------------------------------------
|
||||
| This file will contain the settings needed to access your database.
|
||||
|
|
||||
| For complete instructions please consult the 'Database Connection'
|
||||
| page of the User Guide.
|
||||
|
|
||||
| -------------------------------------------------------------------
|
||||
| EXPLANATION OF VARIABLES
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['dsn'] The full DSN string describe a connection to the database.
|
||||
| ['hostname'] The hostname of your database server.
|
||||
| ['username'] The username used to connect to the database
|
||||
| ['password'] The password used to connect to the database
|
||||
| ['database'] The name of the database you want to connect to
|
||||
| ['dbdriver'] The database driver. e.g.: mysqli.
|
||||
| Currently supported:
|
||||
| cubrid, ibase, mssql, mysql, mysqli, oci8,
|
||||
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Query Builder class
|
||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
||||
| ['cachedir'] The path to the folder where cache files should be stored
|
||||
| ['char_set'] The character set used in communicating with the database
|
||||
| ['dbcollat'] The character collation used in communicating with the database
|
||||
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
||||
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
||||
| (and in table creation queries made with DB Forge).
|
||||
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
||||
| can make your site vulnerable to SQL injection if you are using a
|
||||
| multi-byte character set and are running versions lower than these.
|
||||
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
||||
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
||||
| ['encrypt'] Whether or not to use an encrypted connection.
|
||||
|
|
||||
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
|
||||
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
||||
|
|
||||
| 'ssl_key' - Path to the private key file
|
||||
| 'ssl_cert' - Path to the public key certificate file
|
||||
| 'ssl_ca' - Path to the certificate authority file
|
||||
| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
|
||||
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
|
||||
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
||||
|
|
||||
| ['compress'] Whether or not to use client compression (MySQL only)
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
|
||||
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
|
||||
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
|
||||
| NOTE: Disabling this will also effectively disable both
|
||||
| $this->db->last_query() and profiling of DB queries.
|
||||
| When you run a query, with this setting set to TRUE (default),
|
||||
| CodeIgniter will store the SQL statement for debugging purposes.
|
||||
| However, this may cause high memory usage, especially if you run
|
||||
| a lot of SQL queries ... disable this to avoid that problem.
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $query_builder variables lets you determine whether or not to load
|
||||
| the query builder class.
|
||||
*/
|
||||
$active_group = 'default';
|
||||
$query_builder = TRUE;
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => !empty(getenv('MYSQL_HOST_NAME')) ? getenv('MYSQL_HOST_NAME') : 'localhost',
|
||||
'username' => !empty(getenv('MYSQL_USERNAME')) ? getenv('MYSQL_USERNAME') : 'admin',
|
||||
'password' => !empty(getenv('MYSQL_PASSWORD')) ? getenv('MYSQL_PASSWORD') : 'pointofsale',
|
||||
'database' => !empty(getenv('MYSQL_DB_NAME')) ? getenv('MYSQL_DB_NAME') : 'ospos',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => 'ospos_',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => (ENVIRONMENT !== 'production'),
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'encrypt' => FALSE,
|
||||
'compress' => FALSE,
|
||||
'stricton' => FALSE,
|
||||
'failover' => array(),
|
||||
'save_queries' => TRUE
|
||||
);
|
||||
69
application/config/database.php.tmpl
Normal file
69
application/config/database.php.tmpl
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| DATABASE CONNECTIVITY SETTINGS
|
||||
| -------------------------------------------------------------------
|
||||
| This file will contain the settings needed to access your database.
|
||||
|
|
||||
| For complete instructions please consult the 'Database Connection'
|
||||
| page of the User Guide.
|
||||
|
|
||||
| -------------------------------------------------------------------
|
||||
| EXPLANATION OF VARIABLES
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['hostname'] The hostname of your database server.
|
||||
| ['username'] The username used to connect to the database
|
||||
| ['password'] The password used to connect to the database
|
||||
| ['database'] The name of the database you want to connect to
|
||||
| ['dbdriver'] The database type. ie: mysql. Currently supported:
|
||||
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Active Record class
|
||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
||||
| ['cachedir'] The path to the folder where cache files should be stored
|
||||
| ['char_set'] The character set used in communicating with the database
|
||||
| ['dbcollat'] The character collation used in communicating with the database
|
||||
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
||||
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
||||
| (and in table creation queries made with DB Forge).
|
||||
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
||||
| can make your site vulnerable to SQL injection if you are using a
|
||||
| multi-byte character set and are running versions lower than these.
|
||||
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
||||
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
||||
| ['autoinit'] Whether or not to automatically initialize the database.
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $active_record variables lets you determine whether or not to load
|
||||
| the active record class
|
||||
*/
|
||||
|
||||
$active_group = 'default';
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = 'localhost';
|
||||
$db['default']['username'] = '';
|
||||
$db['default']['password'] = '';
|
||||
$db['default']['database'] = '';
|
||||
$db['default']['dbdriver'] = 'mysql';
|
||||
$db['default']['dbprefix'] = 'ospos_';
|
||||
$db['default']['pconnect'] = FALSE;
|
||||
$db['default']['db_debug'] = TRUE;
|
||||
$db['default']['cache_on'] = FALSE;
|
||||
$db['default']['cachedir'] = '';
|
||||
$db['default']['char_set'] = 'utf8';
|
||||
$db['default']['dbcollat'] = 'utf8_general_ci';
|
||||
$db['default']['swap_pre'] = '';
|
||||
$db['default']['autoinit'] = TRUE;
|
||||
$db['default']['stricton'] = FALSE;
|
||||
|
||||
|
||||
/* End of file database.php */
|
||||
/* Location: ./application/config/database.php */
|
||||
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
$_doctypes = array(
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
|
||||
);
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
|
||||
);
|
||||
|
||||
/* End of file doctypes.php */
|
||||
/* Location: ./application/config/doctypes.php */
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
$config['default_email_address'] = "";
|
||||
$config['default_cc_address'] = '';
|
||||
$config['default_sender_name'] = "";
|
||||
$config['default_sender_address'] = "";
|
||||
$config['default_bounce_address'] = "";
|
||||
$config['charset'] = 'utf-8';
|
||||
$config['mailtype'] = 'html';
|
||||
$config['wordwrap'] = FALSE;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Foreign Characters
|
||||
@@ -16,88 +14,51 @@ $foreign_characters = array(
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
|
||||
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
|
||||
'/Б/' => 'B',
|
||||
'/б/' => 'b',
|
||||
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A',
|
||||
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a',
|
||||
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
|
||||
'/ç|ć|ĉ|ċ|č/' => 'c',
|
||||
'/Д/' => 'D',
|
||||
'/д/' => 'd',
|
||||
'/Ð|Ď|Đ|Δ/' => 'Dj',
|
||||
'/ð|ď|đ|δ/' => 'dj',
|
||||
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
|
||||
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
|
||||
'/Ф/' => 'F',
|
||||
'/ф/' => 'f',
|
||||
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
|
||||
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
|
||||
'/Ð|Ď|Đ/' => 'D',
|
||||
'/ð|ď|đ/' => 'd',
|
||||
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
|
||||
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
|
||||
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
|
||||
'/ĝ|ğ|ġ|ģ/' => 'g',
|
||||
'/Ĥ|Ħ/' => 'H',
|
||||
'/ĥ|ħ/' => 'h',
|
||||
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
|
||||
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
|
||||
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
|
||||
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
|
||||
'/Ĵ/' => 'J',
|
||||
'/ĵ/' => 'j',
|
||||
'/Ķ|Κ|К/' => 'K',
|
||||
'/ķ|κ|к/' => 'k',
|
||||
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
|
||||
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
|
||||
'/М/' => 'M',
|
||||
'/м/' => 'm',
|
||||
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
|
||||
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
|
||||
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
|
||||
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
|
||||
'/П/' => 'P',
|
||||
'/п/' => 'p',
|
||||
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
|
||||
'/ŕ|ŗ|ř|ρ|р/' => 'r',
|
||||
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
|
||||
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
|
||||
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
|
||||
'/ț|ţ|ť|ŧ|т/' => 't',
|
||||
'/Þ|þ/' => 'th',
|
||||
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
|
||||
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
|
||||
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
|
||||
'/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
|
||||
'/В/' => 'V',
|
||||
'/в/' => 'v',
|
||||
'/Ķ/' => 'K',
|
||||
'/ķ/' => 'k',
|
||||
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
|
||||
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
|
||||
'/Ñ|Ń|Ņ|Ň/' => 'N',
|
||||
'/ñ|ń|ņ|ň|ʼn/' => 'n',
|
||||
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
|
||||
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
|
||||
'/Ŕ|Ŗ|Ř/' => 'R',
|
||||
'/ŕ|ŗ|ř/' => 'r',
|
||||
'/Ś|Ŝ|Ş|Š/' => 'S',
|
||||
'/ś|ŝ|ş|š|ſ/' => 's',
|
||||
'/Ţ|Ť|Ŧ/' => 'T',
|
||||
'/ţ|ť|ŧ/' => 't',
|
||||
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
|
||||
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
|
||||
'/Ý|Ÿ|Ŷ/' => 'Y',
|
||||
'/ý|ÿ|ŷ/' => 'y',
|
||||
'/Ŵ/' => 'W',
|
||||
'/ŵ/' => 'w',
|
||||
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
|
||||
'/ź|ż|ž|ζ|з/' => 'z',
|
||||
'/Ź|Ż|Ž/' => 'Z',
|
||||
'/ź|ż|ž/' => 'z',
|
||||
'/Æ|Ǽ/' => 'AE',
|
||||
'/ß/' => 'ss',
|
||||
'/ß/'=> 'ss',
|
||||
'/IJ/' => 'IJ',
|
||||
'/ij/' => 'ij',
|
||||
'/Œ/' => 'OE',
|
||||
'/ƒ/' => 'f',
|
||||
'/ξ/' => 'ks',
|
||||
'/π/' => 'p',
|
||||
'/β/' => 'v',
|
||||
'/μ/' => 'm',
|
||||
'/ψ/' => 'ps',
|
||||
'/Ё/' => 'Yo',
|
||||
'/ё/' => 'yo',
|
||||
'/Є/' => 'Ye',
|
||||
'/є/' => 'ye',
|
||||
'/Ї/' => 'Yi',
|
||||
'/Ж/' => 'Zh',
|
||||
'/ж/' => 'zh',
|
||||
'/Х/' => 'Kh',
|
||||
'/х/' => 'kh',
|
||||
'/Ц/' => 'Ts',
|
||||
'/ц/' => 'ts',
|
||||
'/Ч/' => 'Ch',
|
||||
'/ч/' => 'ch',
|
||||
'/Ш/' => 'Sh',
|
||||
'/ш/' => 'sh',
|
||||
'/Щ/' => 'Shch',
|
||||
'/щ/' => 'shch',
|
||||
'/Ъ|ъ|Ь|ь/' => '',
|
||||
'/Ю/' => 'Yu',
|
||||
'/ю/' => 'yu',
|
||||
'/Я/' => 'Ya',
|
||||
'/я/' => 'ya'
|
||||
'/ƒ/' => 'f'
|
||||
);
|
||||
|
||||
/* End of file foreign_chars.php */
|
||||
/* Location: ./application/config/foreign_chars.php */
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Hooks
|
||||
@@ -8,38 +6,16 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
| This file lets you define "hooks" to extend CI without hacking the core
|
||||
| files. Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/hooks.html
|
||||
| http://codeigniter.com/user_guide/general/hooks.html
|
||||
|
|
||||
*/
|
||||
$hook['post_controller_constructor'][] = array(
|
||||
'class' => '',
|
||||
'function' => 'load_config',
|
||||
'filename' => 'load_config.php',
|
||||
'filepath' => 'hooks'
|
||||
$hook['post_controller_constructor'] = array(
|
||||
'class' => '',
|
||||
'function' => 'load_config',
|
||||
'filename' => 'load_config.php',
|
||||
'filepath' => 'hooks'
|
||||
);
|
||||
|
||||
// 'post_controller' indicated execution of hooks after controller is finished
|
||||
$hook['post_controller'] = array(
|
||||
'class' => '',
|
||||
'function' => 'db_log_queries',
|
||||
'filename' => 'db_log.php',
|
||||
'filepath' => 'hooks'
|
||||
);
|
||||
|
||||
$hook['pre_controller'][] = array(
|
||||
'class' => '',
|
||||
'function' => 'validate_method',
|
||||
'filename' => 'method_hook.php',
|
||||
'filepath' => 'hooks'
|
||||
);
|
||||
|
||||
|
||||
$hook['pre_system'] = function() {
|
||||
$config_path = APPPATH . (ENVIRONMENT == 'testing') ? 'tests/' : 'config/';
|
||||
try {
|
||||
$dotenv = new Dotenv\Dotenv($config_path);
|
||||
$dotenv->overload();
|
||||
} catch(Exception $e) {
|
||||
// continue, .env file not present
|
||||
}
|
||||
};
|
||||
/* End of file hooks.php */
|
||||
/* Location: ./application/config/hooks.php */
|
||||
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Memcached settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Memcached servers can be specified below.
|
||||
|
|
||||
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||
|
|
||||
*/
|
||||
$config = array(
|
||||
'default' => array(
|
||||
'hostname' => '127.0.0.1',
|
||||
'port' => '11211',
|
||||
'weight' => '1',
|
||||
),
|
||||
);
|
||||
@@ -1,84 +1,40 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are disabled by default for security reasons.
|
||||
| You should enable migrations whenever you intend to do a schema migration
|
||||
| and disable it back when you're done.
|
||||
|
|
||||
*/
|
||||
$config['migration_enabled'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Type
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migration file names may be based on a sequential identifier or on
|
||||
| a timestamp. Options are:
|
||||
|
|
||||
| 'sequential' = Sequential migration naming (001_add_blog.php)
|
||||
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
|
||||
| Use timestamp format YYYYMMDDHHIISS.
|
||||
|
|
||||
| Note: If this configuration value is missing the Migration library
|
||||
| defaults to 'sequential' for backward compatibility with CI2.
|
||||
|
|
||||
*/
|
||||
$config['migration_type'] = 'timestamp';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the table that will store the current migrations state.
|
||||
| When migrations runs it will store in a database table which migration
|
||||
| level the system is at. It then compares the migration level in this
|
||||
| table to the $config['migration_version'] if they are not the same it
|
||||
| will migrate up. This must be set.
|
||||
|
|
||||
*/
|
||||
$config['migration_table'] = 'migrations';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto Migrate To Latest
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If this is set to TRUE when you load the migrations class and have
|
||||
| $config['migration_enabled'] set to TRUE the system will auto migrate
|
||||
| to your latest migration (whatever $config['migration_version'] is
|
||||
| set to). This way you do not have to call migrations anywhere else
|
||||
| in your code to have the latest migration.
|
||||
|
|
||||
*/
|
||||
$config['migration_auto_latest'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is used to set migration version that the file system should be on.
|
||||
| If you run $this->migration->current() this is the version that schema will
|
||||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 20180225100000;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to your migrations folder.
|
||||
| Typically, it will be within your application path.
|
||||
| Also, writing permission is required within the migrations path.
|
||||
|
|
||||
*/
|
||||
$config['migration_path'] = APPPATH.'migrations/';
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are disabled by default but should be enabled
|
||||
| whenever you intend to do a schema migration.
|
||||
|
|
||||
*/
|
||||
$config['migration_enabled'] = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is used to set migration version that the file system should be on.
|
||||
| If you run $this->migration->latest() this is the version that schema will
|
||||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 0;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to your migrations folder.
|
||||
| Typically, it will be within your application path.
|
||||
| Also, writing permission is required within the migrations path.
|
||||
|
|
||||
*/
|
||||
$config['migration_path'] = APPPATH . 'migrations/';
|
||||
|
||||
|
||||
/* End of file migration.php */
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| MIME TYPES
|
||||
@@ -9,159 +7,100 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
| Upload class to help identify allowed file types.
|
||||
|
|
||||
*/
|
||||
return array(
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => 'audio/x-acc',
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon')
|
||||
);
|
||||
|
||||
$mimes = array( 'hqx' => 'application/mac-binhex40',
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
|
||||
'bin' => 'application/macbinary',
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => 'application/x-photoshop',
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/x-download'),
|
||||
'ai' => 'application/postscript',
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'php' => 'application/x-httpd-php',
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => 'application/x-javascript',
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => 'audio/x-aiff',
|
||||
'aiff' => 'audio/x-aiff',
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-windows-bmp'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => 'text/css',
|
||||
'html' => 'text/html',
|
||||
'htm' => 'text/html',
|
||||
'shtml' => 'text/html',
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => 'text/xml',
|
||||
'xsl' => 'text/xml',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => 'video/x-msvideo',
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => 'application/msword',
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json')
|
||||
);
|
||||
|
||||
|
||||
/* End of file mimes.php */
|
||||
/* Location: ./application/config/mimes.php */
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bootstrap 3 pagination links styling
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Source code from http://stackoverflow.com/questions/20088779/bootstrap-3-pagination-with-codeigniter
|
||||
*/
|
||||
$config['full_tag_open'] = "<ul class='pagination pagination-sm'>";
|
||||
$config['full_tag_close'] ="</ul>";
|
||||
$config['num_tag_open'] = '<li>';
|
||||
$config['num_tag_close'] = '</li>';
|
||||
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
|
||||
$config['cur_tag_close'] = "<span class='sr-only'></span></a></li>";
|
||||
$config['next_tag_open'] = "<li>";
|
||||
$config['next_tagl_close'] = "</li>";
|
||||
$config['prev_tag_open'] = "<li>";
|
||||
$config['prev_tagl_close'] = "</li>";
|
||||
$config['first_tag_open'] = "<li>";
|
||||
$config['first_tagl_close'] = "</li>";
|
||||
$config['last_tag_open'] = "<li>";
|
||||
$config['last_tagl_close'] = "</li>";
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Profiler Sections
|
||||
@@ -9,6 +7,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
| data are displayed when the Profiler is enabled.
|
||||
| Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/profiling.html
|
||||
| http://codeigniter.com/user_guide/general/profiling.html
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of file profiler.php */
|
||||
/* Location: ./application/config/profiler.php */
|
||||
@@ -1,6 +1,4 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| URI ROUTING
|
||||
@@ -19,13 +17,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
|
||||
| Please see the user guide for complete details:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/routing.html
|
||||
| http://codeigniter.com/user_guide/general/routing.html
|
||||
|
|
||||
| -------------------------------------------------------------------------
|
||||
| RESERVED ROUTES
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| There are three reserved routes:
|
||||
| There area two reserved routes:
|
||||
|
|
||||
| $route['default_controller'] = 'welcome';
|
||||
|
|
||||
@@ -35,53 +33,32 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
|
||||
| $route['404_override'] = 'errors/page_missing';
|
||||
|
|
||||
| This route will tell the Router which controller/method to use if those
|
||||
| provided in the URL cannot be matched to a valid route.
|
||||
| This route will tell the Router what URI segments to use if those provided
|
||||
| in the URL cannot be matched to a valid route.
|
||||
|
|
||||
| $route['translate_uri_dashes'] = FALSE;
|
||||
|
|
||||
| This is not exactly a route, but allows you to automatically route
|
||||
| controller and method names that contain dashes. '-' isn't a valid
|
||||
| class or method name character, so it requires translation.
|
||||
| When you set this option to TRUE, it will replace ALL dashes in the
|
||||
| controller and method URI segments.
|
||||
|
|
||||
| Examples: my-controller/index -> my_controller/index
|
||||
| my-controller/my-method -> my_controller/my_method
|
||||
*/
|
||||
|
||||
$route['default_controller'] = 'login';
|
||||
$route['no_access/([^/]+)'] = 'no_access/index/$1';
|
||||
$route['no_access/([^/]+)/([^/]+)'] = 'no_access/index/$1/$2';
|
||||
$route['default_controller'] = "login";
|
||||
$route['no_access/(:any)'] = "no_access/index/$1";
|
||||
$route['reports/(summary_:any)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/summary_:any'] = "reports/date_input_excel_export";
|
||||
$route['reports/(graphical_:any)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/graphical_:any'] = "reports/date_input";
|
||||
$route['reports/(inventory_:any)/(:any)'] = "reports/$1/$2";
|
||||
$route['reports/inventory_:any'] = "reports/excel_export";
|
||||
|
||||
$route['sales/index/([^/]+)'] = 'sales/manage/$1';
|
||||
$route['sales/index/([^/]+)/([^/]+)'] = 'sales/manage/$1/$2';
|
||||
$route['sales/index/([^/]+)/([^/]+)/([^/]+)'] = 'sales/manage/$1/$2/$3';
|
||||
$route['reports/(detailed_sales)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/detailed_sales'] = "reports/date_input";
|
||||
$route['reports/(detailed_receivings)/(:any)/(:any)'] = "reports/$1/$2/$3";
|
||||
$route['reports/detailed_receivings'] = "reports/date_input_recv";
|
||||
$route['reports/(specific_:any)/(:any)/(:any)/(:any)'] = "reports/$1/$2/$3/$4";
|
||||
$route['reports/specific_customer'] = "reports/specific_customer_input";
|
||||
$route['reports/specific_employee'] = "reports/specific_employee_input";
|
||||
$route['reports/specific_discount'] = "reports/specific_discount_input";
|
||||
|
||||
$route['reports/(summary_:any)/([^/]+)/([^/]+)'] = 'reports/$1/$2/$3/$4';
|
||||
$route['reports/summary_expenses_categories'] = 'reports/date_input_only';
|
||||
$route['reports/summary_payments'] = 'reports/date_input_only';
|
||||
$route['reports/summary_discounts'] = 'reports/summary_discounts_input';
|
||||
$route['reports/summary_:any'] = 'reports/date_input';
|
||||
$route['scaffolding_trigger'] = "";
|
||||
|
||||
$route['reports/(graphical_:any)/([^/]+)/([^/]+)'] = 'reports/$1/$2/$3/$4';
|
||||
$route['reports/graphical_summary_expenses_categories'] = 'reports/date_input_only';
|
||||
$route['reports/graphical_summary_discounts'] = 'reports/summary_discounts_input';
|
||||
$route['reports/graphical_:any'] = 'reports/date_input';
|
||||
$route['404_override'] = 'errors/page_missing';
|
||||
|
||||
$route['reports/(inventory_:any)/([^/]+)'] = 'reports/$1/$2';
|
||||
$route['reports/inventory_summary'] = 'reports/inventory_summary_input';
|
||||
$route['reports/(inventory_summary)/([^/]+)/([^/]+)/([^/]+)'] = 'reports/$1/$2';
|
||||
|
||||
$route['reports/(detailed_:any)/([^/]+)/([^/]+)/([^/]+)'] = 'reports/$1/$2/$3/$4';
|
||||
$route['reports/detailed_sales'] = 'reports/date_input_sales';
|
||||
$route['reports/detailed_receivings'] = 'reports/date_input_recv';
|
||||
|
||||
$route['reports/(specific_:any)/([^/]+)/([^/]+)/([^/]+)'] = 'reports/$1/$2/$3/$4';
|
||||
$route['reports/specific_customer'] = 'reports/specific_customer_input';
|
||||
$route['reports/specific_employee'] = 'reports/specific_employee_input';
|
||||
$route['reports/specific_discount'] = 'reports/specific_discount_input';
|
||||
$route['reports/specific_supplier'] = 'reports/specific_supplier_input';
|
||||
|
||||
$route['404_override'] = '';
|
||||
$route['translate_uri_dashes'] = FALSE;
|
||||
/* End of file routes.php */
|
||||
/* Location: ./application/config/routes.php */
|
||||
@@ -1,18 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| SMILEYS
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of smileys for use with the emoticon helper.
|
||||
| Individual images can be used to replace multiple smileys. For example:
|
||||
| Individual images can be used to replace multiple simileys. For example:
|
||||
| :-) and :) use the same image replacement.
|
||||
|
|
||||
| Please see user guide for more info:
|
||||
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
||||
| http://codeigniter.com/user_guide/helpers/smiley_helper.html
|
||||
|
|
||||
*/
|
||||
|
||||
$smileys = array(
|
||||
|
||||
// smiley image name width height alt
|
||||
@@ -58,7 +57,10 @@ $smileys = array(
|
||||
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
|
||||
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
||||
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
||||
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
|
||||
':question:' => array('question.gif', '19', '19', 'question')
|
||||
':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'),
|
||||
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
/* End of file smileys.php */
|
||||
/* Location: ./application/config/smileys.php */
|
||||
@@ -1,214 +1,178 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| USER AGENT TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains four arrays of user agent data. It is used by the
|
||||
| This file contains four arrays of user agent data. It is used by the
|
||||
| User Agent Class to help identify browser, platform, robot, and
|
||||
| mobile device data. The array keys are used to identify the device
|
||||
| mobile device data. The array keys are used to identify the device
|
||||
| and the array values are used to set the actual name of the item.
|
||||
|
|
||||
*/
|
||||
$platforms = array(
|
||||
'windows nt 10.0' => 'Windows 10',
|
||||
'windows nt 6.3' => 'Windows 8.1',
|
||||
'windows nt 6.2' => 'Windows 8',
|
||||
'windows nt 6.1' => 'Windows 7',
|
||||
'windows nt 6.0' => 'Windows Vista',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows phone' => 'Windows Phone',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'android' => 'Android',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'iphone' => 'iOS',
|
||||
'ipad' => 'iOS',
|
||||
'ipod' => 'iOS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS',
|
||||
'symbian' => 'Symbian OS'
|
||||
);
|
||||
|
||||
$platforms = array (
|
||||
'windows nt 6.0' => 'Windows Longhorn',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS'
|
||||
);
|
||||
|
||||
|
||||
// The order of this array should NOT be changed. Many browsers return
|
||||
// multiple browser types so we want to identify the sub-type first.
|
||||
$browsers = array(
|
||||
'OPR' => 'Opera',
|
||||
'Flock' => 'Flock',
|
||||
'Edge' => 'Spartan',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser'
|
||||
);
|
||||
'Flock' => 'Flock',
|
||||
'Chrome' => 'Chrome',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse'
|
||||
);
|
||||
|
||||
$mobiles = array(
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
|
||||
// Phones and Manufacturers
|
||||
'motorola' => 'Motorola',
|
||||
'nokia' => 'Nokia',
|
||||
'palm' => 'Palm',
|
||||
'iphone' => 'Apple iPhone',
|
||||
'ipad' => 'iPad',
|
||||
'ipod' => 'Apple iPod Touch',
|
||||
'sony' => 'Sony Ericsson',
|
||||
'ericsson' => 'Sony Ericsson',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'cocoon' => 'O2 Cocoon',
|
||||
'blazer' => 'Treo',
|
||||
'lg' => 'LG',
|
||||
'amoi' => 'Amoi',
|
||||
'xda' => 'XDA',
|
||||
'mda' => 'MDA',
|
||||
'vario' => 'Vario',
|
||||
'htc' => 'HTC',
|
||||
'samsung' => 'Samsung',
|
||||
'sharp' => 'Sharp',
|
||||
'sie-' => 'Siemens',
|
||||
'alcatel' => 'Alcatel',
|
||||
'benq' => 'BenQ',
|
||||
'ipaq' => 'HP iPaq',
|
||||
'mot-' => 'Motorola',
|
||||
'playstation portable' => 'PlayStation Portable',
|
||||
'playstation 3' => 'PlayStation 3',
|
||||
'playstation vita' => 'PlayStation Vita',
|
||||
'hiptop' => 'Danger Hiptop',
|
||||
'nec-' => 'NEC',
|
||||
'panasonic' => 'Panasonic',
|
||||
'philips' => 'Philips',
|
||||
'sagem' => 'Sagem',
|
||||
'sanyo' => 'Sanyo',
|
||||
'spv' => 'SPV',
|
||||
'zte' => 'ZTE',
|
||||
'sendo' => 'Sendo',
|
||||
'nintendo dsi' => 'Nintendo DSi',
|
||||
'nintendo ds' => 'Nintendo DS',
|
||||
'nintendo 3ds' => 'Nintendo 3DS',
|
||||
'wii' => 'Nintendo Wii',
|
||||
'open web' => 'Open Web',
|
||||
'openweb' => 'OpenWeb',
|
||||
// Phones and Manufacturers
|
||||
'motorola' => "Motorola",
|
||||
'nokia' => "Nokia",
|
||||
'palm' => "Palm",
|
||||
'iphone' => "Apple iPhone",
|
||||
'ipad' => "iPad",
|
||||
'ipod' => "Apple iPod Touch",
|
||||
'sony' => "Sony Ericsson",
|
||||
'ericsson' => "Sony Ericsson",
|
||||
'blackberry' => "BlackBerry",
|
||||
'cocoon' => "O2 Cocoon",
|
||||
'blazer' => "Treo",
|
||||
'lg' => "LG",
|
||||
'amoi' => "Amoi",
|
||||
'xda' => "XDA",
|
||||
'mda' => "MDA",
|
||||
'vario' => "Vario",
|
||||
'htc' => "HTC",
|
||||
'samsung' => "Samsung",
|
||||
'sharp' => "Sharp",
|
||||
'sie-' => "Siemens",
|
||||
'alcatel' => "Alcatel",
|
||||
'benq' => "BenQ",
|
||||
'ipaq' => "HP iPaq",
|
||||
'mot-' => "Motorola",
|
||||
'playstation portable' => "PlayStation Portable",
|
||||
'hiptop' => "Danger Hiptop",
|
||||
'nec-' => "NEC",
|
||||
'panasonic' => "Panasonic",
|
||||
'philips' => "Philips",
|
||||
'sagem' => "Sagem",
|
||||
'sanyo' => "Sanyo",
|
||||
'spv' => "SPV",
|
||||
'zte' => "ZTE",
|
||||
'sendo' => "Sendo",
|
||||
|
||||
// Operating Systems
|
||||
'android' => 'Android',
|
||||
'symbian' => 'Symbian',
|
||||
'SymbianOS' => 'SymbianOS',
|
||||
'elaine' => 'Palm',
|
||||
'series60' => 'Symbian S60',
|
||||
'windows ce' => 'Windows CE',
|
||||
// Operating Systems
|
||||
'symbian' => "Symbian",
|
||||
'SymbianOS' => "SymbianOS",
|
||||
'elaine' => "Palm",
|
||||
'palm' => "Palm",
|
||||
'series60' => "Symbian S60",
|
||||
'windows ce' => "Windows CE",
|
||||
|
||||
// Browsers
|
||||
'obigo' => 'Obigo',
|
||||
'netfront' => 'Netfront Browser',
|
||||
'openwave' => 'Openwave Browser',
|
||||
'mobilexplorer' => 'Mobile Explorer',
|
||||
'operamini' => 'Opera Mini',
|
||||
'opera mini' => 'Opera Mini',
|
||||
'opera mobi' => 'Opera Mobile',
|
||||
'fennec' => 'Firefox Mobile',
|
||||
// Browsers
|
||||
'obigo' => "Obigo",
|
||||
'netfront' => "Netfront Browser",
|
||||
'openwave' => "Openwave Browser",
|
||||
'mobilexplorer' => "Mobile Explorer",
|
||||
'operamini' => "Opera Mini",
|
||||
'opera mini' => "Opera Mini",
|
||||
|
||||
// Other
|
||||
'digital paths' => 'Digital Paths',
|
||||
'avantgo' => 'AvantGo',
|
||||
'xiino' => 'Xiino',
|
||||
'novarra' => 'Novarra Transcoder',
|
||||
'vodafone' => 'Vodafone',
|
||||
'docomo' => 'NTT DoCoMo',
|
||||
'o2' => 'O2',
|
||||
// Other
|
||||
'digital paths' => "Digital Paths",
|
||||
'avantgo' => "AvantGo",
|
||||
'xiino' => "Xiino",
|
||||
'novarra' => "Novarra Transcoder",
|
||||
'vodafone' => "Vodafone",
|
||||
'docomo' => "NTT DoCoMo",
|
||||
'o2' => "O2",
|
||||
|
||||
// Fallback
|
||||
'mobile' => 'Generic Mobile',
|
||||
'wireless' => 'Generic Mobile',
|
||||
'j2me' => 'Generic Mobile',
|
||||
'midp' => 'Generic Mobile',
|
||||
'cldc' => 'Generic Mobile',
|
||||
'up.link' => 'Generic Mobile',
|
||||
'up.browser' => 'Generic Mobile',
|
||||
'smartphone' => 'Generic Mobile',
|
||||
'cellphone' => 'Generic Mobile'
|
||||
);
|
||||
// Fallback
|
||||
'mobile' => "Generic Mobile",
|
||||
'wireless' => "Generic Mobile",
|
||||
'j2me' => "Generic Mobile",
|
||||
'midp' => "Generic Mobile",
|
||||
'cldc' => "Generic Mobile",
|
||||
'up.link' => "Generic Mobile",
|
||||
'up.browser' => "Generic Mobile",
|
||||
'smartphone' => "Generic Mobile",
|
||||
'cellphone' => "Generic Mobile"
|
||||
);
|
||||
|
||||
// There are hundreds of bots but these are the most common.
|
||||
$robots = array(
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'ask jeeves' => 'Ask Jeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos',
|
||||
'yandex' => 'YandexBot',
|
||||
'mediapartners-google' => 'MediaPartners Google',
|
||||
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||
'adsbot-google' => 'AdsBot Google',
|
||||
'feedfetcher-google' => 'Feedfetcher Google',
|
||||
'curious george' => 'Curious George',
|
||||
'ia_archiver' => 'Alexa Crawler',
|
||||
'MJ12bot' => 'Majestic-12',
|
||||
'Uptimebot' => 'Uptimebot'
|
||||
);
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'askjeeves' => 'AskJeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos'
|
||||
);
|
||||
|
||||
/* End of file user_agents.php */
|
||||
/* Location: ./application/config/user_agents.php */
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('Secure_Controller.php');
|
||||
|
||||
class Attributes extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('attributes');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_attribute_definition_manage_table_headers());
|
||||
|
||||
$this->load->view('attributes/manage', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$attributes = $this->Attribute->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Attribute->get_found_rows($search);
|
||||
|
||||
$data_rows = [];
|
||||
foreach($attributes->result() as $attribute)
|
||||
{
|
||||
$attribute->definition_flags = $this->get_attributes($attribute->definition_flags);
|
||||
$data_rows[] = get_attribute_definition_data_row($attribute, $this);
|
||||
}
|
||||
|
||||
$data_rows = $this->xss_clean($data_rows);
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function save_attribute_value()
|
||||
{
|
||||
$success = $this->Attribute->save_value(
|
||||
$this->input->post('attribute_value'),
|
||||
$this->input->post('definition_id'),
|
||||
$this->input->post('item_id'),
|
||||
$this->input->post('attribute_id')
|
||||
);
|
||||
|
||||
echo json_encode(array('success' => $success != 0));
|
||||
}
|
||||
|
||||
public function delete_attribute_value()
|
||||
{
|
||||
$success = $this->Attribute->delete_value(
|
||||
$this->input->post('attribute_value'),
|
||||
$this->input->post('definition_id')
|
||||
);
|
||||
|
||||
echo json_encode(array('success' => $success));
|
||||
}
|
||||
|
||||
public function save_definition($definition_id = NO_DEFINITION_ID)
|
||||
{
|
||||
$definition_flags = 0;
|
||||
|
||||
$flags = (empty($this->input->post('definition_flags'))) ? [] : $this->input->post('definition_flags');
|
||||
|
||||
foreach($flags as $flag)
|
||||
{
|
||||
$definition_flags |= $flag;
|
||||
}
|
||||
|
||||
//Save definition data
|
||||
$definition_data = array(
|
||||
'definition_name' => $this->input->post('definition_name'),
|
||||
'definition_unit' => $this->input->post('definition_unit') != '' ? $this->input->post('definition_unit') : NULL,
|
||||
'definition_flags' => $definition_flags,
|
||||
'definition_fk' => $this->input->post('definition_group') != '' ? $this->input->post('definition_group') : NULL
|
||||
);
|
||||
|
||||
if ($this->input->post('definition_type') != null)
|
||||
{
|
||||
$definition_data['definition_type'] = DEFINITION_TYPES[$this->input->post('definition_type')];
|
||||
}
|
||||
|
||||
$definition_name = $this->xss_clean($definition_data['definition_name']);
|
||||
|
||||
if($this->Attribute->save_definition($definition_data, $definition_id))
|
||||
{
|
||||
//New definition
|
||||
if($definition_id == 0)
|
||||
{
|
||||
$definition_values = json_decode($this->input->post('definition_values'));
|
||||
|
||||
foreach($definition_values as $definition_value)
|
||||
{
|
||||
$this->Attribute->save_value($definition_value, $definition_data['definition_id']);
|
||||
}
|
||||
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('attributes_definition_successful_adding').' '.
|
||||
$definition_name, 'id' => $definition_data['definition_id']));
|
||||
}
|
||||
//Existing definition
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('attributes_definition_successful_updating').' '.
|
||||
$definition_name, 'id' => $definition_id));
|
||||
}
|
||||
}
|
||||
//Failure
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('attributes_definition_error_adding_updating', $definition_name), 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function suggest_attribute($definition_id)
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Attribute->get_suggestions($definition_id, $this->input->get('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$attribute_definition_info = $this->Attribute->get_info($row_id);
|
||||
$attribute_definition_info->definition_flags = $this->get_attributes($attribute_definition_info->definition_flags);
|
||||
$data_row = $this->xss_clean(get_attribute_definition_data_row($attribute_definition_info));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
private function get_attributes($definition_flags = 0)
|
||||
{
|
||||
$definition_flag_names = [];
|
||||
foreach (Attribute::get_definition_flags() as $id => $term)
|
||||
{
|
||||
if ($id & $definition_flags)
|
||||
{
|
||||
$definition_flag_names[$id] = $this->lang->line('attributes_' . strtolower($term) . '_visibility');
|
||||
}
|
||||
}
|
||||
return $definition_flag_names;
|
||||
}
|
||||
|
||||
public function view($definition_id = NO_DEFINITION_ID)
|
||||
{
|
||||
$info = $this->Attribute->get_info($definition_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$data['definition_id'] = $definition_id;
|
||||
$data['definition_values'] = $this->Attribute->get_definition_values($definition_id);
|
||||
$data['definition_group'] = $this->Attribute->get_definitions_by_type(GROUP, $definition_id);
|
||||
$data['definition_group'][''] = $this->lang->line('common_none_selected_text');
|
||||
$data['definition_info'] = $info;
|
||||
|
||||
$show_all = Attribute::SHOW_IN_ITEMS | Attribute::SHOW_IN_RECEIVINGS | Attribute::SHOW_IN_SALES;
|
||||
$data['definition_flags'] = $this->get_attributes($show_all);
|
||||
$selected_flags = $info->definition_flags === '' ? $show_all : $info->definition_flags;
|
||||
$data['selected_definition_flags'] = $this->get_attributes($selected_flags);
|
||||
|
||||
$this->load->view('attributes/form', $data);
|
||||
}
|
||||
|
||||
public function delete_value($attribute_id)
|
||||
{
|
||||
return $this->Attribute->delete_value($attribute_id);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$attributes_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Attribute->delete_definition_list($attributes_to_delete))
|
||||
{
|
||||
$message = $this->lang->line('attributes_definition_successful_deleted') . ' ' . count($attributes_to_delete) . ' ' . $this->lang->line('attributes_definition_one_or_multiple');
|
||||
echo json_encode(array('success' => TRUE, 'message' => $message));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('attributes_definition_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,246 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Cashups extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('cashups');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_cashups_manage_table_headers());
|
||||
|
||||
// filters that will be loaded in the multiselect dropdown
|
||||
$data['filters'] = array('is_deleted' => $this->lang->line('cashups_is_deleted'));
|
||||
|
||||
$this->load->view('cashups/manage', $data);
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
$cash_up = 0;
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
$filters = array(
|
||||
'start_date' => $this->input->get('start_date'),
|
||||
'end_date' => $this->input->get('end_date'),
|
||||
'is_deleted' => FALSE);
|
||||
|
||||
// check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
|
||||
$filters = array_merge($filters, $filledup);
|
||||
$cash_ups = $this->Cashup->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Cashup->get_found_rows($search, $filters);
|
||||
$data_rows = array();
|
||||
foreach($cash_ups->result() as $cash_up)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_cash_up_data_row($cash_up));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function view($cashup_id = -1)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
foreach(get_object_vars($employee) as $property => $value)
|
||||
{
|
||||
$employee->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$data['employees'][$employee->person_id] = $employee->first_name . ' ' . $employee->last_name;
|
||||
}
|
||||
|
||||
$cash_ups_info = $this->Cashup->get_info($cashup_id);
|
||||
|
||||
foreach(get_object_vars($cash_ups_info) as $property => $value)
|
||||
{
|
||||
$cash_ups_info->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
// open cashup
|
||||
if(empty($cash_ups_info->cashup_id))
|
||||
{
|
||||
$cash_ups_info->open_date = date('Y-m-d H:i:s');
|
||||
$cash_ups_info->close_date = $cash_ups_info->open_date;
|
||||
$cash_ups_info->open_employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$cash_ups_info->close_employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
}
|
||||
// if all the amounts are null or 0 that means it's a close cashup
|
||||
elseif(floatval($cash_ups_info->closed_amount_cash) == 0 &&
|
||||
floatval($cash_ups_info->closed_amount_due) == 0 &&
|
||||
floatval($cash_ups_info->closed_amount_card) == 0 &&
|
||||
floatval($cash_ups_info->closed_amount_check) == 0)
|
||||
{
|
||||
// set the close date and time to the actual as this is a close session
|
||||
$cash_ups_info->close_date = date('Y-m-d H:i:s');
|
||||
|
||||
// the closed amount starts with the open amount -/+ any trasferred amount
|
||||
$cash_ups_info->closed_amount_cash = $cash_ups_info->open_amount_cash + $cash_ups_info->transfer_amount_cash;
|
||||
|
||||
// if it's date mode only and not date & time truncate the open and end date to date only
|
||||
if(empty($this->config->item('date_or_time_format')))
|
||||
{
|
||||
// search for all the payments given the time range
|
||||
$inputs = array('start_date' => substr($cash_ups_info->open_date, 0, 10), 'end_date' => substr($cash_ups_info->close_date, 0, 10), 'sale_type' => 'complete', 'location_id' => 'all');
|
||||
}
|
||||
else
|
||||
{
|
||||
// search for all the payments given the time range
|
||||
$inputs = array('start_date' => $cash_ups_info->open_date, 'end_date' => $cash_ups_info->close_date, 'sale_type' => 'complete', 'location_id' => 'all');
|
||||
}
|
||||
|
||||
// get all the transactions payment summaries
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$reports_data = $this->Summary_payments->getData($inputs);
|
||||
|
||||
foreach($reports_data as $row)
|
||||
{
|
||||
if($row['trans_group'] == $this->lang->line('reports_trans_payments'))
|
||||
{
|
||||
if($row['trans_type'] == $this->lang->line('sales_cash'))
|
||||
{
|
||||
$cash_ups_info->closed_amount_cash += $this->xss_clean($row['trans_amount']);
|
||||
}
|
||||
elseif($row['trans_type'] == $this->lang->line('sales_due'))
|
||||
{
|
||||
$cash_ups_info->closed_amount_due += $this->xss_clean($row['trans_amount']);
|
||||
}
|
||||
elseif($row['trans_type'] == $this->lang->line('sales_debit') ||
|
||||
$row['trans_type'] == $this->lang->line('sales_credit'))
|
||||
{
|
||||
$cash_ups_info->closed_amount_card += $this->xss_clean($row['trans_amount']);
|
||||
}
|
||||
elseif($row['trans_type'] == $this->lang->line('sales_check'))
|
||||
{
|
||||
$cash_ups_info->closed_amount_check += $this->xss_clean($row['trans_amount']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lookup expenses paid in cash
|
||||
$filters = array(
|
||||
'only_cash' => TRUE,
|
||||
'only_due' => FALSE,
|
||||
'only_check' => FALSE,
|
||||
'only_credit' => FALSE,
|
||||
'only_debit' => FALSE,
|
||||
'is_deleted' => FALSE);
|
||||
$payments = $this->Expense->get_payments_summary('', array_merge($inputs, $filters));
|
||||
|
||||
foreach($payments as $row)
|
||||
{
|
||||
$cash_ups_info->closed_amount_cash -= $this->xss_clean($row['amount']);
|
||||
}
|
||||
|
||||
$cash_ups_info->closed_amount_total = $this->_calculate_total($cash_ups_info->open_amount_cash, $cash_ups_info->transfer_amount_cash, $cash_ups_info->closed_amount_cash, $cash_ups_info->closed_amount_due, $cash_ups_info->closed_amount_card, $cash_ups_info->closed_amount_check);
|
||||
}
|
||||
|
||||
$data['cash_ups_info'] = $cash_ups_info;
|
||||
|
||||
$this->load->view("cashups/form", $data);
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$cash_ups_info = $this->Cashup->get_info($row_id);
|
||||
$data_row = $this->xss_clean(get_cash_up_data_row($cash_ups_info));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function save($cashup_id = -1)
|
||||
{
|
||||
$open_date = $this->input->post('open_date');
|
||||
$open_date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $open_date);
|
||||
|
||||
$close_date = $this->input->post('close_date');
|
||||
$close_date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $close_date);
|
||||
|
||||
$cash_up_data = array(
|
||||
'open_date' => $open_date_formatter->format('Y-m-d H:i:s'),
|
||||
'close_date' => $close_date_formatter->format('Y-m-d H:i:s'),
|
||||
'open_amount_cash' => parse_decimals($this->input->post('open_amount_cash')),
|
||||
'transfer_amount_cash' => parse_decimals($this->input->post('transfer_amount_cash')),
|
||||
'closed_amount_cash' => parse_decimals($this->input->post('closed_amount_cash')),
|
||||
'closed_amount_due' => parse_decimals($this->input->post('closed_amount_due')),
|
||||
'closed_amount_card' => parse_decimals($this->input->post('closed_amount_card')),
|
||||
'closed_amount_check' => parse_decimals($this->input->post('closed_amount_check')),
|
||||
'closed_amount_total' => parse_decimals($this->input->post('closed_amount_total')),
|
||||
'note' => $this->input->post('note') != NULL,
|
||||
'description' => $this->input->post('description'),
|
||||
'open_employee_id' => $this->input->post('open_employee_id'),
|
||||
'close_employee_id' => $this->input->post('close_employee_id'),
|
||||
'deleted' => $this->input->post('deleted') != NULL
|
||||
);
|
||||
|
||||
if($this->Cashup->save($cash_up_data, $cashup_id))
|
||||
{
|
||||
$cash_up_data = $this->xss_clean($cash_up_data);
|
||||
|
||||
//New cashup_id
|
||||
if($cashup_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('cashups_successful_adding'), 'id' => $cash_up_data['cashup_id']));
|
||||
}
|
||||
else // Existing Cashup
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('cashups_successful_updating'), 'id' => $cashup_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('cashups_error_adding_updating'), 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$cash_ups_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Cashup->delete_list($cash_ups_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('cashups_successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . $this->lang->line('cashups_one_or_multiple'), 'ids' => $cash_ups_to_delete));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('cashups_cannot_be_deleted'), 'ids' => $cash_ups_to_delete));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AJAX call from cashup input form to calculate the total
|
||||
*/
|
||||
public function ajax_cashup_total()
|
||||
{
|
||||
$open_amount_cash = parse_decimals($this->input->post('open_amount_cash'));
|
||||
$transfer_amount_cash = parse_decimals($this->input->post('transfer_amount_cash'));
|
||||
$closed_amount_cash = parse_decimals($this->input->post('closed_amount_cash'));
|
||||
$closed_amount_due = parse_decimals($this->input->post('closed_amount_due'));
|
||||
$closed_amount_card = parse_decimals($this->input->post('closed_amount_card'));
|
||||
$closed_amount_check = parse_decimals($this->input->post('closed_amount_check'));
|
||||
|
||||
$total = $this->_calculate_total($open_amount_cash, $transfer_amount_cash, $closed_amount_due, $closed_amount_cash, $closed_amount_card, $closed_amount_check);
|
||||
|
||||
echo json_encode(array('total' => to_currency_no_money($total)));
|
||||
}
|
||||
|
||||
/*
|
||||
Calculate total
|
||||
*/
|
||||
private function _calculate_total($open_amount_cash, $transfer_amount_cash, $closed_amount_due, $closed_amount_cash, $closed_amount_card, $closed_amount_check)
|
||||
{
|
||||
return ($closed_amount_cash - $open_amount_cash - $transfer_amount_cash + $closed_amount_due + $closed_amount_card + $closed_amount_check);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,961 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Config extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('config');
|
||||
|
||||
$this->load->library('barcode_lib');
|
||||
$this->load->library('sale_lib');
|
||||
}
|
||||
|
||||
/*
|
||||
* This function loads all the licenses starting with the first one being OSPOS one
|
||||
*/
|
||||
private function _licenses()
|
||||
{
|
||||
$i = 0;
|
||||
$bower = FALSE;
|
||||
$composer = FALSE;
|
||||
$license = array();
|
||||
|
||||
$license[$i]['title'] = 'Open Source Point Of Sale ' . $this->config->item('application_version');
|
||||
|
||||
if(file_exists('license/LICENSE'))
|
||||
{
|
||||
$license[$i]['text'] = $this->xss_clean(file_get_contents('license/LICENSE', NULL, NULL, 0, 2000));
|
||||
}
|
||||
else
|
||||
{
|
||||
$license[$i]['text'] = 'LICENSE file must be in OSPOS license directory. You are not allowed to use OSPOS application until the distribution copy of LICENSE file is present.';
|
||||
}
|
||||
|
||||
$dir = new DirectoryIterator('license'); // read all the files in the dir license
|
||||
|
||||
foreach($dir as $fileinfo)
|
||||
{
|
||||
// license files must be in couples: .version (name & version) & .license (license text)
|
||||
if($fileinfo->isFile())
|
||||
{
|
||||
if($fileinfo->getExtension() == 'version')
|
||||
{
|
||||
++$i;
|
||||
|
||||
$basename = 'license/' . $fileinfo->getBasename('.version');
|
||||
|
||||
$license[$i]['title'] = $this->xss_clean(file_get_contents($basename . '.version', NULL, NULL, 0, 100));
|
||||
|
||||
$license_text_file = $basename . '.license';
|
||||
|
||||
if(file_exists($license_text_file))
|
||||
{
|
||||
$license[$i]['text'] = $this->xss_clean(file_get_contents($license_text_file , NULL, NULL, 0, 2000));
|
||||
}
|
||||
else
|
||||
{
|
||||
$license[$i]['text'] = $license_text_file . ' file is missing';
|
||||
}
|
||||
}
|
||||
elseif($fileinfo->getBasename() == 'bower.LICENSES')
|
||||
{
|
||||
// set a flag to indicate that the JS Plugin bower.LICENSES file is available and needs to be attached at the end
|
||||
$bower = TRUE;
|
||||
}
|
||||
elseif($fileinfo->getBasename() == 'composer.LICENSES')
|
||||
{
|
||||
// set a flag to indicate that the composer.LICENSES file is available and needs to be attached at the end
|
||||
$composer = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// attach the licenses from the LICENSES file generated by bower
|
||||
if($composer)
|
||||
{
|
||||
++$i;
|
||||
$license[$i]['title'] = 'Composer Libraries';
|
||||
$license[$i]['text'] = '';
|
||||
|
||||
$file = file_get_contents('license/composer.LICENSES');
|
||||
$array = json_decode($file, TRUE);
|
||||
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
if(is_array($val) && $key == 'dependencies')
|
||||
{
|
||||
foreach($val as $key1 => $val1)
|
||||
{
|
||||
if(is_array($val1))
|
||||
{
|
||||
$license[$i]['text'] .= 'component: ' . $key1 . "\n";
|
||||
|
||||
foreach($val1 as $key2 => $val2)
|
||||
{
|
||||
if(is_array($val2))
|
||||
{
|
||||
$license[$i]['text'] .= $key2 . ': ';
|
||||
|
||||
foreach($val2 as $key3 => $val3)
|
||||
{
|
||||
$license[$i]['text'] .= $val3 . ' ';
|
||||
}
|
||||
|
||||
$license[$i]['text'] .= "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$license[$i]['text'] .= $key2 . ': ' . $val2 . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$license[$i]['text'] .= "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$license[$i]['text'] .= $key1 . ': ' . $val1 . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$license[$i]['text'] = $this->xss_clean($license[$i]['text']);
|
||||
}
|
||||
|
||||
// attach the licenses from the LICENSES file generated by bower
|
||||
if($bower)
|
||||
{
|
||||
++$i;
|
||||
$license[$i]['title'] = 'JS Plugins';
|
||||
$license[$i]['text'] = '';
|
||||
|
||||
$file = file_get_contents('license/bower.LICENSES');
|
||||
$array = json_decode($file, TRUE);
|
||||
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
if(is_array($val))
|
||||
{
|
||||
$license[$i]['text'] .= 'component: ' . $key . "\n";
|
||||
|
||||
foreach($val as $key1 => $val1)
|
||||
{
|
||||
if(is_array($val1))
|
||||
{
|
||||
$license[$i]['text'] .= $key1 . ': ';
|
||||
|
||||
foreach($val1 as $key2 => $val2)
|
||||
{
|
||||
$license[$i]['text'] .= $val2 . ' ';
|
||||
}
|
||||
|
||||
$license[$i]['text'] .= "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$license[$i]['text'] .= $key1 . ': ' . $val1 . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$license[$i]['text'] .= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$license[$i]['text'] = $this->xss_clean($license[$i]['text']);
|
||||
}
|
||||
|
||||
return $license;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function loads all the available themes in the dist/bootswatch directory
|
||||
*/
|
||||
private function _themes()
|
||||
{
|
||||
$themes = array();
|
||||
|
||||
// read all themes in the dist folder
|
||||
$dir = new DirectoryIterator('dist/bootswatch');
|
||||
|
||||
foreach($dir as $dirinfo)
|
||||
{
|
||||
if($dirinfo->isDir() && !$dirinfo->isDot() && $dirinfo->getFileName() != 'fonts')
|
||||
{
|
||||
$file = $this->xss_clean($dirinfo->getFileName());
|
||||
$themes[$file] = ucfirst($file);
|
||||
}
|
||||
}
|
||||
|
||||
asort($themes);
|
||||
|
||||
return $themes;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['stock_locations'] = $this->Stock_location->get_all()->result_array();
|
||||
$data['dinner_tables'] = $this->Dinner_table->get_all()->result_array();
|
||||
$data['customer_rewards'] = $this->Customer_rewards->get_all()->result_array();
|
||||
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
|
||||
$data['logo_exists'] = $this->config->item('company_logo') != '';
|
||||
$data['line_sequence_options'] = $this->sale_lib->get_line_sequence_options();
|
||||
$data['register_mode_options'] = $this->sale_lib->get_register_mode_options();
|
||||
$data['invoice_type_options'] = $this->sale_lib->get_invoice_type_options();
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['tax_code_options'] = $this->tax_lib->get_tax_code_options();
|
||||
$data['tax_category_options'] = $this->tax_lib->get_tax_category_options();
|
||||
$data['tax_jurisdiction_options'] = $this->tax_lib->get_tax_jurisdiction_options();
|
||||
$data['show_office_group'] = $this->Module->get_show_office_group();
|
||||
$data['currency_code'] = $this->config->item('currency_code');
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
// load all the license statements, they are already XSS cleaned in the private function
|
||||
$data['licenses'] = $this->_licenses();
|
||||
|
||||
// load all the themes, already XSS cleaned in the private function
|
||||
$data['themes'] = $this->_themes();
|
||||
|
||||
//Load General related fields
|
||||
$image_allowed_types = array('jpg','jpeg','gif','svg','webp','bmp','png','tif','tiff');
|
||||
$data['image_allowed_types'] = array_combine($image_allowed_types,$image_allowed_types);
|
||||
|
||||
$data['selected_image_allowed_types'] = explode('|',$this->config->item('image_allowed_types'));
|
||||
|
||||
//Load Integrations Related fields
|
||||
$data['mailchimp'] = array();
|
||||
|
||||
if($this->_check_encryption())
|
||||
{
|
||||
$data['mailchimp']['api_key'] = $this->encryption->decrypt($this->config->item('mailchimp_api_key'));
|
||||
$data['mailchimp']['list_id'] = $this->encryption->decrypt($this->config->item('mailchimp_list_id'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['mailchimp']['api_key'] = '';
|
||||
$data['mailchimp']['list_id'] = '';
|
||||
}
|
||||
|
||||
// load mailchimp lists associated to the given api key, already XSS cleaned in the private function
|
||||
$data['mailchimp']['lists'] = $this->_mailchimp();
|
||||
|
||||
$this->load->view("configs/manage", $data);
|
||||
}
|
||||
|
||||
public function save_info()
|
||||
{
|
||||
$upload_success = $this->_handle_logo_upload();
|
||||
$upload_data = $this->upload->data();
|
||||
|
||||
$batch_save_data = array(
|
||||
'company' => $this->input->post('company'),
|
||||
'address' => $this->input->post('address'),
|
||||
'phone' => $this->input->post('phone'),
|
||||
'email' => $this->input->post('email'),
|
||||
'fax' => $this->input->post('fax'),
|
||||
'website' => $this->input->post('website'),
|
||||
'return_policy' => $this->input->post('return_policy')
|
||||
);
|
||||
|
||||
if(!empty($upload_data['orig_name']))
|
||||
{
|
||||
// XSS file image sanity check
|
||||
if($this->xss_clean($upload_data['raw_name'], TRUE) === TRUE)
|
||||
{
|
||||
$batch_save_data['company_logo'] = $upload_data['raw_name'] . $upload_data['file_ext'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $upload_success && $result ? TRUE : FALSE;
|
||||
$message = $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully');
|
||||
$message = $upload_success ? $message : strip_tags($this->upload->display_errors());
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $message
|
||||
));
|
||||
}
|
||||
|
||||
public function save_general()
|
||||
{
|
||||
$batch_save_data = array(
|
||||
'theme' => $this->input->post('theme'),
|
||||
'login_form' => $this->input->post('login_form'),
|
||||
'default_sales_discount_type' => $this->input->post('default_sales_discount_type') != NULL,
|
||||
'default_sales_discount' => $this->input->post('default_sales_discount'),
|
||||
'default_receivings_discount_type' => $this->input->post('default_receivings_discount_type') != NULL,
|
||||
'default_receivings_discount' => $this->input->post('default_receivings_discount'),
|
||||
'enforce_privacy' => $this->input->post('enforce_privacy'),
|
||||
'receiving_calculate_average_price' => $this->input->post('receiving_calculate_average_price') != NULL,
|
||||
'lines_per_page' => $this->input->post('lines_per_page'),
|
||||
'notify_horizontal_position' => $this->input->post('notify_horizontal_position'),
|
||||
'notify_vertical_position' => $this->input->post('notify_vertical_position'),
|
||||
'image_max_width' => $this->input->post('image_max_width'),
|
||||
'image_max_height' => $this->input->post('image_max_height'),
|
||||
'image_max_size' => $this->input->post('image_max_size'),
|
||||
'image_allowed_types' => implode('|', $this->input->post('image_allowed_types')),
|
||||
'gcaptcha_enable' => $this->input->post('gcaptcha_enable') != NULL,
|
||||
'gcaptcha_secret_key' => $this->input->post('gcaptcha_secret_key'),
|
||||
'gcaptcha_site_key' => $this->input->post('gcaptcha_site_key'),
|
||||
'suggestions_first_column' => $this->input->post('suggestions_first_column'),
|
||||
'suggestions_second_column' => $this->input->post('suggestions_second_column'),
|
||||
'suggestions_third_column' => $this->input->post('suggestions_third_column'),
|
||||
'giftcard_number' => $this->input->post('giftcard_number'),
|
||||
'derive_sale_quantity' => $this->input->post('derive_sale_quantity') != NULL,
|
||||
'multi_pack_enabled' => $this->input->post('multi_pack_enabled') != NULL,
|
||||
'include_hsn' => $this->input->post('include_hsn') != NULL,
|
||||
'category_dropdown' => $this->input->post('category_dropdown') != NULL
|
||||
);
|
||||
|
||||
$this->Module->set_show_office_group($this->input->post('show_office_group') != NULL);
|
||||
|
||||
if($batch_save_data['category_dropdown'] == 1)
|
||||
{
|
||||
$definition_data['definition_name'] = 'ospos_category';
|
||||
$definition_data['definition_flags'] = 0;
|
||||
$definition_data['definition_type'] = 'DROPDOWN';
|
||||
$definition_data['definition_id'] = CATEGORY_DEFINITION_ID;
|
||||
$definition_data['deleted'] = 0;
|
||||
|
||||
$this->Attribute->save_definition($definition_data, CATEGORY_DEFINITION_ID);
|
||||
}
|
||||
else if($batch_save_data['category_dropdown'] == NO_DEFINITION_ID)
|
||||
{
|
||||
$this->Attribute->delete_definition(CATEGORY_DEFINITION_ID);
|
||||
}
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function ajax_check_number_locale()
|
||||
{
|
||||
$number_locale = $this->input->post('number_locale');
|
||||
$save_number_locale = $this->input->post('save_number_locale');
|
||||
|
||||
$fmt = new \NumberFormatter($number_locale, \NumberFormatter::CURRENCY);
|
||||
if($number_locale != $save_number_locale)
|
||||
{
|
||||
$currency_symbol = $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
|
||||
$currency_code = $fmt->getTextAttribute(\NumberFormatter::CURRENCY_CODE);
|
||||
$save_number_locale = $number_locale;
|
||||
}
|
||||
else
|
||||
{
|
||||
$currency_symbol = empty($this->input->post('currency_symbol')) ? $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL) : $this->input->post('currency_symbol');
|
||||
$currency_code = empty($this->input->post('currency_code')) ? $fmt->getTextAttribute(\NumberFormatter::CURRENCY_CODE) : $this->input->post('currency_code');
|
||||
}
|
||||
|
||||
if($this->input->post('thousands_separator') == 'false')
|
||||
{
|
||||
$fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
|
||||
}
|
||||
|
||||
$fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $currency_symbol);
|
||||
$number_local_example = $fmt->format(1234567890.12300);
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $number_local_example != FALSE,
|
||||
'save_number_locale' => $save_number_locale,
|
||||
'number_locale_example' => $number_local_example,
|
||||
'currency_symbol' => $currency_symbol,
|
||||
'currency_code' => $currency_code,
|
||||
));
|
||||
}
|
||||
|
||||
public function save_locale()
|
||||
{
|
||||
$exploded = explode(":", $this->input->post('language'));
|
||||
$batch_save_data = array(
|
||||
'currency_symbol' => $this->input->post('currency_symbol'),
|
||||
'currency_code' => $this->input->post('currency_code'),
|
||||
'language_code' => $exploded[0],
|
||||
'language' => $exploded[1],
|
||||
'timezone' => $this->input->post('timezone'),
|
||||
'dateformat' => $this->input->post('dateformat'),
|
||||
'timeformat' => $this->input->post('timeformat'),
|
||||
'thousands_separator' => !empty($this->input->post('thousands_separator')),
|
||||
'number_locale' => $this->input->post('number_locale'),
|
||||
'currency_decimals' => $this->input->post('currency_decimals'),
|
||||
'tax_decimals' => $this->input->post('tax_decimals'),
|
||||
'quantity_decimals' => $this->input->post('quantity_decimals'),
|
||||
'country_codes' => $this->input->post('country_codes'),
|
||||
'payment_options_order' => $this->input->post('payment_options_order'),
|
||||
'date_or_time_format' => $this->input->post('date_or_time_format'),
|
||||
'cash_decimals' => $this->input->post('cash_decimals'),
|
||||
'cash_rounding_code' => $this->input->post('cash_rounding_code'),
|
||||
'financial_year' => $this->input->post('financial_year')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_email()
|
||||
{
|
||||
$password = '';
|
||||
|
||||
if($this->_check_encryption())
|
||||
{
|
||||
$password = $this->encryption->encrypt($this->input->post('smtp_pass'));
|
||||
}
|
||||
|
||||
$batch_save_data = array(
|
||||
'protocol' => $this->input->post('protocol'),
|
||||
'mailpath' => $this->input->post('mailpath'),
|
||||
'smtp_host' => $this->input->post('smtp_host'),
|
||||
'smtp_user' => $this->input->post('smtp_user'),
|
||||
'smtp_pass' => $password,
|
||||
'smtp_port' => $this->input->post('smtp_port'),
|
||||
'smtp_timeout' => $this->input->post('smtp_timeout'),
|
||||
'smtp_crypto' => $this->input->post('smtp_crypto')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_message()
|
||||
{
|
||||
$password = '';
|
||||
|
||||
if($this->_check_encryption())
|
||||
{
|
||||
$password = $this->encryption->encrypt($this->input->post('msg_pwd'));
|
||||
}
|
||||
|
||||
$batch_save_data = array(
|
||||
'msg_msg' => $this->input->post('msg_msg'),
|
||||
'msg_uid' => $this->input->post('msg_uid'),
|
||||
'msg_pwd' => $password,
|
||||
'msg_src' => $this->input->post('msg_src')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
* This function fetches all the available lists from Mailchimp for the given API key
|
||||
*/
|
||||
private function _mailchimp($api_key = '')
|
||||
{
|
||||
$this->load->library('mailchimp_lib', array('api_key' => $api_key));
|
||||
|
||||
$result = array();
|
||||
|
||||
if(($lists = $this->mailchimp_lib->getLists()) !== FALSE)
|
||||
{
|
||||
if(is_array($lists) && !empty($lists['lists']) && is_array($lists['lists']))
|
||||
{
|
||||
foreach($lists['lists'] as $list)
|
||||
{
|
||||
$list = $this->xss_clean($list);
|
||||
$result[$list['id']] = $list['name'] . ' [' . $list['stats']['member_count'] . ']';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
AJAX call from mailchimp config form to fetch the Mailchimp lists when a valid API key is inserted
|
||||
*/
|
||||
public function ajax_check_mailchimp_api_key()
|
||||
{
|
||||
// load mailchimp lists associated to the given api key, already XSS cleaned in the private function
|
||||
$lists = $this->_mailchimp($this->input->post('mailchimp_api_key'));
|
||||
$success = count($lists) > 0 ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_mailchimp_key_' . ($success ? '' : 'un') . 'successfully'),
|
||||
'mailchimp_lists' => $lists
|
||||
));
|
||||
}
|
||||
|
||||
public function save_mailchimp()
|
||||
{
|
||||
$api_key = '';
|
||||
$list_id = '';
|
||||
|
||||
if($this->_check_encryption())
|
||||
{
|
||||
$api_key = $this->encryption->encrypt($this->input->post('mailchimp_api_key'));
|
||||
$list_id = $this->encryption->encrypt($this->input->post('mailchimp_list_id'));
|
||||
}
|
||||
|
||||
$batch_save_data = array(
|
||||
'mailchimp_api_key' => $api_key,
|
||||
'mailchimp_list_id' => $list_id
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function ajax_stock_locations()
|
||||
{
|
||||
$stock_locations = $this->Stock_location->get_all()->result_array();
|
||||
|
||||
$stock_locations = $this->xss_clean($stock_locations);
|
||||
|
||||
$this->load->view('partial/stock_locations', array('stock_locations' => $stock_locations));
|
||||
}
|
||||
|
||||
public function ajax_dinner_tables()
|
||||
{
|
||||
$dinner_tables = $this->Dinner_table->get_all()->result_array();
|
||||
|
||||
$dinner_tables = $this->xss_clean($dinner_tables);
|
||||
|
||||
$this->load->view('partial/dinner_tables', array('dinner_tables' => $dinner_tables));
|
||||
}
|
||||
|
||||
public function ajax_tax_categories()
|
||||
{
|
||||
$tax_categories = $this->Tax->get_all_tax_categories()->result_array();
|
||||
|
||||
$tax_categories = $this->xss_clean($tax_categories);
|
||||
|
||||
$this->load->view('partial/tax_categories', array('tax_categories' => $tax_categories));
|
||||
}
|
||||
|
||||
public function ajax_customer_rewards()
|
||||
{
|
||||
$customer_rewards = $this->Customer_rewards->get_all()->result_array();
|
||||
|
||||
$customer_rewards = $this->xss_clean($customer_rewards);
|
||||
|
||||
$this->load->view('partial/customer_rewards', array('customer_rewards' => $customer_rewards));
|
||||
}
|
||||
|
||||
private function _clear_session_state()
|
||||
{
|
||||
$this->sale_lib->clear_sale_location();
|
||||
$this->sale_lib->clear_table();
|
||||
$this->sale_lib->clear_all();
|
||||
$this->load->library('receiving_lib');
|
||||
$this->receiving_lib->clear_stock_source();
|
||||
$this->receiving_lib->clear_stock_destination();
|
||||
$this->receiving_lib->clear_all();
|
||||
}
|
||||
|
||||
public function save_locations()
|
||||
{
|
||||
$this->db->trans_start();
|
||||
|
||||
$not_to_delete = array();
|
||||
foreach($this->input->post() as $key => $value)
|
||||
{
|
||||
if(strstr($key, 'stock_location'))
|
||||
{
|
||||
// save or update
|
||||
foreach ($value as $location_id => $location_name)
|
||||
{
|
||||
$location_data = array('location_name' => $location_name);
|
||||
if($this->Stock_location->save($location_data, $location_id))
|
||||
{
|
||||
$location_id = $this->Stock_location->get_location_id($location_name);
|
||||
$not_to_delete[] = $location_id;
|
||||
$this->_clear_session_state();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all locations not available in post will be deleted now
|
||||
$deleted_locations = $this->Stock_location->get_all()->result_array();
|
||||
|
||||
foreach($deleted_locations as $location => $location_data)
|
||||
{
|
||||
if(!in_array($location_data['location_id'], $not_to_delete))
|
||||
{
|
||||
$this->Stock_location->delete($location_data['location_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
$success = $this->db->trans_status();
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_tables()
|
||||
{
|
||||
$this->db->trans_start();
|
||||
|
||||
$dinner_table_enable = $this->input->post('dinner_table_enable') != NULL;
|
||||
|
||||
$this->Appconfig->save('dinner_table_enable', $dinner_table_enable);
|
||||
|
||||
if($dinner_table_enable)
|
||||
{
|
||||
$not_to_delete = array();
|
||||
foreach($this->input->post() as $key => $value)
|
||||
{
|
||||
if(strstr($key, 'dinner_table') && $key != 'dinner_table_enable')
|
||||
{
|
||||
$dinner_table_id = preg_replace("/.*?_(\d+)$/", "$1", $key);
|
||||
$not_to_delete[] = $dinner_table_id;
|
||||
|
||||
// save or update
|
||||
$table_data = array('name' => $value);
|
||||
if($this->Dinner_table->save($table_data, $dinner_table_id))
|
||||
{
|
||||
$this->_clear_session_state();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all tables not available in post will be deleted now
|
||||
$deleted_tables = $this->Dinner_table->get_all()->result_array();
|
||||
|
||||
foreach($deleted_tables as $dinner_tables => $table)
|
||||
{
|
||||
if(!in_array($table['dinner_table_id'], $not_to_delete))
|
||||
{
|
||||
$this->Dinner_table->delete($table['dinner_table_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
$success = $this->db->trans_status();
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_tax()
|
||||
{
|
||||
$this->db->trans_start();
|
||||
|
||||
$batch_save_data = array(
|
||||
'default_tax_1_rate' => parse_tax($this->input->post('default_tax_1_rate')),
|
||||
'default_tax_1_name' => $this->input->post('default_tax_1_name'),
|
||||
'default_tax_2_rate' => parse_tax($this->input->post('default_tax_2_rate')),
|
||||
'default_tax_2_name' => $this->input->post('default_tax_2_name'),
|
||||
'tax_included' => $this->input->post('tax_included') != NULL,
|
||||
'use_destination_based_tax' => $this->input->post('use_destination_based_tax') != NULL,
|
||||
'default_tax_code' => $this->input->post('default_tax_code'),
|
||||
'default_tax_category' => $this->input->post('default_tax_category'),
|
||||
'default_tax_jurisdiction' => $this->input->post('default_tax_jurisdiction'),
|
||||
'tax_id' => $this->input->post('tax_id')
|
||||
);
|
||||
|
||||
$success = $this->Appconfig->batch_save($batch_save_data) ? TRUE : FALSE;
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
$success &= $this->db->trans_status();
|
||||
|
||||
$message = $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully');
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $message
|
||||
));
|
||||
}
|
||||
|
||||
public function save_rewards()
|
||||
{
|
||||
$this->db->trans_start();
|
||||
|
||||
$customer_reward_enable = $this->input->post('customer_reward_enable') != NULL;
|
||||
|
||||
$this->Appconfig->save('customer_reward_enable', $customer_reward_enable);
|
||||
|
||||
if($customer_reward_enable)
|
||||
{
|
||||
$not_to_delete = array();
|
||||
$array_save = array();
|
||||
foreach($this->input->post() as $key => $value)
|
||||
{
|
||||
if(strstr($key, 'customer_reward') && $key != 'customer_reward_enable')
|
||||
{
|
||||
$customer_reward_id = preg_replace("/.*?_(\d+)$/", "$1", $key);
|
||||
$not_to_delete[] = $customer_reward_id;
|
||||
$array_save[$customer_reward_id]['package_name'] = $value;
|
||||
}
|
||||
elseif(strstr($key, 'reward_points'))
|
||||
{
|
||||
$customer_reward_id = preg_replace("/.*?_(\d+)$/", "$1", $key);
|
||||
$array_save[$customer_reward_id]['points_percent'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($array_save))
|
||||
{
|
||||
foreach($array_save as $key => $value)
|
||||
{
|
||||
// save or update
|
||||
$package_data = array('package_name' => $value['package_name'], 'points_percent' => $value['points_percent']);
|
||||
$this->Customer_rewards->save($package_data, $key);
|
||||
}
|
||||
}
|
||||
|
||||
// all packages not available in post will be deleted now
|
||||
$deleted_packages = $this->Customer_rewards->get_all()->result_array();
|
||||
|
||||
foreach($deleted_packages as $customer_rewards => $reward_category)
|
||||
{
|
||||
if(!in_array($reward_category['package_id'], $not_to_delete))
|
||||
{
|
||||
$this->Customer_rewards->delete($reward_category['package_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->trans_complete();
|
||||
|
||||
$success = $this->db->trans_status();
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_barcode()
|
||||
{
|
||||
$batch_save_data = array(
|
||||
'barcode_type' => $this->input->post('barcode_type'),
|
||||
'barcode_width' => $this->input->post('barcode_width'),
|
||||
'barcode_height' => $this->input->post('barcode_height'),
|
||||
'barcode_font' => $this->input->post('barcode_font'),
|
||||
'barcode_font_size' => $this->input->post('barcode_font_size'),
|
||||
'barcode_first_row' => $this->input->post('barcode_first_row'),
|
||||
'barcode_second_row' => $this->input->post('barcode_second_row'),
|
||||
'barcode_third_row' => $this->input->post('barcode_third_row'),
|
||||
'barcode_num_in_row' => $this->input->post('barcode_num_in_row'),
|
||||
'barcode_page_width' => $this->input->post('barcode_page_width'),
|
||||
'barcode_page_cellspacing' => $this->input->post('barcode_page_cellspacing'),
|
||||
'barcode_generate_if_empty' => $this->input->post('barcode_generate_if_empty') != NULL,
|
||||
'allow_duplicate_barcodes' => $this->input->post('allow_duplicate_barcodes') != NULL,
|
||||
'barcode_content' => $this->input->post('barcode_content'),
|
||||
'barcode_formats' => json_encode($this->input->post('barcode_formats'))
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_receipt()
|
||||
{
|
||||
$batch_save_data = array (
|
||||
'receipt_template' => $this->input->post('receipt_template'),
|
||||
'receipt_font_size' => $this->input->post('receipt_font_size'),
|
||||
'print_delay_autoreturn' => $this->input->post('print_delay_autoreturn'),
|
||||
'email_receipt_check_behaviour' => $this->input->post('email_receipt_check_behaviour'),
|
||||
'print_receipt_check_behaviour' => $this->input->post('print_receipt_check_behaviour'),
|
||||
'receipt_show_company_name' => $this->input->post('receipt_show_company_name') != NULL,
|
||||
'receipt_show_taxes' => ($this->input->post('receipt_show_taxes') != NULL),
|
||||
'receipt_show_tax_ind' => ($this->input->post('receipt_show_tax_ind') != NULL),
|
||||
'receipt_show_total_discount' => $this->input->post('receipt_show_total_discount') != NULL,
|
||||
'receipt_show_description' => $this->input->post('receipt_show_description') != NULL,
|
||||
'receipt_show_serialnumber' => $this->input->post('receipt_show_serialnumber') != NULL,
|
||||
'print_silently' => $this->input->post('print_silently') != NULL,
|
||||
'print_header' => $this->input->post('print_header') != NULL,
|
||||
'print_footer' => $this->input->post('print_footer') != NULL,
|
||||
'print_top_margin' => $this->input->post('print_top_margin'),
|
||||
'print_left_margin' => $this->input->post('print_left_margin'),
|
||||
'print_bottom_margin' => $this->input->post('print_bottom_margin'),
|
||||
'print_right_margin' => $this->input->post('print_right_margin')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_invoice()
|
||||
{
|
||||
$batch_save_data = array (
|
||||
'invoice_enable' => $this->input->post('invoice_enable') != NULL,
|
||||
'sales_invoice_format' => $this->input->post('sales_invoice_format'),
|
||||
'sales_quote_format' => $this->input->post('sales_quote_format'),
|
||||
'recv_invoice_format' => $this->input->post('recv_invoice_format'),
|
||||
'invoice_default_comments' => $this->input->post('invoice_default_comments'),
|
||||
'invoice_email_message' => $this->input->post('invoice_email_message'),
|
||||
'line_sequence' => $this->input->post('line_sequence'),
|
||||
'last_used_invoice_number' => $this->input->post('last_used_invoice_number'),
|
||||
'last_used_quote_number' => $this->input->post('last_used_quote_number'),
|
||||
'quote_default_comments' => $this->input->post('quote_default_comments'),
|
||||
'work_order_enable' => $this->input->post('work_order_enable') != NULL,
|
||||
'work_order_format' => $this->input->post('work_order_format'),
|
||||
'last_used_work_order_number' => $this->input->post('last_used_work_order_number'),
|
||||
'invoice_type' => $this->input->post('invoice_type')
|
||||
);
|
||||
|
||||
$result = $this->Appconfig->batch_save($batch_save_data);
|
||||
$success = $result ? TRUE : FALSE;
|
||||
|
||||
// Update the register mode with the latest change so that if the user
|
||||
// switches immediately back to the register the mode reflects the change
|
||||
if($success == TRUE)
|
||||
{
|
||||
if($this->config->item('invoice_enable') == '1')
|
||||
{
|
||||
$this->sale_lib->set_mode($batch_save_data['default_register_mode']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sale_lib->set_mode('sale');
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function remove_logo()
|
||||
{
|
||||
$result = $this->Appconfig->batch_save(array('company_logo' => ''));
|
||||
|
||||
echo json_encode(array('success' => $result));
|
||||
}
|
||||
|
||||
private function _handle_logo_upload()
|
||||
{
|
||||
$this->load->helper('directory');
|
||||
|
||||
// load upload library
|
||||
$config = array('upload_path' => './uploads/',
|
||||
'allowed_types' => 'gif|jpg|png',
|
||||
'max_size' => '1024',
|
||||
'max_width' => '800',
|
||||
'max_height' => '680',
|
||||
'file_name' => 'company_logo');
|
||||
$this->load->library('upload', $config);
|
||||
$this->upload->do_upload('company_logo');
|
||||
|
||||
return strlen($this->upload->display_errors()) == 0 || !strcmp($this->upload->display_errors(), '<p>'.$this->lang->line('upload_no_file_selected').'</p>');
|
||||
}
|
||||
|
||||
private function _check_encryption()
|
||||
{
|
||||
$encryption_key = $this->config->item('encryption_key');
|
||||
|
||||
// check if the encryption_key config item is the default one
|
||||
if($encryption_key == '' || $encryption_key == 'YOUR KEY')
|
||||
{
|
||||
// Config path
|
||||
$config_path = APPPATH . 'config/config.php';
|
||||
|
||||
// Open the file
|
||||
$config = file_get_contents($config_path);
|
||||
|
||||
// $key will be assigned a 32-byte (256-bit) hex-encoded random key
|
||||
$key = bin2hex($this->encryption->create_key(32));
|
||||
|
||||
// set the encryption key in the config item
|
||||
$this->config->set_item('encryption_key', $key);
|
||||
|
||||
// replace the empty placeholder with a real randomly generated encryption key
|
||||
$config = preg_replace("/(.*encryption_key.*)('');/", "$1'$key';", $config);
|
||||
|
||||
$result = FALSE;
|
||||
|
||||
// Chmod the file
|
||||
@chmod($config_path, 0770);
|
||||
|
||||
// Verify file permissions
|
||||
if(is_writable($config_path))
|
||||
{
|
||||
// Write the new config.php file
|
||||
$handle = @fopen($config_path, 'w+');
|
||||
|
||||
// Write the file
|
||||
$result = (fwrite($handle, $config) === FALSE) ? FALSE : TRUE;
|
||||
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
// Chmod the file
|
||||
@chmod($config_path, 0440);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function backup_db()
|
||||
{
|
||||
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
if($this->Employee->has_module_grant('config', $employee_id))
|
||||
{
|
||||
$this->load->dbutil();
|
||||
|
||||
$prefs = array(
|
||||
'format' => 'zip',
|
||||
'filename' => 'ospos.sql'
|
||||
);
|
||||
|
||||
$backup = $this->dbutil->backup($prefs);
|
||||
|
||||
$file_name = 'ospos-' . date("Y-m-d-H-i-s") .'.zip';
|
||||
$save = 'uploads/' . $file_name;
|
||||
$this->load->helper('download');
|
||||
while(ob_get_level())
|
||||
{
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
force_download($file_name, $backup);
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect('no_access/config');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,465 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Persons.php");
|
||||
|
||||
class Customers extends Persons
|
||||
{
|
||||
private $_list_id;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('customers');
|
||||
|
||||
$this->load->library('mailchimp_lib');
|
||||
|
||||
$CI =& get_instance();
|
||||
|
||||
$this->_list_id = $CI->encryption->decrypt($CI->Appconfig->get('mailchimp_list_id'));
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_customer_manage_table_headers());
|
||||
|
||||
$this->load->view('people/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Gets one row for a customer manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$person = $this->Customer->get_info($row_id);
|
||||
|
||||
// retrieve the total amount the customer spent so far together with min, max and average values
|
||||
$stats = $this->Customer->get_stats($person->person_id);
|
||||
if(empty($stats))
|
||||
{
|
||||
//create object with empty properties.
|
||||
$stats = new stdClass;
|
||||
$stats->total = 0;
|
||||
$stats->min = 0;
|
||||
$stats->max = 0;
|
||||
$stats->average = 0;
|
||||
$stats->avg_discount = 0;
|
||||
$stats->quantity = 0;
|
||||
}
|
||||
|
||||
$data_row = $this->xss_clean(get_customer_data_row($person, $stats));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$customers = $this->Customer->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Customer->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($customers->result() as $person)
|
||||
{
|
||||
// retrieve the total amount the customer spent so far together with min, max and average values
|
||||
$stats = $this->Customer->get_stats($person->person_id);
|
||||
if(empty($stats))
|
||||
{
|
||||
//create object with empty properties.
|
||||
$stats = new stdClass;
|
||||
$stats->total = 0;
|
||||
$stats->min = 0;
|
||||
$stats->max = 0;
|
||||
$stats->average = 0;
|
||||
$stats->avg_discount = 0;
|
||||
$stats->quantity = 0;
|
||||
}
|
||||
|
||||
$data_rows[] = $this->xss_clean(get_customer_data_row($person, $stats));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Customer->get_search_suggestions($this->input->get('term'), TRUE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Customer->get_search_suggestions($this->input->post('term'), FALSE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the customer edit form
|
||||
*/
|
||||
public function view($customer_id = -1)
|
||||
{
|
||||
$info = $this->Customer->get_info($customer_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['person_info'] = $info;
|
||||
|
||||
if(empty($info->person_id) || empty($info->date) || empty($info->employee_id))
|
||||
{
|
||||
$data['person_info']->date = date('Y-m-d H:i:s');
|
||||
$data['person_info']->employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
}
|
||||
|
||||
$employee_info = $this->Employee->get_info($info->employee_id);
|
||||
$data['employee'] = $this->xss_clean($employee_info->first_name . ' ' . $employee_info->last_name);
|
||||
|
||||
$tax_code_info = $this->Tax_code->get_info($info->sales_tax_code_id);
|
||||
$tax_code_id = $tax_code_info->tax_code_id;
|
||||
|
||||
if($tax_code_info->tax_code != NULL)
|
||||
{
|
||||
$data['sales_tax_code_label'] = $this->xss_clean($tax_code_info->tax_code . ' ' . $tax_code_info->tax_code_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['sales_tax_code_label'] = '';
|
||||
}
|
||||
|
||||
$packages = array('' => $this->lang->line('items_none'));
|
||||
foreach($this->Customer_rewards->get_all()->result_array() as $row)
|
||||
{
|
||||
$packages[$this->xss_clean($row['package_id'])] = $this->xss_clean($row['package_name']);
|
||||
}
|
||||
$data['packages'] = $packages;
|
||||
$data['selected_package'] = $info->package_id;
|
||||
|
||||
if($this->config->item('use_destination_based_tax') == '1')
|
||||
{
|
||||
$data['use_destination_based_tax'] = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['use_destination_based_tax'] = FALSE;
|
||||
}
|
||||
|
||||
// retrieve the total amount the customer spent so far together with min, max and average values
|
||||
$stats = $this->Customer->get_stats($customer_id);
|
||||
if(!empty($stats))
|
||||
{
|
||||
foreach(get_object_vars($stats) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['stats'] = $stats;
|
||||
}
|
||||
|
||||
// retrieve the info from Mailchimp only if there is an email address assigned
|
||||
if(!empty($info->email))
|
||||
{
|
||||
// collect mailchimp customer info
|
||||
if(($mailchimp_info = $this->mailchimp_lib->getMemberInfo($this->_list_id, $info->email)) !== FALSE)
|
||||
{
|
||||
$data['mailchimp_info'] = $this->xss_clean($mailchimp_info);
|
||||
|
||||
// collect customer mailchimp emails activities (stats)
|
||||
if(($activities = $this->mailchimp_lib->getMemberActivity($this->_list_id, $info->email)) !== FALSE)
|
||||
{
|
||||
if(array_key_exists('activity', $activities))
|
||||
{
|
||||
$open = 0;
|
||||
$unopen = 0;
|
||||
$click = 0;
|
||||
$total = 0;
|
||||
$lastopen = '';
|
||||
|
||||
foreach($activities['activity'] as $activity)
|
||||
{
|
||||
if($activity['action'] == 'sent')
|
||||
{
|
||||
++$unopen;
|
||||
}
|
||||
elseif($activity['action'] == 'open')
|
||||
{
|
||||
if(empty($lastopen))
|
||||
{
|
||||
$lastopen = substr($activity['timestamp'], 0, 10);
|
||||
}
|
||||
++$open;
|
||||
}
|
||||
elseif($activity['action'] == 'click')
|
||||
{
|
||||
if(empty($lastopen))
|
||||
{
|
||||
$lastopen = substr($activity['timestamp'], 0, 10);
|
||||
}
|
||||
++$click;
|
||||
}
|
||||
|
||||
++$total;
|
||||
}
|
||||
|
||||
$data['mailchimp_activity']['total'] = $total;
|
||||
$data['mailchimp_activity']['open'] = $open;
|
||||
$data['mailchimp_activity']['unopen'] = $unopen;
|
||||
$data['mailchimp_activity']['click'] = $click;
|
||||
$data['mailchimp_activity']['lastopen'] = $lastopen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view("customers/form", $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates a customer
|
||||
*/
|
||||
public function save($customer_id = -1)
|
||||
{
|
||||
$first_name = $this->xss_clean($this->input->post('first_name'));
|
||||
$last_name = $this->xss_clean($this->input->post('last_name'));
|
||||
$email = $this->xss_clean(strtolower($this->input->post('email')));
|
||||
|
||||
// format first and last name properly
|
||||
$first_name = $this->nameize($first_name);
|
||||
$last_name = $this->nameize($last_name);
|
||||
|
||||
$person_data = array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'gender' => $this->input->post('gender'),
|
||||
'email' => $email,
|
||||
'phone_number' => $this->input->post('phone_number'),
|
||||
'address_1' => $this->input->post('address_1'),
|
||||
'address_2' => $this->input->post('address_2'),
|
||||
'city' => $this->input->post('city'),
|
||||
'state' => $this->input->post('state'),
|
||||
'zip' => $this->input->post('zip'),
|
||||
'country' => $this->input->post('country'),
|
||||
'comments' => $this->input->post('comments')
|
||||
);
|
||||
|
||||
$date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $this->input->post('date'));
|
||||
|
||||
$customer_data = array(
|
||||
'consent' => $this->input->post('consent') != NULL,
|
||||
'account_number' => $this->input->post('account_number') == '' ? NULL : $this->input->post('account_number'),
|
||||
'tax_id' => $this->input->post('tax_id'),
|
||||
'company_name' => $this->input->post('company_name') == '' ? NULL : $this->input->post('company_name'),
|
||||
'discount' => $this->input->post('discount') == '' ? 0.00 : $this->input->post('discount'),
|
||||
'discount_type' => $this->input->post('discount_type') == NULL ? PERCENT : $this->input->post('discount_type'),
|
||||
'package_id' => $this->input->post('package_id') == '' ? NULL : $this->input->post('package_id'),
|
||||
'taxable' => $this->input->post('taxable') != NULL,
|
||||
'date' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'sales_tax_code_id' => $this->input->post('sales_tax_code_id') == '' ? NULL : $this->input->post('sales_tax_code_id')
|
||||
);
|
||||
|
||||
if($this->Customer->save_customer($person_data, $customer_data, $customer_id))
|
||||
{
|
||||
// save customer to Mailchimp selected list
|
||||
$this->mailchimp_lib->addOrUpdateMember($this->_list_id, $email, $first_name, $last_name, $this->input->post('mailchimp_status'), array('vip' => $this->input->post('mailchimp_vip') != NULL));
|
||||
|
||||
// New customer
|
||||
if($customer_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('customers_successful_adding') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => $this->xss_clean($customer_data['person_id'])));
|
||||
}
|
||||
else // Existing customer
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('customers_successful_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => $customer_id));
|
||||
}
|
||||
}
|
||||
else // Failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE,
|
||||
'message' => $this->lang->line('customers_error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AJAX call to verify if an email address already exists
|
||||
*/
|
||||
public function ajax_check_email()
|
||||
{
|
||||
$exists = $this->Customer->check_email_exists(strtolower($this->input->post('email')), $this->input->post('person_id'));
|
||||
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
/*
|
||||
AJAX call to verify if an account number already exists
|
||||
*/
|
||||
public function ajax_check_account_number()
|
||||
{
|
||||
$exists = $this->Customer->check_account_number_exists($this->input->post('account_number'), $this->input->post('person_id'));
|
||||
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes customers from the customers table
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$customers_to_delete = $this->input->post('ids');
|
||||
$customers_info = $this->Customer->get_multiple_info($customers_to_delete);
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach($customers_info->result() as $info)
|
||||
{
|
||||
if($this->Customer->delete($info->person_id))
|
||||
{
|
||||
// remove customer from Mailchimp selected list
|
||||
$this->mailchimp_lib->removeMember($this->_list_id, $info->email);
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if($count == count($customers_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('customers_successful_deleted') . ' ' . $count . ' ' . $this->lang->line('customers_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Customers import from csv spreadsheet
|
||||
*/
|
||||
public function csv()
|
||||
{
|
||||
$name = 'import_customers.csv';
|
||||
$data = file_get_contents('../' . $name);
|
||||
force_download($name, $data);
|
||||
}
|
||||
|
||||
public function csv_import()
|
||||
{
|
||||
$this->load->view('customers/form_csv_import', NULL);
|
||||
}
|
||||
|
||||
public function do_csv_import()
|
||||
{
|
||||
if($_FILES['file_path']['error'] != UPLOAD_ERR_OK)
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_csv_import_failed')));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(($handle = fopen($_FILES['file_path']['tmp_name'], 'r')) !== FALSE)
|
||||
{
|
||||
// Skip the first row as it's the table description
|
||||
fgetcsv($handle);
|
||||
$i = 1;
|
||||
|
||||
$failCodes = array();
|
||||
|
||||
while(($data = fgetcsv($handle)) !== FALSE)
|
||||
{
|
||||
// XSS file data sanity check
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$consent = $data[3] == '' ? 0 : 1;
|
||||
|
||||
if(sizeof($data) >= 16 && $consent)
|
||||
{
|
||||
$email = strtolower($data[4]);
|
||||
$person_data = array(
|
||||
'first_name' => $data[0],
|
||||
'last_name' => $data[1],
|
||||
'gender' => $data[2],
|
||||
'email' => $email,
|
||||
'phone_number' => $data[5],
|
||||
'address_1' => $data[6],
|
||||
'address_2' => $data[7],
|
||||
'city' => $data[8],
|
||||
'state' => $data[9],
|
||||
'zip' => $data[10],
|
||||
'country' => $data[11],
|
||||
'comments' => $data[12]
|
||||
);
|
||||
|
||||
$customer_data = array(
|
||||
'consent' => $consent,
|
||||
'company_name' => $data[13],
|
||||
'discount' => $data[15],
|
||||
'discount_type' => $data[16],
|
||||
'taxable' => $data[17] == '' ? 0 : 1,
|
||||
'date' => date('Y-m-d H:i:s'),
|
||||
'employee_id' => $this->Employee->get_logged_in_employee_info()->person_id
|
||||
);
|
||||
$account_number = $data[14];
|
||||
|
||||
// don't duplicate people with same email
|
||||
$invalidated = $this->Customer->check_email_exists($email);
|
||||
|
||||
if($account_number != '')
|
||||
{
|
||||
$customer_data['account_number'] = $account_number;
|
||||
$invalidated &= $this->Customer->check_account_number_exists($account_number);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$invalidated = TRUE;
|
||||
}
|
||||
|
||||
if($invalidated)
|
||||
{
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
elseif($this->Customer->save_customer($person_data, $customer_data))
|
||||
{
|
||||
// save customer to Mailchimp selected list
|
||||
$this->mailchimp_lib->addOrUpdateMember($this->_list_id, $person_data['email'], $person_data['first_name'], '', $person_data['last_name']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
|
||||
++$i;
|
||||
}
|
||||
|
||||
if(count($failCodes) > 0)
|
||||
{
|
||||
$message = $this->lang->line('customers_csv_import_partially_failed') . ' (' . count($failCodes) . '): ' . implode(', ', $failCodes);
|
||||
|
||||
echo json_encode(array('success' => FALSE, 'message' => $message));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('customers_csv_import_success')));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('customers_csv_import_nodata_wrongformat')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,201 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Persons.php");
|
||||
|
||||
class Employees extends Persons
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('employees');
|
||||
}
|
||||
|
||||
/*
|
||||
Returns employee table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$employees = $this->Employee->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Employee->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($employees->result() as $person)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_person_data_row($person));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Employee->get_search_suggestions($this->input->get('term'), TRUE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Employee->get_search_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the employee edit form
|
||||
*/
|
||||
public function view($employee_id = -1)
|
||||
{
|
||||
$person_info = $this->Employee->get_info($employee_id);
|
||||
foreach(get_object_vars($person_info) as $property => $value)
|
||||
{
|
||||
$person_info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['person_info'] = $person_info;
|
||||
$data['employee_id'] = $employee_id;
|
||||
|
||||
$modules = array();
|
||||
foreach($this->Module->get_all_modules()->result() as $module)
|
||||
{
|
||||
$module->module_id = $this->xss_clean($module->module_id);
|
||||
$module->grant = $this->xss_clean($this->Employee->has_grant($module->module_id, $person_info->person_id));
|
||||
$module->menu_group = $this->xss_clean($this->Employee->get_menu_group($module->module_id, $person_info->person_id));
|
||||
|
||||
$modules[] = $module;
|
||||
}
|
||||
$data['all_modules'] = $modules;
|
||||
|
||||
$permissions = array();
|
||||
foreach($this->Module->get_all_subpermissions()->result() as $permission)
|
||||
{
|
||||
$permission->module_id = $this->xss_clean($permission->module_id);
|
||||
$permission->permission_id = str_replace(' ', '_', $this->xss_clean($permission->permission_id));
|
||||
$permission->grant = $this->xss_clean($this->Employee->has_grant($permission->permission_id, $person_info->person_id));
|
||||
|
||||
$permissions[] = $permission;
|
||||
}
|
||||
$data['all_subpermissions'] = $permissions;
|
||||
|
||||
$this->load->view('employees/form', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates an employee
|
||||
*/
|
||||
public function save($employee_id = -1)
|
||||
{
|
||||
$first_name = $this->xss_clean($this->input->post('first_name'));
|
||||
$last_name = $this->xss_clean($this->input->post('last_name'));
|
||||
$email = $this->xss_clean(strtolower($this->input->post('email')));
|
||||
|
||||
// format first and last name properly
|
||||
$first_name = $this->nameize($first_name);
|
||||
$last_name = $this->nameize($last_name);
|
||||
|
||||
$person_data = array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'gender' => $this->input->post('gender'),
|
||||
'email' => $email,
|
||||
'phone_number' => $this->input->post('phone_number'),
|
||||
'address_1' => $this->input->post('address_1'),
|
||||
'address_2' => $this->input->post('address_2'),
|
||||
'city' => $this->input->post('city'),
|
||||
'state' => $this->input->post('state'),
|
||||
'zip' => $this->input->post('zip'),
|
||||
'country' => $this->input->post('country'),
|
||||
'comments' => $this->input->post('comments'),
|
||||
);
|
||||
|
||||
$grants_array = array();
|
||||
foreach($this->Module->get_all_permissions()->result() as $permission)
|
||||
{
|
||||
$grants = array();
|
||||
$grant = $this->input->post('grant_'.$permission->permission_id) != NULL ? $this->input->post('grant_'.$permission->permission_id) : '';
|
||||
if($grant == $permission->permission_id)
|
||||
{
|
||||
$grants['permission_id'] = $permission->permission_id;
|
||||
$grants['menu_group'] = $this->input->post('menu_group_'.$permission->permission_id) != NULL ? $this->input->post('menu_group_'.$permission->permission_id) : '--';
|
||||
$grants_array[] = $grants;
|
||||
}
|
||||
}
|
||||
|
||||
//Password has been changed OR first time password set
|
||||
if($this->input->post('password') != '' && ENVIRONMENT != 'testing')
|
||||
{
|
||||
$exploded = explode(":", $this->input->post('language'));
|
||||
$employee_data = array(
|
||||
'username' => $this->input->post('username'),
|
||||
'password' => password_hash($this->input->post('password'), PASSWORD_DEFAULT),
|
||||
'hash_version' => 2,
|
||||
'language_code' => $exploded[0],
|
||||
'language' => $exploded[1]
|
||||
);
|
||||
}
|
||||
else //Password not changed
|
||||
{
|
||||
$exploded = explode(":", $this->input->post('language'));
|
||||
$employee_data = array(
|
||||
'username' => $this->input->post('username'),
|
||||
'language_code' => $exploded[0],
|
||||
'language' => $exploded[1]
|
||||
);
|
||||
}
|
||||
|
||||
if($this->Employee->save_employee($person_data, $employee_data, $grants_array, $employee_id))
|
||||
{
|
||||
// New employee
|
||||
if($employee_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('employees_successful_adding') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => $this->xss_clean($employee_data['person_id'])));
|
||||
}
|
||||
else // Existing employee
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('employees_successful_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => $employee_id));
|
||||
}
|
||||
}
|
||||
else // Failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE,
|
||||
'message' => $this->lang->line('employees_error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
|
||||
'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes employees from the employees table
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$employees_to_delete = $this->xss_clean($this->input->post('ids'));
|
||||
|
||||
if($this->Employee->delete_list($employees_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,'message' => $this->lang->line('employees_successful_deleted') . ' ' .
|
||||
count($employees_to_delete) . ' ' . $this->lang->line('employees_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('employees_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
public function check_username($employee_id)
|
||||
{
|
||||
$exists = $this->Employee->username_exists($employee_id, $this->input->get('username'));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,183 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Expenses extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('expenses');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_expenses_manage_table_headers());
|
||||
|
||||
// filters that will be loaded in the multiselect dropdown
|
||||
$data['filters'] = array('only_cash' => $this->lang->line('expenses_cash_filter'),
|
||||
'only_due' => $this->lang->line('expenses_due_filter'),
|
||||
'only_check' => $this->lang->line('expenses_check_filter'),
|
||||
'only_credit' => $this->lang->line('expenses_credit_filter'),
|
||||
'only_debit' => $this->lang->line('expenses_debit_filter'),
|
||||
'is_deleted' => $this->lang->line('expenses_is_deleted'));
|
||||
|
||||
$this->load->view('expenses/manage', $data);
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
$payments = 0;
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
$filters = array(
|
||||
'start_date' => $this->input->get('start_date'),
|
||||
'end_date' => $this->input->get('end_date'),
|
||||
'only_cash' => FALSE,
|
||||
'only_due' => FALSE,
|
||||
'only_check' => FALSE,
|
||||
'only_credit' => FALSE,
|
||||
'only_debit' => FALSE,
|
||||
'is_deleted' => FALSE);
|
||||
|
||||
// check if any filter is set in the multiselect dropdown
|
||||
$filledup = array_fill_keys($this->input->get('filters'), TRUE);
|
||||
$filters = array_merge($filters, $filledup);
|
||||
$expenses = $this->Expense->search($search, $filters, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Expense->get_found_rows($search, $filters);
|
||||
$payments = $this->Expense->get_payments_summary($search, $filters);
|
||||
$payment_summary = get_expenses_manage_payments_summary($payments, $expenses);
|
||||
$data_rows = array();
|
||||
foreach($expenses->result() as $expense)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_expenses_data_row($expense));
|
||||
}
|
||||
|
||||
if($total_rows > 0)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_expenses_data_last_row($expenses));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows, 'payment_summary' => $payment_summary));
|
||||
}
|
||||
|
||||
public function view($expense_id = -1)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
foreach(get_object_vars($employee) as $property => $value)
|
||||
{
|
||||
$employee->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$data['employees'][$employee->person_id] = $employee->first_name . ' ' . $employee->last_name;
|
||||
}
|
||||
|
||||
$data['expenses_info'] = $this->Expense->get_info($expense_id);
|
||||
|
||||
$expense_categories = array();
|
||||
foreach($this->Expense_category->get_all(0, 0, TRUE)->result_array() as $row)
|
||||
{
|
||||
$expense_categories[$row['expense_category_id']] = $row['category_name'];
|
||||
}
|
||||
$data['expense_categories'] = $expense_categories;
|
||||
|
||||
$expense_id = $data['expenses_info']->expense_id;
|
||||
|
||||
if(empty($expense_id))
|
||||
{
|
||||
$data['expenses_info']->date = date('Y-m-d H:i:s');
|
||||
$data['expenses_info']->employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
}
|
||||
|
||||
$data['payments'] = array();
|
||||
foreach($this->Expense->get_expense_payment($expense_id)->result() as $payment)
|
||||
{
|
||||
foreach(get_object_vars($payment) as $property => $value)
|
||||
{
|
||||
$payment->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$data['payments'][] = $payment;
|
||||
}
|
||||
|
||||
// don't allow gift card to be a payment option in a sale transaction edit because it's a complex change
|
||||
$data['payment_options'] = $this->xss_clean($this->Expense->get_payment_options(FALSE));
|
||||
|
||||
$this->load->view("expenses/form", $data);
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$expense_info = $this->Expense->get_info($row_id);
|
||||
$data_row = $this->xss_clean(get_expenses_data_row($expense_info));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function save($expense_id = -1)
|
||||
{
|
||||
$newdate = $this->input->post('date');
|
||||
|
||||
$date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $newdate);
|
||||
|
||||
$expense_data = array(
|
||||
'date' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
'supplier_id' => $this->input->post('supplier_id') == '' ? NULL : $this->input->post('supplier_id'),
|
||||
'supplier_tax_code' => $this->input->post('supplier_tax_code'),
|
||||
'amount' => parse_decimals($this->input->post('amount')),
|
||||
'tax_amount' => parse_decimals($this->input->post('tax_amount')),
|
||||
'payment_type' => $this->input->post('payment_type'),
|
||||
'expense_category_id' => $this->input->post('expense_category_id'),
|
||||
'description' => $this->input->post('description'),
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'deleted' => $this->input->post('deleted') != NULL
|
||||
);
|
||||
|
||||
if($this->Expense->save($expense_data, $expense_id))
|
||||
{
|
||||
$expense_data = $this->xss_clean($expense_data);
|
||||
|
||||
//New expense_id
|
||||
if($expense_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_successful_adding'), 'id' => $expense_data['expense_id']));
|
||||
}
|
||||
else // Existing Expense
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_successful_updating'), 'id' => $expense_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('expenses_error_adding_updating'), 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function ajax_check_amount()
|
||||
{
|
||||
$value = $this->input->post();
|
||||
$parsed_value = parse_decimals(array_pop($value));
|
||||
echo json_encode(array('success' => $parsed_value !== FALSE));
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$expenses_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Expense->delete_list($expenses_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . $this->lang->line('expenses_one_or_multiple'), 'ids' => $expenses_to_delete));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('expenses_cannot_be_deleted'), 'ids' => $expenses_to_delete));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,97 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Expenses_categories extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('expenses_categories');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_expense_category_manage_table_headers());
|
||||
|
||||
$this->load->view('expenses_categories/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns expense_category_manage table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$expense_categories = $this->Expense_category->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Expense_category->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($expense_categories->result() as $expense_category)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_expense_category_data_row($expense_category));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_expense_category_data_row($this->Expense_category->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view($expense_category_id = -1)
|
||||
{
|
||||
$data['category_info'] = $this->Expense_category->get_info($expense_category_id);
|
||||
|
||||
$this->load->view("expenses_categories/form", $data);
|
||||
}
|
||||
|
||||
public function save($expense_category_id = -1)
|
||||
{
|
||||
$expense_category_data = array(
|
||||
'category_name' => $this->input->post('category_name'),
|
||||
'category_description' => $this->input->post('category_description')
|
||||
);
|
||||
|
||||
if($this->Expense_category->save($expense_category_data, $expense_category_id))
|
||||
{
|
||||
$expense_category_data = $this->xss_clean($expense_category_data);
|
||||
|
||||
// New expense_category_id
|
||||
if($expense_category_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_categories_successful_adding'), 'id' => $expense_category_data['expense_category_id']));
|
||||
}
|
||||
else // Existing Expense Category
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_categories_successful_updating'), 'id' => $expense_category_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('expenses_categories_error_adding_updating') . ' ' . $expense_category_data['category_name'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$expense_category_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Expense_category->delete_list($expense_category_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_categories_successful_deleted') . ' ' . count($expense_category_to_delete) . ' ' . $this->lang->line('expenses_categories_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('expenses_categories_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,152 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Giftcards extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('giftcards');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_giftcards_manage_table_headers());
|
||||
|
||||
$this->load->view('giftcards/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns Giftcards table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$giftcards = $this->Giftcard->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Giftcard->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($giftcards->result() as $giftcard)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_giftcard_data_row($giftcard));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
|
||||
public function suggest()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Giftcard->get_search_suggestions($this->input->get('term'), TRUE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Giftcard->get_search_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_giftcard_data_row($this->Giftcard->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view($giftcard_id = -1)
|
||||
{
|
||||
$giftcard_info = $this->Giftcard->get_info($giftcard_id);
|
||||
|
||||
$data['selected_person_name'] = ($giftcard_id > 0 && isset($giftcard_info->person_id)) ? $giftcard_info->first_name . ' ' . $giftcard_info->last_name : '';
|
||||
$data['selected_person_id'] = $giftcard_info->person_id;
|
||||
if($this->config->item('giftcard_number') == "random")
|
||||
{
|
||||
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$max_giftnumber = isset($this->Giftcard->get_max_number()->giftcard_number) ? $this->Giftcard->get_max_number()->giftcard_number : 0;
|
||||
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : $max_giftnumber + 1;
|
||||
}
|
||||
$data['giftcard_id'] = $giftcard_id;
|
||||
$data['giftcard_value'] = $giftcard_info->value;
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$this->load->view("giftcards/form", $data);
|
||||
}
|
||||
|
||||
public function save($giftcard_id = -1)
|
||||
{
|
||||
$giftcard_number = $this->input->post('giftcard_number');
|
||||
|
||||
if($giftcard_id == -1 && trim($giftcard_number) == '')
|
||||
{
|
||||
$giftcard_number = $this->Giftcard->generate_unique_giftcard_name($this->input->post('giftcard_amount'));
|
||||
}
|
||||
|
||||
$giftcard_data = array(
|
||||
'record_time' => date('Y-m-d H:i:s'),
|
||||
'giftcard_number' => $giftcard_number,
|
||||
'value' => parse_decimals($this->input->post('giftcard_amount')),
|
||||
'person_id' => $this->input->post('person_id') == '' ? NULL : $this->input->post('person_id')
|
||||
);
|
||||
|
||||
if($this->Giftcard->save($giftcard_data, $giftcard_id))
|
||||
{
|
||||
$giftcard_data = $this->xss_clean($giftcard_data);
|
||||
|
||||
//New giftcard
|
||||
if($giftcard_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('giftcards_successful_adding') . ' ' .
|
||||
$giftcard_data['giftcard_number'], 'id' => $giftcard_data['giftcard_id']));
|
||||
}
|
||||
else //Existing giftcard
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('giftcards_successful_updating') . ' ' .
|
||||
$giftcard_data['giftcard_number'], 'id' => $giftcard_id));
|
||||
}
|
||||
}
|
||||
else //failure
|
||||
{
|
||||
$giftcard_data = $this->xss_clean($giftcard_data);
|
||||
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('giftcards_error_adding_updating') . ' ' .
|
||||
$giftcard_data['giftcard_number'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function ajax_check_number_giftcard()
|
||||
{
|
||||
$parsed_value = parse_decimals($this->input->post('giftcard_amount'));
|
||||
echo json_encode(array('success' => $parsed_value !== FALSE, 'giftcard_amount' => to_currency_no_money($parsed_value)));
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$giftcards_to_delete = $this->xss_clean($this->input->post('ids'));
|
||||
|
||||
if($this->Giftcard->delete_list($giftcards_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('giftcards_successful_deleted') . ' ' .
|
||||
count($giftcards_to_delete).' '.$this->lang->line('giftcards_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('giftcards_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Home extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(NULL, NULL, 'home');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('home/home');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->Employee->logout();
|
||||
}
|
||||
|
||||
/*
|
||||
Load "change employee password" form
|
||||
*/
|
||||
public function change_password($employee_id = -1)
|
||||
{
|
||||
$person_info = $this->Employee->get_info($employee_id);
|
||||
foreach(get_object_vars($person_info) as $property => $value)
|
||||
{
|
||||
$person_info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['person_info'] = $person_info;
|
||||
|
||||
$this->load->view('home/form_change_password', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Change employee password
|
||||
*/
|
||||
public function save($employee_id = -1)
|
||||
{
|
||||
if($this->input->post('current_password') != '' && $employee_id != -1)
|
||||
{
|
||||
if($this->Employee->check_password($this->input->post('username'), $this->input->post('current_password')))
|
||||
{
|
||||
$employee_data = array(
|
||||
'username' => $this->input->post('username'),
|
||||
'password' => password_hash($this->input->post('password'), PASSWORD_DEFAULT),
|
||||
'hash_version' => 2
|
||||
);
|
||||
|
||||
if($this->Employee->change_password($employee_data, $employee_id))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('employees_successful_change_password'), 'id' => $employee_id));
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('employees_unsuccessful_change_password'), 'id' => -1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('employees_current_password_invalid'), 'id' => -1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('employees_current_password_invalid'), 'id' => -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,247 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Item_kits extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('item_kits');
|
||||
}
|
||||
|
||||
/*
|
||||
Add the total cost and retail price to a passed items kit retrieving the data from each singular item part of the kit
|
||||
*/
|
||||
private function _add_totals_to_item_kit($item_kit)
|
||||
{
|
||||
$kit_item_info = $this->Item->get_info(isset($item_kit->kit_item_id) ? $item_kit->kit_item_id : $item_kit->item_id);
|
||||
|
||||
$item_kit->total_cost_price = 0;
|
||||
$item_kit->total_unit_price = (float)$kit_item_info->unit_price;
|
||||
$total_quantity = 0;
|
||||
|
||||
foreach($this->Item_kit_items->get_info($item_kit->item_kit_id) as $item_kit_item)
|
||||
{
|
||||
$item_info = $this->Item->get_info($item_kit_item['item_id']);
|
||||
foreach(get_object_vars($item_info) as $property => $value)
|
||||
{
|
||||
$item_info->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$item_kit->total_cost_price += $item_info->cost_price * $item_kit_item['quantity'];
|
||||
|
||||
if($item_kit->price_option == PRICE_OPTION_ALL || ($item_kit->price_option == PRICE_OPTION_KIT_STOCK && $item_info->stock_type == HAS_STOCK ))
|
||||
{
|
||||
$item_kit->total_unit_price += $item_info->unit_price * $item_kit_item['quantity'];
|
||||
$total_quantity += $item_kit_item['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
$discount_fraction = bcdiv($item_kit->kit_discount, 100);
|
||||
|
||||
$item_kit->total_unit_price = $item_kit->total_unit_price - round(($item_kit->kit_discount_type == PERCENT)?bcmul($item_kit->total_unit_price, $discount_fraction): $item_kit->kit_discount, totals_decimals(), PHP_ROUND_HALF_UP);
|
||||
|
||||
return $item_kit;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_item_kits_manage_table_headers());
|
||||
|
||||
$this->load->view('item_kits/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns Item kits table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$item_kits = $this->Item_kit->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Item_kit->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($item_kits->result() as $item_kit)
|
||||
{
|
||||
// calculate the total cost and retail price of the Kit so it can be printed out in the manage table
|
||||
$item_kit = $this->_add_totals_to_item_kit($item_kit);
|
||||
$data_rows[] = $this->xss_clean(get_item_kit_data_row($item_kit));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Item_kit->get_search_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
// calculate the total cost and retail price of the Kit so it can be added to the table refresh
|
||||
$item_kit = $this->_add_totals_to_item_kit($this->Item_kit->get_info($row_id));
|
||||
|
||||
echo json_encode(get_item_kit_data_row($item_kit));
|
||||
}
|
||||
|
||||
public function view($item_kit_id = -1)
|
||||
{
|
||||
$info = $this->Item_kit->get_info($item_kit_id);
|
||||
|
||||
if($item_kit_id == -1)
|
||||
{
|
||||
$info->price_option = '0';
|
||||
$info->print_option = PRINT_ALL;
|
||||
$info->kit_item_id = 0;
|
||||
$info->item_number = '';
|
||||
}
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
|
||||
$data['item_kit_info'] = $info;
|
||||
|
||||
$items = array();
|
||||
foreach($this->Item_kit_items->get_info($item_kit_id) as $item_kit_item)
|
||||
{
|
||||
$item['kit_sequence'] = $this->xss_clean($item_kit_item['kit_sequence']);
|
||||
$item['name'] = $this->xss_clean($this->Item->get_info($item_kit_item['item_id'])->name);
|
||||
$item['item_id'] = $this->xss_clean($item_kit_item['item_id']);
|
||||
$item['quantity'] = $this->xss_clean($item_kit_item['quantity']);
|
||||
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
$data['item_kit_items'] = $items;
|
||||
|
||||
$data['selected_kit_item_id'] = $info->kit_item_id;
|
||||
$data['selected_kit_item'] = ($item_kit_id > 0 && isset($info->kit_item_id)) ? $info->item_name : '';
|
||||
|
||||
$this->load->view("item_kits/form", $data);
|
||||
}
|
||||
|
||||
public function save($item_kit_id = -1)
|
||||
{
|
||||
$item_kit_data = array(
|
||||
'name' => $this->input->post('name'),
|
||||
'item_kit_number' => $this->input->post('item_kit_number'),
|
||||
'item_id' => $this->input->post('kit_item_id'),
|
||||
'kit_discount' => $this->input->post('kit_discount'),
|
||||
'kit_discount_type' => $this->input->post('kit_discount_type') == NULL ? PERCENT : $this->input->post('kit_discount_type'),
|
||||
'price_option' => $this->input->post('price_option'),
|
||||
'print_option' => $this->input->post('print_option'),
|
||||
'description' => $this->input->post('description')
|
||||
);
|
||||
|
||||
if($this->Item_kit->save($item_kit_data, $item_kit_id))
|
||||
{
|
||||
$new_item = FALSE;
|
||||
//New item kit
|
||||
if($item_kit_id == -1)
|
||||
{
|
||||
$item_kit_id = $item_kit_data['item_kit_id'];
|
||||
$new_item = TRUE;
|
||||
}
|
||||
|
||||
if($this->input->post('item_kit_qty') != NULL)
|
||||
{
|
||||
$item_kit_items = array();
|
||||
foreach($this->input->post('item_kit_qty') as $item_id => $quantity)
|
||||
{
|
||||
$seq = $this->input->post('item_kit_seq[' . $item_id . ']');
|
||||
$item_kit_items[] = array(
|
||||
'item_id' => $item_id,
|
||||
'quantity' => $quantity,
|
||||
'kit_sequence' => $seq
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$success = $this->Item_kit_items->save($item_kit_items, $item_kit_id);
|
||||
|
||||
$item_kit_data = $this->xss_clean($item_kit_data);
|
||||
|
||||
if($new_item)
|
||||
{
|
||||
echo json_encode(array('success' => $success,
|
||||
'message' => $this->lang->line('item_kits_successful_adding').' '.$item_kit_data['name'], 'id' => $item_kit_id));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => $success,
|
||||
'message' => $this->lang->line('item_kits_successful_updating').' '.$item_kit_data['name'], 'id' => $item_kit_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
$item_kit_data = $this->xss_clean($item_kit_data);
|
||||
|
||||
echo json_encode(array('success' => FALSE,
|
||||
'message' => $this->lang->line('item_kits_error_adding_updating').' '.$item_kit_data['name'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$item_kits_to_delete = $this->xss_clean($this->input->post('ids'));
|
||||
|
||||
if($this->Item_kit->delete_list($item_kits_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('item_kits_successful_deleted').' '.count($item_kits_to_delete).' '.$this->lang->line('item_kits_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE,
|
||||
'message' => $this->lang->line('item_kits_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
public function check_item_number()
|
||||
{
|
||||
$exists = $this->Item_kit->item_number_exists($this->input->post('item_kit_number'), $this->input->post('item_kit_id'));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
public function generate_barcodes($item_kit_ids)
|
||||
{
|
||||
$this->load->library('barcode_lib');
|
||||
$result = array();
|
||||
|
||||
$item_kit_ids = explode(':', $item_kit_ids);
|
||||
foreach($item_kit_ids as $item_kid_id)
|
||||
{
|
||||
// calculate the total cost and retail price of the Kit so it can be added to the barcode text at the bottom
|
||||
$item_kit = $this->_add_totals_to_item_kit($this->Item_kit->get_info($item_kid_id));
|
||||
|
||||
$item_kid_id = 'KIT '. urldecode($item_kid_id);
|
||||
|
||||
$result[] = array('name' => $item_kit->name, 'item_id' => $item_kid_id, 'item_number' => $item_kid_id,
|
||||
'cost_price' => $item_kit->total_cost_price, 'unit_price' => $item_kit->total_unit_price);
|
||||
}
|
||||
|
||||
$data['items'] = $result;
|
||||
$barcode_config = $this->barcode_lib->get_barcode_config();
|
||||
// in case the selected barcode type is not Code39 or Code128 we set by default Code128
|
||||
// the rationale for this is that EAN codes cannot have strings as seed, so 'KIT ' is not allowed
|
||||
if($barcode_config['barcode_type'] != 'Code39' && $barcode_config['barcode_type'] != 'Code128')
|
||||
{
|
||||
$barcode_config['barcode_type'] = 'Code128';
|
||||
}
|
||||
$data['barcode_config'] = $barcode_config;
|
||||
|
||||
// display barcodes
|
||||
$this->load->view("barcodes/barcode_sheet", $data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,125 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Login extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('migration');
|
||||
|
||||
if($this->Employee->is_logged_in())
|
||||
{
|
||||
redirect('home');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
|
||||
|
||||
$this->form_validation->set_rules('username', 'lang:login_username', 'required|callback_login_check');
|
||||
|
||||
if($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('login');
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect('home');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function login_check($username)
|
||||
{
|
||||
if(!$this->installation_check())
|
||||
{
|
||||
$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_installation'));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!$this->migration->is_latest())
|
||||
{
|
||||
set_time_limit(3600);
|
||||
// trigger any required upgrade before starting the application
|
||||
$this->migration->latest();
|
||||
}
|
||||
|
||||
$password = $this->input->post('password');
|
||||
|
||||
if(!$this->Employee->login($username, $password))
|
||||
{
|
||||
$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_username_and_password'));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if($this->config->item('gcaptcha_enable'))
|
||||
{
|
||||
$g_recaptcha_response = $this->input->post('g-recaptcha-response');
|
||||
|
||||
if(!$this->gcaptcha_check($g_recaptcha_response))
|
||||
{
|
||||
$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_gcaptcha'));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
private function gcaptcha_check($response)
|
||||
{
|
||||
if(!empty($response))
|
||||
{
|
||||
$check = array(
|
||||
'secret' => $this->config->item('gcaptcha_secret_key'),
|
||||
'response' => $response,
|
||||
'remoteip' => $this->input->ip_address()
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
|
||||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($check));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$status = json_decode($result, TRUE);
|
||||
|
||||
if(!empty($status['success']))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
private function installation_check()
|
||||
{
|
||||
// get PHP extensions and check that the required ones are installed
|
||||
$extensions = implode(', ', get_loaded_extensions());
|
||||
$keys = array('bcmath', 'intl', 'gd', 'openssl', 'mbstring', 'curl');
|
||||
$pattern = '/';
|
||||
foreach($keys as $key)
|
||||
{
|
||||
$pattern .= '(?=.*\b' . preg_quote($key, '/') . '\b)';
|
||||
}
|
||||
$pattern .= '/i';
|
||||
$result = preg_match($pattern, $extensions);
|
||||
|
||||
if(!$result)
|
||||
{
|
||||
error_log('Check your php.ini');
|
||||
error_log('PHP installed extensions: ' . $extensions);
|
||||
error_log('PHP required extensions: ' . implode(', ', $keys));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Messages extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('messages');
|
||||
|
||||
$this->load->library('sms_lib');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('messages/sms');
|
||||
}
|
||||
|
||||
public function view($person_id = -1)
|
||||
{
|
||||
$info = $this->Person->get_info($person_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['person_info'] = $info;
|
||||
|
||||
$this->load->view('messages/form_sms', $data);
|
||||
}
|
||||
|
||||
public function send()
|
||||
{
|
||||
$phone = $this->input->post('phone');
|
||||
$message = $this->input->post('message');
|
||||
|
||||
$response = $this->sms_lib->sendSMS($phone, $message);
|
||||
|
||||
if($response)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('messages_successfully_sent') . ' ' . $this->xss_clean($phone)));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('messages_unsuccessfully_sent') . ' ' . $this->xss_clean($phone)));
|
||||
}
|
||||
}
|
||||
|
||||
public function send_form($person_id = -1)
|
||||
{
|
||||
$phone = $this->input->post('phone');
|
||||
$message = $this->input->post('message');
|
||||
|
||||
$response = $this->sms_lib->sendSMS($phone, $message);
|
||||
|
||||
if($response)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('messages_successfully_sent') . ' ' . $this->xss_clean($phone), 'person_id' => $this->xss_clean($person_id)));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('messages_unsuccessfully_sent') . ' ' . $this->xss_clean($phone), 'person_id' => -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class No_Access extends CI_Controller
|
||||
{
|
||||
public function index($module_id = '', $permission_id = '')
|
||||
{
|
||||
$data['module_name'] = $this->Module->get_module_name($module_id);
|
||||
$data['permission_id'] = $permission_id;
|
||||
|
||||
$data = $this->security->xss_clean($data);
|
||||
|
||||
$this->load->view('no_access', $data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Office extends Secure_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('office', NULL, 'office');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('home/office');
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->Employee->logout();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
abstract class Persons extends Secure_Controller
|
||||
{
|
||||
public function __construct($module_id = NULL)
|
||||
{
|
||||
parent::__construct($module_id);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_people_manage_table_headers());
|
||||
|
||||
$this->load->view('people/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Person->get_search_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gets one row for a person manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_person_data_row($this->Person->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
/*
|
||||
Capitalize segments of a name, and put the rest into lower case.
|
||||
You can pass the characters you want to use as delimiters as exceptions.
|
||||
The function supports UTF-8 string.
|
||||
|
||||
Example:
|
||||
i.e. <?php echo nameize("john o'grady-smith"); ?>
|
||||
|
||||
returns John O'Grady-Smith
|
||||
*/
|
||||
|
||||
protected function nameize($string)
|
||||
{
|
||||
return str_name_case($string);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,409 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Receivings extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('receivings');
|
||||
|
||||
$this->load->library('receiving_lib');
|
||||
$this->load->library('token_lib');
|
||||
$this->load->library('barcode_lib');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function item_search()
|
||||
{
|
||||
$suggestions = $this->Item->get_search_suggestions($this->input->get('term'), array('search_custom' => FALSE, 'is_deleted' => FALSE), TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->Item_kit->get_search_suggestions($this->input->get('term')));
|
||||
|
||||
$suggestions = $this->xss_clean($suggestions);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function stock_item_search()
|
||||
{
|
||||
$suggestions = $this->Item->get_stock_search_suggestions($this->input->get('term'), array('search_custom' => FALSE, 'is_deleted' => FALSE), TRUE);
|
||||
$suggestions = array_merge($suggestions, $this->Item_kit->get_search_suggestions($this->input->get('term')));
|
||||
|
||||
$suggestions = $this->xss_clean($suggestions);
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function select_supplier()
|
||||
{
|
||||
$supplier_id = $this->input->post('supplier');
|
||||
if($this->Supplier->exists($supplier_id))
|
||||
{
|
||||
$this->receiving_lib->set_supplier($supplier_id);
|
||||
}
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function change_mode()
|
||||
{
|
||||
$stock_destination = $this->input->post('stock_destination');
|
||||
$stock_source = $this->input->post('stock_source');
|
||||
|
||||
if((!$stock_source || $stock_source == $this->receiving_lib->get_stock_source()) &&
|
||||
(!$stock_destination || $stock_destination == $this->receiving_lib->get_stock_destination()))
|
||||
{
|
||||
$this->receiving_lib->clear_reference();
|
||||
$mode = $this->input->post('mode');
|
||||
$this->receiving_lib->set_mode($mode);
|
||||
}
|
||||
elseif($this->Stock_location->is_allowed_location($stock_source, 'receivings'))
|
||||
{
|
||||
$this->receiving_lib->set_stock_source($stock_source);
|
||||
$this->receiving_lib->set_stock_destination($stock_destination);
|
||||
}
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function set_comment()
|
||||
{
|
||||
$this->receiving_lib->set_comment($this->input->post('comment'));
|
||||
}
|
||||
|
||||
public function set_print_after_sale()
|
||||
{
|
||||
$this->receiving_lib->set_print_after_sale($this->input->post('recv_print_after_sale'));
|
||||
}
|
||||
|
||||
public function set_reference()
|
||||
{
|
||||
$this->receiving_lib->set_reference($this->input->post('recv_reference'));
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$mode = $this->receiving_lib->get_mode();
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post('item');
|
||||
$this->token_lib->parse_barcode($quantity, $price, $item_id_or_number_or_item_kit_or_receipt);
|
||||
$quantity = ($mode == 'receive' || $mode == 'requisition') ? $quantity : -$quantity;
|
||||
$item_location = $this->receiving_lib->get_stock_source();
|
||||
$discount = $this->config->item('default_receivings_discount');
|
||||
$discount_type = $this->config->item('default_receivings_discount_type');
|
||||
|
||||
if($mode == 'return' && $this->Receiving->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt))
|
||||
{
|
||||
$this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt);
|
||||
}
|
||||
elseif($this->Item_kit->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
|
||||
{
|
||||
$this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt, $item_location, $discount, $discount_type);
|
||||
}
|
||||
elseif(!$this->receiving_lib->add_item($item_id_or_number_or_item_kit_or_receipt, $quantity, $item_location, $discount, $discount_type))
|
||||
{
|
||||
$data['error'] = $this->lang->line('receivings_unable_to_add_item');
|
||||
}
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
public function edit_item($item_id)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$this->form_validation->set_rules('price', 'lang:items_price', 'required|callback_numeric');
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|callback_numeric');
|
||||
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|callback_numeric');
|
||||
|
||||
$description = $this->input->post('description');
|
||||
$serialnumber = $this->input->post('serialnumber');
|
||||
$price = parse_decimals($this->input->post('price'));
|
||||
$quantity = parse_quantity($this->input->post('quantity'));
|
||||
$discount_type = $this->input->post('discount_type');
|
||||
$discount = $discount_type ? parse_quantity($this->input->post('discount')) : parse_decimals($this->input->post('discount'));
|
||||
|
||||
$receiving_quantity = $this->input->post('receiving_quantity');
|
||||
|
||||
if($this->form_validation->run() != FALSE)
|
||||
{
|
||||
$this->receiving_lib->edit_item($item_id, $description, $serialnumber, $quantity, $discount, $discount_type, $price, $receiving_quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error']=$this->lang->line('receivings_error_editing_item');
|
||||
}
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
public function edit($receiving_id)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['suppliers'] = array('' => 'No Supplier');
|
||||
foreach($this->Supplier->get_all()->result() as $supplier)
|
||||
{
|
||||
$data['suppliers'][$supplier->person_id] = $this->xss_clean($supplier->first_name . ' ' . $supplier->last_name);
|
||||
}
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
$data['employees'][$employee->person_id] = $this->xss_clean($employee->first_name . ' '. $employee->last_name);
|
||||
}
|
||||
|
||||
$receiving_info = $this->xss_clean($this->Receiving->get_info($receiving_id)->row_array());
|
||||
$data['selected_supplier_name'] = !empty($receiving_info['supplier_id']) ? $receiving_info['company_name'] : '';
|
||||
$data['selected_supplier_id'] = $receiving_info['supplier_id'];
|
||||
$data['receiving_info'] = $receiving_info;
|
||||
|
||||
$this->load->view('receivings/form', $data);
|
||||
}
|
||||
|
||||
public function delete_item($item_number)
|
||||
{
|
||||
$this->receiving_lib->delete_item($item_number);
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function delete($receiving_id = -1, $update_inventory = TRUE)
|
||||
{
|
||||
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$receiving_ids = $receiving_id == -1 ? $this->input->post('ids') : array($receiving_id);
|
||||
|
||||
if($this->Receiving->delete_list($receiving_ids, $employee_id, $update_inventory))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('receivings_successfully_deleted') . ' ' .
|
||||
count($receiving_ids) . ' ' . $this->lang->line('receivings_one_or_multiple'), 'ids' => $receiving_ids));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('receivings_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
public function remove_supplier()
|
||||
{
|
||||
$this->receiving_lib->clear_reference();
|
||||
$this->receiving_lib->remove_supplier();
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
public function complete()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['cart'] = $this->receiving_lib->get_cart();
|
||||
$data['total'] = $this->receiving_lib->get_total();
|
||||
$data['transaction_time'] = to_datetime(time());
|
||||
$data['mode'] = $this->receiving_lib->get_mode();
|
||||
$data['comment'] = $this->receiving_lib->get_comment();
|
||||
$data['reference'] = $this->receiving_lib->get_reference();
|
||||
$data['payment_type'] = $this->input->post('payment_type');
|
||||
$data['show_stock_locations'] = $this->Stock_location->show_locations('receivings');
|
||||
$data['stock_location'] = $this->receiving_lib->get_stock_source();
|
||||
if($this->input->post('amount_tendered') != NULL)
|
||||
{
|
||||
$data['amount_tendered'] = $this->input->post('amount_tendered');
|
||||
$data['amount_change'] = to_currency($data['amount_tendered'] - $data['total']);
|
||||
}
|
||||
|
||||
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$employee_info = $this->Employee->get_info($employee_id);
|
||||
$data['employee'] = $employee_info->first_name . ' ' . $employee_info->last_name;
|
||||
|
||||
$supplier_info = '';
|
||||
$supplier_id = $this->receiving_lib->get_supplier();
|
||||
if($supplier_id != -1)
|
||||
{
|
||||
$supplier_info = $this->Supplier->get_info($supplier_id);
|
||||
$data['supplier'] = $supplier_info->company_name;
|
||||
$data['first_name'] = $supplier_info->first_name;
|
||||
$data['last_name'] = $supplier_info->last_name;
|
||||
$data['supplier_email'] = $supplier_info->email;
|
||||
$data['supplier_address'] = $supplier_info->address_1;
|
||||
if(!empty($supplier_info->zip) or !empty($supplier_info->city))
|
||||
{
|
||||
$data['supplier_location'] = $supplier_info->zip . ' ' . $supplier_info->city;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['supplier_location'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
//SAVE receiving to database
|
||||
$data['receiving_id'] = 'RECV ' . $this->Receiving->save($data['cart'], $supplier_id, $employee_id, $data['comment'], $data['reference'], $data['payment_type'], $data['stock_location']);
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
if($data['receiving_id'] == 'RECV -1')
|
||||
{
|
||||
$data['error_message'] = $this->lang->line('receivings_transaction_failed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['receiving_id']);
|
||||
}
|
||||
|
||||
$data['print_after_sale'] = $this->receiving_lib->is_print_after_sale();
|
||||
|
||||
$this->load->view("receivings/receipt",$data);
|
||||
|
||||
$this->receiving_lib->clear_all();
|
||||
}
|
||||
|
||||
public function requisition_complete()
|
||||
{
|
||||
if($this->receiving_lib->get_stock_source() != $this->receiving_lib->get_stock_destination())
|
||||
{
|
||||
foreach($this->receiving_lib->get_cart() as $item)
|
||||
{
|
||||
$this->receiving_lib->delete_item($item['line']);
|
||||
$this->receiving_lib->add_item($item['item_id'], $item['quantity'], $this->receiving_lib->get_stock_destination(), $item['discount_type']);
|
||||
$this->receiving_lib->add_item($item['item_id'], -$item['quantity'], $this->receiving_lib->get_stock_source(), $item['discount_type']);
|
||||
}
|
||||
|
||||
$this->complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error'] = $this->lang->line('receivings_error_requisition');
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function receipt($receiving_id)
|
||||
{
|
||||
$receiving_info = $this->Receiving->get_info($receiving_id)->row_array();
|
||||
$this->receiving_lib->copy_entire_receiving($receiving_id);
|
||||
$data['cart'] = $this->receiving_lib->get_cart();
|
||||
$data['total'] = $this->receiving_lib->get_total();
|
||||
$data['mode'] = $this->receiving_lib->get_mode();
|
||||
$data['transaction_time'] = to_datetime(strtotime($receiving_info['receiving_time']));
|
||||
$data['show_stock_locations'] = $this->Stock_location->show_locations('receivings');
|
||||
$data['payment_type'] = $receiving_info['payment_type'];
|
||||
$data['reference'] = $this->receiving_lib->get_reference();
|
||||
$data['receiving_id'] = 'RECV ' . $receiving_id;
|
||||
$data['barcode'] = $this->barcode_lib->generate_receipt_barcode($data['receiving_id']);
|
||||
$employee_info = $this->Employee->get_info($receiving_info['employee_id']);
|
||||
$data['employee'] = $employee_info->first_name . ' ' . $employee_info->last_name;
|
||||
|
||||
$supplier_id = $this->receiving_lib->get_supplier();
|
||||
if($supplier_id != -1)
|
||||
{
|
||||
$supplier_info = $this->Supplier->get_info($supplier_id);
|
||||
$data['supplier'] = $supplier_info->company_name;
|
||||
$data['first_name'] = $supplier_info->first_name;
|
||||
$data['last_name'] = $supplier_info->last_name;
|
||||
$data['supplier_email'] = $supplier_info->email;
|
||||
$data['supplier_address'] = $supplier_info->address_1;
|
||||
if(!empty($supplier_info->zip) or !empty($supplier_info->city))
|
||||
{
|
||||
$data['supplier_location'] = $supplier_info->zip . ' ' . $supplier_info->city;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['supplier_location'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$data['print_after_sale'] = FALSE;
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$this->load->view("receivings/receipt", $data);
|
||||
|
||||
$this->receiving_lib->clear_all();
|
||||
}
|
||||
|
||||
private function _reload($data = array())
|
||||
{
|
||||
$data['cart'] = $this->receiving_lib->get_cart();
|
||||
$data['modes'] = array('receive' => $this->lang->line('receivings_receiving'), 'return' => $this->lang->line('receivings_return'));
|
||||
$data['mode'] = $this->receiving_lib->get_mode();
|
||||
$data['stock_locations'] = $this->Stock_location->get_allowed_locations('receivings');
|
||||
$data['show_stock_locations'] = count($data['stock_locations']) > 1;
|
||||
if($data['show_stock_locations'])
|
||||
{
|
||||
$data['modes']['requisition'] = $this->lang->line('receivings_requisition');
|
||||
$data['stock_source'] = $this->receiving_lib->get_stock_source();
|
||||
$data['stock_destination'] = $this->receiving_lib->get_stock_destination();
|
||||
}
|
||||
|
||||
$data['total'] = $this->receiving_lib->get_total();
|
||||
$data['items_module_allowed'] = $this->Employee->has_grant('items', $this->Employee->get_logged_in_employee_info()->person_id);
|
||||
$data['comment'] = $this->receiving_lib->get_comment();
|
||||
$data['reference'] = $this->receiving_lib->get_reference();
|
||||
$data['payment_options'] = $this->Receiving->get_payment_options();
|
||||
|
||||
$supplier_id = $this->receiving_lib->get_supplier();
|
||||
$supplier_info = '';
|
||||
if($supplier_id != -1)
|
||||
{
|
||||
$supplier_info = $this->Supplier->get_info($supplier_id);
|
||||
$data['supplier'] = $supplier_info->company_name;
|
||||
$data['first_name'] = $supplier_info->first_name;
|
||||
$data['last_name'] = $supplier_info->last_name;
|
||||
$data['supplier_email'] = $supplier_info->email;
|
||||
$data['supplier_address'] = $supplier_info->address_1;
|
||||
if(!empty($supplier_info->zip) or !empty($supplier_info->city))
|
||||
{
|
||||
$data['supplier_location'] = $supplier_info->zip . ' ' . $supplier_info->city;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['supplier_location'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$data['print_after_sale'] = $this->receiving_lib->is_print_after_sale();
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$this->load->view("receivings/receiving", $data);
|
||||
}
|
||||
|
||||
public function save($receiving_id = -1)
|
||||
{
|
||||
$newdate = $this->input->post('date');
|
||||
|
||||
$date_formatter = date_create_from_format($this->config->item('dateformat') . ' ' . $this->config->item('timeformat'), $newdate);
|
||||
$receiving_time = $date_formatter->format('Y-m-d H:i:s');
|
||||
|
||||
$receiving_data = array(
|
||||
'receiving_time' => $receiving_time,
|
||||
'supplier_id' => $this->input->post('supplier_id') ? $this->input->post('supplier_id') : NULL,
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'reference' => $this->input->post('reference') != '' ? $this->input->post('reference') : NULL
|
||||
);
|
||||
|
||||
$this->Inventory->update('RECV '.$receiving_id, ['trans_date' => $receiving_time]);
|
||||
if($this->Receiving->update($receiving_data, $receiving_id))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('receivings_successfully_updated'), 'id' => $receiving_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('receivings_unsuccessfully_updated'), 'id' => $receiving_id));
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel_receiving()
|
||||
{
|
||||
$this->receiving_lib->clear_all();
|
||||
|
||||
$this->_reload();
|
||||
}
|
||||
}
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,103 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Secure_Controller extends CI_Controller
|
||||
{
|
||||
/*
|
||||
* Controllers that are considered secure extend Secure_Controller, optionally a $module_id can
|
||||
* be set to also check if a user can access a particular module in the system.
|
||||
*/
|
||||
public function __construct($module_id = NULL, $submodule_id = NULL, $menu_group = NULL)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('Employee');
|
||||
$model = $this->Employee;
|
||||
|
||||
if(!$model->is_logged_in())
|
||||
{
|
||||
redirect('login');
|
||||
}
|
||||
|
||||
$logged_in_employee_info = $model->get_logged_in_employee_info();
|
||||
if(!$model->has_module_grant($module_id, $logged_in_employee_info->person_id) ||
|
||||
(isset($submodule_id) && !$model->has_module_grant($submodule_id, $logged_in_employee_info->person_id)))
|
||||
{
|
||||
redirect('no_access/' . $module_id . '/' . $submodule_id);
|
||||
}
|
||||
|
||||
// load up global data visible to all the loaded views
|
||||
|
||||
$this->load->library('session');
|
||||
if($menu_group == NULL)
|
||||
{
|
||||
$menu_group = $this->session->userdata('menu_group');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_userdata('menu_group', $menu_group);
|
||||
}
|
||||
|
||||
if($menu_group == 'home')
|
||||
{
|
||||
$allowed_modules = $this->Module->get_allowed_home_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$allowed_modules = $this->Module->get_allowed_office_modules($logged_in_employee_info->person_id);
|
||||
}
|
||||
|
||||
foreach($allowed_modules->result() as $module)
|
||||
{
|
||||
$data['allowed_modules'][] = $module;
|
||||
}
|
||||
|
||||
$data['user_info'] = $logged_in_employee_info;
|
||||
$data['controller_name'] = $module_id;
|
||||
|
||||
$this->load->vars($data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal method to do XSS clean in the derived classes
|
||||
*/
|
||||
protected function xss_clean($str, $is_image = FALSE)
|
||||
{
|
||||
// This setting is configurable in application/config/config.php.
|
||||
// Users can disable the XSS clean for performance reasons
|
||||
// (cases like intranet installation with no Internet access)
|
||||
if($this->config->item('ospos_xss_clean') == FALSE)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->security->xss_clean($str, $is_image);
|
||||
}
|
||||
}
|
||||
|
||||
public function numeric($str)
|
||||
{
|
||||
return parse_decimals($str);
|
||||
}
|
||||
|
||||
public function check_numeric()
|
||||
{
|
||||
$result = TRUE;
|
||||
|
||||
foreach($this->input->get() as $str)
|
||||
{
|
||||
$result &= parse_decimals($str);
|
||||
}
|
||||
|
||||
echo $result !== FALSE ? 'true' : 'false';
|
||||
}
|
||||
|
||||
// this is the basic set of methods most OSPOS Controllers will implement
|
||||
public function index() { return FALSE; }
|
||||
public function search() { return FALSE; }
|
||||
public function suggest_search() { return FALSE; }
|
||||
public function view($data_item_id = -1) { return FALSE; }
|
||||
public function save($data_item_id = -1) { return FALSE; }
|
||||
public function delete() { return FALSE; }
|
||||
}
|
||||
?>
|
||||
@@ -1,171 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Persons.php");
|
||||
|
||||
class Suppliers extends Persons
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('suppliers');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_suppliers_manage_table_headers());
|
||||
|
||||
$this->load->view('people/manage', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Gets one row for a supplier manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_supplier_data_row($this->Supplier->get_info($row_id)));
|
||||
$data_row['category'] = $this->Supplier->get_category_name($data_row['category']);
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns Supplier table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$suppliers = $this->Supplier->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Supplier->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($suppliers->result() as $supplier)
|
||||
{
|
||||
$row = $this->xss_clean(get_supplier_data_row($supplier));
|
||||
$row['category'] = $this->Supplier->get_category_name($row['category']);
|
||||
$data_rows[] = $row;
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Supplier->get_search_suggestions($this->input->get('term'), TRUE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Supplier->get_search_suggestions($this->input->post('term'), FALSE));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the supplier edit form
|
||||
*/
|
||||
public function view($supplier_id = -1)
|
||||
{
|
||||
$info = $this->Supplier->get_info($supplier_id);
|
||||
foreach(get_object_vars($info) as $property => $value)
|
||||
{
|
||||
$info->$property = $this->xss_clean($value);
|
||||
}
|
||||
$data['person_info'] = $info;
|
||||
$data['categories'] = $this->Supplier->get_categories();
|
||||
|
||||
$this->load->view("suppliers/form", $data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates a supplier
|
||||
*/
|
||||
public function save($supplier_id = -1)
|
||||
{
|
||||
$first_name = $this->xss_clean($this->input->post('first_name'));
|
||||
$last_name = $this->xss_clean($this->input->post('last_name'));
|
||||
$email = $this->xss_clean(strtolower($this->input->post('email')));
|
||||
|
||||
// format first and last name properly
|
||||
$first_name = $this->nameize($first_name);
|
||||
$last_name = $this->nameize($last_name);
|
||||
|
||||
$person_data = array(
|
||||
'first_name' => $first_name,
|
||||
'last_name' => $last_name,
|
||||
'gender' => $this->input->post('gender'),
|
||||
'email' => $email,
|
||||
'phone_number' => $this->input->post('phone_number'),
|
||||
'address_1' => $this->input->post('address_1'),
|
||||
'address_2' => $this->input->post('address_2'),
|
||||
'city' => $this->input->post('city'),
|
||||
'state' => $this->input->post('state'),
|
||||
'zip' => $this->input->post('zip'),
|
||||
'country' => $this->input->post('country'),
|
||||
'comments' => $this->input->post('comments')
|
||||
);
|
||||
|
||||
$supplier_data = array(
|
||||
'company_name' => $this->input->post('company_name'),
|
||||
'agency_name' => $this->input->post('agency_name'),
|
||||
'category' => $this->input->post('category'),
|
||||
'account_number' => $this->input->post('account_number') == '' ? NULL : $this->input->post('account_number'),
|
||||
'tax_id' => $this->input->post('tax_id')
|
||||
);
|
||||
|
||||
if($this->Supplier->save_supplier($person_data, $supplier_data, $supplier_id))
|
||||
{
|
||||
$supplier_data = $this->xss_clean($supplier_data);
|
||||
|
||||
//New supplier
|
||||
if($supplier_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('suppliers_successful_adding') . ' ' . $supplier_data['company_name'],
|
||||
'id' => $supplier_data['person_id']));
|
||||
}
|
||||
else //Existing supplier
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,
|
||||
'message' => $this->lang->line('suppliers_successful_updating') . ' ' . $supplier_data['company_name'],
|
||||
'id' => $supplier_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
$supplier_data = $this->xss_clean($supplier_data);
|
||||
|
||||
echo json_encode(array('success' => FALSE,
|
||||
'message' => $this->lang->line('suppliers_error_adding_updating') . ' ' . $supplier_data['company_name'],
|
||||
'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes suppliers from the suppliers table
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$suppliers_to_delete = $this->xss_clean($this->input->post('ids'));
|
||||
|
||||
if($this->Supplier->delete_list($suppliers_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE,'message' => $this->lang->line('suppliers_successful_deleted').' '.
|
||||
count($suppliers_to_delete).' '.$this->lang->line('suppliers_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE,'message' => $this->lang->line('suppliers_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,100 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Tax_categories extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('tax_categories');
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['tax_categories_table_headers'] = $this->xss_clean(get_tax_categories_table_headers());
|
||||
|
||||
$this->load->view('taxes/tax_categories', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$tax_categories = $this->Tax_category->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Tax_category->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($tax_categories->result() as $tax_category)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_tax_category_data_row($tax_category));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_tax_category_data_row($this->Tax_category->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view($tax_category_id = -1)
|
||||
{
|
||||
$data['tax_category_info'] = $this->Tax_category->get_info($tax_category_id);
|
||||
|
||||
$this->load->view("taxes/tax_category_form", $data);
|
||||
}
|
||||
|
||||
|
||||
public function save($tax_category_id = -1)
|
||||
{
|
||||
$tax_category_data = array(
|
||||
'tax_category' => $this->input->post('tax_category'),
|
||||
'tax_category_code' => $this->input->post('tax_category_code'),
|
||||
'tax_group_sequence' => $this->input->post('tax_group_sequence')
|
||||
);
|
||||
|
||||
if($this->Tax_category->save($tax_category_data, $tax_category_id))
|
||||
{
|
||||
$tax_category_data = $this->xss_clean($tax_category_data);
|
||||
|
||||
// New tax_category_id
|
||||
if($tax_category_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_categories_successful_adding'), 'id' => $tax_category_data['tax_category_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_categories_successful_updating'), 'id' => $tax_category_id));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_categories_error_adding_updating') . ' ' . $tax_category_data['tax_category'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$tax_categories_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Tax_category->delete_list($tax_categories_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_categories_successful_deleted') . ' ' . count($tax_categories_to_delete) . ' ' . $this->lang->line('taxes_categories_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_categories_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Tax_codes extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('tax_codes');
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('taxes/tax_codes',get_data());
|
||||
}
|
||||
|
||||
public function get_data()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_tax_codes_table_headers());
|
||||
return $data;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$tax_codes = $this->Tax_code->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Tax_code->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($tax_codes->result() as $tax_code)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_tax_code_data_row($tax_code));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_tax_code_data_row($this->Tax_code->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view($tax_code_id = -1)
|
||||
{
|
||||
$data['tax_code_info'] = $this->Tax_code->get_info($tax_code_id);
|
||||
|
||||
$this->load->view("taxes/tax_code_form", $data);
|
||||
}
|
||||
|
||||
|
||||
public function save($tax_code_id = -1)
|
||||
{
|
||||
$tax_code_data = array(
|
||||
'tax_code' => $this->input->post('tax_code'),
|
||||
'tax_code_name' => $this->input->post('tax_code_name'),
|
||||
'city' => $this->input->post('city'),
|
||||
'state' => $this->input->post('state')
|
||||
);
|
||||
|
||||
if($this->Tax_code->save($tax_code_data))
|
||||
{
|
||||
$tax_code_data = $this->xss_clean($tax_code_data);
|
||||
|
||||
if($tax_code_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_codes_successful_adding'), 'id' => $tax_code_data['tax_code_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_codes_successful_updating'), 'id' => $tax_code_id));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_codes_error_adding_updating') . ' ' . $tax_code_data['tax_code_id'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$tax_codes_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Tax_code->delete_list($tax_codes_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_codes_successful_deleted') . ' ' . count($tax_codes_to_delete) . ' ' . $this->lang->line('taxes_codes_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_codes_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Tax_jurisdictions extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('tax_jurisdictions');
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['table_headers'] = $this->xss_clean(get_tax_jurisdictions_table_headers());
|
||||
|
||||
$this->load->view('taxes/tax_jurisdictions', $data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns tax_category table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$tax_jurisdictions = $this->Tax_jurisdiction->search($search, $limit, $offset, $sort, $order);
|
||||
$total_rows = $this->Tax_jurisdiction->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($tax_jurisdictions->result() as $tax_jurisdiction)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_tax_jurisdiction_data_row($tax_jurisdiction));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_tax_jurisdiction_data_row($this->Tax_jurisdiction->get_info($row_id)));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view($tax_jurisdiction_id = -1)
|
||||
{
|
||||
$data['tax_jurisdiction_info'] = $this->Tax_jurisdiction->get_info($tax_jurisdiction_id);
|
||||
|
||||
$this->load->view("taxes/tax_jurisdiction_form", $data);
|
||||
}
|
||||
|
||||
|
||||
public function save($jurisdiction_id = -1)
|
||||
{
|
||||
$tax_jurisdiction_data = array(
|
||||
'jurisdiction_name' => $this->input->post('jurisdiction_name'),
|
||||
'reporting_authority' => $this->input->post('reporting_authority')
|
||||
);
|
||||
|
||||
if($this->Tax_jurisdiction->save($tax_jurisdiction_data))
|
||||
{
|
||||
$tax_jurisdiction_data = $this->xss_clean($tax_jurisdiction_data);
|
||||
|
||||
if($jurisdiction_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_jurisdictions_successful_adding'), 'id' => $tax_jurisdiction_data['jurisdiction_id']));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_jurisdictions_successful_updating'), 'id' => $jurisdiction_id));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_jurisdictions_error_adding_updating') . ' ' . $tax_jurisdiction_data['jurisdiction_name'], 'id' => -1));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$tax_jurisdictions_to_delete = $this->input->post('ids');
|
||||
|
||||
if($this->Tax_jurisdiction->delete_list($tax_jurisdictions_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_jurisdictions_successful_deleted') . ' ' . count($tax_jurisdictions_to_delete) . ' ' . $this->lang->line('taxes_jurisdictions_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_jurisdictions_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,542 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once("Secure_Controller.php");
|
||||
|
||||
class Taxes extends Secure_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('taxes');
|
||||
|
||||
$this->load->model('enums/Rounding_mode');
|
||||
$this->load->library('tax_lib');
|
||||
$this->load->helper('tax_helper');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['tax_codes'] = $this->xss_clean($this->Tax_code->get_all()->result_array());
|
||||
if (count($data['tax_codes']) == 0)
|
||||
{
|
||||
$data['tax_codes'] = $this->Tax_code->get_empty_row();
|
||||
}
|
||||
$data['tax_categories'] = $this->xss_clean($this->Tax_category->get_all()->result_array());
|
||||
if (count($data['tax_categories']) == 0)
|
||||
{
|
||||
$data['tax_categories'] = $this->Tax_category->get_empty_row();
|
||||
}
|
||||
$data['tax_jurisdictions'] = $this->xss_clean($this->Tax_jurisdiction->get_all()->result_array());
|
||||
if (count($data['tax_jurisdictions']) == 0)
|
||||
{
|
||||
$data['tax_jurisdictions'] = $this->Tax_jurisdiction->get_empty_row();
|
||||
}
|
||||
$data['tax_rate_table_headers'] = $this->xss_clean(get_tax_rates_manage_table_headers());
|
||||
$data['tax_categories_table_headers'] = $this->xss_clean(get_tax_categories_table_headers());
|
||||
$data['tax_types'] = $this->tax_lib->get_tax_types();
|
||||
|
||||
if($this->config->item('tax_included') == '1')
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
$data['tax_type_options'] = $this->tax_lib->get_tax_type_options($data['default_tax_type']);
|
||||
|
||||
$this->load->view('taxes/manage', $data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Returns tax_codes table data rows. This will be called with AJAX.
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$search = $this->input->get('search');
|
||||
$limit = $this->input->get('limit');
|
||||
$offset = $this->input->get('offset');
|
||||
$sort = $this->input->get('sort');
|
||||
$order = $this->input->get('order');
|
||||
|
||||
$tax_rates = $this->Tax->search($search, $limit, $offset, $sort, $order);
|
||||
|
||||
$total_rows = $this->Tax->get_found_rows($search);
|
||||
|
||||
$data_rows = array();
|
||||
foreach($tax_rates->result() as $tax_rate_row)
|
||||
{
|
||||
$data_rows[] = $this->xss_clean(get_tax_rates_data_row($tax_rate_row));
|
||||
}
|
||||
|
||||
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
public function suggest_search()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Tax->get_search_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Provides list of tax categories to select from
|
||||
*/
|
||||
public function suggest_tax_categories()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Tax_category->get_tax_category_suggestions($this->input->post('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
|
||||
public function get_row($row_id)
|
||||
{
|
||||
$data_row = $this->xss_clean(get_tax_rates_data_row($this->Tax->get_info($row_id), $this));
|
||||
|
||||
echo json_encode($data_row);
|
||||
}
|
||||
|
||||
public function view_tax_codes($tax_code = -1)
|
||||
{
|
||||
$tax_code_info = $this->Tax->get_info($tax_code);
|
||||
|
||||
$default_tax_category_id = 1; // Tax category id is always the default tax category
|
||||
$default_tax_category = $this->Tax->get_tax_category($default_tax_category_id);
|
||||
|
||||
$tax_rate_info = $this->Tax->get_rate_info($tax_code, $default_tax_category_id);
|
||||
|
||||
if($this->config->item('tax_included') == '1')
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if($tax_code == -1)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
$data['tax_code_type'] = '0';
|
||||
$data['city'] = '';
|
||||
$data['state'] = '';
|
||||
$data['tax_rate'] = '0.0000';
|
||||
$data['rate_tax_code'] = '';
|
||||
$data['rate_tax_category_id'] = 1;
|
||||
$data['tax_category'] = '';
|
||||
$data['add_tax_category'] = '';
|
||||
$data['rounding_code'] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['tax_code'] = $tax_code;
|
||||
$data['tax_code_name'] = $tax_code_info->tax_code_name;
|
||||
$data['tax_code_type'] = $tax_code_info->tax_code_type;
|
||||
$data['city'] = $tax_code_info->city;
|
||||
$data['state'] = $tax_code_info->state;
|
||||
$data['rate_tax_code'] = $tax_code_info->rate_tax_code;
|
||||
$data['rate_tax_category_id'] = $tax_code_info->rate_tax_category_id;
|
||||
$data['tax_category'] = $tax_code_info->tax_category;
|
||||
$data['add_tax_category'] = '';
|
||||
$data['tax_rate'] = $tax_rate_info->tax_rate;
|
||||
$data['rounding_code'] = $tax_rate_info->rounding_code;
|
||||
}
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$tax_rates = array();
|
||||
foreach($this->Tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate)
|
||||
{
|
||||
$tax_rate_row = array();
|
||||
$tax_rate_row['rate_tax_category_id'] = $this->xss_clean($tax_code_rate['rate_tax_category_id']);
|
||||
$tax_rate_row['tax_category'] = $this->xss_clean($tax_code_rate['tax_category']);
|
||||
$tax_rate_row['tax_rate'] = $this->xss_clean($tax_code_rate['tax_rate']);
|
||||
$tax_rate_row['rounding_code'] = $this->xss_clean($tax_code_rate['rounding_code']);
|
||||
|
||||
$tax_rates[] = $tax_rate_row;
|
||||
}
|
||||
|
||||
$data['tax_rates'] = $tax_rates;
|
||||
|
||||
$this->load->view('taxes/tax_code_form', $data);
|
||||
}
|
||||
|
||||
|
||||
public function view($tax_rate_id = -1)
|
||||
{
|
||||
|
||||
$tax_rate_info = $this->Tax->get_info($tax_rate_id);
|
||||
|
||||
$data['tax_rate_id'] = $tax_rate_id;
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
|
||||
$data['tax_code_options'] = $this->tax_lib->get_tax_code_options();
|
||||
$data['tax_category_options'] = $this->tax_lib->get_tax_category_options();
|
||||
$data['tax_jurisdiction_options'] = $this->tax_lib->get_tax_jurisdiction_options();
|
||||
|
||||
if($tax_rate_id == -1)
|
||||
{
|
||||
$data['rate_tax_code_id'] = $this->config->item('default_tax_code');
|
||||
$data['rate_tax_category_id'] = $this->config->item('default_tax_category');
|
||||
$data['rate_jurisdiction_id'] = $this->config->item('default_tax_jurisdiction');
|
||||
$data['tax_rounding_code'] = Rounding_mode::HALF_UP;
|
||||
$data['tax_rate'] = '0.0000';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['rate_tax_code_id'] = $tax_rate_info->rate_tax_code_id;
|
||||
$data['rate_tax_code'] = $tax_rate_info->tax_code;
|
||||
$data['rate_tax_category_id'] = $tax_rate_info->rate_tax_category_id;
|
||||
$data['rate_jurisdiction_id'] = $tax_rate_info->rate_jurisdiction_id;
|
||||
$data['tax_rounding_code'] = $tax_rate_info->tax_rounding_code;
|
||||
$data['tax_rate'] = $tax_rate_info->tax_rate;
|
||||
}
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$this->load->view('taxes/tax_rates_form', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function view_tax_categories($tax_code = -1)
|
||||
{
|
||||
$tax_code_info = $this->Tax->get_info($tax_code);
|
||||
|
||||
$default_tax_category_id = 1; // Tax category id is always the default tax category
|
||||
$default_tax_category = $this->Tax->get_tax_category($default_tax_category_id);
|
||||
|
||||
$tax_rate_info = $this->Tax->get_rate_info($tax_code, $default_tax_category_id);
|
||||
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if($this->config->item('tax_included') == '1')
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
if($tax_code == -1)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
$data['tax_code_type'] = '0';
|
||||
$data['city'] = '';
|
||||
$data['state'] = '';
|
||||
$data['tax_rate'] = '0.0000';
|
||||
$data['rate_tax_code'] = '';
|
||||
$data['rate_tax_category_id'] = 1;
|
||||
$data['tax_category'] = '';
|
||||
$data['add_tax_category'] = '';
|
||||
$data['rounding_code'] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['tax_code'] = $tax_code;
|
||||
$data['tax_code_name'] = $tax_code_info->tax_code_name;
|
||||
$data['tax_code_type'] = $tax_code_info->tax_code_type;
|
||||
$data['city'] = $tax_code_info->city;
|
||||
$data['state'] = $tax_code_info->state;
|
||||
$data['rate_tax_code'] = $tax_code_info->rate_tax_code;
|
||||
$data['rate_tax_category_id'] = $tax_code_info->rate_tax_category_id;
|
||||
$data['tax_category'] = $tax_code_info->tax_category;
|
||||
$data['add_tax_category'] = '';
|
||||
$data['tax_rate'] = $tax_rate_info->tax_rate;
|
||||
$data['rounding_code'] = $tax_rate_info->rounding_code;
|
||||
}
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$tax_rates = array();
|
||||
foreach($this->Tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate)
|
||||
{
|
||||
$tax_rate_row = array();
|
||||
$tax_rate_row['rate_tax_category_id'] = $this->xss_clean($tax_code_rate['rate_tax_category_id']);
|
||||
$tax_rate_row['tax_category'] = $this->xss_clean($tax_code_rate['tax_category']);
|
||||
$tax_rate_row['tax_rate'] = $this->xss_clean($tax_code_rate['tax_rate']);
|
||||
$tax_rate_row['rounding_code'] = $this->xss_clean($tax_code_rate['rounding_code']);
|
||||
|
||||
$tax_rates[] = $tax_rate_row;
|
||||
}
|
||||
|
||||
$data['tax_rates'] = $tax_rates;
|
||||
|
||||
$this->load->view('taxes/tax_category_form', $data);
|
||||
}
|
||||
|
||||
public function view_tax_jurisdictions($tax_code = -1)
|
||||
{
|
||||
$tax_code_info = $this->Tax->get_info($tax_code);
|
||||
|
||||
$default_tax_category_id = 1; // Tax category id is always the default tax category
|
||||
$default_tax_category = $this->Tax->get_tax_category($default_tax_category_id);
|
||||
|
||||
$tax_rate_info = $this->Tax->get_rate_info($tax_code, $default_tax_category_id);
|
||||
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if($this->config->item('tax_included') == '1')
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
if($tax_code == -1)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
$data['tax_code_type'] = '0';
|
||||
$data['city'] = '';
|
||||
$data['state'] = '';
|
||||
$data['tax_rate'] = '0.0000';
|
||||
$data['rate_tax_code'] = '';
|
||||
$data['rate_tax_category_id'] = 1;
|
||||
$data['tax_category'] = '';
|
||||
$data['add_tax_category'] = '';
|
||||
$data['rounding_code'] = '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['tax_code'] = $tax_code;
|
||||
$data['tax_code_name'] = $tax_code_info->tax_code_name;
|
||||
$data['tax_code_type'] = $tax_code_info->tax_code_type;
|
||||
$data['city'] = $tax_code_info->city;
|
||||
$data['state'] = $tax_code_info->state;
|
||||
$data['rate_tax_code'] = $tax_code_info->rate_tax_code;
|
||||
$data['rate_tax_category_id'] = $tax_code_info->rate_tax_category_id;
|
||||
$data['tax_category'] = $tax_code_info->tax_category;
|
||||
$data['add_tax_category'] = '';
|
||||
$data['tax_rate'] = $tax_rate_info->tax_rate;
|
||||
$data['rounding_code'] = $tax_rate_info->rounding_code;
|
||||
}
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
$tax_rates = array();
|
||||
foreach($this->Tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate)
|
||||
{
|
||||
$tax_rate_row = array();
|
||||
$tax_rate_row['rate_tax_category_id'] = $this->xss_clean($tax_code_rate['rate_tax_category_id']);
|
||||
$tax_rate_row['tax_category'] = $this->xss_clean($tax_code_rate['tax_category']);
|
||||
$tax_rate_row['tax_rate'] = $this->xss_clean($tax_code_rate['tax_rate']);
|
||||
$tax_rate_row['rounding_code'] = $this->xss_clean($tax_code_rate['rounding_code']);
|
||||
|
||||
$tax_rates[] = $tax_rate_row;
|
||||
}
|
||||
|
||||
$data['tax_rates'] = $tax_rates;
|
||||
|
||||
$this->load->view('taxes/tax_jurisdiction_form', $data);
|
||||
}
|
||||
|
||||
public static function get_html_rounding_options()
|
||||
{
|
||||
return Rounding_mode::get_html_rounding_options();
|
||||
}
|
||||
|
||||
public function save($tax_rate_id = -1)
|
||||
{
|
||||
$tax_category_id = $this->input->post('rate_tax_category_id');
|
||||
$tax_rate = parse_tax($this->input->post('tax_rate'));
|
||||
|
||||
if ($tax_rate == 0) {
|
||||
$tax_category_info = $this->Tax_category->get_info($tax_category_id);
|
||||
}
|
||||
|
||||
$tax_rate_data = array(
|
||||
'rate_tax_code_id' => $this->input->post('rate_tax_code_id'),
|
||||
'rate_tax_category_id' => $this->input->post('rate_tax_category_id'),
|
||||
'rate_jurisdiction_id' => $this->input->post('rate_jurisdiction_id'),
|
||||
'tax_rate' => $tax_rate,
|
||||
'tax_rounding_code' => $this->input->post('tax_rounding_code')
|
||||
);
|
||||
|
||||
if($this->Tax->save($tax_rate_data, $tax_rate_id))
|
||||
{
|
||||
if($tax_rate_id == -1)
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_tax_rate_successfully_added')));
|
||||
}
|
||||
else //Existing tax_code
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_tax_rate_successful_updated')));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_tax_rate_error_adding_updating')));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$tax_codes_to_delete = $this->xss_clean($this->input->post('ids'));
|
||||
|
||||
if($this->Tax->delete_list($tax_codes_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('taxes_tax_code_successful_deleted')));
|
||||
} else
|
||||
{
|
||||
echo json_encode(array('success' => FALSE, 'message' => $this->lang->line('taxes_tax_code_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
public function suggest_tax_codes()
|
||||
{
|
||||
$suggestions = $this->xss_clean($this->Tax_code->get_tax_codes_search_suggestions($this->input->post_get('term')));
|
||||
|
||||
echo json_encode($suggestions);
|
||||
}
|
||||
|
||||
|
||||
public function save_tax_codes()
|
||||
{
|
||||
$tax_code_id = $this->input->post('tax_code_id');
|
||||
$tax_code = $this->input->post('tax_code');
|
||||
$tax_code_name = $this->input->post('tax_code_name');
|
||||
$tax_code_id = $this->input->post('tax_code_id');
|
||||
$city = $this->input->post('city');
|
||||
$state = $this->input->post('state');
|
||||
|
||||
$array_save = array();
|
||||
foreach($tax_code_id as $key=>$val)
|
||||
{
|
||||
$array_save[] = array('tax_code_id'=>$this->xss_clean($val), 'tax_code'=>$this->xss_clean($tax_code[$key]),
|
||||
'tax_code_name'=>$this->xss_clean($tax_code_name[$key]), 'tax_code_id'=>$this->xss_clean($tax_code_id[$key]),
|
||||
'city'=>$this->xss_clean($city[$key]), 'state'=>$this->xss_clean($state[$key]));
|
||||
}
|
||||
|
||||
$success = $this->Tax_code->save_tax_codes($array_save);
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('taxes_tax_codes_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_tax_jurisdictions()
|
||||
{
|
||||
$jurisdiction_id = $this->input->post('jurisdiction_id');
|
||||
$jurisdiction_name = $this->input->post('jurisdiction_name');
|
||||
$tax_group = $this->input->post('tax_group');
|
||||
$tax_type = $this->input->post('tax_type');
|
||||
$reporting_authority = $this->input->post('reporting_authority');
|
||||
$tax_group_sequence = $this->input->post('tax_group_sequence');
|
||||
$cascade_sequence = $this->input->post('cascade_sequence');
|
||||
|
||||
$array_save = array();
|
||||
|
||||
$unique_tax_groups = [];
|
||||
|
||||
foreach($jurisdiction_id as $key => $val)
|
||||
{
|
||||
$array_save[] = array(
|
||||
'jurisdiction_id'=>$this->xss_clean($val),
|
||||
'jurisdiction_name'=>$this->xss_clean($jurisdiction_name[$key]),
|
||||
'tax_group'=>$this->xss_clean($tax_group[$key]),
|
||||
'tax_type'=>$this->xss_clean($tax_type[$key]),
|
||||
'reporting_authority'=>$this->xss_clean($reporting_authority[$key]),
|
||||
'tax_group_sequence'=>$this->xss_clean($tax_group_sequence[$key]),
|
||||
'cascade_sequence'=>$this->xss_clean($cascade_sequence[$key]));
|
||||
|
||||
if (array_search($tax_group[$key], $unique_tax_groups) !== false)
|
||||
{
|
||||
echo json_encode(array(
|
||||
'success' => FALSE,
|
||||
'message' => $this->lang->line('taxes_tax_group_not_unique', $tax_group[$key])
|
||||
));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$unique_tax_groups[] = $tax_group[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$success = $this->Tax_jurisdiction->save_jurisdictions($array_save);
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('taxes_tax_jurisdictions_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function save_tax_categories()
|
||||
{
|
||||
$tax_category_id = $this->input->post('tax_category_id');
|
||||
$tax_category = $this->input->post('tax_category');
|
||||
$tax_group_sequence = $this->input->post('tax_group_sequence');
|
||||
|
||||
$array_save= array();
|
||||
|
||||
foreach($tax_category_id as $key => $val)
|
||||
{
|
||||
$array_save[] = array(
|
||||
'tax_category_id'=>$this->xss_clean($val),
|
||||
'tax_category'=>$this->xss_clean($tax_category[$key]),
|
||||
'tax_group_sequence'=>$this->xss_clean($tax_group_sequence[$key]));
|
||||
}
|
||||
|
||||
$success = $this->Tax_category->save_categories($array_save);
|
||||
|
||||
echo json_encode(array(
|
||||
'success' => $success,
|
||||
'message' => $this->lang->line('taxes_tax_categories_saved_' . ($success ? '' : 'un') . 'successfully')
|
||||
));
|
||||
}
|
||||
|
||||
public function ajax_tax_codes()
|
||||
{
|
||||
$tax_codes = $this->Tax_code->get_all()->result_array();
|
||||
|
||||
$tax_codes = $this->xss_clean($tax_codes);
|
||||
|
||||
$this->load->view('partial/tax_codes', array('tax_codes' => $tax_codes));
|
||||
}
|
||||
|
||||
public function ajax_tax_categories()
|
||||
{
|
||||
$tax_categories = $this->Tax_category->get_all()->result_array();
|
||||
|
||||
$tax_categories = $this->xss_clean($tax_categories);
|
||||
|
||||
$this->load->view('partial/tax_categories', array('tax_categories' => $tax_categories));
|
||||
}
|
||||
|
||||
public function ajax_tax_jurisdictions()
|
||||
{
|
||||
$tax_jurisdictions = $this->Tax_jurisdiction->get_all()->result_array();
|
||||
|
||||
if($this->config->item('tax_included') == '1')
|
||||
{
|
||||
$default_tax_type = Tax_lib::TAX_TYPE_INCLUDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
$default_tax_type = Tax_lib::TAX_TYPE_EXCLUDED;
|
||||
}
|
||||
|
||||
$tax_jurisdictions = $this->xss_clean($tax_jurisdictions);
|
||||
$tax_types = $this->tax_lib->get_tax_types();
|
||||
|
||||
$this->load->view('partial/tax_jurisdictions', array('tax_jurisdictions' => $tax_jurisdictions, 'tax_types' => $tax_types, 'default_tax_type' => $default_tax_type));
|
||||
}
|
||||
}
|
||||
?>
|
||||
14
application/controllers/barcode.php
Normal file
14
application/controllers/barcode.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class Barcode extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->view('barcode');
|
||||
}
|
||||
}
|
||||
?>
|
||||
77
application/controllers/config.php
Normal file
77
application/controllers/config.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
class Config extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('config');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$location_names = array();
|
||||
$locations = $this->Stock_locations->get_location_names();
|
||||
foreach($locations->result_array() as $array)
|
||||
{
|
||||
array_push($location_names, $array['location_name']);
|
||||
}
|
||||
$data['location_names'] = implode(',', $location_names);
|
||||
$this->load->view("config", $data);
|
||||
}
|
||||
|
||||
function save()
|
||||
{
|
||||
$batch_save_data=array(
|
||||
'company'=>$this->input->post('company'),
|
||||
'address'=>$this->input->post('address'),
|
||||
'phone'=>$this->input->post('phone'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'fax'=>$this->input->post('fax'),
|
||||
'website'=>$this->input->post('website'),
|
||||
'default_tax_1_rate'=>$this->input->post('default_tax_1_rate'),
|
||||
'default_tax_1_name'=>$this->input->post('default_tax_1_name'),
|
||||
'default_tax_2_rate'=>$this->input->post('default_tax_2_rate'),
|
||||
'default_tax_2_name'=>$this->input->post('default_tax_2_name'),
|
||||
'currency_symbol'=>$this->input->post('currency_symbol'),
|
||||
'currency_side'=>$this->input->post('currency_side'),/**GARRISON ADDED 4/20/2013**/
|
||||
'return_policy'=>$this->input->post('return_policy'),
|
||||
'language'=>$this->input->post('language'),
|
||||
'timezone'=>$this->input->post('timezone'),
|
||||
'print_after_sale'=>$this->input->post('print_after_sale'),
|
||||
'custom1_name'=>$this->input->post('custom1_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom2_name'=>$this->input->post('custom2_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom3_name'=>$this->input->post('custom3_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom4_name'=>$this->input->post('custom4_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom5_name'=>$this->input->post('custom5_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom6_name'=>$this->input->post('custom6_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom7_name'=>$this->input->post('custom7_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom8_name'=>$this->input->post('custom8_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom9_name'=>$this->input->post('custom9_name'),/**GARRISON ADDED 4/20/2013**/
|
||||
'custom10_name'=>$this->input->post('custom10_name')/**GARRISON ADDED 4/20/2013**/
|
||||
);
|
||||
|
||||
$stock_locations = explode( ',', $this->input->post('stock_location'));
|
||||
$stock_locations_trimmed=array();
|
||||
foreach($stock_locations as $location)
|
||||
{
|
||||
array_push($stock_locations_trimmed, trim($location, ' '));
|
||||
}
|
||||
$current_locations = $this->Stock_locations->concat_location_names()->location_names;
|
||||
if ($this->input->post('stock_locations') != $current_locations)
|
||||
{
|
||||
$this->load->library('sale_lib');
|
||||
$this->sale_lib->clear_sale_location();
|
||||
$this->sale_lib->clear_all();
|
||||
$this->load->library('receiving_lib');
|
||||
$this->receiving_lib->clear_stock_source();
|
||||
$this->receiving_lib->clear_stock_destination();
|
||||
$this->receiving_lib->clear_all();
|
||||
}
|
||||
|
||||
if( $this->Appconfig->batch_save( $batch_save_data ) && $this->Stock_locations->array_save($stock_locations_trimmed))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('config_saved_successfully')));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
201
application/controllers/customers.php
Normal file
201
application/controllers/customers.php
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
require_once ("person_controller.php");
|
||||
class Customers extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('customers');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/customers/index');
|
||||
$config['total_rows'] = $this->Customer->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_people_manage_table( $this->Customer->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('people/manage',$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns customer table data rows. This will be called with AJAX.
|
||||
*/
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_people_manage_table_data_rows($this->Customer->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Customer->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the customer edit form
|
||||
*/
|
||||
function view($customer_id=-1)
|
||||
{
|
||||
$data['person_info']=$this->Customer->get_info($customer_id);
|
||||
$this->load->view("customers/form",$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates a customer
|
||||
*/
|
||||
function save($customer_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$customer_data=array(
|
||||
'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'),
|
||||
'taxable'=>$this->input->post('taxable')=='' ? 0:1,
|
||||
);
|
||||
if($this->Customer->save($person_data,$customer_data,$customer_id))
|
||||
{
|
||||
//New customer
|
||||
if($customer_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_adding').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$customer_data['person_id']));
|
||||
}
|
||||
else //previous customer
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_updating').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$customer_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('customers_error_adding_updating').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>-1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes customers from the customers table
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$customers_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Customer->delete_list($customers_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('customers_successful_deleted').' '.
|
||||
count($customers_to_delete).' '.$this->lang->line('customers_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('customers_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
function excel()
|
||||
{
|
||||
$data = file_get_contents("import_customers.csv");
|
||||
$name = 'import_customers.csv';
|
||||
force_download($name, $data);
|
||||
}
|
||||
|
||||
function excel_import()
|
||||
{
|
||||
$this->load->view("customers/excel_import", null);
|
||||
}
|
||||
|
||||
function do_excel_import()
|
||||
{
|
||||
$msg = 'do_excel_import';
|
||||
$failCodes = array();
|
||||
if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK)
|
||||
{
|
||||
$msg = $this->lang->line('items_excel_import_failed');
|
||||
echo json_encode( array('success'=>false,'message'=>$msg) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE)
|
||||
{
|
||||
//Skip first row
|
||||
fgetcsv($handle);
|
||||
|
||||
$i=1;
|
||||
while (($data = fgetcsv($handle)) !== FALSE)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$data[0],
|
||||
'last_name'=>$data[1],
|
||||
'email'=>$data[2],
|
||||
'phone_number'=>$data[3],
|
||||
'address_1'=>$data[4],
|
||||
'address_2'=>$data[5],
|
||||
'city'=>$data[6],
|
||||
'state'=>$data[7],
|
||||
'zip'=>$data[8],
|
||||
'country'=>$data[9],
|
||||
'comments'=>$data[10]
|
||||
);
|
||||
|
||||
$customer_data=array(
|
||||
'account_number'=>$data[11]=='' ? null:$data[11],
|
||||
'taxable'=>$data[12]=='' ? 0:1,
|
||||
);
|
||||
|
||||
if(!$this->Customer->save($person_data,$customer_data))
|
||||
{
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$success = true;
|
||||
if(count($failCodes) > 1)
|
||||
{
|
||||
$msg = "Most customers imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes);
|
||||
$success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "Import Customers successful";
|
||||
}
|
||||
|
||||
echo json_encode( array('success'=>$success,'message'=>$msg) );
|
||||
}
|
||||
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 350;
|
||||
}
|
||||
}
|
||||
?>
|
||||
132
application/controllers/employees.php
Normal file
132
application/controllers/employees.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
require_once ("person_controller.php");
|
||||
class Employees extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('employees');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/employees/index');
|
||||
$config['total_rows'] = $this->Employee->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_people_manage_table( $this->Employee->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('people/manage',$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns employee table data rows. This will be called with AJAX.
|
||||
*/
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_people_manage_table_data_rows($this->Employee->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Employee->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the employee edit form
|
||||
*/
|
||||
function view($employee_id=-1)
|
||||
{
|
||||
$data['person_info']=$this->Employee->get_info($employee_id);
|
||||
$data['all_modules']=$this->Module->get_all_modules();
|
||||
$this->load->view("employees/form",$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates an employee
|
||||
*/
|
||||
function save($employee_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$permission_data = $this->input->post("permissions")!=false ? $this->input->post("permissions"):array();
|
||||
|
||||
//Password has been changed OR first time password set
|
||||
if($this->input->post('password')!='')
|
||||
{
|
||||
$employee_data=array(
|
||||
'username'=>$this->input->post('username'),
|
||||
'password'=>md5($this->input->post('password'))
|
||||
);
|
||||
}
|
||||
else //Password not changed
|
||||
{
|
||||
$employee_data=array('username'=>$this->input->post('username'));
|
||||
}
|
||||
|
||||
if($this->Employee->save($person_data,$employee_data,$permission_data,$employee_id))
|
||||
{
|
||||
//New employee
|
||||
if($employee_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_adding').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$employee_data['person_id']));
|
||||
}
|
||||
else //previous employee
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_updating').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>$employee_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_error_adding_updating').' '.
|
||||
$person_data['first_name'].' '.$person_data['last_name'],'person_id'=>-1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes employees from the employees table
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$employees_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Employee->delete_list($employees_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('employees_successful_deleted').' '.
|
||||
count($employees_to_delete).' '.$this->lang->line('employees_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('employees_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 650;
|
||||
}
|
||||
}
|
||||
?>
|
||||
117
application/controllers/giftcards.php
Normal file
117
application/controllers/giftcards.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
require_once ("interfaces/idata_controller.php");
|
||||
class Giftcards extends Secure_area implements iData_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('giftcards');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/giftcards/index');
|
||||
$config['total_rows'] = $this->Giftcard->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_giftcards_manage_table( $this->Giftcard->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('giftcards/manage',$data);
|
||||
}
|
||||
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_giftcards_manage_table_data_rows($this->Giftcard->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Giftcard->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
/** GARRISON ADDED 5/3/2013 **/
|
||||
/*
|
||||
Gives search suggestions for person_id based on what is being searched for
|
||||
*/
|
||||
function suggest_person()
|
||||
{
|
||||
$suggestions = $this->Giftcard->get_person_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
/** END GARRISON ADDED **/
|
||||
function get_row()
|
||||
{
|
||||
$giftcard_id = $this->input->post('row_id');
|
||||
$data_row=get_giftcard_data_row($this->Giftcard->get_info($giftcard_id),$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
function view($giftcard_id=-1)
|
||||
{
|
||||
$data['giftcard_info']=$this->Giftcard->get_info($giftcard_id);
|
||||
|
||||
$this->load->view("giftcards/form",$data);
|
||||
}
|
||||
|
||||
function save($giftcard_id=-1)
|
||||
{
|
||||
$giftcard_data = array(
|
||||
'giftcard_number'=>$this->input->post('giftcard_number'),
|
||||
'value'=>$this->input->post('value'),
|
||||
'person_id'=>$this->input->post('person_id')/**GARRISON ADDED 4/22/2013**/
|
||||
);
|
||||
|
||||
if( $this->Giftcard->save( $giftcard_data, $giftcard_id ) )
|
||||
{
|
||||
//New giftcard
|
||||
if($giftcard_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_adding').' '.
|
||||
$giftcard_data['giftcard_number'],'giftcard_id'=>$giftcard_data['giftcard_id']));
|
||||
$giftcard_id = $giftcard_data['giftcard_id'];
|
||||
}
|
||||
else //previous giftcard
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_updating').' '.
|
||||
$giftcard_data['giftcard_number'],'giftcard_id'=>$giftcard_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('giftcards_error_adding_updating').' '.
|
||||
$giftcard_data['giftcard_number'],'giftcard_id'=>-1));
|
||||
}
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$giftcards_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Giftcard->delete_list($giftcards_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('giftcards_successful_deleted').' '.
|
||||
count($giftcards_to_delete).' '.$this->lang->line('giftcards_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('giftcards_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 360;
|
||||
}
|
||||
}
|
||||
?>
|
||||
21
application/controllers/home.php
Normal file
21
application/controllers/home.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
|
||||
class Home extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->view("home");
|
||||
}
|
||||
|
||||
function logout()
|
||||
{
|
||||
$this->Employee->logout();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
17
application/controllers/interfaces/idata_controller.php
Normal file
17
application/controllers/interfaces/idata_controller.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
This interface is implemented by any controller that keeps track of data items, such
|
||||
as the customers, employees, and items controllers.
|
||||
*/
|
||||
interface iData_controller
|
||||
{
|
||||
public function index();
|
||||
public function search();
|
||||
public function suggest();
|
||||
public function get_row();
|
||||
public function view($data_item_id=-1);
|
||||
public function save($data_item_id=-1);
|
||||
public function delete();
|
||||
public function get_form_width();
|
||||
}
|
||||
?>
|
||||
11
application/controllers/interfaces/iperson_controller.php
Normal file
11
application/controllers/interfaces/iperson_controller.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
This interface is implemented by any controller that keeps track of people, such
|
||||
as customers and employees.
|
||||
*/
|
||||
require_once("idata_controller.php");
|
||||
interface iPerson_controller extends iData_controller
|
||||
{
|
||||
public function mailto();
|
||||
}
|
||||
?>
|
||||
138
application/controllers/item_kits.php
Normal file
138
application/controllers/item_kits.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
require_once ("interfaces/idata_controller.php");
|
||||
class Item_kits extends Secure_area implements iData_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('item_kits');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/item_kits/index');
|
||||
$config['total_rows'] = $this->Item_kit->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_item_kits_manage_table( $this->Item_kit->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('item_kits/manage',$data);
|
||||
}
|
||||
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_item_kits_manage_table_data_rows($this->Item_kit->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Item_kit->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function get_row()
|
||||
{
|
||||
$item_kit_id = $this->input->post('row_id');
|
||||
$data_row=get_item_kit_data_row($this->Item_kit->get_info($item_kit_id),$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
function view($item_kit_id=-1)
|
||||
{
|
||||
$data['item_kit_info']=$this->Item_kit->get_info($item_kit_id);
|
||||
$this->load->view("item_kits/form",$data);
|
||||
}
|
||||
|
||||
function save($item_kit_id=-1)
|
||||
{
|
||||
$item_kit_data = array(
|
||||
'name'=>$this->input->post('name'),
|
||||
'description'=>$this->input->post('description')
|
||||
);
|
||||
|
||||
if($this->Item_kit->save($item_kit_data,$item_kit_id))
|
||||
{
|
||||
//New item kit
|
||||
if($item_kit_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_adding').' '.
|
||||
$item_kit_data['name'],'item_kit_id'=>$item_kit_data['item_kit_id']));
|
||||
$item_kit_id = $item_kit_data['item_kit_id'];
|
||||
}
|
||||
else //previous item
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_updating').' '.
|
||||
$item_kit_data['name'],'item_kit_id'=>$item_kit_id));
|
||||
}
|
||||
|
||||
if ($this->input->post('item_kit_item'))
|
||||
{
|
||||
$item_kit_items = array();
|
||||
foreach($this->input->post('item_kit_item') as $item_id => $quantity)
|
||||
{
|
||||
$item_kit_items[] = array(
|
||||
'item_id' => $item_id,
|
||||
'quantity' => $quantity
|
||||
);
|
||||
}
|
||||
|
||||
$this->Item_kit_items->save($item_kit_items, $item_kit_id);
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('item_kits_error_adding_updating').' '.
|
||||
$item_kit_data['name'],'item_kit_id'=>-1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$item_kits_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Item_kit->delete_list($item_kits_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('item_kits_successful_deleted').' '.
|
||||
count($item_kits_to_delete).' '.$this->lang->line('item_kits_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('item_kits_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
function generate_barcodes($item_kit_ids)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$item_kit_ids = explode(':', $item_kit_ids);
|
||||
foreach ($item_kit_ids as $item_kid_id)
|
||||
{
|
||||
$item_kit_info = $this->Item_kit->get_info($item_kid_id);
|
||||
|
||||
$result[] = array('name' =>$item_kit_info->name, 'id'=> 'KIT '.$item_kid_id);
|
||||
}
|
||||
|
||||
$data['items'] = $result;
|
||||
$this->load->view("barcode_sheet", $data);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 360;
|
||||
}
|
||||
}
|
||||
?>
|
||||
611
application/controllers/items.php
Normal file
611
application/controllers/items.php
Normal file
@@ -0,0 +1,611 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
require_once ("interfaces/idata_controller.php");
|
||||
class Items extends Secure_area implements iData_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('items');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/items/index');
|
||||
$config['total_rows'] = $this->Item->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_items_manage_table( $this->Item->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('items/manage',$data);
|
||||
}
|
||||
|
||||
function refresh()
|
||||
{
|
||||
$is_serialized=$this->input->post('is_serialized');
|
||||
$no_description=$this->input->post('no_description');
|
||||
$search_custom=$this->input->post('search_custom');//GARRISON ADDED 4/13/2013
|
||||
$is_deleted=$this->input->post('is_deleted'); // Parq 131215
|
||||
|
||||
$data['search_section_state']=$this->input->post('search_section_state');
|
||||
$data['is_serialized']=$this->input->post('is_serialized');
|
||||
$data['no_description']=$this->input->post('no_description');
|
||||
$data['search_custom']=$this->input->post('search_custom');//GARRISON ADDED 4/13/2013
|
||||
$data['is_deleted']=$this->input->post('is_deleted'); // Parq 131215
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_items_manage_table($this->Item->get_all_filtered($is_serialized,$no_description,$search_custom,$is_deleted),$this);//GARRISON MODIFIED 4/13/2013, Parq 131215
|
||||
$this->load->view('items/manage',$data);
|
||||
}
|
||||
|
||||
function find_item_info()
|
||||
{
|
||||
$item_number=$this->input->post('scan_item_number');
|
||||
echo json_encode($this->Item->find_item_info($item_number));
|
||||
}
|
||||
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_items_manage_table_data_rows($this->Item->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Item->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function item_search()
|
||||
{
|
||||
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'),'warehouse');
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_category()
|
||||
{
|
||||
$suggestions = $this->Item->get_category_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/**GARRISON ADDED 5/18/2013**/
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_location()
|
||||
{
|
||||
$suggestions = $this->Item->get_location_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom1()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom1_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom2()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom2_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom3()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom3_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom4()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom4_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom5()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom5_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom6()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom6_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom7()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom7_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom8()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom8_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom9()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom9_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest_custom10()
|
||||
{
|
||||
$suggestions = $this->Item->get_custom10_suggestions($this->input->post('q'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/**END GARRISON ADDED**/
|
||||
|
||||
function get_row()
|
||||
{
|
||||
$item_id = $this->input->post('row_id');
|
||||
$data_row=get_item_data_row($this->Item->get_info($item_id),$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
function view($item_id=-1)
|
||||
{
|
||||
$data['item_info']=$this->Item->get_info($item_id);
|
||||
$data['item_tax_info']=$this->Item_taxes->get_info($item_id);
|
||||
$suppliers = array('' => $this->lang->line('items_none'));
|
||||
foreach($this->Supplier->get_all()->result_array() as $row)
|
||||
{
|
||||
$suppliers[$row['person_id']] = $row['company_name'] .' ('.$row['first_name'] .' '. $row['last_name'].')';
|
||||
}
|
||||
|
||||
$data['suppliers']=$suppliers;
|
||||
$data['selected_supplier'] = $this->Item->get_info($item_id)->supplier_id;
|
||||
$data['default_tax_1_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_1_rate') : '';
|
||||
$data['default_tax_2_rate']=($item_id==-1) ? $this->Appconfig->get('default_tax_2_rate') : '';
|
||||
|
||||
$locations_data = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$location_array;
|
||||
foreach($locations_data as $location)
|
||||
{
|
||||
$quantity = $this->Item_quantities->get_item_quantity($item_id, $location['location_id'])->quantity;
|
||||
$quantity = ($item_id == -1) ? null: $quantity;
|
||||
$location_array[$location['location_id']] = array('location_name'=>$location['location_name'],
|
||||
'quantity'=>$quantity);
|
||||
}
|
||||
$data['stock_locations']= $location_array;
|
||||
$this->load->view("items/form",$data);
|
||||
}
|
||||
|
||||
|
||||
//Ramel Inventory Tracking
|
||||
function inventory($item_id=-1)
|
||||
{
|
||||
$data['item_info']=$this->Item->get_info($item_id);
|
||||
|
||||
$data['stock_locations'] = array();
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
foreach($stock_locations as $location_data)
|
||||
{
|
||||
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
|
||||
$data['item_quantities'][$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity;
|
||||
}
|
||||
|
||||
$this->load->view("items/inventory",$data);
|
||||
}
|
||||
|
||||
function count_details($item_id=-1)
|
||||
{
|
||||
$data['item_info']=$this->Item->get_info($item_id);
|
||||
|
||||
$data['stock_locations'] = array();
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
foreach($stock_locations as $location_data)
|
||||
{
|
||||
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
|
||||
$data['item_quantities'][$location_data['location_id']] = $this->Item_quantities->get_item_quantity($item_id,$location_data['location_id'])->quantity;
|
||||
}
|
||||
|
||||
$this->load->view("items/count_details",$data);
|
||||
} //------------------------------------------- Ramel
|
||||
|
||||
function generate_barcodes($item_ids)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$item_ids = explode(':', $item_ids);
|
||||
foreach ($item_ids as $item_id)
|
||||
{
|
||||
$item_info = $this->Item->get_info($item_id);
|
||||
|
||||
$result[] = array('name' =>$item_info->name, 'id'=> $item_id);
|
||||
}
|
||||
|
||||
$data['items'] = $result;
|
||||
$this->load->view("barcode_sheet", $data);
|
||||
}
|
||||
|
||||
function bulk_edit()
|
||||
{
|
||||
$data = array();
|
||||
$suppliers = array('' => $this->lang->line('items_none'));
|
||||
foreach($this->Supplier->get_all()->result_array() as $row)
|
||||
{
|
||||
$suppliers[$row['person_id']] = $row['first_name'] .' '. $row['last_name'];
|
||||
}
|
||||
$data['suppliers'] = $suppliers;
|
||||
$data['allow_alt_description_choices'] = array(
|
||||
''=>$this->lang->line('items_do_nothing'),
|
||||
1 =>$this->lang->line('items_change_all_to_allow_alt_desc'),
|
||||
0 =>$this->lang->line('items_change_all_to_not_allow_allow_desc'));
|
||||
|
||||
$data['serialization_choices'] = array(
|
||||
''=>$this->lang->line('items_do_nothing'),
|
||||
1 =>$this->lang->line('items_change_all_to_serialized'),
|
||||
0 =>$this->lang->line('items_change_all_to_unserialized'));
|
||||
$this->load->view("items/form_bulk", $data);
|
||||
}
|
||||
|
||||
function save($item_id=-1)
|
||||
{
|
||||
//Save item data
|
||||
$item_data = array(
|
||||
'name'=>$this->input->post('name'),
|
||||
'description'=>$this->input->post('description'),
|
||||
'category'=>$this->input->post('category'),
|
||||
'supplier_id'=>$this->input->post('supplier_id')=='' ? null:$this->input->post('supplier_id'),
|
||||
'item_number'=>$this->input->post('item_number')=='' ? null:$this->input->post('item_number'),
|
||||
'cost_price'=>$this->input->post('cost_price'),
|
||||
'unit_price'=>$this->input->post('unit_price'),
|
||||
'reorder_level'=>$this->input->post('reorder_level'),
|
||||
'allow_alt_description'=>$this->input->post('allow_alt_description'),
|
||||
'is_serialized'=>$this->input->post('is_serialized'),
|
||||
'deleted'=>$this->input->post('is_deleted'), /** Parq 131215 **/
|
||||
'custom1'=>$this->input->post('custom1'), /**GARRISON ADDED 4/21/2013**/
|
||||
'custom2'=>$this->input->post('custom2'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom3'=>$this->input->post('custom3'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom4'=>$this->input->post('custom4'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom5'=>$this->input->post('custom5'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom6'=>$this->input->post('custom6'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom7'=>$this->input->post('custom7'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom8'=>$this->input->post('custom8'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom9'=>$this->input->post('custom9'),/**GARRISON ADDED 4/21/2013**/
|
||||
'custom10'=>$this->input->post('custom10')/**GARRISON ADDED 4/21/2013**/
|
||||
);
|
||||
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$cur_item_info = $this->Item->get_info($item_id);
|
||||
|
||||
|
||||
if($this->Item->save($item_data,$item_id))
|
||||
{
|
||||
//New item
|
||||
if($item_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_adding').' '.
|
||||
$item_data['name'],'item_id'=>$item_data['item_id']));
|
||||
$item_id = $item_data['item_id'];
|
||||
}
|
||||
else //previous item
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '.
|
||||
$item_data['name'],'item_id'=>$item_id));
|
||||
}
|
||||
|
||||
$items_taxes_data = array();
|
||||
$tax_names = $this->input->post('tax_names');
|
||||
$tax_percents = $this->input->post('tax_percents');
|
||||
for($k=0;$k<count($tax_percents);$k++)
|
||||
{
|
||||
if (is_numeric($tax_percents[$k]))
|
||||
{
|
||||
$items_taxes_data[] = array('name'=>$tax_names[$k], 'percent'=>$tax_percents[$k] );
|
||||
}
|
||||
}
|
||||
$this->Item_taxes->save($items_taxes_data, $item_id);
|
||||
|
||||
|
||||
//Save item quantity
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
foreach($stock_locations as $location_data)
|
||||
{
|
||||
$updated_quantity = $this->input->post($location_data['location_id'].'_quantity');
|
||||
$location_detail = array('item_id'=>$item_id,
|
||||
'location_id'=>$location_data['location_id'],
|
||||
'quantity'=>$updated_quantity);
|
||||
$item_quantity = $this->Item_quantities->get_item_quantity($item_id, $location_data['location_id']);
|
||||
if ($item_quantity->quantity != $updated_quantity)
|
||||
{
|
||||
$this->Item_quantities->save($location_detail, $item_id, $location_data['location_id']);
|
||||
|
||||
$inv_data = array
|
||||
(
|
||||
'trans_date'=>date('Y-m-d H:i:s'),
|
||||
'trans_items'=>$item_id,
|
||||
'trans_user'=>$employee_id,
|
||||
'trans_location'=>$location_data['location_id'],
|
||||
'trans_comment'=>$this->lang->line('items_manually_editing_of_quantity'),
|
||||
'trans_inventory'=>$updated_quantity - $item_quantity->quantity
|
||||
);
|
||||
$this->Inventory->insert($inv_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '.
|
||||
$item_data['name'],'item_id'=>-1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Ramel Inventory Tracking
|
||||
function save_inventory($item_id=-1)
|
||||
{
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$cur_item_info = $this->Item->get_info($item_id);
|
||||
$location_id = $this->input->post('stock_location');
|
||||
$inv_data = array
|
||||
(
|
||||
'trans_date'=>date('Y-m-d H:i:s'),
|
||||
'trans_items'=>$item_id,
|
||||
'trans_user'=>$employee_id,
|
||||
'trans_location'=>$location_id,
|
||||
'trans_comment'=>$this->input->post('trans_comment'),
|
||||
'trans_inventory'=>$this->input->post('newquantity')
|
||||
);
|
||||
$this->Inventory->insert($inv_data);
|
||||
|
||||
//Update stock quantity
|
||||
|
||||
$item_quantity= $this->Item_quantities->get_item_quantity($item_id,$location_id);
|
||||
$item_quantity_data = array(
|
||||
'item_id'=>$item_id,
|
||||
'location_id'=>$location_id,
|
||||
'quantity'=>$item_quantity->quantity + $this->input->post('newquantity')
|
||||
);
|
||||
if($this->Item_quantities->save($item_quantity_data,$item_id,$location_id))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_updating').' '.
|
||||
$cur_item_info->name,'item_id'=>$item_id));
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_adding_updating').' '.
|
||||
$cur_item_info->name,'item_id'=>-1));
|
||||
}
|
||||
|
||||
}//---------------------------------------------------------------------Ramel
|
||||
|
||||
function bulk_update()
|
||||
{
|
||||
$items_to_update=$this->input->post('item_ids');
|
||||
$item_data = array();
|
||||
|
||||
foreach($_POST as $key=>$value)
|
||||
{
|
||||
//This field is nullable, so treat it differently
|
||||
if ($key == 'supplier_id')
|
||||
{
|
||||
$item_data["$key"]=$value == '' ? null : $value;
|
||||
}
|
||||
elseif($value!='' and !(in_array($key, array('item_ids', 'tax_names', 'tax_percents'))))
|
||||
{
|
||||
$item_data["$key"]=$value;
|
||||
}
|
||||
}
|
||||
|
||||
//Item data could be empty if tax information is being updated
|
||||
if(empty($item_data) || $this->Item->update_multiple($item_data,$items_to_update))
|
||||
{
|
||||
$items_taxes_data = array();
|
||||
$tax_names = $this->input->post('tax_names');
|
||||
$tax_percents = $this->input->post('tax_percents');
|
||||
for($k=0;$k<count($tax_percents);$k++)
|
||||
{
|
||||
if (is_numeric($tax_percents[$k]))
|
||||
{
|
||||
$items_taxes_data[] = array('name'=>$tax_names[$k], 'percent'=>$tax_percents[$k] );
|
||||
}
|
||||
}
|
||||
$this->Item_taxes->save_multiple($items_taxes_data, $items_to_update);
|
||||
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_bulk_edit')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_error_updating_multiple')));
|
||||
}
|
||||
}
|
||||
|
||||
function delete()
|
||||
{
|
||||
$items_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Item->delete_list($items_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('items_successful_deleted').' '.
|
||||
count($items_to_delete).' '.$this->lang->line('items_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('items_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
function excel()
|
||||
{
|
||||
$data = file_get_contents("import_items.csv");
|
||||
$name = 'import_items.csv';
|
||||
force_download($name, $data);
|
||||
}
|
||||
|
||||
function excel_import()
|
||||
{
|
||||
$this->load->view("items/excel_import", null);
|
||||
}
|
||||
|
||||
function do_excel_import()
|
||||
{
|
||||
$msg = 'do_excel_import';
|
||||
$failCodes = array();
|
||||
if ($_FILES['file_path']['error']!=UPLOAD_ERR_OK)
|
||||
{
|
||||
$msg = $this->lang->line('items_excel_import_failed');
|
||||
echo json_encode( array('success'=>false,'message'=>$msg) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($handle = fopen($_FILES['file_path']['tmp_name'], "r")) !== FALSE)
|
||||
{
|
||||
//Skip first row
|
||||
fgetcsv($handle);
|
||||
|
||||
$i=1;
|
||||
while (($data = fgetcsv($handle)) !== FALSE)
|
||||
{
|
||||
$item_data = array(
|
||||
'name' => $data[1],
|
||||
'description' => $data[13],
|
||||
'category' => $data[2],
|
||||
'cost_price' => $data[4],
|
||||
'unit_price' => $data[5],
|
||||
'quantity' => $data[10],
|
||||
'reorder_level' => $data[11],
|
||||
'supplier_id' => $this->Supplier->exists($data[3]) ? $data[3] : null,
|
||||
'allow_alt_description' => $data[14] != '' ? '1' : '0',
|
||||
'is_serialized' => $data[15] != '' ? '1' : '0',
|
||||
'custom1' => $data[16], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom2' => $data[17], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom3' => $data[18], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom4' => $data[19], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom5' => $data[20], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom6' => $data[21], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom7' => $data[22], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom8' => $data[23], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom9' => $data[24], /** GARRISON ADDED 5/6/2013 **/
|
||||
'custom10' => $data[25] /** GARRISON ADDED 5/6/2013 **/
|
||||
);
|
||||
$item_number = $data[0];
|
||||
|
||||
if ($item_number != "")
|
||||
{
|
||||
$item_data['item_number'] = $item_number;
|
||||
}
|
||||
|
||||
if($this->Item->save($item_data))
|
||||
{
|
||||
$items_taxes_data = null;
|
||||
//tax 1
|
||||
if( is_numeric($data[7]) && $data[6]!='' )
|
||||
{
|
||||
$items_taxes_data[] = array('name'=>$data[6], 'percent'=>$data[7] );
|
||||
}
|
||||
|
||||
//tax 2
|
||||
if( is_numeric($data[9]) && $data[8]!='' )
|
||||
{
|
||||
$items_taxes_data[] = array('name'=>$data[8], 'percent'=>$data[9] );
|
||||
}
|
||||
|
||||
// save tax values
|
||||
if(count($items_taxes_data) > 0)
|
||||
{
|
||||
$this->Item_taxes->save($items_taxes_data, $item_data['item_id']);
|
||||
}
|
||||
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$emp_info=$this->Employee->get_info($employee_id);
|
||||
$comment ='Qty CSV Imported';
|
||||
$excel_data = array
|
||||
(
|
||||
'trans_items'=>$item_data['item_id'],
|
||||
'trans_user'=>$employee_id,
|
||||
'trans_comment'=>$comment,
|
||||
'trans_inventory'=>$data[10]
|
||||
);
|
||||
$this->db->insert('inventory',$excel_data);
|
||||
//------------------------------------------------Ramel
|
||||
}
|
||||
else//insert or update item failure
|
||||
{
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode( array('success'=>false,'message'=>'Your upload file has no data or not in supported format.') );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$success = true;
|
||||
if(count($failCodes) > 1)
|
||||
{
|
||||
$msg = "Most items imported. But some were not, here is list of their CODE (" .count($failCodes) ."): ".implode(", ", $failCodes);
|
||||
$success = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = "Import items successful";
|
||||
}
|
||||
|
||||
echo json_encode( array('success'=>$success,'message'=>$msg) );
|
||||
}
|
||||
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 360;
|
||||
}
|
||||
|
||||
function is_sale_store_item($item_number)
|
||||
{
|
||||
echo $this->Item->is_sale_store_item_exist($item_number);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
192
application/controllers/languagecheck.php
Normal file
192
application/controllers/languagecheck.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
// ---------------------------------------------------------------------
|
||||
class Languagecheck extends CI_Controller {
|
||||
|
||||
/*
|
||||
* use this language as comparison reference.
|
||||
* this should be the one that is complete.
|
||||
*/
|
||||
private $reference = 'english';
|
||||
|
||||
private $lang_path = 'language';
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* controller constructor
|
||||
*/
|
||||
function Languagecheck()
|
||||
{
|
||||
parent::Controller();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* use remap to capture all calls to this controller
|
||||
*/
|
||||
function _remap()
|
||||
{
|
||||
// load the required helpers
|
||||
$this->load->helper('directory');
|
||||
|
||||
// for simplicity, we don't use views
|
||||
$this->output('h1', 'Open Source Point of Sale - Language file checking and validation');
|
||||
|
||||
// determine the language file path
|
||||
if ( ! is_dir($this->lang_path) )
|
||||
{
|
||||
$this->lang_path = APPPATH . $this->lang_path;
|
||||
|
||||
if ( ! is_dir($this->lang_path) )
|
||||
{
|
||||
$this->output('h2', 'Defined language path "'.$this->lang_path.'" not found!', TRUE);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// fetch the languages directory map
|
||||
$languages = directory_map( $this->lang_path, TRUE );
|
||||
|
||||
// is our reference language present?
|
||||
if ( ! in_array($this->reference, $languages ) )
|
||||
{
|
||||
$this->output('h2', 'Reference language "'.$this->reference.'" not found!', TRUE);
|
||||
exit;
|
||||
}
|
||||
|
||||
// load the list of language files for the reference language
|
||||
$references = directory_map( $this->lang_path . '/' . $this->reference, TRUE );
|
||||
|
||||
// now process the list
|
||||
foreach( $references as $reference )
|
||||
{
|
||||
// skip non-language files in the language directory
|
||||
if ( strpos($reference, '_lang'.EXT) === FALSE )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// process it
|
||||
$this->output('h2', 'Processing '.$this->reference . ' » ' .$reference);
|
||||
|
||||
// load the language file
|
||||
include $this->lang_path . '/' . $this->reference . '/' . $reference;
|
||||
|
||||
// did the file contain any language strings?
|
||||
if ( empty($lang) )
|
||||
{
|
||||
// language file was empty or not properly defined
|
||||
$this->output('h3', 'Language file doesn\'t contain any language strings. Skipping file!', TRUE);
|
||||
continue;
|
||||
}
|
||||
|
||||
// store the loaded language strings
|
||||
$lang_ref = $lang;
|
||||
unset($lang);
|
||||
|
||||
// now loop through the available languages
|
||||
foreach ( $languages as $language )
|
||||
{
|
||||
// skip the reference language
|
||||
if ( $language == $this->reference )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// language file to check
|
||||
$file = $this->lang_path . '/' . $language . '/' . $reference;
|
||||
|
||||
// check if the language file exists for this language
|
||||
if ( ! file_exists( $file ) )
|
||||
{
|
||||
// file not found
|
||||
$this->output('h3', 'Language file doesn\'t exist for the language '.$language.'!', TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load the file to compare
|
||||
include $file;
|
||||
|
||||
// did the file contain any language strings?
|
||||
if ( empty($lang) )
|
||||
{
|
||||
// language file was empty or not properly defined
|
||||
$this->output('h3', 'Language file for the language '.$language.' doesn\'t contain any language strings!', TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// start comparing
|
||||
$this->output('h3', 'Comparing with the '.$language.' version:');
|
||||
|
||||
// assume all goes well
|
||||
$failures = 0;
|
||||
|
||||
// start comparing language keys
|
||||
foreach( $lang_ref as $key => $value )
|
||||
{
|
||||
if ( ! isset($lang[$key]) )
|
||||
{
|
||||
// report the missing key
|
||||
$this->output('', 'Missing language string "'.$key.'"', TRUE);
|
||||
|
||||
// increment the failure counter
|
||||
$failures++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $failures )
|
||||
{
|
||||
$this->output('', 'The two language files have matching strings.');
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the lang array is deleted before the next check
|
||||
if ( isset($lang) )
|
||||
{
|
||||
unset($lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->output('h2', 'Language file checking and validation completed');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
private function output($type = '', $line = '', $highlight = FALSE)
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 'h1':
|
||||
$html = "<h1>{line}</h1>\n<hr />\n";
|
||||
break;
|
||||
|
||||
case 'h2':
|
||||
$html = "<h2>{line}</h2>\n";
|
||||
break;
|
||||
|
||||
case 'h3':
|
||||
$html = "<h3> {line}</h3>\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
$html = " » {line}<br />";
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $highlight )
|
||||
{
|
||||
$line = '<span style="color:red;font-weight:bold;">' . $line . '</span>';
|
||||
}
|
||||
|
||||
echo str_replace('{line}', $line, $html);
|
||||
}
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
/* End of file languagecheck.php */
|
||||
/* Location: ./application/controllers/languagecheck.php */
|
||||
43
application/controllers/login.php
Normal file
43
application/controllers/login.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class Login extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
if($this->Employee->is_logged_in())
|
||||
{
|
||||
redirect('home');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_rules('username', 'lang:login_undername', 'callback_login_check');
|
||||
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
|
||||
|
||||
if($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('login');
|
||||
}
|
||||
else
|
||||
{
|
||||
redirect('home');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function login_check($username)
|
||||
{
|
||||
$password = $this->input->post("password");
|
||||
|
||||
if(!$this->Employee->login($username,$password))
|
||||
{
|
||||
$this->form_validation->set_message('login_check', $this->lang->line('login_invalid_username_and_password'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
15
application/controllers/no_access.php
Normal file
15
application/controllers/no_access.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class No_Access extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function index($module_id='')
|
||||
{
|
||||
$data['module_name']=$this->Module->get_module_name($module_id);
|
||||
$this->load->view('no_access',$data);
|
||||
}
|
||||
}
|
||||
?>
|
||||
54
application/controllers/person_controller.php
Normal file
54
application/controllers/person_controller.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
require_once ("interfaces/iperson_controller.php");
|
||||
require_once ("secure_area.php");
|
||||
abstract class Person_controller extends Secure_area implements iPerson_controller
|
||||
{
|
||||
function __construct($module_id=null)
|
||||
{
|
||||
parent::__construct($module_id);
|
||||
}
|
||||
|
||||
/*
|
||||
This returns a mailto link for persons with a certain id. This is called with AJAX.
|
||||
*/
|
||||
function mailto()
|
||||
{
|
||||
$people_to_email=$this->input->post('ids');
|
||||
|
||||
if($people_to_email!=false)
|
||||
{
|
||||
$mailto_url='mailto:';
|
||||
foreach($this->Person->get_multiple_info($people_to_email)->result() as $person)
|
||||
{
|
||||
$mailto_url.=$person->email.',';
|
||||
}
|
||||
//remove last comma
|
||||
$mailto_url=substr($mailto_url,0,strlen($mailto_url)-1);
|
||||
|
||||
echo $mailto_url;
|
||||
exit;
|
||||
}
|
||||
echo '#';
|
||||
}
|
||||
/** GARRISON ADDED 4/25/2013 IN PROGRESS **/
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Person->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Gets one row for a person manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
function get_row()
|
||||
{
|
||||
$person_id = $this->input->post('row_id');
|
||||
$data_row=get_person_data_row($this->Person->get_info($person_id),$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
278
application/controllers/receivings.php
Normal file
278
application/controllers/receivings.php
Normal file
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
class Receivings extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('receivings');
|
||||
$this->load->library('receiving_lib');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function item_search()
|
||||
{
|
||||
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
$suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit')));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function supplier_search()
|
||||
{
|
||||
$suggestions = $this->Supplier->get_suppliers_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function select_supplier()
|
||||
{
|
||||
$supplier_id = $this->input->post("supplier");
|
||||
$this->receiving_lib->set_supplier($supplier_id);
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function change_mode()
|
||||
{
|
||||
$stock_destination = $this->input->post('stock_destination');
|
||||
$stock_source = $this->input->post("stock_source");
|
||||
if ((!$stock_source || $stock_source == $this->receiving_lib->get_stock_source()) &&
|
||||
(!$stock_destination || $stock_destination == $this->receiving_lib->get_stock_destination()))
|
||||
{
|
||||
$this->receiving_lib->empty_cart();
|
||||
$mode = $this->input->post("mode");
|
||||
$this->receiving_lib->set_mode($mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->receiving_lib->set_stock_source($stock_source);
|
||||
$this->receiving_lib->set_stock_destination($stock_destination);
|
||||
}
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$data=array();
|
||||
$mode = $this->receiving_lib->get_mode();
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
|
||||
$quantity = ($mode=="receive" or $mode=="requisition") ? 1:-1;
|
||||
$item_location = $this->receiving_lib->get_stock_source();
|
||||
if($this->receiving_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return')
|
||||
{
|
||||
$this->receiving_lib->return_entire_receiving($item_id_or_number_or_item_kit_or_receipt,$item_location);
|
||||
}
|
||||
elseif($this->receiving_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
|
||||
{
|
||||
$this->receiving_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt,$item_location);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$this->receiving_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity,$item_location))
|
||||
$data['error']=$this->lang->line('recvs_unable_to_add_item');
|
||||
}
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
function edit_item($item_id)
|
||||
{
|
||||
$data= array();
|
||||
|
||||
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|integer');
|
||||
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|integer');
|
||||
|
||||
$description = $this->input->post("description");
|
||||
$serialnumber = $this->input->post("serialnumber");
|
||||
$price = $this->input->post("price");
|
||||
$quantity = $this->input->post("quantity");
|
||||
$discount = $this->input->post("discount");
|
||||
$item_location = $this->input->post("location");
|
||||
|
||||
if ($this->form_validation->run() != FALSE)
|
||||
{
|
||||
$this->receiving_lib->edit_item($item_id,$description,$serialnumber,$quantity,$discount,$price);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error']=$this->lang->line('recvs_error_editing_item');
|
||||
}
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
function edit_item_unit($item_id)
|
||||
{
|
||||
$data= array();
|
||||
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|integer');
|
||||
$quantity = $this->input->post("quantity");
|
||||
|
||||
|
||||
if ($this->form_validation->run() != FALSE)
|
||||
{
|
||||
$this->receiving_lib->edit_item_unit($item_id,$description,$quantity,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error']=$this->lang->line('recvs_error_editing_item');
|
||||
}
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
function delete_item($item_number)
|
||||
{
|
||||
$this->receiving_lib->delete_item($item_number);
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function delete_supplier()
|
||||
{
|
||||
$this->receiving_lib->delete_supplier();
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function complete()
|
||||
{
|
||||
$data['cart']=$this->receiving_lib->get_cart();
|
||||
$data['total']=$this->receiving_lib->get_total();
|
||||
$data['receipt_title']=$this->lang->line('recvs_receipt');
|
||||
$data['transaction_time']= date('m/d/Y h:i:s a');
|
||||
$data['mode']=$this->receiving_lib->get_mode();
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$data['show_stock_locations'] = count($stock_locations) > 1;
|
||||
$supplier_id=$this->receiving_lib->get_supplier();
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$comment = $this->input->post('comment');
|
||||
$emp_info=$this->Employee->get_info($employee_id);
|
||||
$payment_type = $this->input->post('payment_type');
|
||||
$data['payment_type']=$this->input->post('payment_type');
|
||||
$data['stock_location']=$this->receiving_lib->get_stock_source();
|
||||
|
||||
if ($this->input->post('amount_tendered'))
|
||||
{
|
||||
$data['amount_tendered'] = $this->input->post('amount_tendered');
|
||||
$data['amount_change'] = to_currency($data['amount_tendered'] - round($data['total'], 2));
|
||||
}
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($supplier_id!=-1)
|
||||
{
|
||||
$suppl_info=$this->Supplier->get_info($supplier_id);
|
||||
$data['supplier']=$suppl_info->first_name.' '.$suppl_info->last_name;
|
||||
}
|
||||
|
||||
//SAVE receiving to database
|
||||
$data['receiving_id']='RECV '.$this->Receiving->save($data['cart'], $supplier_id,$employee_id,$comment,$payment_type,$data['stock_location']);
|
||||
|
||||
if ($data['receiving_id'] == 'RECV -1')
|
||||
{
|
||||
$data['error_message'] = $this->lang->line('receivings_transaction_failed');
|
||||
}
|
||||
|
||||
$this->load->view("receivings/receipt",$data);
|
||||
$this->receiving_lib->clear_all();
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function requisition_complete()
|
||||
{
|
||||
if ($this->receiving_lib->get_stock_source() != $this->receiving_lib->get_stock_destination())
|
||||
{
|
||||
foreach($this->receiving_lib->get_cart() as $item)
|
||||
{
|
||||
$this->receiving_lib->delete_item($item['line']);
|
||||
$this->receiving_lib->add_item($item['item_id'],$item['quantity'],$this->receiving_lib->get_stock_destination());
|
||||
$this->receiving_lib->add_item($item['item_id'],-$item['quantity'],$this->receiving_lib->get_stock_source());
|
||||
}
|
||||
|
||||
$this->complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error']=$this->lang->line('recvs_error_requisition');
|
||||
$this->_reload($data);
|
||||
}
|
||||
}
|
||||
|
||||
function receipt($receiving_id)
|
||||
{
|
||||
$receiving_info = $this->Receiving->get_info($receiving_id)->row_array();
|
||||
$this->receiving_lib->copy_entire_receiving($receiving_id);
|
||||
$data['cart']=$this->receiving_lib->get_cart();
|
||||
$data['total']=$this->receiving_lib->get_total();
|
||||
$data['mode']=$this->receiving_lib->get_mode();
|
||||
$data['receipt_title']=$this->lang->line('recvs_receipt');
|
||||
$data['transaction_time']= date('m/d/Y h:i:s a', strtotime($receiving_info['receiving_time']));
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$data['show_stock_locations'] = count($stock_locations) > 1;
|
||||
$supplier_id=$this->receiving_lib->get_supplier();
|
||||
$emp_info=$this->Employee->get_info($receiving_info['employee_id']);
|
||||
$data['payment_type']=$receiving_info['payment_type'];
|
||||
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($supplier_id!=-1)
|
||||
{
|
||||
$supplier_info=$this->Supplier->get_info($supplier_id);
|
||||
$data['supplier']=$supplier_info->first_name.' '.$supplier_info->last_name;
|
||||
}
|
||||
$data['receiving_id']='RECV '.$receiving_id;
|
||||
$this->load->view("receivings/receipt",$data);
|
||||
$this->receiving_lib->clear_all();
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function _reload($data=array())
|
||||
{
|
||||
$data['stock_locations'] = array();
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$show_stock_locations = count($stock_locations) > 1;
|
||||
|
||||
$person_info = $this->Employee->get_logged_in_employee_info();
|
||||
$data['cart']=$this->receiving_lib->get_cart();
|
||||
$data['modes']=array('receive'=>$this->lang->line('recvs_receiving'),'return'=>$this->lang->line('recvs_return'));
|
||||
|
||||
$data['mode']=$this->receiving_lib->get_mode();
|
||||
|
||||
if ($show_stock_locations) {
|
||||
$data['modes']['requisition'] = $this->lang->line('recvs_requisition');
|
||||
foreach($stock_locations as $location_data)
|
||||
{
|
||||
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
|
||||
}
|
||||
|
||||
$data['stock_source']=$this->receiving_lib->get_stock_source();
|
||||
$data['stock_destination']=$this->receiving_lib->get_stock_destination();
|
||||
}
|
||||
$data['show_stock_locations'] = $show_stock_locations;
|
||||
|
||||
$data['total']=$this->receiving_lib->get_total();
|
||||
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
|
||||
$data['payment_options']=array(
|
||||
$this->lang->line('sales_cash') => $this->lang->line('sales_cash'),
|
||||
$this->lang->line('sales_check') => $this->lang->line('sales_check'),
|
||||
$this->lang->line('sales_debit') => $this->lang->line('sales_debit'),
|
||||
$this->lang->line('sales_credit') => $this->lang->line('sales_credit')
|
||||
);
|
||||
|
||||
$supplier_id=$this->receiving_lib->get_supplier();
|
||||
if($supplier_id!=-1)
|
||||
{
|
||||
$info=$this->Supplier->get_info($supplier_id);
|
||||
$data['supplier']=$info->first_name.' '.$info->last_name;
|
||||
}
|
||||
$this->load->view("receivings/receiving",$data);
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function cancel_receiving()
|
||||
{
|
||||
$this->receiving_lib->clear_all();
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
965
application/controllers/reports.php
Normal file
965
application/controllers/reports.php
Normal file
@@ -0,0 +1,965 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
require_once (APPPATH."libraries/ofc-library/open-flash-chart.php");
|
||||
|
||||
define("FORM_WIDTH", "400");
|
||||
|
||||
class Reports extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('reports');
|
||||
$this->load->helper('report');
|
||||
}
|
||||
|
||||
//Initial report listing screen
|
||||
function index()
|
||||
{
|
||||
$this->load->view("reports/listing",array());
|
||||
}
|
||||
|
||||
function _get_common_report_data()
|
||||
{
|
||||
$data = array();
|
||||
$data['report_date_range_simple'] = get_simple_date_ranges();
|
||||
$data['months'] = get_months();
|
||||
$data['days'] = get_days();
|
||||
$data['years'] = get_years();
|
||||
$data['selected_month']=date('n');
|
||||
$data['selected_day']=date('d');
|
||||
$data['selected_year']=date('Y');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//Input for reports that require only a date range and an export to excel. (see routes.php to see that all summary reports route here)
|
||||
function date_input_excel_export()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$this->load->view("reports/date_input_excel_export",$data);
|
||||
}
|
||||
|
||||
function get_detailed_sales_row($sale_id, $sale_type=1)
|
||||
{
|
||||
$this->load->model('reports/Detailed_sales');
|
||||
$model = $this->Detailed_sales;
|
||||
|
||||
$report_data = $model->getDataBySaleId($sale_id, $sale_type);
|
||||
|
||||
$summary_data = array(anchor('sales/edit/'.$report_data['sale_id'] . '/width:'.FORM_WIDTH,
|
||||
'POS '.$report_data['sale_id'],
|
||||
array('class' => 'thickbox')),
|
||||
$report_data['sale_date'],
|
||||
$report_data['items_purchased'],
|
||||
$report_data['employee_name'],
|
||||
$report_data['customer_name'],
|
||||
to_currency($report_data['subtotal']),
|
||||
to_currency($report_data['total']),
|
||||
to_currency($report_data['tax']),
|
||||
to_currency($report_data['profit']),
|
||||
$report_data['payment_type'],
|
||||
$report_data['comment']);
|
||||
echo get_detailed_sales_data_row($summary_data, $this);
|
||||
}
|
||||
|
||||
function get_summary_data($start_date, $end_date = NULL, $sale_type=0)
|
||||
{
|
||||
$end_date = $end_date ?: $start_date;
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
$summary = $model->getSummaryData(array(
|
||||
'start_date'=>$start_date,
|
||||
'end_date'=>$end_date,
|
||||
'sale_type' => $sale_type));
|
||||
echo get_sales_summary_totals($summary, $this);
|
||||
}
|
||||
|
||||
//Summary sales report
|
||||
function summary_sales($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['sale_date'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_sales_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary categories report
|
||||
function summary_categories($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_categories');
|
||||
$model = $this->Summary_categories;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['category'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_categories_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary customers report
|
||||
function summary_customers($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_customers');
|
||||
$model = $this->Summary_customers;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['customer'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_customers_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary suppliers report
|
||||
function summary_suppliers($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_suppliers');
|
||||
$model = $this->Summary_suppliers;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['supplier'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_suppliers_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary items report
|
||||
function summary_items($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_items');
|
||||
$model = $this->Summary_items;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array(character_limiter($row['name'], 16), $row['quantity_purchased'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_items_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary employees report
|
||||
function summary_employees($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_employees');
|
||||
$model = $this->Summary_employees;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['employee'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_employees_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary taxes report
|
||||
function summary_taxes($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_taxes');
|
||||
$model = $this->Summary_taxes;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['percent'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_taxes_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Summary discounts report
|
||||
function summary_discounts($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_discounts');
|
||||
$model = $this->Summary_discounts;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['discount_percent'],$row['count']);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_discounts_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
function summary_payments($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$model = $this->Summary_payments;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['payment_type'],to_currency($row['payment_amount']));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_payments_summary_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
//Input for reports that require only a date range. (see routes.php to see that all graphical summary reports route here)
|
||||
function date_input()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['mode'] = 'sale';
|
||||
$this->load->view("reports/date_input",$data);
|
||||
}
|
||||
|
||||
function date_input_recv()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['mode'] = 'receiving';
|
||||
$this->load->view("reports/date_input",$data);
|
||||
}
|
||||
|
||||
function date_input_reqs()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['mode'] = 'requisition';
|
||||
$this->load->view("reports/date_input",$data);
|
||||
}
|
||||
|
||||
//Graphical summary sales report
|
||||
function graphical_summary_sales($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_sales_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_sales_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_sales_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_sales');
|
||||
$model = $this->Summary_sales;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[date('m/d/Y', strtotime($row['sale_date']))]= $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_sales_summary_report'),
|
||||
"yaxis_label"=>$this->lang->line('reports_revenue'),
|
||||
"xaxis_label"=>$this->lang->line('reports_date'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/line",$data);
|
||||
|
||||
}
|
||||
|
||||
//Graphical summary items report
|
||||
function graphical_summary_items($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_items');
|
||||
$model = $this->Summary_items;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_items_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_items_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_items_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_items');
|
||||
$model = $this->Summary_items;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['name']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_items_summary_report'),
|
||||
"xaxis_label"=>$this->lang->line('reports_revenue'),
|
||||
"yaxis_label"=>$this->lang->line('reports_items'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/hbar",$data);
|
||||
}
|
||||
|
||||
//Graphical summary customers report
|
||||
function graphical_summary_categories($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_categories');
|
||||
$model = $this->Summary_categories;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_categories_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_categories_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_categories_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_categories');
|
||||
$model = $this->Summary_categories;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['category']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_categories_summary_report'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/pie",$data);
|
||||
}
|
||||
|
||||
function graphical_summary_suppliers($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_suppliers');
|
||||
$model = $this->Summary_suppliers;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_suppliers_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_suppliers_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_suppliers_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_suppliers');
|
||||
$model = $this->Summary_suppliers;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['supplier']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_suppliers_summary_report'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/pie",$data);
|
||||
}
|
||||
|
||||
function graphical_summary_employees($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_employees');
|
||||
$model = $this->Summary_employees;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_employees_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_employees_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_employees_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_employees');
|
||||
$model = $this->Summary_employees;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['employee']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_employees_summary_report'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/pie",$data);
|
||||
}
|
||||
|
||||
function graphical_summary_taxes($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_taxes');
|
||||
$model = $this->Summary_taxes;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_taxes_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_taxes_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_taxes_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_taxes');
|
||||
$model = $this->Summary_taxes;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['percent']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_taxes_summary_report'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/pie",$data);
|
||||
}
|
||||
|
||||
//Graphical summary customers report
|
||||
function graphical_summary_customers($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_customers');
|
||||
$model = $this->Summary_customers;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_customers_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_customers_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_customers_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_customers');
|
||||
$model = $this->Summary_customers;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['customer']] = $row['total'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_customers_summary_report'),
|
||||
"xaxis_label"=>$this->lang->line('reports_revenue'),
|
||||
"yaxis_label"=>$this->lang->line('reports_customers'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/hbar",$data);
|
||||
}
|
||||
|
||||
//Graphical summary discounts report
|
||||
function graphical_summary_discounts($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_discounts');
|
||||
$model = $this->Summary_discounts;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_discounts_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_discounts_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_discounts_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_discounts');
|
||||
$model = $this->Summary_discounts;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['discount_percent']] = $row['count'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_discounts_summary_report'),
|
||||
"yaxis_label"=>$this->lang->line('reports_count'),
|
||||
"xaxis_label"=>$this->lang->line('reports_discount_percent'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/bar",$data);
|
||||
}
|
||||
|
||||
function graphical_summary_payments($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$model = $this->Summary_payments;
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_payments_summary_report'),
|
||||
"data_file" => site_url("reports/graphical_summary_payments_graph/$start_date/$end_date/$sale_type"),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type))
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphical",$data);
|
||||
}
|
||||
|
||||
//The actual graph data
|
||||
function graphical_summary_payments_graph($start_date, $end_date, $sale_type)
|
||||
{
|
||||
$this->load->model('reports/Summary_payments');
|
||||
$model = $this->Summary_payments;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$graph_data = array();
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$graph_data[$row['payment_type']] = $row['payment_amount'];
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_payments_summary_report'),
|
||||
"yaxis_label"=>$this->lang->line('reports_revenue'),
|
||||
"xaxis_label"=>$this->lang->line('reports_payment_type'),
|
||||
"data" => $graph_data
|
||||
);
|
||||
|
||||
$this->load->view("reports/graphs/pie",$data);
|
||||
}
|
||||
function specific_customer_input()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['specific_input_name'] = $this->lang->line('reports_customer');
|
||||
|
||||
$customers = array();
|
||||
foreach($this->Customer->get_all()->result() as $customer)
|
||||
{
|
||||
$customers[$customer->person_id] = $customer->first_name .' '.$customer->last_name;
|
||||
}
|
||||
$data['specific_input_data'] = $customers;
|
||||
$this->load->view("reports/specific_input",$data);
|
||||
}
|
||||
|
||||
function specific_customer($start_date, $end_date, $customer_id, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Specific_customer');
|
||||
$model = $this->Specific_customer;
|
||||
|
||||
$headers = $model->getDataColumns();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'customer_id' =>$customer_id, 'sale_type' => $sale_type));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%');
|
||||
}
|
||||
}
|
||||
|
||||
$customer_info = $this->Customer->get_info($customer_id);
|
||||
$data = array(
|
||||
"title" => $customer_info->first_name .' '. $customer_info->last_name.' '.$this->lang->line('reports_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'customer_id' =>$customer_id, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
}
|
||||
|
||||
function specific_employee_input()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['specific_input_name'] = $this->lang->line('reports_employee');
|
||||
|
||||
$employees = array();
|
||||
foreach($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
$employees[$employee->person_id] = $employee->first_name .' '.$employee->last_name;
|
||||
}
|
||||
$data['specific_input_data'] = $employees;
|
||||
$this->load->view("reports/specific_input",$data);
|
||||
}
|
||||
|
||||
function specific_employee($start_date, $end_date, $employee_id, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Specific_employee');
|
||||
$model = $this->Specific_employee;
|
||||
|
||||
$headers = $model->getDataColumns();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'employee_id' =>$employee_id, 'sale_type' => $sale_type));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%');
|
||||
}
|
||||
}
|
||||
|
||||
$employee_info = $this->Employee->get_info($employee_id);
|
||||
$data = array(
|
||||
"title" => $employee_info->first_name .' '. $employee_info->last_name.' '.$this->lang->line('reports_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'employee_id' =>$employee_id, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
}
|
||||
|
||||
function specific_discount_input()
|
||||
{
|
||||
$data = $this->_get_common_report_data();
|
||||
$data['specific_input_name'] = $this->lang->line('reports_discount');
|
||||
|
||||
$discounts = array();
|
||||
for($i = 0; $i <= 100; $i += 10)
|
||||
{
|
||||
$discounts[$i] = $i . '%';
|
||||
}
|
||||
$data['specific_input_data'] = $discounts;
|
||||
$this->load->view("reports/specific_input",$data);
|
||||
}
|
||||
|
||||
function specific_discount($start_date, $end_date, $discount, $sale_type, $export_excel = 0)
|
||||
{
|
||||
$this->load->model('reports/Specific_discount');
|
||||
$model = $this->Specific_discount;
|
||||
|
||||
$headers = $model->getDataColumns();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'discount' =>$discount, 'sale_type' => $sale_type));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('sales/receipt/'.$row['sale_id'], 'POS '.$row['sale_id'], array('target' => '_blank')), $row['sale_date'], $row['items_purchased'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),/*to_currency($row['profit']),*/ $row['payment_type'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['category'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),/*to_currency($drow['profit']),*/ $drow['discount_percent'].'%');
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $discount. '% '.$this->lang->line('reports_discount') . ' ' . $this->lang->line('reports_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $headers,
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"header_width" => intval(100 / count($headers['summary'])),
|
||||
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date,'discount' =>$discount, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
|
||||
}
|
||||
|
||||
function detailed_sales($start_date, $end_date, $sale_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Detailed_sales');
|
||||
$model = $this->Detailed_sales;
|
||||
|
||||
$headers = $model->getDataColumns();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('sales/edit/'.$row['sale_id'] . '/width:'.FORM_WIDTH, 'POS '.$row['sale_id'], array('class' => 'thickbox')), $row['sale_date'], $row['items_purchased'], $row['employee_name'], $row['customer_name'], to_currency($row['subtotal']), to_currency($row['total']), to_currency($row['tax']),to_currency($row['profit']), $row['payment_type'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['category'], $drow['serialnumber'], $drow['description'], $drow['quantity_purchased'], to_currency($drow['subtotal']), to_currency($drow['total']), to_currency($drow['tax']),to_currency($drow['profit']), $drow['discount_percent'].'%');
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" =>$this->lang->line('reports_detailed_sales_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"editable" => true,
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"header_width" => intval(100 / count($headers['summary'])),
|
||||
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type' => $sale_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
}
|
||||
|
||||
function detailed_receivings($start_date, $end_date, $receiving_type, $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Detailed_receivings');
|
||||
$model = $this->Detailed_receivings;
|
||||
|
||||
$headers = $model->getDataColumns();
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type' => $receiving_type));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('receivings/receipt/'.$row['receiving_id'], 'RECV '.$row['receiving_id'], array('target' => '_blank')), $row['receiving_date'], $row['items_purchased'], $row['employee_name'], $row['supplier_name'], to_currency($row['total']), $row['payment_type'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['category'], $drow['quantity_purchased'], to_currency($drow['total']), $drow['discount_percent'].'%');
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" =>$this->lang->line('reports_detailed_receivings_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"overall_summary_data" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'receiving_type' => $receiving_type)),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
}
|
||||
|
||||
function detailed_requisition($start_date, $end_date , $export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Detailed_requisition');
|
||||
$model = $this->Detailed_requisition;
|
||||
$report_data = $model->getData(array('start_date'=>$start_date, 'end_date'=>$end_date));
|
||||
|
||||
$summary_data = array();
|
||||
$details_data = array();
|
||||
|
||||
foreach($report_data['summary'] as $key=>$row)
|
||||
{
|
||||
$summary_data[] = array(anchor('receivings/requisition_receipt/'.$row['requisition_id'], 'REQS '.$row['requisition_id'], array('target' => '_blank')), $row['requisition_date'], $row['employee_name'], $row['comment']);
|
||||
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$details_data[$key][] = array($drow['name'], $drow['requisition_quantity'],
|
||||
$drow['related_item_id'], $drow['related_item_quantity'],
|
||||
$drow['related_item_total_quantity']);
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" =>$this->lang->line('reports_detailed_requisition_report'),
|
||||
"subtitle" => date('m/d/Y', strtotime($start_date)) .'-'.date('m/d/Y', strtotime($end_date)),
|
||||
"headers" => $model->getDataColumns(),
|
||||
"summary_data" => $summary_data,
|
||||
"details_data" => $details_data,
|
||||
"overall_summary_data" => '',
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
$this->load->view("reports/tabular_details",$data);
|
||||
}
|
||||
|
||||
function excel_export()
|
||||
{
|
||||
$this->load->view("reports/excel_export",array());
|
||||
}
|
||||
|
||||
function inventory_low($export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Inventory_low');
|
||||
$model = $this->Inventory_low;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array());
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level'], $row['location_name']);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_low_inventory_report'),
|
||||
"subtitle" => '',
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array()),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
function inventory_summary($export_excel=0)
|
||||
{
|
||||
$this->load->model('reports/Inventory_summary');
|
||||
$model = $this->Inventory_summary;
|
||||
$tabular_data = array();
|
||||
$report_data = $model->getData(array());
|
||||
foreach($report_data as $row)
|
||||
{
|
||||
$tabular_data[] = array($row['name'], $row['item_number'], $row['description'], $row['quantity'], $row['reorder_level'],$row['location_name']);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
"title" => $this->lang->line('reports_inventory_summary_report'),
|
||||
"subtitle" => '',
|
||||
"headers" => $model->getDataColumns(),
|
||||
"data" => $tabular_data,
|
||||
"summary_data" => $model->getSummaryData(array()),
|
||||
"export_excel" => $export_excel
|
||||
);
|
||||
|
||||
$this->load->view("reports/tabular",$data);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
470
application/controllers/sales.php
Normal file
470
application/controllers/sales.php
Normal file
@@ -0,0 +1,470 @@
|
||||
<?php
|
||||
require_once ("secure_area.php");
|
||||
class Sales extends Secure_area
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('sales');
|
||||
$this->load->library('sale_lib');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function item_search()
|
||||
{
|
||||
$suggestions = $this->Item->get_item_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
$suggestions = array_merge($suggestions, $this->Item_kit->get_item_kit_search_suggestions($this->input->post('q'),$this->input->post('limit')));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function customer_search()
|
||||
{
|
||||
$suggestions = $this->Customer->get_customer_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
function select_customer()
|
||||
{
|
||||
$customer_id = $this->input->post("customer");
|
||||
$this->sale_lib->set_customer($customer_id);
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function change_mode()
|
||||
{
|
||||
$stock_location = $this->input->post("stock_location");
|
||||
if (!$stock_location || $stock_location == $this->sale_lib->get_sale_location())
|
||||
{
|
||||
$this->sale_lib->clear_all();
|
||||
$mode = $this->input->post("mode");
|
||||
$this->sale_lib->set_mode($mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sale_lib->set_sale_location($stock_location);
|
||||
}
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function set_comment()
|
||||
{
|
||||
$this->sale_lib->set_comment($this->input->post('comment'));
|
||||
}
|
||||
|
||||
function set_email_receipt()
|
||||
{
|
||||
$this->sale_lib->set_email_receipt($this->input->post('email_receipt'));
|
||||
}
|
||||
|
||||
//Alain Multiple Payments
|
||||
function add_payment()
|
||||
{
|
||||
$data = array();
|
||||
$this->form_validation->set_rules( 'amount_tendered', 'lang:sales_amount_tendered', 'numeric' );
|
||||
|
||||
if ( $this->form_validation->run() == FALSE )
|
||||
{
|
||||
if ( $this->input->post( 'payment_type' ) == $this->lang->line( 'sales_gift_card' ) )
|
||||
$data['error']=$this->lang->line('sales_must_enter_numeric_giftcard');
|
||||
else
|
||||
$data['error']=$this->lang->line('sales_must_enter_numeric');
|
||||
|
||||
$this->_reload( $data );
|
||||
return;
|
||||
}
|
||||
|
||||
$payment_type = $this->input->post( 'payment_type' );
|
||||
if ( $payment_type == $this->lang->line( 'sales_giftcard' ) )
|
||||
{
|
||||
$payments = $this->sale_lib->get_payments();
|
||||
$payment_type = $this->input->post( 'payment_type' ) . ':' . $payment_amount = $this->input->post( 'amount_tendered' );
|
||||
$current_payments_with_giftcard = isset( $payments[$payment_type] ) ? $payments[$payment_type]['payment_amount'] : 0;
|
||||
$cur_giftcard_value = $this->Giftcard->get_giftcard_value( $this->input->post( 'amount_tendered' ) ) - $current_payments_with_giftcard;
|
||||
|
||||
if ( $cur_giftcard_value <= 0 )
|
||||
{
|
||||
$data['error'] = 'Giftcard balance is ' . to_currency( $this->Giftcard->get_giftcard_value( $this->input->post( 'amount_tendered' ) ) ) . ' !';
|
||||
$this->_reload( $data );
|
||||
return;
|
||||
}
|
||||
|
||||
$new_giftcard_value = $this->Giftcard->get_giftcard_value( $this->input->post( 'amount_tendered' ) ) - $this->sale_lib->get_amount_due( );
|
||||
$new_giftcard_value = ( $new_giftcard_value >= 0 ) ? $new_giftcard_value : 0;
|
||||
$data['warning'] = 'Giftcard ' . $this->input->post( 'amount_tendered' ) . ' balance is ' . to_currency( $new_giftcard_value ) . ' !';
|
||||
$payment_amount = min( $this->sale_lib->get_amount_due( ), $this->Giftcard->get_giftcard_value( $this->input->post( 'amount_tendered' ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$payment_amount = $this->input->post( 'amount_tendered' );
|
||||
}
|
||||
|
||||
if( !$this->sale_lib->add_payment( $payment_type, $payment_amount ) )
|
||||
{
|
||||
$data['error']='Unable to Add Payment! Please try again!';
|
||||
}
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
//Alain Multiple Payments
|
||||
function delete_payment( $payment_id )
|
||||
{
|
||||
$this->sale_lib->delete_payment( $payment_id );
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function add()
|
||||
{
|
||||
$data=array();
|
||||
$mode = $this->sale_lib->get_mode();
|
||||
$item_id_or_number_or_item_kit_or_receipt = $this->input->post("item");
|
||||
$quantity = ($mode=="return")? -1:1;
|
||||
$item_location = $this->sale_lib->get_sale_location();
|
||||
|
||||
if($this->sale_lib->is_valid_receipt($item_id_or_number_or_item_kit_or_receipt) && $mode=='return')
|
||||
{
|
||||
$this->sale_lib->return_entire_sale($item_id_or_number_or_item_kit_or_receipt);
|
||||
}
|
||||
elseif($this->sale_lib->is_valid_item_kit($item_id_or_number_or_item_kit_or_receipt))
|
||||
{
|
||||
$this->sale_lib->add_item_kit($item_id_or_number_or_item_kit_or_receipt,$item_location);
|
||||
}
|
||||
elseif(!$this->sale_lib->add_item($item_id_or_number_or_item_kit_or_receipt,$quantity,$item_location))
|
||||
{
|
||||
$data['error']=$this->lang->line('sales_unable_to_add_item');
|
||||
}
|
||||
|
||||
if($this->sale_lib->out_of_stock($item_id_or_number_or_item_kit_or_receipt,$item_location))
|
||||
{
|
||||
$data['warning'] = $this->lang->line('sales_quantity_less_than_zero');
|
||||
}
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
function edit_item($line)
|
||||
{
|
||||
$data= array();
|
||||
|
||||
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
|
||||
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
|
||||
|
||||
$description = $this->input->post("description");
|
||||
$serialnumber = $this->input->post("serialnumber");
|
||||
$price = $this->input->post("price");
|
||||
$quantity = $this->input->post("quantity");
|
||||
$discount = $this->input->post("discount");
|
||||
$item_location = $this->input->post("location");
|
||||
|
||||
|
||||
if ($this->form_validation->run() != FALSE)
|
||||
{
|
||||
$this->sale_lib->edit_item($line,$description,$serialnumber,$quantity,$discount,$price);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['error']=$this->lang->line('sales_error_editing_item');
|
||||
}
|
||||
|
||||
if($this->sale_lib->out_of_stock($this->sale_lib->get_item_id($line),$item_location))
|
||||
{
|
||||
$data['warning'] = $this->lang->line('sales_quantity_less_than_zero');
|
||||
}
|
||||
|
||||
|
||||
$this->_reload($data);
|
||||
}
|
||||
|
||||
function delete_item($item_number)
|
||||
{
|
||||
$this->sale_lib->delete_item($item_number);
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function remove_customer()
|
||||
{
|
||||
$this->sale_lib->remove_customer();
|
||||
$this->_reload();
|
||||
}
|
||||
|
||||
function complete()
|
||||
{
|
||||
$data['cart']=$this->sale_lib->get_cart();
|
||||
$data['subtotal']=$this->sale_lib->get_subtotal();
|
||||
$data['taxes']=$this->sale_lib->get_taxes();
|
||||
$data['total']=$this->sale_lib->get_total();
|
||||
$data['receipt_title']=$this->lang->line('sales_receipt');
|
||||
$data['transaction_time']= date('m/d/Y h:i:s a');
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$data['show_stock_locations'] = count($stock_locations) > 1;
|
||||
$customer_id=$this->sale_lib->get_customer();
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$comment = $this->sale_lib->get_comment();
|
||||
$emp_info=$this->Employee->get_info($employee_id);
|
||||
$data['payments']=$this->sale_lib->get_payments();
|
||||
$data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1);
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($customer_id!=-1)
|
||||
{
|
||||
$cust_info=$this->Customer->get_info($customer_id);
|
||||
$data['customer']=$cust_info->first_name.' '.$cust_info->last_name;
|
||||
}
|
||||
|
||||
//SAVE sale to database
|
||||
$data['sale_id']='POS '.$this->Sale->save($data['cart'], $customer_id,$employee_id,$comment,$data['payments']);
|
||||
if ($data['sale_id'] == 'POS -1')
|
||||
{
|
||||
$data['error_message'] = $this->lang->line('sales_transaction_failed');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->sale_lib->get_email_receipt() && !empty($cust_info->email))
|
||||
{
|
||||
$this->load->library('email');
|
||||
$config['mailtype'] = 'html';
|
||||
$this->email->initialize($config);
|
||||
$this->email->from($this->config->item('email'), $this->config->item('company'));
|
||||
$this->email->to($cust_info->email);
|
||||
|
||||
$this->email->subject($this->lang->line('sales_receipt'));
|
||||
$this->email->message($this->load->view("sales/receipt_email",$data, true));
|
||||
$this->email->send();
|
||||
}
|
||||
}
|
||||
$this->load->view("sales/receipt",$data);
|
||||
$this->sale_lib->clear_all();
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function receipt($sale_id)
|
||||
{
|
||||
$sale_info = $this->Sale->get_info($sale_id)->row_array();
|
||||
$this->sale_lib->copy_entire_sale($sale_id);
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$data['show_stock_locations'] = count($stock_locations) > 1;
|
||||
$data['cart']=$this->sale_lib->get_cart();
|
||||
$data['payments']=$this->sale_lib->get_payments();
|
||||
$data['subtotal']=$this->sale_lib->get_subtotal();
|
||||
$data['taxes']=$this->sale_lib->get_taxes();
|
||||
$data['total']=$this->sale_lib->get_total();
|
||||
$data['receipt_title']=$this->lang->line('sales_receipt');
|
||||
$data['transaction_time']= date('m/d/Y h:i:s a', strtotime($sale_info['sale_time']));
|
||||
$customer_id=$this->sale_lib->get_customer();
|
||||
$emp_info=$this->Employee->get_info($sale_info['employee_id']);
|
||||
$data['payment_type']=$sale_info['payment_type'];
|
||||
$data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1);
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($customer_id!=-1)
|
||||
{
|
||||
$cust_info=$this->Customer->get_info($customer_id);
|
||||
$data['customer']=$cust_info->first_name.' '.$cust_info->last_name;
|
||||
}
|
||||
$data['sale_id']='POS '.$sale_id;
|
||||
$this->load->view("sales/receipt",$data);
|
||||
$this->sale_lib->clear_all();
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function edit($sale_id)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['customers'] = array('' => 'No Customer');
|
||||
foreach ($this->Customer->get_all()->result() as $customer)
|
||||
{
|
||||
$data['customers'][$customer->person_id] = $customer->first_name . ' '. $customer->last_name;
|
||||
}
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach ($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
$data['employees'][$employee->person_id] = $employee->first_name . ' '. $employee->last_name;
|
||||
}
|
||||
|
||||
$sale_info = $this->Sale->get_info($sale_id)->row_array();
|
||||
$person_name = $sale_info['first_name'] . " " . $sale_info['last_name'];
|
||||
$data['selected_customer'] = !empty($sale_info['customer_id']) ? $sale_info['customer_id'] . "|" . $person_name : "";
|
||||
$data['sale_info'] = $sale_info;
|
||||
|
||||
$this->load->view('sales/form', $data);
|
||||
}
|
||||
|
||||
function delete($sale_id = -1, $update_inventory=TRUE) {
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$sale_ids= $sale_id == -1 ? $this->input->post('ids') : array($sale_id);
|
||||
|
||||
if($this->Sale->delete_list($sale_ids, $employee_id, $update_inventory))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('sales_delete_successful').' '.
|
||||
count($sale_ids).' '.$this->lang->line('sales_one_or_multiple'),'ids'=>$sale_ids));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('sales_delete_unsuccessful')));
|
||||
}
|
||||
}
|
||||
|
||||
function save($sale_id)
|
||||
{
|
||||
$sale_data = array(
|
||||
'sale_time' => date('Y-m-d', strtotime($this->input->post('date'))),
|
||||
'customer_id' => $this->input->post('customer_id') ? $this->input->post('customer_id') : null,
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment')
|
||||
);
|
||||
|
||||
if ($this->Sale->update($sale_data, $sale_id))
|
||||
{
|
||||
echo json_encode(array(
|
||||
'success'=>true,
|
||||
'message'=>$this->lang->line('sales_successfully_updated'),
|
||||
'id'=>$sale_id)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array(
|
||||
'success'=>false,
|
||||
'message'=>$this->lang->line('sales_unsuccessfully_updated'),
|
||||
'id'=>$sale_id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function _payments_cover_total()
|
||||
{
|
||||
$total_payments = 0;
|
||||
|
||||
foreach($this->sale_lib->get_payments() as $payment)
|
||||
{
|
||||
$total_payments += $payment['payment_amount'];
|
||||
}
|
||||
|
||||
/* Changed the conditional to account for floating point rounding */
|
||||
if ( ($this->sale_lib->get_mode() == 'sale') &&
|
||||
( ( to_currency_no_money( $this->sale_lib->get_total() ) - $total_payments ) > 1e-6 ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _reload($data=array())
|
||||
{
|
||||
$person_info = $this->Employee->get_logged_in_employee_info();
|
||||
$data['cart']=$this->sale_lib->get_cart();
|
||||
$data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return'));
|
||||
$data['mode']=$this->sale_lib->get_mode();
|
||||
|
||||
$data['stock_locations'] = array();
|
||||
$stock_locations = $this->Stock_locations->get_undeleted_all()->result_array();
|
||||
$show_stock_locations = count($stock_locations) > 1;
|
||||
if ($show_stock_locations) {
|
||||
foreach($stock_locations as $location_data)
|
||||
{
|
||||
$data['stock_locations'][$location_data['location_id']] = $location_data['location_name'];
|
||||
}
|
||||
$data['stock_location']=$this->sale_lib->get_sale_location();
|
||||
}
|
||||
$data['show_stock_locations'] = $show_stock_locations;
|
||||
|
||||
$data['subtotal']=$this->sale_lib->get_subtotal();
|
||||
$data['taxes']=$this->sale_lib->get_taxes();
|
||||
$data['total']=$this->sale_lib->get_total();
|
||||
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
|
||||
$data['comment'] = $this->sale_lib->get_comment();
|
||||
$data['email_receipt'] = $this->sale_lib->get_email_receipt();
|
||||
$data['payments_total']=$this->sale_lib->get_payments_total();
|
||||
$data['amount_due']=$this->sale_lib->get_amount_due();
|
||||
$data['payments']=$this->sale_lib->get_payments();
|
||||
$data['payment_options']=array(
|
||||
$this->lang->line('sales_cash') => $this->lang->line('sales_cash'),
|
||||
$this->lang->line('sales_check') => $this->lang->line('sales_check'),
|
||||
$this->lang->line('sales_giftcard') => $this->lang->line('sales_giftcard'),
|
||||
$this->lang->line('sales_debit') => $this->lang->line('sales_debit'),
|
||||
$this->lang->line('sales_credit') => $this->lang->line('sales_credit')
|
||||
);
|
||||
|
||||
$customer_id=$this->sale_lib->get_customer();
|
||||
if($customer_id!=-1)
|
||||
{
|
||||
$info=$this->Customer->get_info($customer_id);
|
||||
$data['customer']=$info->first_name.' '.$info->last_name;
|
||||
$data['customer_email']=$info->email;
|
||||
}
|
||||
$data['payments_cover_total'] = $this->_payments_cover_total();
|
||||
$this->load->view("sales/register",$data);
|
||||
$this->_remove_duplicate_cookies();
|
||||
}
|
||||
|
||||
function cancel_sale()
|
||||
{
|
||||
$this->sale_lib->clear_all();
|
||||
$this->_reload();
|
||||
|
||||
}
|
||||
|
||||
function suspend()
|
||||
{
|
||||
$data['cart']=$this->sale_lib->get_cart();
|
||||
$data['subtotal']=$this->sale_lib->get_subtotal();
|
||||
$data['taxes']=$this->sale_lib->get_taxes();
|
||||
$data['total']=$this->sale_lib->get_total();
|
||||
$data['receipt_title']=$this->lang->line('sales_receipt');
|
||||
$data['transaction_time']= date('m/d/Y h:i:s a');
|
||||
$customer_id=$this->sale_lib->get_customer();
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
$comment = $this->input->post('comment');
|
||||
$emp_info=$this->Employee->get_info($employee_id);
|
||||
$payment_type = $this->input->post('payment_type');
|
||||
$data['payment_type']=$this->input->post('payment_type');
|
||||
//Alain Multiple payments
|
||||
$data['payments']=$this->sale_lib->get_payments();
|
||||
$data['amount_change']=to_currency($this->sale_lib->get_amount_due() * -1);
|
||||
$data['employee']=$emp_info->first_name.' '.$emp_info->last_name;
|
||||
|
||||
if($customer_id!=-1)
|
||||
{
|
||||
$cust_info=$this->Customer->get_info($customer_id);
|
||||
$data['customer']=$cust_info->first_name.' '.$cust_info->last_name;
|
||||
}
|
||||
|
||||
$total_payments = 0;
|
||||
|
||||
foreach($data['payments'] as $payment)
|
||||
{
|
||||
$total_payments += $payment['payment_amount'];
|
||||
}
|
||||
|
||||
//SAVE sale to database
|
||||
$data['sale_id']='POS '.$this->Sale_suspended->save($data['cart'], $customer_id,$employee_id,$comment,$data['payments']);
|
||||
if ($data['sale_id'] == 'POS -1')
|
||||
{
|
||||
$data['error_message'] = $this->lang->line('sales_transaction_failed');
|
||||
}
|
||||
$this->sale_lib->clear_all();
|
||||
$this->_reload(array('success' => $this->lang->line('sales_successfully_suspended_sale')));
|
||||
}
|
||||
|
||||
function suspended()
|
||||
{
|
||||
$data = array();
|
||||
$data['suspended_sales'] = $this->Sale_suspended->get_all()->result_array();
|
||||
$this->load->view('sales/suspended', $data);
|
||||
}
|
||||
|
||||
function unsuspend()
|
||||
{
|
||||
$sale_id = $this->input->post('suspended_sale_id');
|
||||
$this->sale_lib->clear_all();
|
||||
$this->sale_lib->copy_entire_suspended_sale($sale_id);
|
||||
$this->Sale_suspended->delete($sale_id);
|
||||
$this->_reload();
|
||||
}
|
||||
}
|
||||
?>
|
||||
82
application/controllers/secure_area.php
Normal file
82
application/controllers/secure_area.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
class Secure_area extends CI_Controller
|
||||
{
|
||||
/*
|
||||
Controllers that are considered secure extend Secure_area, optionally a $module_id can
|
||||
be set to also check if a user can access a particular module in the system.
|
||||
*/
|
||||
function __construct($module_id=null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('Employee');
|
||||
if(!$this->Employee->is_logged_in())
|
||||
{
|
||||
redirect('login');
|
||||
}
|
||||
|
||||
if(!$this->Employee->has_permission($module_id,$this->Employee->get_logged_in_employee_info()->person_id))
|
||||
{
|
||||
redirect('no_access/'.$module_id);
|
||||
}
|
||||
|
||||
//load up global data
|
||||
$logged_in_employee_info=$this->Employee->get_logged_in_employee_info();
|
||||
$data['allowed_modules']=$this->Module->get_allowed_modules($logged_in_employee_info->person_id);
|
||||
$data['user_info']=$logged_in_employee_info;
|
||||
$this->load->vars($data);
|
||||
}
|
||||
|
||||
function _remove_duplicate_cookies ()
|
||||
{
|
||||
//php < 5.3 doesn't have header remove so this function will fatal error otherwise
|
||||
if (function_exists('header_remove'))
|
||||
{
|
||||
$CI = &get_instance();
|
||||
|
||||
// clean up all the cookies that are set...
|
||||
$headers = headers_list();
|
||||
$cookies_to_output = array ();
|
||||
$header_session_cookie = '';
|
||||
$session_cookie_name = $CI->config->item('sess_cookie_name');
|
||||
|
||||
foreach ($headers as $header)
|
||||
{
|
||||
list ($header_type, $data) = explode (':', $header, 2);
|
||||
$header_type = trim ($header_type);
|
||||
$data = trim ($data);
|
||||
|
||||
if (strtolower ($header_type) == 'set-cookie')
|
||||
{
|
||||
header_remove ('Set-Cookie');
|
||||
|
||||
$cookie_value = current(explode (';', $data));
|
||||
list ($key, $val) = explode ('=', $cookie_value);
|
||||
$key = trim ($key);
|
||||
|
||||
if ($key == $session_cookie_name)
|
||||
{
|
||||
// OVERWRITE IT (yes! do it!)
|
||||
$header_session_cookie = $data;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not a session related cookie, add it as normal. Might be a CSRF or some other cookie we are setting
|
||||
$cookies_to_output[] = array ('header_type' => $header_type, 'data' => $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty ($header_session_cookie))
|
||||
{
|
||||
$cookies_to_output[] = array ('header_type' => 'Set-Cookie', 'data' => $header_session_cookie);
|
||||
}
|
||||
|
||||
foreach ($cookies_to_output as $cookie)
|
||||
{
|
||||
header ("{$cookie['header_type']}: {$cookie['data']}", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
131
application/controllers/suppliers.php
Normal file
131
application/controllers/suppliers.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
require_once ("person_controller.php");
|
||||
class Suppliers extends Person_controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct('suppliers');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$config['base_url'] = site_url('/suppliers/index');
|
||||
$config['total_rows'] = $this->Supplier->count_all();
|
||||
$config['per_page'] = '20';
|
||||
$config['uri_segment'] = 3;
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
$data['controller_name']=strtolower(get_class());
|
||||
$data['form_width']=$this->get_form_width();
|
||||
$data['manage_table']=get_supplier_manage_table( $this->Supplier->get_all( $config['per_page'], $this->uri->segment( $config['uri_segment'] ) ), $this );
|
||||
$this->load->view('suppliers/manage',$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns supplier table data rows. This will be called with AJAX.
|
||||
*/
|
||||
function search()
|
||||
{
|
||||
$search=$this->input->post('search');
|
||||
$data_rows=get_supplier_manage_table_data_rows($this->Supplier->search($search),$this);
|
||||
echo $data_rows;
|
||||
}
|
||||
|
||||
/*
|
||||
Gives search suggestions based on what is being searched for
|
||||
*/
|
||||
function suggest()
|
||||
{
|
||||
$suggestions = $this->Supplier->get_search_suggestions($this->input->post('q'),$this->input->post('limit'));
|
||||
echo implode("\n",$suggestions);
|
||||
}
|
||||
|
||||
/*
|
||||
Loads the supplier edit form
|
||||
*/
|
||||
function view($supplier_id=-1)
|
||||
{
|
||||
$data['person_info']=$this->Supplier->get_info($supplier_id);
|
||||
$this->load->view("suppliers/form",$data);
|
||||
}
|
||||
|
||||
/*
|
||||
Inserts/updates a supplier
|
||||
*/
|
||||
function save($supplier_id=-1)
|
||||
{
|
||||
$person_data = array(
|
||||
'first_name'=>$this->input->post('first_name'),
|
||||
'last_name'=>$this->input->post('last_name'),
|
||||
'email'=>$this->input->post('email'),
|
||||
'phone_number'=>$this->input->post('phone_number'),
|
||||
'address_1'=>$this->input->post('address_1'),
|
||||
'address_2'=>$this->input->post('address_2'),
|
||||
'city'=>$this->input->post('city'),
|
||||
'state'=>$this->input->post('state'),
|
||||
'zip'=>$this->input->post('zip'),
|
||||
'country'=>$this->input->post('country'),
|
||||
'comments'=>$this->input->post('comments')
|
||||
);
|
||||
$supplier_data=array(
|
||||
'company_name'=>$this->input->post('company_name'),
|
||||
'account_number'=>$this->input->post('account_number')=='' ? null:$this->input->post('account_number'),
|
||||
);
|
||||
if($this->Supplier->save($person_data,$supplier_data,$supplier_id))
|
||||
{
|
||||
//New supplier
|
||||
if($supplier_id==-1)
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_adding').' '.
|
||||
$supplier_data['company_name'],'person_id'=>$supplier_data['person_id']));
|
||||
}
|
||||
else //previous supplier
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_updating').' '.
|
||||
$supplier_data['company_name'],'person_id'=>$supplier_id));
|
||||
}
|
||||
}
|
||||
else//failure
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('suppliers_error_adding_updating').' '.
|
||||
$supplier_data['company_name'],'person_id'=>-1));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This deletes suppliers from the suppliers table
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$suppliers_to_delete=$this->input->post('ids');
|
||||
|
||||
if($this->Supplier->delete_list($suppliers_to_delete))
|
||||
{
|
||||
echo json_encode(array('success'=>true,'message'=>$this->lang->line('suppliers_successful_deleted').' '.
|
||||
count($suppliers_to_delete).' '.$this->lang->line('suppliers_one_or_multiple')));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode(array('success'=>false,'message'=>$this->lang->line('suppliers_cannot_be_deleted')));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Gets one row for a supplier manage table. This is called using AJAX to update one row.
|
||||
*/
|
||||
function get_row()
|
||||
{
|
||||
$person_id = $this->input->post('row_id');
|
||||
$data_row=get_supplier_data_row($this->Supplier->get_info($person_id),$this);
|
||||
echo $data_row;
|
||||
}
|
||||
|
||||
/*
|
||||
get the width for the add/edit form
|
||||
*/
|
||||
function get_form_width()
|
||||
{
|
||||
return 360;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class MY_Lang extends CI_Lang
|
||||
{
|
||||
public function switch_to($idiom)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
if(is_string($idiom))
|
||||
{
|
||||
$CI->config->set_item('language', $idiom);
|
||||
$loaded = $this->is_loaded;
|
||||
$this->is_loaded = array();
|
||||
|
||||
foreach($loaded as $file)
|
||||
{
|
||||
$filename = strtr($file, '', '_lang.php');
|
||||
$this->load($filename, 'english');
|
||||
$array = $this->load($filename, $idiom, TRUE);
|
||||
foreach($array as $lang_key => $lang_value) {
|
||||
if ($lang_value != '') {
|
||||
$this->language[$lang_key] = $lang_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a single line of text from the language array. Takes variable number
|
||||
* of arguments and supports wildcards in the form of '%1', '%2', etc.
|
||||
* Overloaded function.
|
||||
*
|
||||
* @access public
|
||||
* @return mixed false if not found or the language string
|
||||
*/
|
||||
public function line($line = '', $log_errors = TRUE)
|
||||
{
|
||||
//get the arguments passed to the function
|
||||
$args = func_get_args();
|
||||
|
||||
//count the number of arguments
|
||||
$c = count($args);
|
||||
|
||||
//if one or more arguments, perform the necessary processing
|
||||
if($c)
|
||||
{
|
||||
//first argument should be the actual language line key
|
||||
//so remove it from the array (pop from front)
|
||||
$line = array_shift($args);
|
||||
|
||||
//check to make sure the key is valid and load the line
|
||||
if($line == '')
|
||||
{
|
||||
$line = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->language[$line]) && $this->language[$line] != '')
|
||||
{
|
||||
$line = $this->language[$line];
|
||||
//if the line exists and more function arguments remain
|
||||
//perform wildcard replacements
|
||||
if($args)
|
||||
{
|
||||
$i = 1;
|
||||
foreach($args as $arg)
|
||||
{
|
||||
$line = preg_replace('/\%'.$i.'/', $arg, $line);
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just return label name (with TBD)
|
||||
$line = $this->line_tbd($line);
|
||||
log_message('error', 'Could not find the language line "'.$line.'"');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if no arguments given, no language line available
|
||||
$line = FALSE;
|
||||
}
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
public function line_tbd($line = '')
|
||||
{
|
||||
return $line . ' (TBD)';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class MY_Security extends CI_Security
|
||||
{
|
||||
/**
|
||||
* CSRF Set Cookie with samesite
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return CI_Security
|
||||
*/
|
||||
public function csrf_set_cookie()
|
||||
{
|
||||
$expire = time() + $this->_csrf_expire;
|
||||
$secure_cookie = (bool)config_item('cookie_secure');
|
||||
|
||||
if ($secure_cookie && !is_https())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$path = config_item('cookie_path');
|
||||
|
||||
if (PHP_VERSION_ID < 70300) {
|
||||
|
||||
if (is_https())
|
||||
{
|
||||
$path .= '; samesite=strict';
|
||||
}
|
||||
|
||||
setcookie($this->_csrf_cookie_name,
|
||||
$this->_csrf_hash, $expire,
|
||||
$path,
|
||||
config_item('cookie_domain'),
|
||||
$secure_cookie,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$samesite = is_https() ? 'None' : 'Strict';
|
||||
|
||||
setcookie($this->_csrf_cookie_name,
|
||||
$this->_csrf_hash,
|
||||
['samesite' => $samesite,
|
||||
'secure' => $secure_cookie,
|
||||
'expires' => $expire,
|
||||
'path' => config_item('cookie_path'),
|
||||
'domain' => config_item('cookie_domain'),
|
||||
'httponly' => FALSE]);
|
||||
}
|
||||
|
||||
|
||||
log_message('info', 'CSRF cookie sent');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,14 +1,12 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>404 Page Not Found</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-selection{ background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
@@ -47,7 +45,7 @@ code {
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -1,14 +1,12 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Database Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-selection{ background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
@@ -47,7 +45,7 @@ code {
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -1,14 +1,12 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
?><!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection { background-color: #E13300; color: white; }
|
||||
::-moz-selection { background-color: #E13300; color: white; }
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-selection{ background-color: #E13300; color: white; }
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
@@ -47,7 +45,7 @@ code {
|
||||
#container {
|
||||
margin: 10px;
|
||||
border: 1px solid #D0D0D0;
|
||||
box-shadow: 0 0 8px #D0D0D0;
|
||||
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
|
||||
p {
|
||||
10
application/errors/error_php.php
Normal file
10
application/errors/error_php.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
|
||||
|
||||
<h4>A PHP Error was encountered</h4>
|
||||
|
||||
<p>Severity: <?php echo $severity; ?></p>
|
||||
<p>Message: <?php echo $message; ?></p>
|
||||
<p>Filename: <?php echo $filepath; ?></p>
|
||||
<p>Line Number: <?php echo $line; ?></p>
|
||||
|
||||
</div>
|
||||
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
28
application/helpers/currency_helper.php
Normal file
28
application/helpers/currency_helper.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/** GARRISON MODIFIED 4/20/2013 **/
|
||||
function to_currency($number)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$currency_symbol = $CI->config->item('currency_symbol') ? $CI->config->item('currency_symbol') : '$';
|
||||
if($number >= 0)
|
||||
{
|
||||
if($CI->config->item('currency_side') !== 'currency_side')
|
||||
return $currency_symbol.number_format($number, 2, '.', '');
|
||||
else
|
||||
return number_format($number, 2, '.', '').$currency_symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($CI->config->item('currency_side') !== 'currency_side')
|
||||
return '-'.$currency_symbol.number_format(abs($number), 2, '.', '');
|
||||
else
|
||||
return '-'.number_format(abs($number), 2, '.', '').$currency_symbol;
|
||||
}
|
||||
}
|
||||
/** END MODIFIED **/
|
||||
|
||||
function to_currency_no_money($number)
|
||||
{
|
||||
return number_format($number, 2, '.', '');
|
||||
}
|
||||
?>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* PDF helper
|
||||
*/
|
||||
|
||||
function create_pdf($html, $filename = '')
|
||||
{
|
||||
// need to enable magic quotes for the
|
||||
$dompdf = new Dompdf\Dompdf(array("isRemoteEnabled" => TRUE, "isPhpEnabled" => TRUE));
|
||||
$dompdf->loadHtml(str_replace(array("\n", "\r"), '', $html));
|
||||
$dompdf->render();
|
||||
|
||||
if($filename != '')
|
||||
{
|
||||
$dompdf->stream($filename . '.pdf');
|
||||
}
|
||||
else
|
||||
{
|
||||
return $dompdf->output();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
function generate_import_items_csv($stock_locations,$attributes)
|
||||
{
|
||||
$csv_headers = pack('CCC',0xef,0xbb,0xbf); //Encode the Byte-Order Mark (BOM) so that UTF-8 File headers display properly in Microsoft Excel
|
||||
$csv_headers .= 'Id,Barcode,"Item Name",Category,"Supplier ID","Cost Price","Unit Price","Tax 1 Name","Tax 1 Percent","Tax 2 Name","Tax 2 Percent","Reorder Level",Description,"Allow Alt Description","Item has Serial Number",Image,HSN';
|
||||
$csv_headers .= generate_stock_location_headers($stock_locations);
|
||||
$csv_headers .= generate_attribute_headers($attributes);
|
||||
|
||||
return $csv_headers;
|
||||
}
|
||||
|
||||
function generate_stock_location_headers($locations)
|
||||
{
|
||||
$location_headers = '';
|
||||
|
||||
foreach($locations as $location_name)
|
||||
{
|
||||
$location_headers .= ',"location_' . $location_name . '"';
|
||||
}
|
||||
|
||||
return $location_headers;
|
||||
}
|
||||
|
||||
function generate_attribute_headers($attribute_names)
|
||||
{
|
||||
$attribute_headers = '';
|
||||
unset($attribute_names[-1]);
|
||||
|
||||
foreach($attribute_names as $attribute_name)
|
||||
{
|
||||
$attribute_headers .= ',"attribute_' . $attribute_name . '"';
|
||||
}
|
||||
|
||||
return $attribute_headers;
|
||||
}
|
||||
|
||||
function get_csv_file($file_name)
|
||||
{
|
||||
//TODO: current implementation reads the entire file in. This is memory intensive for large files.
|
||||
//We may want to rework the CSV import feature to read the file in chunks, process it and continue.
|
||||
//It must be done in a way that does not significantly negatively affect performance.
|
||||
ini_set('auto_detect_line_endings', true);
|
||||
|
||||
$csv_rows = FALSE;
|
||||
|
||||
if(($csv_file = fopen($file_name,'r')) !== FALSE)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->helper('security');
|
||||
|
||||
$csv_rows = [];
|
||||
|
||||
//Skip Byte-Order Mark
|
||||
if(bom_exists($csv_file) === TRUE)
|
||||
{
|
||||
fseek($csv_file, 3);
|
||||
}
|
||||
|
||||
$headers = fgetcsv($csv_file);
|
||||
|
||||
while(($row = fgetcsv($csv_file)) !== FALSE)
|
||||
{
|
||||
//Skip empty lines
|
||||
if($row !== array(null))
|
||||
{
|
||||
$csv_rows[] = array_combine($headers, $CI->security->xss_clean($row));
|
||||
}
|
||||
}
|
||||
|
||||
fclose($csv_file);
|
||||
}
|
||||
|
||||
return $csv_rows;
|
||||
}
|
||||
|
||||
function bom_exists(&$file_handle)
|
||||
{
|
||||
$result = FALSE;
|
||||
$candidate = fread($file_handle, 3);
|
||||
|
||||
rewind($file_handle);
|
||||
|
||||
$bom = pack('CCC', 0xef, 0xbb, 0xbf);
|
||||
|
||||
if (0 === strncmp($candidate, $bom, 3))
|
||||
{
|
||||
$result = TRUE;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
@@ -1,4 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
@@ -8,4 +7,4 @@
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user