Compare commits

..

652 Commits

Author SHA1 Message Date
objecttothis
afce945312 Correct Migration
- Programmatically delete an index which requires all constraints to be dropped.
- Removed unneeded blank line in Item model.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2025-03-28 12:16:18 +04:00
objecttothis
84304cad04 Use custom rule to account for all locales
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-11-12 14:24:38 +04:00
dependabot[bot]
6d712f3a1e Bump symfony/process from 7.1.6 to 7.1.7 (#4111)
Bumps [symfony/process](https://github.com/symfony/process) from 7.1.6 to 7.1.7.
- [Release notes](https://github.com/symfony/process/releases)
- [Changelog](https://github.com/symfony/process/blob/7.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/process/compare/v7.1.6...v7.1.7)

---
updated-dependencies:
- dependency-name: symfony/process
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-12 10:48:11 +04:00
objecttothis
2d895b4a9e Adapt Configuration checker for CI4 (#4108)
- Removed $import variable as it is never used and the code generates the csv file for item imports
- Refactored import_customers.csv to match PSR-12 standard file names
- Refactored variable names to match PSR-12 standard variable names
- Updated .editorconfig to reflect PSR-12 requirement for spaces rather than tab symbols. https://www.php-fig.org/psr/psr-12/#24-indenting
- Added version number to browser reporting
- Corrected timezone reporting

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Revert .editorconfig (#3708)

---------

Signed-off-by: objecttothis <objecttothis@gmail.com>
Co-authored-by: jekkos <jeroen.peelaerts@gmail.com>
2024-11-10 09:23:42 +01:00
jekkos
ae27cba6f6 Use v2 npm deploy (#2834) 2024-11-10 00:37:32 +01:00
objecttothis
00a5e1b897 Bump CodeIgniter4 to 4.5.5 (#4106)
Updated composer.json and composer.lock.

- Ran through steps in https://codeigniter.com/user_guide/installation/upgrade_452.html
- Ran through steps in https://codeigniter.com/user_guide/installation/upgrade_453.html (this bumps several packages)
- Ran through steps in https://codeigniter.com/user_guide/installation/upgrade_454.html
- Ran through steps in https://codeigniter.com/user_guide/installation/upgrade_455.html

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-11-05 22:38:54 +01:00
objecttothis
d946b31cf4 Bugfix Attributes not saving (#4080)
Fixed issue with Attribute Values not saving correctly

This issue was caused by the Attribute->attributeValueExists function receiving a date which was already in Y-m-d format, so the conversion was returning false. Added logic to pass the date through if it was already in Y-m-d format.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-11-05 22:37:47 +01:00
Kristoffer Grundström
f66ffc81b7 Translated using Weblate (Swedish)
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/sv/
2024-11-03 01:59:10 +01:00
Kristoffer Grundström
07a38f5a90 Translated using Weblate (Swedish)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/sv/
2024-11-03 01:59:10 +01:00
Kristoffer Grundström
801639957e Translated using Weblate (Swedish)
Currently translated at 100.0% (20 of 20 strings)

Translation: opensourcepos/datepicker
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/datepicker/sv/
2024-11-03 01:59:09 +01:00
Kristoffer Grundström
e384378d27 Translated using Weblate (Swedish)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/messages
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/messages/sv/
2024-11-03 01:59:09 +01:00
Kristoffer Grundström
289fd78113 Translated using Weblate (Swedish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/sv/
2024-10-31 05:54:42 +01:00
Kristoffer Grundström
fc8e7dc116 Translated using Weblate (Swedish)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/sv/
2024-10-31 05:54:42 +01:00
Kristoffer Grundström
ebb1546995 Translated using Weblate (Swedish)
Currently translated at 100.0% (222 of 222 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
06edce9ee2 Translated using Weblate (Swedish)
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
0164d451b1 Translated using Weblate (Swedish)
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
50fe205026 Translated using Weblate (Swedish)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
07d97de067 Translated using Weblate (Swedish)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
fbb2a0d8ab Translated using Weblate (Swedish)
Currently translated at 100.0% (46 of 46 strings)

Translation: opensourcepos/cashups
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/cashups/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
d4f0a1d509 Translated using Weblate (Swedish)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
c20cf68e37 Translated using Weblate (Swedish)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
e64f04dba6 Translated using Weblate (Swedish)
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
1d538ba60c Translated using Weblate (Swedish)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
41bfeab725 Translated using Weblate (Swedish)
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
3053e6a7c9 Translated using Weblate (Swedish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
bf1aa1f986 Translated using Weblate (Swedish)
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
1d4f7eace1 Translated using Weblate (Swedish)
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/sv/
2024-10-29 08:06:42 +01:00
Kristoffer Grundström
f6914701d2 Translated using Weblate (Swedish)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/sv/
2024-10-29 08:06:42 +01:00
objecttothis
004f2b5b65 Populated CSP related directives
- Added TODO
- Copied directives from .htaccess to the ContentSecurityPolicy.php config file.
- Left CSPEnabled set to false in App.php because there is currently no CSP3 support in CI4
- Added `img-src blob:` To Content-Security-Policy header to remove error.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-28 22:22:37 +01:00
objecttothis
18b400ee56 Fix #3633
- Moved PSR/Log to the replace block of the composer json which gets rid of the problem with duplicate installs of PSR/Log.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-28 22:22:37 +01:00
objecttothis
4d6a7fff96 Fix deprecated code
- strlen() can no longer take null as an argument. This change resolves the issue.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-28 22:22:37 +01:00
objecttothis
28b8ff2ea6 Bump Bootstrap-table to 1.23.5
- This does not resolve #3854 but keeps the version up to date.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-28 22:22:37 +01:00
khao_lek
3404ce99d9 Translated using Weblate (Thai)
Currently translated at 100.0% (222 of 222 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/th/
2024-10-24 16:04:34 +02:00
khao_lek
3fb5b997ef Translated using Weblate (Thai)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/th/
2024-10-24 16:04:34 +02:00
jekkos
2da941725e Increase table width on bigger screens 2024-10-19 10:44:38 +02:00
jekkos
6a0f33e5db Fix print after sale (#3985) 2024-10-19 00:35:26 +02:00
jekkos
4369a94363 Fix sale edit form 2024-10-13 23:16:55 +02:00
jekkos
0f7d0a7903 Fix expenses entry (#4075) 2024-10-06 01:29:52 +02:00
jekkos
691ba1e8ca Fix definition flags (#4081) 2024-10-05 02:45:39 +02:00
jekkos
f3277b0d38 Try to fix checkNumeric (#4082) 2024-10-05 02:35:17 +02:00
jekkos
b8a74ba30a Fix employee, supplier, customer (#4086) 2024-10-05 02:27:25 +02:00
jekkos
0f4d06af61 Blind SQL injection fix (#3284) 2024-10-03 00:00:55 +02:00
jekkos
72f147074d Enable html escape + fix XSS (#3965) 2024-10-02 21:29:09 +02:00
objecttothis
951279aabe Pre-view filtering Items Controller
- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

- Bump bootstrap-table to 1.23.1 in attempt to resolve issue with sticky headers
- Sanitize attribute data in tables
- Sanitize item data with controller function.

Signed-off-by: objecttothis <objecttothis@gmail.com>

Sanitize Item data

- Sanitize category and item_number before display in forms.
- refactor check in pic_filename for empty to be best practices compliant.
- Added TODO

Signed-off-by: objecttothis <objecttothis@gmail.com>

Minor changes

- Refactored for code clarity.
- Removed extra blank lines.
- Minor reformatting.
- Added PHPdocs
- bumped bootstrap-table to 1.23.2

Signed-off-by: objecttothis <objecttothis@gmail.com>

Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

- Bump bootstrap-table to 1.23.1 in attempt to resolve issue with sticky headers
- Sanitize attribute data in tables
- Sanitize item data with controller function.

Signed-off-by: objecttothis <objecttothis@gmail.com>

Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

Sanitize Item data

- Sanitize category and item_number before display in forms.
- refactor check in pic_filename for empty to be best practices compliant.
- Added TODO

Signed-off-by: objecttothis <objecttothis@gmail.com>

Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

Removed unnecessary use statement

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-02 21:29:09 +02:00
objecttothis
0e361107ca Explicitly define variables
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-10-01 00:47:03 +02:00
dependabot[bot]
99530d64e0 Bump micromatch from 4.0.5 to 4.0.8 (#4078)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 13:43:59 +04:00
dependabot[bot]
1662ef5856 Bump braces from 3.0.2 to 3.0.3 (#4077)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 13:43:17 +04:00
dependabot[bot]
07ee353113 Bump dompurify from 2.5.1 to 2.5.6 (#4057)
Bumps [dompurify](https://github.com/cure53/DOMPurify) from 2.5.1 to 2.5.6.
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.5.1...2.5.6)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-30 13:37:28 +04:00
objecttothis
0aaac04344 Fixed Only Group By problem (#4073)
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-09-24 14:20:46 +04:00
jekkos
a197226c28 Fix employee search suggestion 2024-09-23 23:31:35 +02:00
jekkos
c606bde733 More giftcard fixes (#2935) 2024-09-23 00:54:46 +02:00
jekkos
42c86ec684 Fix detailed sales report (#4064) 2024-09-22 22:13:43 +02:00
jekkos
4293f70cd5 Fix column refresh after attribute delete (#2911) 2024-09-20 01:15:13 +02:00
jekkos
1406c232a5 Fix attribute save (#4016) 2024-09-20 00:46:50 +02:00
jekkos
822bebaf64 Giftcard modal improvements (#2935) 2024-09-20 00:41:34 +02:00
jekkos
3e32a5e121 Giftcard number validation (#2935) 2024-09-20 00:00:35 +02:00
jekkos
4b8d009c76 Add english fallback if no translation (#3995) 2024-09-17 17:47:30 +02:00
jekkos
7d04371425 Fix checkNumeric validation (#3872) 2024-09-17 02:02:05 +02:00
jekkos
d69e7be848 Fix bugs in expenses form (#3840) 2024-09-17 01:50:35 +02:00
jekkos
9a032d1891 Add refresh after submit in expenses (#3840) 2024-09-17 01:39:34 +02:00
jekkos
7003b124d4 Revert to english (#3995) 2024-09-17 00:54:26 +02:00
jekkos
687ded433f Fix sales date table filtering (#3999) 2024-09-17 00:46:13 +02:00
jekkos
f279877cd6 Fix customer suggestion (#4031) 2024-09-17 00:32:10 +02:00
jekkos
3a7470b4fd Sort on MAX(sale_time) in supplier report (#4055)
Sort on aggregate field reports (#4055)
2024-09-16 23:43:50 +02:00
jekkos
e91a0181af Sort on MAX(sale_time) in supplier report (#4055) 2024-09-16 23:41:59 +02:00
jekkos
b41196966c Remove duplicate attribute_links constraint (#4012) 2024-09-16 14:18:17 +02:00
jekkos
8a346b0b4c Use sqlscript container to read init script (#3826) 2024-09-16 14:18:17 +02:00
jekkos
2e56cf766f Move queries to new migration script (#4012)
Iterate over empty array if no query result
Switch compose back to master
Only remove index if no pk
Remove drop indices
Only person_id changes in this migration
Do not name primary key
2024-09-16 14:18:17 +02:00
Steve Ireland
1c95d35a74 This is intended to start resolving #3634. CIR4 query() now returns false for failed queries
Minor improvements to migrations to report to the log any failures and remove unnecessary key definitions. (#4043)
2024-09-16 14:18:17 +02:00
objecttothis
6eb22276f3 Locale handling of decimals in attribute saves
- Added check in controller to convert locale-specific decimal formats to use a period decimal separator.
- Added PHPdoc explanation

Signed-off-by: objecttothis <objecttothis@gmail.com>

Add TODO to clarify workaround

Signed-off-by: objecttothis <objecttothis@gmail.com>

Fixed bugs in SQL

- Added checks before attempting to delete non-existing values.
- Corrected function which deletes duplicate attribute values and replaces the attribute_ids

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-09-16 14:18:17 +02:00
Johntini
5434eaed03 Translated using Weblate (Spanish)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/es/
2024-09-10 13:13:13 +02:00
Johntini
94a72abf49 Translated using Weblate (Spanish)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/es/
2024-09-10 13:13:13 +02:00
Johntini
b3c8081738 Translated using Weblate (Spanish)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/es/
2024-09-10 13:13:12 +02:00
Johntini
92927e1572 Translated using Weblate (Spanish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es/
2024-09-10 13:13:12 +02:00
Johntini
502db509a2 Translated using Weblate (Spanish)
Currently translated at 100.0% (222 of 222 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/es/
2024-09-10 13:13:12 +02:00
Johntini
439572e403 Translated using Weblate (Spanish)
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/es/
2024-09-10 13:13:11 +02:00
jekkos
3540fa2f6c Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/en_GB/
2024-09-08 12:44:47 +02:00
jekkos
61894c89cd Fix translations file format (#3468) 2024-09-08 01:39:20 +02:00
BNSHKEL
7c0d749d3b Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/ar_LB/
2024-09-07 22:11:27 +02:00
Agung Hari Wijaya
fbd384ecdb Translated using Weblate (Indonesian)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/id/
2024-09-07 22:11:27 +02:00
Agung Hari Wijaya
84be846b5f Translated using Weblate (Indonesian)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/id/
2024-09-07 22:11:26 +02:00
Agung Hari Wijaya
900893109e Translated using Weblate (Indonesian)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/id/
2024-09-07 22:11:26 +02:00
Agung Hari Wijaya
70b8217f23 Translated using Weblate (Indonesian)
Currently translated at 100.0% (222 of 222 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/id/
2024-09-07 22:11:26 +02:00
jekkos
c1dcf4e3c6 Fix for giftcard suggestions (#4030)
Switch back to master in docker-compose.yml
2024-08-28 00:04:56 +02:00
jekkos
f49d763254 XSS mitigation features (#4041)
* Remove HtmlPurifier calls

- All calls to Services::htmlPurifier()->purify() removed from data received from view.
- Bootstrap and bootswatch bump in package-lock.json

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Pre-view filtering Customers Controller

- Refactored code for clarity
- Replaced == with === operator to prevent type juggling
- Added Sanitization of Customer data before being sent to the view

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Bump bootstrap-table to 1.23.1

- Bump bootstrap-table to 1.23.1 in attempt to resolve issue with sticky headers
- Sanitize attribute data in tables
- Sanitize item data with controller function.

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Sanitize Item data

- Sanitize category and item_number before display in forms.
- refactor check in pic_filename for empty to be best practices compliant.
- Added TODO

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Minor changes

- Refactored for code clarity.
- Removed extra blank lines.
- Minor reformatting.
- Added PHPdocs
- bumped bootstrap-table to 1.23.2

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Pre-view filtering Items Controller

- Refactored code for clarity
- Created and called sanitization functions.
- Sanitize TEXT type Attributes before being sent to the view.

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Sanitize Item data

- Sanitize category and item_number before display in forms.
- refactor check in pic_filename for empty to be best practices compliant.
- Added TODO

Signed-off-by: objecttothis <objecttothis@gmail.com>

---------

Signed-off-by: objecttothis <objecttothis@gmail.com>
Co-authored-by: objecttothis <objecttothis@gmail.com>
2024-08-26 11:35:56 +04:00
jekkos
402997f0da Update INSTALL.md 2024-08-17 01:24:27 +02:00
jekkos
0be9488cfb Fix customer sale suggestion (#4031) 2024-08-04 00:13:07 +02:00
objecttothis
e1f8b73005 Add check to migration to prevent errors (#4032)
* Add check to migration

- Only drop the constraint if it exists.

Signed-off-by: objecttothis <objecttothis@gmail.com>

* Automatic bump of package-lock.json

Signed-off-by: objecttothis <objecttothis@gmail.com>

---------

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-07-27 00:08:49 +04:00
Steve Ireland
05538570ec Supplementing issue #3997, this change allows the discount amount to be deleted by the user (instead of needing to enter a zero). 2024-07-26 21:36:19 +02:00
Steve Ireland
82aac4ec79 Resolving issue #3997 for discount type toggle not staying put. 2024-07-26 21:36:19 +02:00
Steve Ireland
d2622e94d7 An attempt to resolve issue #4025. Since a kit item code is prefixed by "KIT" it's not going to work to always assume that the item id is numeric. So "int" needs to be replaced with "string". 2024-07-22 08:38:18 +02:00
Steve Ireland
034f79e157 Start Daily Sales with selected customer (#4019) 2024-07-08 20:48:31 -04:00
Steve Ireland
c972cdfaf4 Correct a constraint that wasn't using the full unique key based on composite keys. (#4014) 2024-07-01 13:25:11 -04:00
Steve Ireland
a1e8841129 Missed a comma (#4012) 2024-06-27 19:38:47 +02:00
jekkos
70ac367761 Reinstate required_username translation (#3468) 2024-06-27 19:38:37 +02:00
Temuri Doghonadze
a9fcbc624b Translated using Weblate (Georgian)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/ci4-upgrade
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/ci4-upgrade/ka/
2024-06-27 19:38:37 +02:00
Temuri Doghonadze
fd163923ad Added translation using Weblate (Georgian) 2024-06-27 19:38:37 +02:00
khao_lek
35fe460692 Translated using Weblate (Thai)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/ci4-upgrade
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/ci4-upgrade/th/
2024-06-27 19:38:37 +02:00
Steve Ireland
0b889ec443 Clean up install.md a bit (#4012)
Corrected primary keys involving person_id.
Corrected a couple of errors in constraints involving compound keys.
2024-06-27 19:38:09 +02:00
jekkos
154fe9f9e3 Temporarily remove linter (#3708) 2024-06-15 17:19:15 +02:00
objecttothis
0bd0d48c91 revert fallback language to en
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
c942f53bf1 Minor fixes.
- Correct capitalization.
- Revert assignment to an invalid language code.
- Correct dynamic assignment in config singleton.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
BudsieBuds
c39b733c90 Language fallback improvement
- Changes for following best practice for CI4 localization
- Norwegian and Urdu languages now working again
- Sort languages by alphabet in config
2024-06-15 17:19:15 +02:00
jekkos
fea38e1608 Sync language files (#3468) 2024-06-15 17:19:15 +02:00
SpookedByRoaches
4436d7396d Fixed get_definition_by_name so that it does not get deleted
definitions.
2024-06-15 17:19:15 +02:00
objecttothis
52723ceeec Updated PHPDocs
- Added @noinspection PhpUnused to AJAX-called functions to remove weak warning that the function is unused. This will be needed for the linter.
- Referenced where the function is called in the PHPdocs.
- Removed redundant transaction. batch_save() is already being run in a transaction.
- Fixed function name in controller and view.
- Removed form helper load because it's autoloaded.
- Corrected variable reference in Secure_Controller.php

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
b3b8e7ec1d HTMLPurifier filtering on searches
- Formatting
- Added calls to HTMLPurifier
- Added filtering
- Refactored out variable for clarity

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
8408bb0d80 Revert push
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
14248edc06 HTMLPurifier filtering
- Replaced == with === to avoid type juggling
- Removed unneeded TODO
- Added HTMLPurifier to composer.json
- Added Service to allow singleton instance of purifier.
- Implemented use in Customer Controller Search function.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
061ed57bf2 - Corrected capitalization
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
SpookedByRoaches
11d5abe6d7 Fixed csv import when updating items that have a barcode 2024-06-15 17:19:15 +02:00
BudsieBuds
e4c1f4a146 Update README.md
Updated Travis CI badge
2024-06-15 17:19:15 +02:00
BudsieBuds
c384909cf6 Update BUILD.md
Reflect changes in #3826
2024-06-15 17:19:15 +02:00
jekkos
dfe614efaf Fix pie charts (#3773) 2024-06-15 17:19:15 +02:00
jekkos
a1c3b2090b Fix graphical reports (#3773) 2024-06-15 17:19:15 +02:00
jekkos
07e09e1948 Fix register functionality
Fix controller method names
2024-06-15 17:19:15 +02:00
jekkos
f81dfe1b0b Fix permissions checkbox state (#3993) 2024-06-15 17:19:15 +02:00
BudsieBuds
9fe578504c Update login screen
- Updated deprecated BS5 classes
- Throw errors in separate alert boxes and not as an <ul>
- Make error translatable
- Small updates/fixes
2024-06-15 17:19:15 +02:00
jekkos
f9f40c7f3c Remove linter overrides (#3708) 2024-06-15 17:19:15 +02:00
jekkos
46009b2062 Remove admin folder from linter (#3708) 2024-06-15 17:19:15 +02:00
jekkos
24772f856f Remove action for userguide (#3708) 2024-06-15 17:19:15 +02:00
jekkos
857ef96724 Add workflow to test coding standards 2024-06-15 17:19:15 +02:00
jekkos
9da7c73415 Fix gulp font copy issue (#3987) 2024-06-15 17:19:15 +02:00
objecttothis
63ae5494a7 - Converted raw queries to QueryBuilder where possible
- Removed completed TODOs
- Added TODOs and comments where needed.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
1328b4d9b8 - Removed TODOs that had been completed
- Added TODO where we need to convert to querybuilder
- Converted to switch statement.
- Removed unnecessary local variable
- Replaced Qualifiers with imports
- Replaced isset() call with null coalescing operator
- Replaced strpos function calls in if statements with str_contains calls
- Removed unnecessary leading \ in use statement
- Replaced deprecated functions
- Updated PHPdocs to match function signature
- Added missing type declarations
- Made class variables private.
- Explicitly declared dynamic properties
- use https:// links instead of http://
- Fixed type error from sending null when editing transactions
- Fixed Search Suggestion function name in Employees, Persons, Suppliers controller
- Fixed function name on Receivings Controller

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
41d06f5f79 Remove unneeded use statement
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
5824f78d55 Convert raw query to querybuilder for security
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
SpookedByRoaches
17908b55ef Make register background colors use bootswatch 2024-06-15 17:19:15 +02:00
jekkos
3963b2c924 Fix redirect + no permission error message 2024-06-15 17:19:15 +02:00
jekkos
8d59cd9d83 Fix no_access route (#3984) 2024-06-15 17:19:15 +02:00
jekkos
bd1af2b854 Fix delete payment (#3983) 2024-06-15 17:19:15 +02:00
jekkos
8886cac056 Update travis file (#3916) 2024-06-15 17:19:15 +02:00
jekkos
8f52e283bb Add gulp compress task (#3916) 2024-06-15 17:19:15 +02:00
jekkos
c9c6a88c5d Add suffix to exported filename (#3970) 2024-06-15 17:19:15 +02:00
jekkos
2fdddbc043 Revert gulp downgrade (#3909) 2024-06-15 17:19:15 +02:00
jekkos
75b00be637 Upgrade jspdf (#3909) 2024-06-15 17:19:15 +02:00
BudsieBuds
dd5a20229d Docker compose typo
Fixed a typo in docker-compose.test file
2024-06-15 17:19:15 +02:00
BudsieBuds
0f098bb741 Docs updated
Updated documentation. Fixed image links, links in changelog, and minor typos.
2024-06-15 17:19:15 +02:00
objecttothis
1bc3d141e9 Bump npm dependencies
- Revert jspdf and jspdf-autotable bump due to problems caused in npm run build
- Correct gulpfile for fixed reference.
- Reverted chartist dependency changes since it broke the build.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
2985b8c6ae Bump npm dependencies
- Revert jspdf and jspdf-autotable bump due to problems caused in npm run build
- Correct gulpfile for fixed reference.
- Reverted chartist dependency changes since it broke the build.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
87b4526078 Bump npm dependencies
- bootstrap-tagsinput-2021 replaced bootstrap-tagsinput because the latter has vulnerabilities.
- Chartist and addons bumped to attempt to resolve issues with graphical reports.
- jspdf and addons bumped due to vulnerabilities.  It's still be broken however.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
c60d81dd88 Removed escaping of data
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
141a644d14 Summary Taxes Report fix
- Added name to group by to satisfy only full groupby settings
- Added commented replacement of the query using query builder which is buggy. See https://forum.codeigniter.com/showthread.php?tid=90756&pid=418212#pid418212

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
84e01d14c6 Summary Reports fix
- Converted query to use QueryBuilder for security.
- Reworked code to generate a BaseBuilder instance and pass it.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
SpookedByRoaches
3d163e1969 Fix for attribute addition for items 2024-06-15 17:19:15 +02:00
WShells
a105308ad4 Fix for Edit Sales Receipt Details
Modal not displaying
2024-06-15 17:19:15 +02:00
WShells
70f464c094 Gift Card edit
Refining code to ensure consistency among other sections.
Replacing FILTER_SANITIZE_NUMBER_FLOAT as it's removing all other chars
2024-06-15 17:19:15 +02:00
WShells
95a1d0b4f1 Fix for Receivings Receipt display
Receivings receipt returning the following errors:
. Param count in the URI are greater than the controller method
. ($supplier_id) must be of type int
2024-06-15 17:19:15 +02:00
WShells
32c05b475d Fix for Receivings Edit form
Receiving form wasn't popping up for update.
2024-06-15 17:19:15 +02:00
WShells
e779ac8a79 Fix for Low Inventory Report
. Param count in the URI are greater than the controller method params.
Now displaying and listing items as needed
2024-06-15 17:19:15 +02:00
objecttothis
80e83448ee Minor formating fix
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
34503b73b8 Fixing Reports
- Corrected sale_time data

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
35e3adeca8 Fixing Reports
- Added checks for array keys not set
- Renamed functions so that reports would generate
- Minor reformatting
- Added sale_id to the groupBy() call to remove error when only full group by is enabled.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
658a9ce553 Fixing routes
- Refactored function name to match the route.
- Added null check on sale date.
- enabled escaping in bootstrap-tables
- removed the esc() function from the

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
6b44aea1c5 Fixing routes
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
WShells
9c0d597159 Fix for invoice barcode 2024-06-15 17:19:15 +02:00
WShells
9516073084 Fix for line break in invoice 2024-06-15 17:19:15 +02:00
WShells
128ac0c63e Fix for New Kit
Fix new kit modal not displaying expecting int
2024-06-15 17:19:15 +02:00
WShells
ffa92dd37c Fix for Receipt & Invoice Reprint / Display through Daily Sales
The param count in the URI are greater than the controller method params. Handler:\App\Controllers\Sales::getIndex
2024-06-15 17:19:15 +02:00
WShells
3d88d1a387 Fix For Gift Card: Always displaying invalid when generated randomly
Upon creating a new gift card and using it to complete the sales alphabetical identifiers are being removed due to FILTER_SANITIZE_NUMBER_FLOAT thus detecting gift card as invalid.
This is a fix unless we should rewrite it in a different way.
2024-06-15 17:19:15 +02:00
WShells
77420083ef Fix for Gift Card Number Display
Gift card number field wasn't displaying
2024-06-15 17:19:15 +02:00
WShells
f5bc497602 Fix for Sale Suspend/Unsuspend 2024-06-15 17:19:15 +02:00
WShells
f75c7fad15 Fix for Sale Suspend/Unsuspend 2024-06-15 17:19:15 +02:00
jekkos
1f2d2efbc2 Set default timezone to UTC 2024-06-15 17:19:15 +02:00
WShells
e07cfd4143 Fix for Shortcuts
Keyboard Shortcuts Help modl returning 404 / not displaying
2024-06-15 17:19:15 +02:00
WShells
9fc2a4edbd Refactoring Change Register Mode
Switched from conditional if stmt to case
2024-06-15 17:19:15 +02:00
WShells
ec283e24dc Fix for Gift Cards creation
($value) must be of type string, int given
Unable to load view upon new gift card creation
2024-06-15 17:19:15 +02:00
WShells
b2f5a94859 Fix for Quantity Update in Register
($decimal) must be of type string, null given
2024-06-15 17:19:15 +02:00
WShells
75f435787c Fix for Update Inventory
Update inventory form ( Adding/Subtracting Qty )
2024-06-15 17:19:15 +02:00
WShells
5e55296ea7 Fix for Item Update in Items
Qty Per Pack: ($decimal) must be of type string, null given
2024-06-15 17:19:15 +02:00
objecttothis
9d083f2fe7 Fixing routes
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
b07051e448 Fixing routes
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
WShells
9508770f47 Fix for Serialnumber & Discount Type
($discount_type) must be of type int
($serialnumber) must be of type string
2024-06-15 17:19:15 +02:00
objecttothis
9ad99a92e0 Cast tax code id's to string
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
57755a338d Routes change
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
WShells
18d0345370 Adding item to sales fix 2024-06-15 17:19:15 +02:00
objecttothis
b593de9f83 Receivings Bugfixes
- Fixed incorrect variable name
- Return empty string on null
- Added return types for mixed return functions

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
5500d3989f Filtering
- Added filtering to decimals which may have different comma separator
- Added formatting of decimals before concatenating into string
- Cast int to string in form_hidden() call

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
73cec25468 Clean up code
- Removed unneeded use statements

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
8197e1918a - Refactor file name to match class name.
- Updated autoload in composer.json to reflect actual structure.
- Removed unneeded use statements

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
665ef5aeef - Updated .gitattributes to automatically convert line endings on commit to LF.
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
e8c6d7e01d - Updated .gitattributes to automatically convert line endings on commit to LF.
- Changed Line endings.
- Prepared Decimals before filtering them for number_float.
- Refactored variable names
- Reworked code for clarity
- Added empty check to POST var.
- Removed unneeded code.
- Removed old TODO.
- changed POST variable check to !empty

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
730d01fb74 CI 4.5.1 fixes
Changed .editorconfig
- Force lf line endings for compatibility with all systems.

Fixed Login
- Removed strtolower() call because getMethod() now returns all uppercase

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
d8ec3a4c6c Changed .editorconfig
- Force lf line endings for compatibility with all systems.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
09f84526ac Added missing filters
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
865044f114 Bump CodeIgniter to 4.5.1
- CodeIgniter 4.5.1
- PSR/Log 3.0.0
- PHP >= 8.1
- Replaced mandatory files.
- Modified breaking change code.
- Modified updated code.
- Added missing files.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
00fed097b0 Update .env template 2024-06-15 17:19:15 +02:00
objecttothis
4c689ec6fd Bump CodeIgniter to 4.5.1
- CodeIgniter 4.5.1
- PSR/Log 3.0.0
- PHP >= 8.1
- Replaced mandatory files.
- Modified breaking change code.
- Modified updated code.
- Added missing files.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
68d3482065 Attribute item form and decimal fixes
- Updated formatting to reflect standard
- Wrapped Decimal type in to_decimals() function for localization
- Fixed function name
- Removed unneeded TODO
- Fixed problems with sales register not receiving decimals with comma for separator properly.

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
9428d1cd61 Attribute item form
- Updated formatting to reflect standard
- Wrapped Decimal type in to_decimals() function for localization

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
34476ce374 Bump CI4 to 4.4.8
- Merged changed files since 4.4.8
- Fixed Breaking changes

Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
79812c5982 Fixing accidentally deleted line of code
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
c71c75d69f - Minor HTML formatting
Signed-off-by: objecttothis <objecttothis@gmail.com>
2024-06-15 17:19:15 +02:00
objecttothis
34246ee885 Prepped barcode for being able to be set by width. 2024-06-15 17:19:15 +02:00
objecttothis
21c84efd2d Formatting
- Added missing ; to "nbsp"
- Remove filtering from checkbox items in controller
- Added null check to checkboxes in controller
- Fixed function naming to avoid 404
- Removed escaping from fixed urls
- Removed esc() wrapping around site_url() which already returns escaped urls.
2024-06-15 17:19:15 +02:00
objecttothis
e71c035671 Formatting
- Made view CI form helper function call format uniform.
- replaced calls to array() with []
- Placed { on its own line
- Removed empty lines where there shouldn't be any.
- Replaced text/javascript with application/javascript as the former is deprecated
2024-06-15 17:19:15 +02:00
odiea
27a4ccdff6 Update Persons.php (#3962)
Back to the original
2024-06-15 17:19:15 +02:00
odiea
ab88f1eec1 Update Persons.php (#3961)
added use Tamtamchik\NameCase\Formatter;
2024-06-15 17:19:15 +02:00
odiea
0f33c399a9 Changed < 0 to == NEW_ENTRY (#3960)
* Update Cashup.php

If(!count_only) was causing the table view to not show properly.

* Update Cashups.php

empty it must not be.

* Update Cashups.php

* Update Expenses.php

* Update Persons.php
2024-06-15 17:19:15 +02:00
odiea
9f78a8a075 Changes to Cash_up and Cash_ups for better date feature and Table view to show data (#3958)
* Update Cashup.php

If(!count_only) was causing the table view to not show properly.

* Update Cashups.php

empty it must not be.
2024-06-15 17:19:15 +02:00
objecttothis
c1c2e9df77 Bumped bootstrap-table to 1.22.4 2024-06-15 17:19:15 +02:00
objecttothis
3d6f0a912a Removed escaping
- Removed escaping from anchor() functions
- Removed escaping from form_helper functions
- added context
2024-06-15 17:19:15 +02:00
objecttothis
6d37414444 Removed escaping 2024-06-15 17:19:15 +02:00
objecttothis
a6b674e995 Barcode & escaping
- Removed overflow-visible as it is not needed.
- Bumped TamTamChik/nameCase to latest.
- Workaround to prevent nameCase from capitalizing the first letter of html entities
- Autoload security_helper.php
- Develop means of escaping outputs without encoding characters we don't want encoded.
- proof of concept in form_basic_info.php
2024-06-15 17:19:15 +02:00
odiea
a2df771f19 Update Customers.php
To keep coding the same
2024-06-15 17:19:15 +02:00
odiea
9926577b2f Update Suppliers.php
this allows correct sorting
2024-06-15 17:19:15 +02:00
odiea
5b8ccb6e2a Update Supplier.php (#3952)
* Update Supplier.php

Only way I could get supplier Category to show properly

* Update receipt.php

This changes display to show Address and New Barcode correctly
2024-06-15 17:19:15 +02:00
objecttothis
e327bb3780 Suppliers Fixes
- Added html_entity_decode() to outputs which had been html encoded
- Added escaping of direct data from the database.
2024-06-15 17:19:15 +02:00
objecttothis
b42d43d71d Change generated Barcodes to SVG 2024-06-15 17:19:15 +02:00
odiea
3555de87f6 Item Kits updates for form and Barcodes to show (#3949)
* Update Item_kits.php

* Update Item_kits.php Barcode Issue

public function Generate Barcodes
changed Code to just c and it started working
2024-06-15 17:19:15 +02:00
objecttothis
0fbbc26ab6 Convert Barcode to new Types 2024-06-15 17:19:15 +02:00
objecttothis
68d6479f0d Decimal changes
- Format percentage per locale rules
- Format sequence as integer, not per quantity rules
- Minor formatting changes
2024-06-15 17:19:15 +02:00
objecttothis
7356500d86 - Fixed missing call to helper and helper function
- Format percentage per locale rules
- Moved constants to Constants.php
- Added PHPdoc comments
- Refactor code for clarity and simplicity.
- Added decimal formatting per locale for display.
- autoload locale helper
- Remove unneeded calls to helpers
- Removed unneeded comments
- fixed errors causing checks in parse_decimals to return false due to locales which use a comma.
2024-06-15 17:19:15 +02:00
objecttothis
7cb9ffd7aa Formattings
- Format of ternary changed for readability
- Corrected CSS to use : instead of =
- Removed Label for item name to allow more text
2024-06-15 17:19:15 +02:00
objecttothis
453ee6c061 Formattings
- Format of ternary changed for readability
- Corrected CSS to use : instead of =
2024-06-15 17:19:15 +02:00
objecttothis
a5b5fccd5e Barcode Changes
- Strip out old code
- Added missing variable declaration
2024-06-15 17:19:15 +02:00
objecttothis
20828ea421 Barcode Changes
- Barcode content is item_id if barcode_number is empty.
- Styling fixes
- Bump picquer/php-barcode-generator version to 2.4.0
- Ported over Receipt Barcode Generation
2024-06-15 17:19:15 +02:00
odiea
5d1670fe65 Update Config.php (#3944)
Remove /Name from config language
2024-06-15 17:19:15 +02:00
odiea
2446b23f6e Update general_config.php (#3942) 2024-06-15 17:19:15 +02:00
odiea
c4d293b1a0 Update Customer form.php 2024-06-15 17:19:15 +02:00
objecttothis
24fd80e4fd Barcode Changes
- Removed mixed type-hint
- Replacing emberlabs code with picquer/php-barcode-generator
2024-06-15 17:19:15 +02:00
objecttothis
183f2472eb Fixed issues related to barcode generation 2024-06-15 17:19:15 +02:00
objecttothis
bf167a06b6 Removed log_message() call for debugging 2024-06-15 17:19:15 +02:00
objecttothis
b4b0b5ff8b CodeIgniter 4.4.5 version bump
- Corrected syntax to allow all 8.x versions of PHP in composer.json
- Bumped CodeIgniter from 4.4.3 to 4.4.5
- Bumped Code from 4.4.3 format to 4.4.4 format
2024-06-15 17:19:15 +02:00
objecttothis
5b725d04d5 Company logo upload
- Added conversion to migration file for delimiter in image_allowed_types
- Corrected business logic for image upload in items form.
- Removed log message used for debugging.
- Replaced '|' with ',' in image_allowed_types save/populate.
2024-06-15 17:19:15 +02:00
objecttothis
5c0325511c Company logo upload
- Corrected errors uploading file
- Renamed remove_logo for proper routing
- Corrected name
- Assigned file extension based on guessFileExtension() for security
- Don't call file upload if no file was specified
- added missing jpeg mime type
- fixed company logo change
2024-06-15 17:19:15 +02:00
objecttothis
a5296e81bb Bump PHP require version range 2024-06-15 17:19:15 +02:00
jekkos
204734570b Inline docker-mysql (#3826)
Fix database.sql mapping
2024-06-15 17:19:15 +02:00
jekkos
cefd200b29 Add suggestion for receiving validation (#3878) 2024-06-15 17:19:15 +02:00
objecttothis
61cc93ab57 Updated helper
- Removed TODO which is already a github issue (https://github.com/opensourcepos/opensourcepos/issues/3833)
- Removed call to auto_detect_line_endings which was deprecated in php 8.1. This only negatively affects files created using macOS 9 or earlier which had an EOL in 2002.
- Updated PHPdoc comments
- Removed unnecessary comments
2024-06-15 17:19:15 +02:00
objecttothis
a810100ca1 Added check to javascript
- Checks to see if response.id is undefined before trying to call toString() against it.
2024-06-15 17:19:15 +02:00
objecttothis
34bc4540bf Added Error log
- Logs message when error encountered during Customers CSV Import
2024-06-15 17:19:15 +02:00
jekkos
b25273ceee Fix docker compose version (#3826) 2024-06-15 17:19:15 +02:00
jekkos
a4b3469369 Fix user/groupadd in container (#3826) 2024-06-15 17:19:15 +02:00
jekkos
84f3bd3bfb Add docker build args (#3826) 2024-06-15 17:19:15 +02:00
Doug Hutcheson
9315d56408 ci4-bugfix to stock locations and item csv import
Stock locations are now being handled correctly in the Configuration stock page, due to a fix to Models/Stock_locations.php  and imports to stock locations from csv are now working due to a correction to Controllers/Items.php
2024-06-15 17:19:15 +02:00
Doug Hutcheson
b36ef3a603 ci4-bugfix to items customers and attributes
Attributes: Noticed log_message() being called with uppercase letters in the level which causes errors in the system; Customers: improved the layout of the stats page in the information dialog issue 3892; Items: got csv import working issue 3896 and bulk edits working - barcode generation does not work yet.
2024-06-15 17:19:15 +02:00
jekkos
fba33ed995 Update packaga-lock.json (#3923) 2024-06-15 17:19:15 +02:00
jekkos
c0cdff7e11 Fix reference to chartist-tooltip (#3923) 2024-06-15 17:19:15 +02:00
objecttothis
cb1b269d7a Datepicker fixes
- Updated datepicker_locale.php to prevent array/string conversion.
- changed bootstrap-datepicker_locale version in package.json to specify which version.
- Changed bootstrap-table back to latest since the github commit did not resolve the issue.
2024-06-15 17:19:15 +02:00
Doug Hutcheson
c01b514596 ci4-bugfix further corrections for lang calls
These files have been patched to correct anomalies in the calls to lang().
2024-06-15 17:19:15 +02:00
Doug Hutcheson
f7bb778351 ci4-bugfix ucase first letter of controller name
Many labels were not picking up the language stings because the langauge file name was being passes to lang() without an uppercase first letter.
2024-06-15 17:19:15 +02:00
Doug Hutcheson
c6d51bff04 ci4 bug fix Sales controller_name and Receivings function name
In Views/sales/register.php two button labels did not show the correct language strings, because the variable '$controller_name' was passed to lang(), but this needed to be given literally as 'Sales'. In Views/receivings/receiving.php, the suggested items autocomplete function was called as stock_item_search and needed to be changed to stockItemSearch. There is also an almost identical function itemSearch, which may indicate that one of the two is redundant and should be pruned, but without documentation to guide me I am unwilling to do that at this time.
2024-06-15 17:19:15 +02:00
jekkos
de9038f450 Remove free query + update CSP (#3885) 2024-06-15 17:19:15 +02:00
jekkos
09bf4d2f31 Update npm dependencies (#3909) 2024-06-15 17:19:15 +02:00
jekkos
7523c0fed8 Fix bstables to commit ca85b98 2024-06-15 17:19:15 +02:00
jekkos
ff4ef97b25 Add back debian base layer in Dockerfile (#3875) 2024-06-15 17:19:15 +02:00
jekkos
5e3fa3c580 Map uid in container (#3875) 2024-06-15 17:19:15 +02:00
jekkos
0669428026 Bump bstables (#3854) 2024-06-15 17:19:15 +02:00
jekkos
9f2474e156 Use loading animation only (#3891) 2024-06-15 17:19:15 +02:00
Doug Hutcheson
9723e82b61 CI4 bug fixes on behalf of DEV-byoos 3776
Changes to Controllers/Receivings.php and Controllers/Sales.php identified by @DEV-byoos, plus a change to Controllers/Customers.php to deal with the new way PHP 8.2 handles missing array keys.
2024-06-15 17:19:15 +02:00
jekkos
8457f1460e Replace Cal. with Calendar (#3864) 2024-06-15 17:19:15 +02:00
jekkos
1789311299 Strip prefix in calendar files (#3864) 2024-06-15 17:19:15 +02:00
jekkos
6b8d788185 Add english calendar language files (#3864) 2024-06-15 17:19:15 +02:00
jekkos
dedb6f9836 Add calendar language files (#3864) 2024-06-15 17:19:15 +02:00
jekkos
c20153aa00 Sync language files (#3468) 2024-06-15 17:19:15 +02:00
jekkos
245dcd2dd1 Add missing docker-mysql.yml (#3826) 2024-06-15 17:19:15 +02:00
jekkos
33a6356cc4 Create backup folder if it does not exist (#3826) 2024-06-15 17:19:15 +02:00
jekkos
8dbb8f8f69 Enable docker config override (#3908) 2024-06-15 17:19:15 +02:00
jekkos
60c3a9a96f Remove stale .bowerrc, update INSTALL.md 2024-06-15 17:19:15 +02:00
jekkos
b4fea6dddc Fix database.sql mount (#3875) 2024-06-15 17:19:15 +02:00
jekkos
681ec28131 Add .git to .dockerignore
This decreases docker image size locally by 700MB
2024-06-15 17:19:15 +02:00
jekkos
cd3581ce28 Try to build with default travis docker (#3875) 2024-06-15 17:19:15 +02:00
jekkos
b89faa3a94 Add back debian base layer in Dockerfile (#3875) 2024-06-15 17:19:15 +02:00
objecttothis
60a5bfdc9a Corrected Function names for routes
- generate_barcode function name changes in Controllers
- generate_barcode function name calls in views
- Added PHPdocs
2024-06-15 17:19:15 +02:00
objecttothis
47341f1a07 Bump tableexport.jquery.plugin
- New version 1.28.0
2024-06-15 17:19:15 +02:00
objecttothis
29d0703426 Fixed report error
- can_show_report() was returning an unexpected value.
2024-06-15 17:19:15 +02:00
objecttothis
ff676aeb93 Fixes
- Removed XLSX export format due to errors.
- Upgraded Fakerphp to try to resolve datepicker issues.
- Attempted to fix datepicker language issues.
- Removed duplicate Sunday in the picker.
2024-06-15 17:19:15 +02:00
objecttothis
05d39ff896 Attempts at correcting problem with JSPDF 2024-06-15 17:19:15 +02:00
objecttothis
b5f93b6325 Fixed Customer CSV import
- Corrected function name for CI4
- Removed trailing whitespace
2024-06-15 17:19:15 +02:00
objecttothis
2efda51309 Fixes
- Removed unneeded use statements
- Corrected function name for routes
- Moved import_customers.csv to writable folder to prevent unauthorized access
- Added return to function to force download
2024-06-15 17:19:15 +02:00
objecttothis
728a6a67e0 Fixed incorrect verb 2024-06-15 17:19:15 +02:00
objecttothis
ae44e38855 Dependencies
- Updated bootstrap-table
- Updated jquery
- Refactored local variable name
- fixed problem with null being sent on no filters
- fixed incorrect reference in view of variables
2024-06-15 17:19:15 +02:00
objecttothis
f662f45bf7 bootstrap-table
- Updated dependency
- Added XLSX format to export formats.
2024-06-15 17:19:15 +02:00
objecttothis
ac3a11c6a3 Corrected ID
- company_name id was overriding in the CSS so that text in the form was 150% and bold.  Changed the ID field
2024-06-15 17:19:15 +02:00
objecttothis
d18d2cf814 PHPdocs
- Removed unnecessary ReflectionException in PHPdoc
- Corrected return details of insert function
- Replaced deprecated class
- Removed Inventory model's insert function because it wasn't providing functionality that the Model class wasn't.
- Corrected the calling method signature for Inventory->insert()
2024-06-15 17:19:15 +02:00
objecttothis
cc58cecff0 Compatibility changes
- Removed `mixed` function return type from some functions for backward compatibility with php 7.4
- Refactored string concatination for readability.
- Added TODO for later
- Corrected PHPdocs
- Removed unneeded TODO
- Refactored function names with mixed snake and pascal case names
2024-06-15 17:19:15 +02:00
objecttothis
ba9bcd7786 PHPdocs
- Added missing PHPdocs
- Corrected Syntax
- Added noinspection parameters to PHPdoc for AJAX called functions
- Added missing function return types
- Added missing parameter types
- Added public keyword to functions without visibility modifier
- Corrected incorrectly formatted PHPdocs
- Added public to constants and functions missing a visibility keyword
2024-06-15 17:19:15 +02:00
objecttothis
88007f56be Fixed enforce_privacy checkbox 2024-06-15 17:19:15 +02:00
objecttothis
4a23adbb2f Corrected Function call
- setAttribute() expects the second parameter to be an int or float. setTextAttribute() resolves this.
- Added TODO
2024-06-15 17:19:15 +02:00
objecttothis
2245aacf81 Refactoring
- Minor formatting fix
- Refactored function name for clarity
- Corrected name of route
2024-06-15 17:19:15 +02:00
objecttothis
a8d67895e7 Remove debugging log_message() references 2024-06-15 17:19:15 +02:00
objecttothis
2a3317a270 Removed htmlspecialchars() calls 2024-06-15 17:19:15 +02:00
objecttothis
1dfa428989 Fixed bug causing checkbox not to populate
- The two values set for show_office_group in the database are 0 and 999. Testing for 1 will always leave the checkbox disabled.
2024-06-15 17:19:15 +02:00
objecttothis
01512b0835 Fixed incorrectly named function for route. 2024-06-15 17:19:15 +02:00
objecttothis
3e3da57543 Fixed multiselect form issues
- Missing `[]` in name of multiselect form.
2024-06-15 17:19:15 +02:00
odiea
d5c767aeb9 Update Config.php (#3884) 2024-06-15 17:19:15 +02:00
objecttothis
7124e4ca5f Minor changes and fixes
- Convert space to tab indents
- Fix location of company_logo file to uploads
2024-06-15 17:19:15 +02:00
objecttothis
c8773ad7b1 Formatting fixes
- Convert space to tab indents
2024-06-15 17:19:15 +02:00
objecttothis
7b224be665 PSR compliance and formatting changes
- Replaced TRUE/FALSE constants with true/false keywords
- Replaced NULL constant with null keyword
- Replaced `<?php echo` in views with shortened `<?=`
- Added missing variable declaration
- Added missing function return type in declaration
- replaced `== true`, `== false`, `=== true` and `=== false` in if statements with simplified forms
2024-06-15 17:19:15 +02:00
objecttothis
588f96a945 Added missing return type to function 2024-06-15 17:19:15 +02:00
objecttothis
0754f2f6e6 Fix Request variable retrieval
- getSearch functions to properly retrieve HTTP vars.
- getVar() function calls replaced with getGet() or getPost()
- replaced TRUE/FALSE constants with true/false keywords
2024-06-15 17:19:15 +02:00
objecttothis
48c04417b8 Fixes
- PHP 8.2 deprecates dynamically declared class properties. Adding these declarations removes deprecation warnings and makes the code PHP 8.3 compatible.
- Add Elvis operator to set search string to an empty string when it's value is null to get rid of an error in the search function call.
- Imported class for OSPOS config
- Replaced private with protected in parent controller's property.
- Removed unneeded TODO
- Refactored local variables
- Replaced ternary notation
- Removed unneeded comments
- Removed unneeded class property
- Removed unneeded @property declarations
- Fixed database version
2024-06-15 17:19:15 +02:00
objecttothis
70ee1ed36e Declared class properties
PHP 8.2 deprecates dynamically declared class properties. Adding these declarations removes deprecation warnings and makes the code PHP 8.3 compatible.
2024-06-15 17:19:15 +02:00
objecttothis
283ee4d7c6 Corrected Problems
- Add missing use statement
- Remove log messages used for debug
2024-06-15 17:19:15 +02:00
objecttothis
0a527abfa0 Corrected Problems
- Corrected type of config property.
- Added property declarations.
2024-06-15 17:19:15 +02:00
objecttothis
3890f50e77 Corrected Problems
- Added types to config.
- Added formatting to DB_log messages
- Corrected bug referencing non-existent OSPOS config property timezone
- set the date_default_timezone to the php-specified default when timezone is not set in the app rather than 'America/New York'
- Added TODO indicating problem.
2024-06-15 17:19:15 +02:00
objecttothis
c4cd60ad58 Update .env
- Corrected order.
- Added db_log_only_long boolean
2024-06-15 17:19:15 +02:00
objecttothis
3da79fc47c Added long running query tag
- Now if queries run for longer than 0.5 s, a tag will be appended to the log [LONG RUNNING QUERY]
- If app.db_log_only_long is set to true in the .env file, the db log will only show long running queries.
2024-06-15 17:19:15 +02:00
objecttothis
e90029dea6 Changed db log file type
- It's inaccurate to log these as .php files since they do not contain php.
2024-06-15 17:19:15 +02:00
objecttothis
ad9645020c Database Logging fixes
- Corrected the event listener names. `post_controller` no longer exists.
- Corrected the db_log_queries function to pull just the most recent query
- Added function to convert time into a more easily understood unit when small
2024-06-15 17:19:15 +02:00
objecttothis
2bb4b7c865 Formatting and naming refactor
- Added `@noinspection PhpUnused` tags to PHPdocs for functions which are called via AJAX.
- removed conversion to array in getResult in favor of returning an array to begin with.
- Refactored variable for clarity.
- declared variable in view coming from controller
- Added PHPdocs
- Refactored nested if/else statements into ternary notation.
- Corrected tab type
- added missing model declaration in view
- Modified query builder to extrapolate out the set() command for clarity
2024-06-15 17:19:15 +02:00
objecttothis
c971e025b8 Fix gitignore
- Removed ignore from master .gitignore
- Added .gitignore to item_pics directory.
- Added .gitignore to uploads directory.
2024-06-15 17:19:15 +02:00
jekkos
05372b96cc Fix string escape (#3468) 2024-06-15 17:19:15 +02:00
objecttothis
086a90b04d Code fixes
- Added PHPdoc tags for the IDE to ignore unused function inspections on AJAX calls.
- set TRUE, FALSE, NULL to true, false, null for PSR-2,12 compliance
2024-06-15 17:19:15 +02:00
objecttothis
6074d984ed Code fixes
- Replaced ternary notation with null coalescing version.
- Removed unnecessary semi-colon
- Replaced `<? echo` with short echo ``<?=`
- declared stay_open explicitly with `let`
- Updated PHPdocs
- Replaced force_download() from the CI3 download helper with CI4 version
- Removed unneeded using statements
- added needed call to db_connect()
- Removed parameter that matches the default value since it's redundant.
2024-06-15 17:19:15 +02:00
objecttothis
20bbe8c783 Formatting fixes 2024-06-15 17:19:15 +02:00
objecttothis
a5cdbe4523 Attributes fixes and warning removal
- Declared variable in view coming down from controller
- refactored javascript variable name to remove duplicate declaration warning
- Import missing class
2024-06-15 17:19:15 +02:00
objecttothis
405583c832 Attributes fixes and warning removal
- when the payments array was folded into sale_data there was an earlier payments[] reference in the foreach loop that didn't get folded in.
- Update PHPdoc
- Added ::class to remove polymorphic call warning
- Removed unreachable 'break;' statement after return statement.
- Added missing return type
- fixed missing assignment of mailchimp_api_key
2024-06-15 17:19:15 +02:00
objecttothis
6a316c56f6 Attributes fixes and warning removal
- missing return type in Events->load_config(), added void
- Dynamic property creation is deprecated starting in php 8.2. The solution is to declare the property in the class before using it.
- Added ::class to model instantiations to remove "potentially polymorphic call" warnings
- Corrected phpdoc
2024-06-15 17:19:15 +02:00
objecttothis
54f5b6fa8f Downgraded laminas/laminas-escaper
- 2.13 drops support for php 7.4 and 8.0
- Fixed 2.12 support for now
2024-06-15 17:19:15 +02:00
objecttothis
e5dcdd5970 Attributes queries fixes
- Minor formatting fixes
- Adding back bitwise equals into query using RawSql()
- Corrected GET method to POST
- Removed if statement causing no attribute values
- Removed param in get() from CI3
- Changed setAttribute to setTextAttribute
- Replaced NULL constant with null keyword PSR-2,12
- Replaced TRUE/FALSE constants with true/false keywords PSR-2,12
- explicit cast to get rid of deprecation warning
2024-06-15 17:19:15 +02:00
jekkos
6b7608fd62 Fix bootstrap tables prefix in conversion 2024-06-15 17:19:15 +02:00
jekkos
43c37da01a Sync language files (#3468) 2024-06-15 17:19:15 +02:00
objecttothis
af21beb19e Resolve issue with item_pics
- item_pics were being escaped by bootstrap-table
2024-06-15 17:19:15 +02:00
objecttothis
0de0f3ec89 bump bootstrap5
- bootstrap5 to 5.3.2
- bootswatch5 to 5.3.2
2024-06-15 17:19:15 +02:00
objecttothis
aa5bfd9b18 bump readable-stream to 4.4.2 2024-06-15 17:19:15 +02:00
objecttothis
3536454638 bump gulp-debug to 5.0.1 2024-06-15 17:19:15 +02:00
objecttothis
08f1318268 bump npm-check-updates to 16.14.6 2024-06-15 17:19:15 +02:00
objecttothis
397194f2ca ignore files in uploads 2024-06-15 17:19:15 +02:00
objecttothis
75d66f62c0 ignore webp files 2024-06-15 17:19:15 +02:00
objecttothis
b19b4818e3 Roll back committed injections 2024-06-15 17:19:15 +02:00
objecttothis
2601fbb7b0 Formatting fixes
- Removed TODOs
- String Interpolation
- Changed quotes in html to match the rest of code
2024-06-15 17:19:15 +02:00
objecttothis
e8e3073553 - Converted statement to ternary notation for readability
- Removed space
- Removed TODO
- Added TODO
2024-06-15 17:19:15 +02:00
objecttothis
6c6b1cb4bc gitignore transient files 2024-06-15 17:19:15 +02:00
objecttothis
8081a98243 gitignore debugbar 2024-06-15 17:19:15 +02:00
objecttothis
3025615ff8 gitignore logs 2024-06-15 17:19:15 +02:00
objecttothis
2fa3ef3c30 Removed non-existent folders from gitignore 2024-06-15 17:19:15 +02:00
objecttothis
aa5fd5d0aa Fixed Thumbnail Generation Endpoint
- String interpolation
- Removed TODO
- Reworked thumbnail creation for CI4
- Corrected capitalization in calling function URL
- Added send() to return the HTTP response
2024-06-15 17:19:15 +02:00
objecttothis
f661284612 fixed out of range segment 2024-06-15 17:19:15 +02:00
objecttothis
fd77dcfc5e Syntax errors
- Deleted extra closing parenthesis
2024-06-15 17:19:15 +02:00
objecttothis
c5c4a528b4 Fixed incorrect session table name 2024-06-15 17:19:15 +02:00
objecttothis
85de6adadb Upgrade CI to 4.4.3
- Bump composer.json/lock to codeigniter 4.4.3
- Fix base_url() call without arguments
- Updated files in the project space
- Bump composer.json/lock to kint 5.0.4
- Update composer.json to include missing CI elements
- Corrected composer.json regarding minimum versions
- Updated README.md to reflect CI4 implementation
- Migrated some Routes.php to Routing.php
- Removed deprecated settings from Config/App.php
2024-06-15 17:19:15 +02:00
objecttothis
93a3788467 Replaced BASEPATH with FCPATH 2024-06-15 17:19:15 +02:00
objecttothis
62cfc67779 add location to gitignore 2024-06-15 17:19:15 +02:00
objecttothis
3072b4c1c0 Remove location from gitignore 2024-06-15 17:19:15 +02:00
jekkos
2c4a2f7af1 Remove Gruntfile.js + bower.json (#3842) 2024-06-15 17:19:15 +02:00
objecttothis
7d791ba59f Corrected keys for Bootstrap_tables.php 2024-06-15 17:19:15 +02:00
objecttothis
74210bead5 Bump to allow php 8.1 2024-06-15 17:19:15 +02:00
Doug Hutcheson
044170b2b1 CI4: Bugfix test sanity of config item
Add a !empty test when dereferencing mailchimp_api_key and mailchimp_list_id from the config array.
2024-06-15 17:19:15 +02:00
Doug Hutcheson
8ea5fc5078 CI4: Bugfix to correct two config issues
Adds 'payment_message' to the app_config table and corrects a typo in Views/login.php where 'Login.form' should have been 'login_form'.
2024-06-15 17:19:15 +02:00
jekkos
b4d117011a Add CI4 language migration scripts (#3468) 2024-06-15 17:19:15 +02:00
Doug Hutcheson
1a465621e0 Ci4 bugfix string interpolation (#3836)
* CI4: Bugfix string interpolation language files

These are the language files with all placeholders converted to CI4 numbered style eg {0}.

* CI4: Bugfix string interpolation source code files

These are the controllers and views which call lang() with parameters to be interpolated.

* CI4: Bugfix string interpolation shell scripts

These are the Linux bash scripts which use the sed (stream editor) utility to convert earlier forms of placeholders to CI4 numeric type. A number of typographical errors in the original Language files were corrected by these scripts.
2024-06-15 17:19:15 +02:00
Edwin Smith
af51e4c735 Clean up work on reports listing view and lang() methods (#3707)
* reworked reports and listing page to handle lang() functions in CI_4

* removed old methods

* update code style

* updated bracket style

---------

Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2024-06-15 17:19:15 +02:00
Doug Hutcheson
310585d8af CI4: Bugfix - add function to remove .env.bak issue #3826
Added function remove_backup() to security_helper.php. Added a call to this from the two places that call check_encryption where the backup is created. Added more defensive code to Config.php to ensure the encrypter  objectexists before it is called to avoid a crash.
2024-06-15 17:19:15 +02:00
jekkos
3690296766 Add CI4 coding standards linter 2024-06-15 17:19:15 +02:00
Doug Hutcheson
9b86ddaac0 CI4: string interpolation changes (#3811)
* Initial setup in a new environment

The result of running the npm build and editing the .env file

* Revert "Initial setup in a new environment"

This reverts commit 23e06dea7f.

* Language interpolation update

I have edited all the interpolations in the en-US tree. To be consistent in using named parameters and not just positional numbers, I also edited the relevant lines in two controllers (Sales.php and Items.php) to send named variables to the lang() calls. The language string 'Sales.invoice_number_duplicate' contains an interploation for 'invoice_number'. This is sent when used by Controllers/Sales.php, but not sent when used by Views/sales/form.php, which means that string will contain a double space where the invoice number should be. The language string 'Customers.csv_import_partially_failed' contains no interpolations but two parameters are not being sent where it is used by Controllers/Customers.php. The string appears to be a near duplicate of 'Items.csv_import_partially_failed' which contains two interpolations. Either the Customers controller needs to be edited, or the Customers language string needs to be revised to look like the Items string.

---------

Co-authored-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
2024-06-15 17:19:15 +02:00
jekkos
d47143bfef Reinstate en-US files (#3468) 2024-06-15 17:19:15 +02:00
objecttothis
76cefada53 added note about intl 2024-06-15 17:19:15 +02:00
jekkos
2b7e37c8d9 Revert to last working Dockerfile (#3584) 2024-06-15 17:19:15 +02:00
Steve Ireland
78a6316062 Correct dockerignore to pick up changes to path folder names. 2024-06-15 17:19:15 +02:00
jekkos
9e182c323b Add back database Dockerfile (#3584) 2024-06-15 17:19:15 +02:00
Steve Ireland
477ceb2317 In Token_lib change App\Models\tokens\Token to App\Models\Tokens\Toke 2024-06-15 17:19:15 +02:00
jekkos
24539101d2 Bump docker base image to php8 2024-06-15 17:19:15 +02:00
Steve Ireland
f5094d62a2 Restore the tables.sql to its virgin state. 2024-06-15 17:19:15 +02:00
jarebear6expepjozn6rakjq5iczi3irqwphcvbswgkahd6b6twnxxid
a2610c3bc9 update int(1) columns in _customers and _cash_up tables to use tinyint (#3709) 2024-06-15 17:19:15 +02:00
Steve Ireland
4798041408 Tack on the void return type onto the Employee:logout method. 2024-06-15 17:19:15 +02:00
objecttothis
1d87de6f7d Sales MVC
- Added todo to Stock_location.php
- make library function return nullable
- Added missing model instantiation
- Commented out Sale model instantiation in library because it's causing infinite loop
- Changed function name prepending get and post required by CI4 autorouting
2024-06-15 17:19:15 +02:00
Steve Ireland
13a14ec310 Remove grunt045 from zipped opensourcepos file. Also fix the call to array_walker since the parameters (even if not used) are validated in PHP 8. 2024-06-15 17:19:15 +02:00
objecttothis
8d80f5a261 CI4 bugfixes
- Added session variable instantiation where needed.
- Added tabular helper to autoload
- removed tabular helper reference where no longer needed.
- Remove esc() references where it was causing display problems.
- Remove excess whitespace on blank line
- Remove unecessary using reference
- Make parameters for dinner table functions nullable
2024-06-15 17:19:15 +02:00
Steve Ireland
145930ce5b Mostly clean up the build documentation, but also corrects an error in the creation of the database script that supports migration from phppos 2024-06-15 17:19:15 +02:00
objecttothis
525c65ffb3 Convert encryption to CI4
- automatic upgrade of encryption key.
- automatic decryption of CI3 data, then re-encryption in CI4 and update of table.
- Fixing save function in app_config model
2024-06-15 17:19:15 +02:00
Steve Ireland
2e06f89724 This revises the build process to handle grunt components requiring two versions of grunt. The new BUILD.md file documents the changes. 2024-06-15 17:19:15 +02:00
objecttothis
ae357cab4a Formatting
- Convert indents to tabs
- Remove unnecessary else statement
- Correct PHPDoc formatting
2024-06-15 17:19:15 +02:00
Steve Ireland
38a1815d31 Adjust the build config to allow building the CI4 branch. 2024-06-15 17:19:15 +02:00
objecttothis
1dd58e922f Corrected link in README.md 2024-06-15 17:19:15 +02:00
jekkos
4123d9d8f7 Use double quotes in language files (#3468) 2024-06-15 17:19:15 +02:00
Samuel
8526947df1 Item thumbnail creation ported to CI4 (#3597)
* pic_thumb() now using CI4 service image

* remove unused lines

Co-authored-by: Samuel Bentil <bentilebo@gmail.com>
2024-06-15 17:19:15 +02:00
jekkos
828fd639b2 Porting over 4f3226b 2024-06-15 17:19:15 +02:00
chunter2
e4fed64976 Porting over e4ca111 2024-06-15 17:19:15 +02:00
objecttothis
de531e20c6 Migrations
- Delete old CI3 file
- Correct format of Migrations file datetime
2024-06-15 17:19:15 +02:00
jekkos
1745e973a1 Apply changes from master 2024-06-15 17:19:15 +02:00
objecttothis
b4f0aaa587 Porting 5669dff 2024-06-15 17:19:15 +02:00
jekkos
2d45ca626b Apply changes from master 2024-06-15 17:19:15 +02:00
objecttothis
f84b795ee6 Upgrade to CodeIgniter 4.1.3 2024-06-15 17:19:15 +02:00
jekkos
73b189b6d4 Prepare rebase: move files to new folder structure 2024-06-15 17:19:15 +02:00
Oleg
a6f4558829 Translated using Weblate (Russian)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ru/
2024-06-04 13:33:51 +02:00
jekkos
bfdffbb944 Update README.md 2024-04-26 08:42:20 +02:00
Poedeloel
7355ee6154 Translated using Weblate (Dutch)
Currently translated at 98.1% (52 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/nl/
2024-04-22 10:54:34 +02:00
Poedeloel
6ecacabe16 Translated using Weblate (Dutch)
Currently translated at 98.1% (217 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/nl/
2024-04-22 10:54:33 +02:00
Poedeloel
0c1cd830f7 Translated using Weblate (Dutch)
Currently translated at 96.2% (76 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/nl/
2024-04-22 10:22:44 +02:00
objecttothis
83a0ca4a5b Update bug report.yml (#3950)
* Update bug report.yml

Changed order of bug report

* Update bug report.yml

Converted values into placeholders
2024-03-20 17:17:52 +04:00
SONKO ABDOU
6c6eb09dcc Translated using Weblate (French)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/fr/
2024-03-17 21:19:57 +01:00
SONKO ABDOU
cad41e5576 Translated using Weblate (French)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/fr/
2024-03-17 21:19:57 +01:00
SONKO ABDOU
dda927ad09 Translated using Weblate (French)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/fr/
2024-03-17 16:42:11 +01:00
SONKO ABDOU
585e674e4d Translated using Weblate (French)
Currently translated at 96.5% (28 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/fr/
2024-03-17 16:42:11 +01:00
Emin Tufan Çetin
d56c78ebc0 Translated using Weblate (Turkish)
Currently translated at 99.1% (116 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/tr/
2024-03-13 03:20:30 +01:00
objecttothis
698f9bb3d7 Update bug report.yml (#3946)
Add option to select a development build
2024-03-12 20:42:27 +04:00
iscdavidhernandez
dc943aecb8 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/es_MX/
2024-03-02 17:50:34 +01:00
jekkos
2618772f20 Update issue templates (#3895) (#3936)
Co-authored-by: odiea <oagnew@aim.com>
2024-02-29 00:16:07 +04:00
khao_lek
d4ee5c12dd Translated using Weblate (Thai)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/th/
2024-02-28 18:28:07 +01:00
khao_lek
1fdebed0e2 Translated using Weblate (Thai)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/th/
2023-12-19 11:05:19 +01:00
khao_lek
5cf744d885 Translated using Weblate (Thai)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/th/
2023-12-19 11:05:18 +01:00
khao_lek
1b8c66122f Translated using Weblate (Thai)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/th/
2023-12-19 11:05:18 +01:00
khao_lek
40a1ec8baf Translated using Weblate (Thai)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/th/
2023-12-19 11:05:17 +01:00
khao_lek
eb4ef3f487 Translated using Weblate (Thai)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/th/
2023-12-19 11:05:16 +01:00
khao_lek
ead1603213 Translated using Weblate (Thai)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/th/
2023-12-19 11:05:15 +01:00
khao_lek
26f10c09b1 Translated using Weblate (Thai)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/th/
2023-12-19 11:05:15 +01:00
donjade
bf7f2e03b7 Translated using Weblate (Chinese (Simplified))
Currently translated at 60.3% (32 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/zh_Hans/
2023-11-14 08:05:17 +01:00
donjade
d21b3f7ba9 Translated using Weblate (Chinese (Simplified))
Currently translated at 28.5% (2 of 7 strings)

Translation: opensourcepos/enum
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/enum/zh_Hans/
2023-11-14 08:05:17 +01:00
donjade
c0fce5fabb Translated using Weblate (Chinese (Simplified))
Currently translated at 93.6% (44 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/zh_Hans/
2023-11-14 08:05:17 +01:00
donjade
9bdaeaa95b Translated using Weblate (Chinese (Simplified))
Currently translated at 63.9% (209 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/zh_Hans/
2023-11-14 08:05:17 +01:00
donjade
ed371a0568 Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/messages
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/messages/zh_Hans/
2023-11-14 08:05:17 +01:00
donjade
5b003c6519 Translated using Weblate (Chinese (Simplified))
Currently translated at 72.7% (8 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/zh_Hans/
2023-11-14 08:05:17 +01:00
jekkos
c00ff28d10 Update npm package secret 2023-11-06 22:29:19 +01:00
jekkos
351ab93523 Update .travis.yml secret 2023-11-06 19:44:06 +01:00
jekkos
7c87ac6f60 Bump to 3.3.9 2023-11-06 09:55:29 +01:00
jekkos
f7b5c6542d Bump jspdf to 1.3.5 2023-11-06 09:47:20 +01:00
FrancescoUK
676e09068e Fix cash_adjustment NULL exception 2023-11-05 13:50:48 +00:00
Flibble
f0067757e2 Translated using Weblate (Czech)
Currently translated at 76.9% (170 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/cs/
2023-11-02 09:35:57 +01:00
Flibble
5ad8af8fe9 Translated using Weblate (Czech)
Currently translated at 54.7% (29 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/cs/
2023-11-02 09:35:56 +01:00
jekkos
7109ab3521 Translated using Weblate (English)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/en/
2023-10-16 23:53:22 +02:00
Johntini
4e182fcde8 Translated using Weblate (Spanish)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/es/
2023-10-09 08:05:23 +02:00
truchosky
bd65957d02 Translated using Weblate (Spanish)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/es/
2023-10-09 08:05:23 +02:00
Johntini
a9e5a0fcfe Translated using Weblate (Spanish)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/es/
2023-10-09 08:05:23 +02:00
Johntini
fc15db9d2c Translated using Weblate (Spanish)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/es/
2023-10-09 08:05:23 +02:00
Johntini
7db56e8ee8 Translated using Weblate (Spanish)
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/es/
2023-10-09 08:05:23 +02:00
Johntini
f035fe7ab3 Translated using Weblate (Spanish)
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/es/
2023-10-09 08:05:23 +02:00
Johntini
8cc8ab61ae Translated using Weblate (Spanish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es/
2023-10-09 08:05:23 +02:00
daN4cat
10b245399d Revert config.php changes 2023-09-02 18:18:32 +01:00
daN4cat
4806c0f700 Various fixes 2023-08-30 23:54:13 +02:00
jekkos
82d7f48ee0 Add semicolon (#3792) 2023-08-29 00:49:20 +02:00
Denis Baryshev
9f377fa40a Update config.php 2023-08-29 00:35:04 +02:00
Denis Baryshev
d0209a711b allow unattended scheme mode
Signed-off-by: Denis Baryshev <dennybaa@gmail.com>
2023-08-29 00:35:04 +02:00
jekkos
57eb9c1e35 Fix tagsinput bower dependency 2023-08-29 00:33:44 +02:00
Jan Kadlec
5ad6097fd1 Fixing typo 2023-08-07 23:45:01 +02:00
Jorge Ivan Contreras Pacheco
712d4c60ae Translated using Weblate (Spanish (Mexico))
Currently translated at 57.3% (39 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/es_MX/
2023-07-28 00:35:48 +02:00
Jorge Ivan Contreras Pacheco
79618f3877 Translated using Weblate (Spanish (Mexico))
Currently translated at 22.2% (26 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/es_MX/
2023-07-27 19:29:17 +02:00
Jorge Ivan Contreras Pacheco
a67872f66d Translated using Weblate (Spanish (Mexico))
Currently translated at 99.3% (325 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es_MX/
2023-07-19 20:41:28 +02:00
WebShells
8659c17ddd Translated using Weblate (Croatian)
Currently translated at 68.3% (151 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/hr/
2023-07-08 18:02:51 +02:00
jekkos
dcb797571e evert "Prepare rebase: move files to new folder structure"
This reverts commit eed0cd1ca0.
2023-05-30 17:52:17 +02:00
Oleg
5bd358dd24 Translated using Weblate (Russian)
Currently translated at 98.6% (218 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/ru/
2023-05-26 20:42:38 +02:00
Oleg
427aa592d9 Translated using Weblate (Russian)
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/ru/
2023-05-24 13:35:59 +02:00
Oleg
6d2e95c4ed Translated using Weblate (Russian)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ru/
2023-05-24 08:57:22 +02:00
Oleg
5852c0a709 Translated using Weblate (Russian)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ru/
2023-05-24 08:57:21 +02:00
Oleg
31ca72fbde Translated using Weblate (Russian)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ru/
2023-05-24 08:57:21 +02:00
Oleg
e6811ce2a1 Translated using Weblate (Russian)
Currently translated at 97.6% (83 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/ru/
2023-05-23 19:25:35 +02:00
Oleg
4d960c7b78 Translated using Weblate (Russian)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ru/
2023-05-23 19:25:35 +02:00
Oleg
a1f50e1df7 Translated using Weblate (Russian)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ru/
2023-05-23 19:25:28 +02:00
Oleg
9de467fd30 Translated using Weblate (Russian)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ru/
2023-05-23 14:47:28 +02:00
Oleg
9be17a277a Translated using Weblate (Russian)
Currently translated at 94.9% (75 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/ru/
2023-05-23 14:47:27 +02:00
Oleg
6c5982b5f2 Translated using Weblate (Russian)
Currently translated at 95.5% (43 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/ru/
2023-05-23 14:47:26 +02:00
Oleg
fd8da94487 Translated using Weblate (Russian)
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/ru/
2023-05-23 14:47:26 +02:00
Oleg
4c04279b1e Translated using Weblate (Russian)
Currently translated at 98.6% (218 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/ru/
2023-05-23 14:47:25 +02:00
Oleg
a56fd88247 Translated using Weblate (Russian)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ru/
2023-05-23 14:47:24 +02:00
Oleg
15edc925ca Translated using Weblate (Russian)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ru/
2023-05-23 14:47:23 +02:00
Oleg
ff4b04757a Translated using Weblate (Russian)
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/ru/
2023-05-23 14:47:22 +02:00
Oleg
3c5ab264ea Translated using Weblate (Russian)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ru/
2023-05-23 11:31:44 +02:00
Oleg
c85fccd99a Translated using Weblate (Russian)
Currently translated at 95.5% (43 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/ru/
2023-05-23 11:31:44 +02:00
Oleg
80cdd2f2d1 Translated using Weblate (Russian)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/messages
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/messages/ru/
2023-05-23 11:31:44 +02:00
Oleg
28ffc64af1 Translated using Weblate (Russian)
Currently translated at 89.6% (130 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ru/
2023-05-23 11:31:43 +02:00
Oleg
ad0476d99e Translated using Weblate (Russian)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/ru/
2023-05-23 11:31:43 +02:00
Oleg
bc2d1f587b Translated using Weblate (Russian)
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/ru/
2023-05-22 19:01:11 +02:00
Oleg
62f53e110e Translated using Weblate (Russian)
Currently translated at 97.6% (83 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/ru/
2023-05-22 19:01:11 +02:00
Oleg
cf5e6dee39 Translated using Weblate (Russian)
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/ru/
2023-05-22 19:01:10 +02:00
Oleg
8890dc30e8 Translated using Weblate (Russian)
Currently translated at 93.1% (109 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ru/
2023-05-22 19:01:10 +02:00
Oleg
35d44ffccc Translated using Weblate (Russian)
Currently translated at 100.0% (20 of 20 strings)

Translation: opensourcepos/datepicker
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/datepicker/ru/
2023-05-22 19:01:09 +02:00
Oleg
b69280ec55 Translated using Weblate (Russian)
Currently translated at 98.1% (52 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/ru/
2023-05-22 19:01:09 +02:00
Oleg
6459ee7ddb Translated using Weblate (Russian)
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/ru/
2023-05-22 19:01:08 +02:00
Oleg
3004f1e9ea Translated using Weblate (Russian)
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/ru/
2023-05-22 19:01:08 +02:00
Oleg
ab88c76596 Translated using Weblate (Russian)
Currently translated at 30.4% (14 of 46 strings)

Translation: opensourcepos/cashups
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/cashups/ru/
2023-05-22 19:01:08 +02:00
Oleg
0e697e3c53 Translated using Weblate (Russian)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ru/
2023-05-22 19:01:07 +02:00
Oleg
75c61b3e49 Translated using Weblate (Russian)
Currently translated at 100.0% (2 of 2 strings)

Translation: opensourcepos/error
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/error/ru/
2023-05-22 19:00:59 +02:00
Oleg
cf45b25a3a Translated using Weblate (Russian)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/ru/
2023-05-22 19:00:59 +02:00
Oleg
5347c4981b Translated using Weblate (Russian)
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/ru/
2023-05-22 19:00:59 +02:00
Oleg
383ffd2e73 Translated using Weblate (Russian)
Currently translated at 28.5% (2 of 7 strings)

Translation: opensourcepos/enum
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/enum/ru/
2023-05-22 19:00:58 +02:00
Oleg
a981387e9f Translated using Weblate (Russian)
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/ru/
2023-05-22 19:00:58 +02:00
Oleg
90ad5ae115 Translated using Weblate (Russian)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/ru/
2023-05-22 12:20:21 +02:00
jekkos
568678587e Revert compose file to v2 (#3754) 2023-05-07 15:12:59 +02:00
jekkos
eed0cd1ca0 Prepare rebase: move files to new folder structure 2023-05-07 15:10:27 +02:00
titusito
a312434b87 Update system_info.php
add php_Xml dependecie check
2023-04-22 21:43:36 +02:00
titusito
69b2c4c51c Update INSTALL.md
add php-xml to needed extensions
2023-04-22 21:08:07 +02:00
Aril Apria Susanto
f2faf1cf32 Translated using Weblate (Indonesian)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/id/
2023-04-12 14:03:43 +02:00
Aril Apria Susanto
2c508f3fe5 Translated using Weblate (Indonesian)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/id/
2023-04-12 14:03:43 +02:00
Aril Apria Susanto
20fad5890f Translated using Weblate (Indonesian)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/id/
2023-04-12 14:03:42 +02:00
Aril Apria Susanto
099d324d2e Translated using Weblate (Indonesian)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/id/
2023-04-12 14:03:42 +02:00
Aril Apria Susanto
2fe82484d7 Translated using Weblate (Indonesian)
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/id/
2023-04-12 14:03:42 +02:00
Aril Apria Susanto
ea99d0234d Translated using Weblate (Indonesian)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/id/
2023-04-12 14:03:41 +02:00
WebShells
0f435621ad Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/en_GB/
2023-04-03 07:50:57 +02:00
WebShells
fda088d4f2 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/en_GB/
2023-04-03 07:50:56 +02:00
WebShells
d71c831a58 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/en_GB/
2023-04-03 07:50:56 +02:00
WebShells
fb40550756 Translated using Weblate (French)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/fr/
2023-04-03 07:50:56 +02:00
WebShells
bb2fc5e888 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (46 of 46 strings)

Translation: opensourcepos/cashups
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/cashups/en_GB/
2023-04-03 07:50:55 +02:00
WebShells
d6a35c66f5 Translated using Weblate (French)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/fr/
2023-04-03 07:50:55 +02:00
WebShells
782438892e Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/ar_EG/
2023-04-03 07:50:55 +02:00
WebShells
9d5d1ced07 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/en_GB/
2023-04-03 07:50:54 +02:00
WebShells
beea0efee8 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/en_GB/
2023-04-03 07:50:54 +02:00
WebShells
f73740547b Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/en_GB/
2023-04-03 07:50:54 +02:00
WebShells
d125c8a5d7 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/ar_LB/
2023-04-03 07:50:54 +02:00
WebShells
610fdf9213 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/ar_EG/
2023-04-03 07:50:53 +02:00
FrancescoUK
21d41ae371 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/en_GB/
2023-04-03 07:50:52 +02:00
WebShells
a35004f1a5 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/en_GB/
2023-04-03 07:50:52 +02:00
WebShells
8c40242a4c Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/en_GB/
2023-04-03 07:50:52 +02:00
WebShells
ca7ea81769 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/ar_EG/
2023-04-03 07:50:51 +02:00
WebShells
05df1dae4b Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/en_GB/
2023-04-03 07:50:51 +02:00
WebShells
d5b4a2745e Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/ar_EG/
2023-04-03 07:50:51 +02:00
WebShells
fd96bac495 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/en_GB/
2023-04-03 07:50:51 +02:00
WebShells
52d1da53d0 Translated using Weblate (Lao)
Currently translated at 55.1% (16 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/lo/
2023-04-03 07:50:49 +02:00
WebShells
abf5bffeff Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/en_GB/
2023-04-03 07:50:49 +02:00
WebShells
a045296b77 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/en_GB/
2023-04-03 07:50:47 +02:00
WebShells
04fb87fd8e Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/en_GB/
2023-04-03 07:50:47 +02:00
WebShells
89d7fcc3ca Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/en_GB/
2023-04-03 07:50:47 +02:00
WebShells
51daf2b70e Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/en_GB/
2023-04-03 07:50:47 +02:00
WebShells
8a2f125c52 Translated using Weblate (French)
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/fr/
2023-04-03 07:50:46 +02:00
WebShells
0f83096296 Translated using Weblate (English (United Kingdom))
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/en_GB/
2023-04-03 07:50:46 +02:00
WebShells
6f0b35bb2c Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/ar_EG/
2023-04-03 07:50:46 +02:00
BudsieBuds
003f68a681 Translated using Weblate (English)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/en/
2023-04-03 07:50:46 +02:00
BudsieBuds
f696731b1d Translated using Weblate (English)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/en/
2023-04-03 07:50:45 +02:00
WebShells
d8ade4b023 Translated using Weblate (English)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/en/
2023-04-03 07:50:45 +02:00
BudsieBuds
36e3861894 Translated using Weblate (English)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/en/
2023-04-03 07:50:45 +02:00
WebShells
1657510ca2 Translated using Weblate (English)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/en/
2023-04-03 07:50:44 +02:00
WebShells
7215747000 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ar_LB/
2023-03-29 11:49:14 +02:00
WebShells
71bfb4681b Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/ar_LB/
2023-03-29 11:49:14 +02:00
WebShells
a98fa2b166 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/ar_EG/
2023-03-29 11:49:14 +02:00
WebShells
922d8491da Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/ar_EG/
2023-03-29 11:49:14 +02:00
WebShells
b7b8c314c7 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ar_LB/
2023-03-29 11:49:13 +02:00
WebShells
580f04dea4 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/ar_EG/
2023-03-29 11:49:13 +02:00
WebShells
3422a15fb1 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/ar_LB/
2023-03-29 11:49:13 +02:00
WebShells
3392c5357f Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/ar_EG/
2023-03-29 11:49:13 +02:00
WebShells
dd329840dc Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/ar_EG/
2023-03-29 11:49:12 +02:00
WebShells
a79d553d5c Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/ar_EG/
2023-03-29 11:49:12 +02:00
WebShells
1eead53cd7 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/ar_EG/
2023-03-29 11:49:12 +02:00
WebShells
8a8235c1e5 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ar_EG/
2023-03-29 11:49:12 +02:00
WebShells
c28a7fba63 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/ar_EG/
2023-03-29 11:49:12 +02:00
WebShells
ecbb00fb1b Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/ar_LB/
2023-03-29 11:49:11 +02:00
WebShells
08f6a1a151 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/ar_LB/
2023-03-29 11:49:11 +02:00
WebShells
f9a6d8ce77 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/ar_EG/
2023-03-29 11:49:11 +02:00
WebShells
253e76b21d Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/ar_LB/
2023-03-29 11:49:10 +02:00
WebShells
312b965c66 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/ar_EG/
2023-03-29 11:49:10 +02:00
WebShells
8bdbd77422 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (68 of 68 strings)

Translation: opensourcepos/giftcards
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/giftcards/ar_LB/
2023-03-29 11:49:10 +02:00
WebShells
af286f00b9 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/ar_LB/
2023-03-29 11:49:10 +02:00
WebShells
dac42b1630 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/ar_LB/
2023-03-29 11:49:09 +02:00
WebShells
3a92ec0da7 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/ar_LB/
2023-03-29 11:49:09 +02:00
WebShells
3766a90540 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/ar_EG/
2023-03-29 11:49:09 +02:00
WebShells
0d2affadc5 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/ar_LB/
2023-03-29 11:49:09 +02:00
WebShells
e5b8a2063f Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/ar_LB/
2023-03-29 11:49:08 +02:00
WebShells
6556e40aff Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/ar_LB/
2023-03-29 11:49:08 +02:00
WebShells
3a0b0af047 Translated using Weblate (Arabic (Egypt))
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/ar_EG/
2023-03-29 11:49:08 +02:00
WebShells
6d3eee6bea Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/ar_LB/
2023-03-29 11:49:08 +02:00
Pascual Marcone
cfdc3cf9a8 Translated using Weblate (Spanish)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/es/
2023-03-20 02:42:47 +01:00
kampvogn
5ecb68a384 Translated using Weblate (Danish)
Currently translated at 20.3% (45 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/da/
2023-03-07 18:54:03 +01:00
dependabot[bot]
3c4dff5ac1 Bump dompdf/dompdf from 2.0.2 to 2.0.3 (#3653)
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v2.0.2...v2.0.3)

---
updated-dependencies:
- dependency-name: dompdf/dompdf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-08 00:40:41 +04:00
dependabot[bot]
eacd7d1f07 Bump mout and grunt-wiredep (#3651)
Bumps [mout](https://github.com/mout/mout) to 1.2.4 and updates ancestor dependency [grunt-wiredep](https://github.com/stephenplusplus/grunt-wiredep). These dependencies need to be updated together.


Updates `mout` from 0.9.1 to 1.2.4
- [Release notes](https://github.com/mout/mout/releases)
- [Changelog](https://github.com/mout/mout/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mout/mout/compare/v0.9.1...v1.2.4)

Updates `grunt-wiredep` from 2.0.0 to 3.0.1
- [Release notes](https://github.com/stephenplusplus/grunt-wiredep/releases)
- [Commits](https://github.com/stephenplusplus/grunt-wiredep/compare/v2.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: mout
  dependency-type: indirect
- dependency-name: grunt-wiredep
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 09:17:22 +04:00
dependabot[bot]
702d0c773c Bump http-cache-semantics and npm (#3645)
Removes [http-cache-semantics](https://github.com/kornelski/http-cache-semantics). It's no longer used after updating ancestor dependency [npm](https://github.com/npm/cli). These dependencies need to be updated together.


Removes `http-cache-semantics`

Updates `npm` from 6.14.15 to 9.4.1
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/cli/compare/v6.14.15...v9.4.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
- dependency-name: npm
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 06:48:46 +04:00
dependabot[bot]
56994b1b85 Bump dompdf/dompdf from 0.8.6 to 2.0.2 (#3643)
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 0.8.6 to 2.0.2.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v0.8.6...v2.0.2)

---
updated-dependencies:
- dependency-name: dompdf/dompdf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 06:43:27 +04:00
dependabot[bot]
6c7ff029d3 Bump debug and grunt-contrib-watch (#3625)
Bumps [debug](https://github.com/debug-js/debug) to 3.2.7 and updates ancestor dependency [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch). These dependencies need to be updated together.


Updates `debug` from 0.7.4 to 3.2.7
- [Release notes](https://github.com/debug-js/debug/releases)
- [Commits](https://github.com/debug-js/debug/compare/0.7.4...3.2.7)

Updates `grunt-contrib-watch` from 0.5.3 to 1.1.0
- [Release notes](https://github.com/gruntjs/grunt-contrib-watch/releases)
- [Changelog](https://github.com/gruntjs/grunt-contrib-watch/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt-contrib-watch/compare/v0.5.3...v1.1.0)

---
updated-dependencies:
- dependency-name: debug
  dependency-type: indirect
- dependency-name: grunt-contrib-watch
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 06:41:44 +04:00
Clifford Cheefoon
57662183f9 update readme 2023-01-31 22:51:42 +01:00
objecttothis
98eff67702 Translated using Weblate (Azerbaijani)
Currently translated at 96.0% (314 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/az/
2023-01-31 01:12:13 +01:00
Boors96
1547663439 Translated using Weblate (Arabic (ar_LB))
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/ar_LB/
2023-01-08 16:11:12 +01:00
jekkos
babe06132c Update README.md 2022-11-28 23:04:10 +01:00
jekkos
db9da86df5 Update version badge 2022-11-27 00:15:17 +01:00
jekkos
b44993f2fa Fix logout race condition (#3578) 2022-10-18 23:00:50 +02:00
khao_lek
3c32944ce9 Translated using Weblate (Thai)
Currently translated at 99.0% (219 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/th/
2022-10-15 05:16:34 +02:00
Nicolás Gómez Solano
8d8487a637 Translated using Weblate (Spanish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es/
2022-10-08 06:20:07 +02:00
Aamir Shahzad
b449c10f0d Updated my info 2022-10-04 22:32:14 +02:00
Aamir Shahzad
a91f21ca05 Timezone added for Pakistan 2022-10-04 22:32:14 +02:00
Aamir Shahzad
a501dc9b99 Fix closing parenthesis, otherwise ENVIRONMENT always resulted true & path added as tests/ 2022-10-04 22:32:14 +02:00
jekkos
06ca9e9f74 Update DO offer 2022-10-04 14:41:21 +02:00
Aril Apria Susanto
56bb57ba8a Translated using Weblate (Indonesian)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/id/
2022-09-26 09:50:58 +02:00
Cheabhak Ezecom
20dad261fd Translated using Weblate (Central Khmer)
Currently translated at 43.8% (97 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/km/
2022-09-14 16:53:36 +02:00
Cheabhak Ezecom
6c60a6aa78 Translated using Weblate (Central Khmer)
Currently translated at 100.0% (2 of 2 strings)

Translation: opensourcepos/error
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/error/km/
2022-09-13 14:41:01 +02:00
Cheabhak Ezecom
e48f408635 Translated using Weblate (Central Khmer)
Currently translated at 97.4% (114 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/km/
2022-09-13 14:41:01 +02:00
Cheabhak Ezecom
87af7df2a5 Translated using Weblate (Central Khmer)
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/km/
2022-09-13 14:41:00 +02:00
Cheabhak Ezecom
67aadb48ae Translated using Weblate (Central Khmer)
Currently translated at 31.6% (70 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/km/
2022-09-13 14:41:00 +02:00
Cheabhak Ezecom
5248e964ff Translated using Weblate (Central Khmer)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/km/
2022-09-13 14:40:59 +02:00
Cheabhak Ezecom
fd474f548e Translated using Weblate (Central Khmer)
Currently translated at 37.9% (11 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/km/
2022-09-12 22:03:30 +02:00
robbytriadi
78d2ca72b2 Translated using Weblate (Indonesian)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/id/
2022-09-10 12:37:34 +02:00
robbytriadi
ed7613b7da Translated using Weblate (Indonesian)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/id/
2022-09-10 12:37:33 +02:00
Cheabhak Ezecom
0b2198e229 Translated using Weblate (Central Khmer)
Currently translated at 65.0% (13 of 20 strings)

Translation: opensourcepos/datepicker
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/datepicker/km/
2022-09-09 10:43:01 +02:00
Cheabhak Ezecom
5f5fe5eb47 Translated using Weblate (Central Khmer)
Currently translated at 100.0% (7 of 7 strings)

Translation: opensourcepos/enum
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/enum/km/
2022-09-09 10:43:01 +02:00
Cheabhak Ezecom
1da81e95b3 Translated using Weblate (Central Khmer)
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/km/
2022-09-09 10:43:01 +02:00
Cheabhak Ezecom
c45e164a83 Translated using Weblate (Central Khmer)
Currently translated at 95.2% (81 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/km/
2022-09-06 09:56:48 +02:00
Cheabhak Ezecom
2bf9effe1d Translated using Weblate (Central Khmer)
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/km/
2022-09-06 09:56:48 +02:00
Kasper
bd4ec13b9a Translated using Weblate (Danish)
Currently translated at 51.7% (75 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/da/
2022-09-05 00:07:06 +02:00
Aril Apria Susanto
44651de42b Translated using Weblate (Indonesian)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/id/
2022-08-11 18:03:57 +02:00
jekkos
ffe49278fc Bump to 3.3.8 2022-08-03 08:50:41 +02:00
Nguyen Tuan Anh
2eb6d85818 Translated using Weblate (Vietnamese)
Currently translated at 99.0% (219 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/vi/
2022-08-02 03:21:05 +02:00
Johntini
d5e371d0ef Translated using Weblate (Spanish)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/es/
2022-07-29 02:30:19 +02:00
Johntini
306cfbef7c Translated using Weblate (Spanish)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/es/
2022-07-29 02:30:19 +02:00
Johntini
9ce55583f5 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es_MX/
2022-07-29 02:30:18 +02:00
Johntini
f2dd1131a2 Translated using Weblate (Spanish)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/es/
2022-07-29 02:30:16 +02:00
Johntini
4df6d708dc Translated using Weblate (Spanish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es/
2022-07-29 02:30:16 +02:00
Johntini
dbf2ee711e Translated using Weblate (Spanish)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/es/
2022-07-29 02:30:15 +02:00
Johntini
aff43196eb Translated using Weblate (Spanish)
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/es/
2022-07-29 02:30:14 +02:00
Johntini
8d8d9b7b54 Translated using Weblate (Spanish)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/es/
2022-07-29 02:30:14 +02:00
Johntini
76a96503da Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es_MX/
2022-07-28 13:05:40 +02:00
Johntini
6cfb6abbf9 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/es_MX/
2022-07-28 13:05:37 +02:00
khao_lek
b864e684b6 Translated using Weblate (Thai)
Currently translated at 97.7% (44 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/th/
2022-07-28 13:05:37 +02:00
Ricardo Vargas
1516006646 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/es_MX/
2022-07-28 13:05:37 +02:00
Johntini
86757cb11a Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/es_MX/
2022-07-28 13:05:36 +02:00
Johntini
96abcf6ba9 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/es_MX/
2022-07-28 05:09:28 +02:00
Johntini
4ae8505a19 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/es_MX/
2022-07-28 05:09:27 +02:00
Johntini
5b6ada58d4 Translated using Weblate (Spanish (Mexico))
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/es_MX/
2022-07-28 05:09:25 +02:00
Val Thi
d2301dbfde Translated using Weblate (French)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/fr/
2022-07-14 21:48:12 +02:00
Val Thi
0ec9a85990 Translated using Weblate (French)
Currently translated at 100.0% (12 of 12 strings)

Translation: opensourcepos/messages
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/messages/fr/
2022-07-14 21:48:11 +02:00
Val Thi
6181953039 Translated using Weblate (French)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/fr/
2022-07-14 21:48:11 +02:00
Val Thi
d81d0b2fc5 Translated using Weblate (French)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/fr/
2022-07-14 21:48:10 +02:00
Val Thi
b37cc5ee8b Translated using Weblate (French)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/fr/
2022-07-14 21:48:09 +02:00
Val Thi
5daed8cc84 Translated using Weblate (French)
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/fr/
2022-07-14 21:48:09 +02:00
Val Thi
8ea4869f4d Translated using Weblate (French)
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/fr/
2022-07-14 07:25:56 +02:00
Val Thi
2b3818c5da Translated using Weblate (French)
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/fr/
2022-07-14 07:25:56 +02:00
Val Thi
1bb96f6dda Translated using Weblate (French)
Currently translated at 100.0% (20 of 20 strings)

Translation: opensourcepos/datepicker
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/datepicker/fr/
2022-07-14 07:25:56 +02:00
Val Thi
f3f1d0e28c Translated using Weblate (French)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/fr/
2022-07-14 07:25:56 +02:00
Val Thi
05229bc2f6 Translated using Weblate (French)
Currently translated at 100.0% (8 of 8 strings)

Translation: opensourcepos/bootstrap_tables
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/bootstrap_tables/fr/
2022-07-14 07:25:55 +02:00
Val Thi
fbb4739673 Translated using Weblate (French)
Currently translated at 92.9% (79 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/fr/
2022-07-14 07:25:55 +02:00
Val Thi
90186bc667 Translated using Weblate (French)
Currently translated at 100.0% (55 of 55 strings)

Translation: opensourcepos/receivings
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/receivings/fr/
2022-07-14 07:25:55 +02:00
Val Thi
bd9d2c00a7 Translated using Weblate (French)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/fr/
2022-07-14 07:25:55 +02:00
Val Thi
e91fcd8bb9 Translated using Weblate (French)
Currently translated at 88.0% (288 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/fr/
2022-07-14 07:25:55 +02:00
Val Thi
d44dbb8760 Translated using Weblate (French)
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/fr/
2022-07-14 07:25:54 +02:00
Val Thi
1649b81038 Translated using Weblate (French)
Currently translated at 93.1% (109 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/fr/
2022-07-14 07:25:54 +02:00
Val Thi
16ded77931 Translated using Weblate (French)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/fr/
2022-07-14 07:25:54 +02:00
Val Thi
f8f186ca2e Translated using Weblate (French)
Currently translated at 100.0% (29 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/fr/
2022-07-14 07:25:53 +02:00
Val Thi
94bd295188 Translated using Weblate (French)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/fr/
2022-07-14 07:25:53 +02:00
Val Thi
0aa2dd3f6c Translated using Weblate (French)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/fr/
2022-07-14 07:25:53 +02:00
Val Thi
cbed9e4882 Translated using Weblate (French)
Currently translated at 100.0% (46 of 46 strings)

Translation: opensourcepos/cashups
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/cashups/fr/
2022-07-14 07:25:52 +02:00
Val Thi
31fa79e27a Translated using Weblate (French)
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/fr/
2022-07-14 07:25:52 +02:00
Val Thi
7f1411edbc Translated using Weblate (French)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/fr/
2022-07-14 02:37:27 +02:00
Val Thi
2e41975c4e Translated using Weblate (French)
Currently translated at 92.1% (35 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/fr/
2022-07-14 02:37:27 +02:00
Val Thi
1740a69e7c Translated using Weblate (French)
Currently translated at 100.0% (19 of 19 strings)

Translation: opensourcepos/expenses_categories
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses_categories/fr/
2022-07-14 02:37:27 +02:00
Val Thi
0544e13211 Translated using Weblate (French)
Currently translated at 84.8% (123 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/fr/
2022-07-14 02:37:27 +02:00
Val Thi
2da2895062 Translated using Weblate (French)
Currently translated at 90.9% (10 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/fr/
2022-07-14 02:37:27 +02:00
Val Thi
f11f4eeb2d Translated using Weblate (French)
Currently translated at 95.0% (19 of 20 strings)

Translation: opensourcepos/datepicker
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/datepicker/fr/
2022-07-14 02:37:27 +02:00
Val Thi
71efb0262f Translated using Weblate (French)
Currently translated at 96.5% (28 of 29 strings)

Translation: opensourcepos/attributes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/attributes/fr/
2022-07-14 02:37:27 +02:00
jekkos
f061a83317 Substract refund from total rewards (#3536) 2022-06-30 14:22:26 +02:00
jekkos
e09875e5f3 Use POST to prevent CSRF logo attack (#3533) 2022-06-30 00:25:35 +02:00
Josuw
6a244d1beb Translated using Weblate (Spanish (Mexico))
Currently translated at 21.3% (25 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/es_MX/
2022-06-24 01:04:04 +02:00
Josuw
5695b74f1b Translated using Weblate (Spanish (Mexico))
Currently translated at 98.8% (84 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/es_MX/
2022-06-24 01:04:04 +02:00
jekkos
77393d1d21 Add zipfile to releases (#3519) 2022-06-16 10:53:30 +02:00
Dzung Do
b366641fbc Translated using Weblate (Vietnamese)
Currently translated at 90.9% (10 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/vi/
2022-06-03 05:54:03 +02:00
Dzung Do
bde0dc0b7c Translated using Weblate (Vietnamese)
Currently translated at 34.7% (16 of 46 strings)

Translation: opensourcepos/cashups
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/cashups/vi/
2022-06-03 05:54:03 +02:00
Dzung Do
f99d0dca8d Translated using Weblate (Vietnamese)
Currently translated at 49.3% (39 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/vi/
2022-06-03 05:54:03 +02:00
Dzung Do
24f8c94c49 Translated using Weblate (Vietnamese)
Currently translated at 91.7% (78 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/vi/
2022-06-03 05:54:03 +02:00
dependabot[bot]
7e3d048bfc Bump grunt from 1.5.2 to 1.5.3
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.5.2 to 1.5.3.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.5.2...v1.5.3)

---
updated-dependencies:
- dependency-name: grunt
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 09:47:02 +02:00
FastAct
122a827645 Translated using Weblate (Flemish)
Currently translated at 100.0% (53 of 53 strings)

Translation: opensourcepos/customers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/customers/nl_BE/
2022-05-25 14:01:36 +02:00
FastAct
427c4c7d3d Translated using Weblate (Flemish)
Currently translated at 100.0% (38 of 38 strings)

Translation: opensourcepos/item_kits
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/item_kits/nl_BE/
2022-05-25 14:01:36 +02:00
FastAct
6ca1cb739f Translated using Weblate (Flemish)
Currently translated at 100.0% (145 of 145 strings)

Translation: opensourcepos/reports
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/reports/nl_BE/
2022-05-25 14:01:36 +02:00
FastAct
070d989548 Translated using Weblate (Flemish)
Currently translated at 100.0% (21 of 21 strings)

Translation: opensourcepos/suppliers
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/suppliers/nl_BE/
2022-05-25 14:01:36 +02:00
FastAct
cd0132c22c Translated using Weblate (Flemish)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/nl_BE/
2022-05-25 14:01:35 +02:00
FastAct
9f8cf48467 Translated using Weblate (Flemish)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/nl_BE/
2022-05-25 14:01:35 +02:00
FastAct
206b56333a Translated using Weblate (Flemish)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/nl_BE/
2022-05-25 14:01:35 +02:00
FastAct
cf59d6779e Translated using Weblate (Flemish)
Currently translated at 100.0% (327 of 327 strings)

Translation: opensourcepos/config
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/config/nl_BE/
2022-05-25 14:01:35 +02:00
FastAct
68ed73ab3b Translated using Weblate (Flemish)
Currently translated at 100.0% (41 of 41 strings)

Translation: opensourcepos/employees
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/employees/nl_BE/
2022-05-25 14:01:34 +02:00
FastAct
e5236dd510 Translated using Weblate (Flemish)
Currently translated at 100.0% (221 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/nl_BE/
2022-05-25 14:01:34 +02:00
FastAct
d1f8c15f3e Translated using Weblate (Flemish)
Currently translated at 100.0% (79 of 79 strings)

Translation: opensourcepos/taxes
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/taxes/nl_BE/
2022-05-25 14:01:33 +02:00
FastAct
6810f613a0 Translated using Weblate (Flemish)
Currently translated at 100.0% (45 of 45 strings)

Translation: opensourcepos/module
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/module/nl_BE/
2022-05-25 14:01:32 +02:00
FastAct
3980f248ed Translated using Weblate (Flemish)
Currently translated at 100.0% (47 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/nl_BE/
2022-05-25 14:01:32 +02:00
Natig Asadov
bf2cf416db Translated using Weblate (Azerbaijani)
Currently translated at 99.5% (220 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/az/
2022-05-18 04:36:03 +02:00
knnhsn
772d42490b Translated using Weblate (Azerbaijani)
Currently translated at 97.8% (46 of 47 strings)

Translation: opensourcepos/expenses
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/expenses/az/
2022-05-16 12:43:12 +02:00
Natig Asadov
c580e4cdee Translated using Weblate (Azerbaijani)
Currently translated at 100.0% (85 of 85 strings)

Translation: opensourcepos/common
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/common/az/
2022-05-13 05:44:30 +02:00
Natig Asadov
efe4becfab Translated using Weblate (Azerbaijani)
Currently translated at 100.0% (117 of 117 strings)

Translation: opensourcepos/items
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/items/az/
2022-05-13 05:44:30 +02:00
Natig Asadov
d1c25991fe Translated using Weblate (Azerbaijani)
Currently translated at 100.0% (11 of 11 strings)

Translation: opensourcepos/login
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/login/az/
2022-05-13 05:44:29 +02:00
khao_lek
528ebf8e20 Translated using Weblate (Thai)
Currently translated at 99.0% (219 of 221 strings)

Translation: opensourcepos/sales
Translate-URL: https://translate.opensourcepos.org/projects/opensourcepos/sales/th/
2022-05-10 21:47:53 +02:00
2742 changed files with 140313 additions and 129119 deletions

View File

@@ -1,7 +0,0 @@
{
"directory": "public/bower_components",
"scripts": {
"postinstall": "grunt default genlicense",
"postuninstall": "grunt default genlicense"
}
}

View File

@@ -1,6 +1,6 @@
node_modules
tmp
application/config/email.php
app/Config/Email.php
*.patch
patches/
.idea/
@@ -10,10 +10,15 @@ git-svn-diff.py
.buildpath
.project
.settings/*
.git
dist/
node_modules/
*.swp
*.rej
*.orig
*~
*.~
*.log
application/sessions/*
app/writable/session/*
!app/writable/session/index.html

22
.editorconfig Normal file
View File

@@ -0,0 +1,22 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 120
tab_width = 4
[{*.cjs,*.js}]
indent_style = tab
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
indent_style = tab
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,composer.lock,jest.config}]
indent_style = tab
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
indent_style = tab

86
.env Normal file
View File

@@ -0,0 +1,86 @@
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
CI_ENVIRONMENT = production
CI_DEBUG = false
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
app.appTimezone = 'UTC'
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
database.default.hostname = 'localhost'
database.default.database = 'ospos'
database.default.username = 'admin'
database.default.password = 'pointofsale'
database.default.DBDriver = 'MySQLi'
database.default.DBPrefix = 'ospos_'
database.default.port = 3306
database.development.hostname = 'localhost'
database.development.database = 'ospos'
database.development.username = 'admin'
database.development.password = 'pointofsale'
database.development.DBDriver = 'MySQLi'
database.development.DBPrefix = 'ospos_'
database.development.port = 3306
database.tests.hostname = 'localhost'
database.tests.database = 'ospos'
database.tests.username = 'admin'
database.tests.password = 'pointofsale'
database.tests.DBDriver = 'MySQLi'
database.tests.DBPrefix = 'ospos_'
database.tests.charset = utf8mb4
database.tests.DBCollat = utf8mb4_general_ci
database.tests.port = 3306
#--------------------------------------------------------------------
# EMAIL
#--------------------------------------------------------------------
email.SMTPHost = ''
email.SMTPUser = ''
email.SMTPPass = ''
email.SMTPPort =
email.SMTPTimeout = 5
email.SMTPCrypto = 'tls'
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
encryption.key = ''
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
honeypot.hidden = true
honeypot.label = 'Fill This Field'
honeypot.name = 'honeypot'
honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
honeypot.container = '<div style="display:none">{template}</div>'
#--------------------------------------------------------------------
# LOGGER
# - 0 = Disables logging, Error logging TURNED OFF
# - 1 = Emergency Messages - System is unusable
# - 2 = Alert Messages - Action Must Be Taken Immediately
# - 3 = Critical Messages - Application component unavailable, unexpected exception.
# - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
# - 5 = Warnings - Exceptional occurrences that are not errors.
# - 6 = Notices - Normal but significant events.
# - 7 = Info - Interesting events, like user logging in, etc.
# - 8 = Debug - Detailed debug information.
# - 9 = All Messages
#--------------------------------------------------------------------
logger.threshold = 0
app.db_log_enabled = false
app.db_log_only_long = false

63
.env-example Normal file
View File

@@ -0,0 +1,63 @@
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
CI_ENVIRONMENT = production
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
database.default.hostname = 'localhost'
database.default.database = 'ospos'
database.default.username = 'admin'
database.default.password = 'pointofsale'
database.default.DBDriver = 'MySQLi'
database.default.DBPrefix = 'ospos_'
database.development.hostname = 'localhost'
database.development.database = 'ospos'
database.development.username = 'admin'
database.development.password = 'pointofsale'
database.development.DBDriver = 'MySQLi'
database.development.DBPrefix = 'ospos_'
database.tests.hostname = 'localhost'
database.tests.database = 'ospos'
database.tests.username = 'admin'
database.tests.password = 'pointofsale'
database.tests.DBDriver = 'MySQLi'
database.tests.DBPrefix = 'ospos_'
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
encryption.key = ''
#--------------------------------------------------------------------
# LOGGER
# - 0 = Disables logging, Error logging TURNED OFF
# - 1 = Emergency Messages - System is unusable
# - 2 = Alert Messages - Action Must Be Taken Immediately
# - 3 = Critical Messages - Application component unavailable, unexpected exception.
# - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
# - 5 = Warnings - Exceptional occurrences that are not errors.
# - 6 = Notices - Normal but significant events.
# - 7 = Info - Interesting events, like user logging in, etc.
# - 8 = Debug - Detailed debug information.
# - 9 = All Messages
#--------------------------------------------------------------------
logger.threshold = 0
app.db_log_enabled = false
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
honeypot.hidden = true
honeypot.label = 'Fill This Field'
honeypot.name = 'honeypot'
honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
honeypot.container = '<div style="display:none">{template}</div>'

4
.gitattributes vendored
View File

@@ -1,3 +1,3 @@
dist/ merge=ours
application/language/**/*.php merge=ours
text=auto
app/Language/**/*.php merge=ours
text=auto eol=lf

119
.github/ISSUE_TEMPLATE/bug report.yml vendored Normal file
View File

@@ -0,0 +1,119 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
projects: ["ospos/3", "ospos/4"]
assignees:
- none
body:
- type: markdown
attributes:
value: |
Bug reports indicate that something is not working as intended.
Please include as much detail as possible and submit a separate bug report for each problem.
Do not include personal identifying information such as email addresses or encryption keys.
- type: textarea
id: bug-description
attributes:
label: Bug Description?
description: Describe the problem that you are seeing
placeholder: "Describe the problem that you are seeing"
validations:
required: true
- type: textarea
id: steps-reproduce
attributes:
label: Steps to Reproduce?
description: List the steps to reproduce this issue
placeholder: "Steps to Reproduce"
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior?
description: Tell us what did you expect to happen?
placeholder: "Expected Behavior"
validations:
required: true
- type: dropdown
id: ospos-version
attributes:
label: OpensourcePOS Version
description: What version of our software are you running?
options:
- opensourcepos 3.3.9
- opensourcepos 3.3.8
- opensourcepos 3.3.7
- development (unreleased)
default: 0
validations:
required: true
- type: dropdown
id: php-version
attributes:
label: Php version
description: What version of Php?
options:
- Php 7.2
- Php 7.3
- Php 7.4
- Php 8.1
- Php 8.2
- Php 8.3
- Php 8.4
default: 0
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Other
- type: input
id: server
attributes:
label: Server Operating System and version
description: "Server Operating System "
placeholder: "Server Operating System "
validations:
required: true
- type: input
id: database
attributes:
label: Database Management System and version
description: "Database Management System"
placeholder: "Database Management"
validations:
required: true
- type: input
id: webserver
attributes:
label: Web Server and version
description: "Web Server and version "
placeholder: "Web Server and version "
validations:
required: true
- type: textarea
id: servers
attributes:
label: System Information Report (optional)
description: Copy and paste from OSPOS > Configuration > Setup & Conf > Setup & Conf?
placeholder: System Information Report
value: "System Information Report"
validations:
required: true
- type: checkboxes
id: terms
attributes:
label: Unmodified copy of OpensourcePOS
description: By submitting this issue you agree this copy has not been modified
options:
- label: I agree this copy has not been modified
required: true

View File

@@ -0,0 +1,63 @@
name: ✨ Feature Request
description: Suggest an idea for this project
title: "[Feature]: "
labels: ["enhancement"]
assignees: ["none"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request! 🤗
Please make sure this feature request hasn't been already submitted by someone by looking through other open/closed issues. 😃
- type: dropdown
attributes:
multiple: false
label: Type of Feature
description: Select the type of feature request.
options:
- "✨ New Feature"
- "📝 Documentation"
- "🎨 Style and UI"
- "🔨 Code Refactor"
- "⚡ Performance Improvements"
- "✅ New Test"
validations:
required: true
- type: dropdown
id: ospos-version
attributes:
label: OpensourcePOS Version
description: What version of our software are you running?
options:
- opensourcepos 3.3.9
- opensourcepos 3.3.8
- opensourcepos 3.3.7
default: 0
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Give us a brief description of the feature or enhancement you would like
validations:
required: true
- type: textarea
id: additional-information
attributes:
label: Additional Information
description: Give us some additional information on the feature request like proposed solutions, links, screenshots, etc.
- type: checkboxes
id: terms
attributes:
label: Verify you searched open requests in OpensourcePOS
description: By submitting this request you agree that you have searched Open Requests in the Tracker
options:
- label: I agree I have searched Open Requests
required: true

54
.gitignore vendored
View File

@@ -1,33 +1,15 @@
# Dependency directories
/node_modules
/vendor
/public/bower_components
# Logs
/application/logs/*
*.log
node_modules
vendor
public/resources
app/Config/email.php
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/*
!docker/.env
docker/data/database/db/*
docker/data/certbot/conf/*
docker/data/ospos/app/*
# Editors
## SublimeText
@@ -69,11 +51,11 @@ $RECYCLE.BIN/
.com.apple.timemachine.donotpresent
# Other
/generate_langauges.php
/dist
/docs
generate_languages.php
dist
docs
/patches
/translations
translations
/.buildpath
/.project
/.settings/*
@@ -81,6 +63,7 @@ $RECYCLE.BIN/
git-svn-diff.py
*.bash
.swp
system/
*.swp
*.rej
*.orig
@@ -88,3 +71,14 @@ git-svn-diff.py
*.~
.env
auth.json
*.png
*.jpg
*.jpeg
*.webp
*copy*
/writable/logs/*.log
/writable/debugbar/*.json
/app/Database/database.sql
/writable/cache/settings
/.env.bak

View File

@@ -1,9 +1,15 @@
# 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]
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public$
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge [NC]
RewriteRule "^(.*)$" "/public/" [R=301,L]
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need. Uncomment
# the line below and comment the line above.
#RewriteRule "^(.*)$" "/[SUBDIRECTORY]/public/" [R=301,L]
</IfModule>
# disable directory browsing
@@ -17,7 +23,6 @@ IndexIgnore *
Header always set X-Frame-Options "SAMEORIGIN"
</Ifmodule>
# Apache 2.4
<IfModule authz_core_module>
# secure htaccess file
<Files .htaccess>
@@ -39,34 +44,3 @@ IndexIgnore *
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>

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
use Nexus\CsConfig\FixerGenerator;
use PhpCsFixer\Finder;
$finder = Finder::create()
->files()
->in([
__DIR__ . '/app',
__DIR__ . '/public',
])
->exclude(['Views/errors/html'])
->append([
__DIR__ . '/admin/starter/builds',
]);
$overrides = [
// for updating to coding-standard
'modernize_strpos' => true,
];
$options = [
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
'finder' => $finder,
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
'customRules' => [
NoCodeSeparatorCommentFixer::name() => true,
],
];
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();

View File

@@ -5,63 +5,55 @@ branches:
- 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
dist: jammy
language: node_js
node_js:
- 20
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")
- docker run --rm -u $(id -u) -v $(pwd):/app opensourcepos/composer:ci4 composer install
- version=$(grep application_version app/Config/App.php | sed "s/.*=\s'\(.*\)';/\1/g")
- sed -i "s/commit_sha1 = 'dev'/commit_sha1 = '$rev'/g" app/Config/OSPOS.php
- 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"
- npm ci && npm install -g gulp && npm run build
- 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
- docker build app/Database/ -t "jekkos/opensourcepos:sql-$TAG"
env:
global:
- DOCKER_COMPOSE_VERSION=1.29.1
- BRANCH=$(echo ${TRAVIS_BRANCH} | sed s/feature\\///)
- TAG=${TRAVIS_TAG:-$BRANCH}
- 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"
"jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:$TAG" && docker push "jekkos/opensourcepos:sql-$TAG"
- gulp compress
- mv dist/opensourcepos.tar.gz "dist/opensourcepos.$version.$rev.tgz"
- mv dist/opensourcepos.zip "dist/opensourcepos.$version.$rev.zip"
deploy:
- provider: npm
file: dist/opensourcepos.$version.$rev.tgz
registry: npm.pkg.github.com
edge: true
src: dist/opensourcepos.$version.$rev.tgz
registry: https://npm.pkg.github.com
email: jeroen@steganos.dev
skip_cleanup: true
api_key:
secure: "bmOfMoGBi+wTEdTbIB7wPenNTCZrmHAa05xZnMxZSOjxplZpnZSO4Tvnnkihz9LpbF3xT1hm76AJJuZonu2HKtUez+6L4Fg+i/jS8Ij/BZlbvKBVTeB+2yN09ncXNmObnl1bShtm90d2WYQJKk3NJGuEboFQNxwJLYJXg33iMhc="
secure: "DNPJOrT51wdO0BAbkX2hKowdXYh7x8d43xvAw7eVfOslyBPiv6Bb/1QdC2Bpnlqe0WiJVS5hvBTMrJ+vSDK5i/l8jA+ZoI6ms1+P1DQ6sBBMBQI2fuvRCrJj+Fp3WnaduZb/N7R+FqdKQwD/ZORyhzJ4whtHkrO8uC7cY/wlacU="
on:
all_branches: true
- provider: releases
file: dist/opensourcepos.$version.$rev.tgz
edge: true
file: dist/opensourcepos.$version.$rev.zip
name: "OpensourcePos $version"
release_notes_file: WHATS_NEW.txt
release_notes_file: CHANGELOG.md
prerelease: true
skip_cleanup: true
user: jekkos
overwrite: true
api_key:
secure: Ax25mMRDfHVf/HjRwqxYJe2oMnWC4sc2aKIiUxAOviVJJSCl4GMWhcFlUNnFsDcKIg2ofEGMVD6b9cTBuOwPDvymUDFnLNCCgDWve+vRDdWaTkTipn77Qk4c9UO9VvuzlPSKopChefPHlQ0n1rEmAMiKIXuqjUlNGqybW4FLP4E=
secure: "DNPJOrT51wdO0BAbkX2hKowdXYh7x8d43xvAw7eVfOslyBPiv6Bb/1QdC2Bpnlqe0WiJVS5hvBTMrJ+vSDK5i/l8jA+ZoI6ms1+P1DQ6sBBMBQI2fuvRCrJj+Fp3WnaduZb/N7R+FqdKQwD/ZORyhzJ4whtHkrO8uC7cY/wlacU="
on:
tags: true
branch: master

67
BUILD.md Normal file
View File

@@ -0,0 +1,67 @@
# Building OSPOS
## For Developers and Hobbyists Only
If you are a developer and need to add unique features to OSPOS, you can download the raw code from the github repository and make changes. If it's a really cool change that might benefit others, we ask that you consider contributing it to the project.
After you've made your changes, you will need to do a "BUILD" on it to add all necessary components that OSPOS needs to be a fully functional application.
This documents the "How to Build" process.
The goal here is to set up and configure the build process so that the actual build is as simple as possible.
The build process uses the build tools "npm" and "gulp" to piece everything together.
## Prerequisites
- Install the latest version of NPM (tested using version 9.4.2)
- Install the latest version of Composer (tested using composer 2.5.1)
## The Workflow
1. Download the code from the master branch found at https://github.com/opensourcepos/opensourcepos/tree/master.
2. Unzip it and copy the contents into the working folder.
3. Start a terminal session from the root of your working folder. For example, I normally open up the working folder in PHPStorm and run the commands from the Terminal provided by the IDE.
4. Enter the following three commands in sequence:
- `composer install`
- `npm install`
- `npm run build`
That's all there is to it.
Note: If you receive messages similar to 'codeigniter4/framework v4.3.1 requires ext-intl', this is an indicator that you do not have intl enabled in php.ini
After the build tasks are complete, if you have the database set up and a preconfigured copy of .env, just drop the .env file into the root of the working folder. You should be ready to go.
If you do not have an existing (and upgraded) database, then you will need to continue from this point forward with the standard installation instructions, but at this point you have a runnable version of OSPOS.
### Windows Platform
Using an `.env` file is a convenient approach to store OSPOS configuration.
I've added the following Powershell scripts to make my life a bit easier, which I share with you.
* `build.ps1` - Which runs the build but also restores the .env from a backup I make of it in a specifically placed folder. I place a copy of the configured .env file in a folder that has the following path from the working folder: `../env/<working-folder-name>/.env`
### Containerized setup
Development using docker has the advantage that all the application's dependencies are contained within the docker environment. During development we want to have a live version of the code in the container when we edit it. This is accomplished by mounting the application folder within the /app of the docker container.
The file permissions for the repository in the container should be the same as on the host. That's why we have to startthe PHP process in docker with the host current uid.
```
export USERID=$(id -u)
export GROUPID=$(id -g)
docker-compose -f docker-compose.dev.yml up
```
## The Result
The build creates a developer version of a runnable instance of OSPOS. It contains a ton of developer stuff that **should not be deployed to a production environment**.
Again, the results of this build is NOT something that should be used for production.
However, the zip and tar files, found in the root `dist` folder, are created as part of the build process and can be used for deploying a ***trial production*** instance of OSPOS.
Only official releases should be used for real production. There is significant risk of failure should you chose to deploy a development branch or even a master branch that the development team hasn't signed off on.
Good luck with your build. Please report any issues you encounter.

View File

@@ -1,5 +1,8 @@
[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
[unreleased]: https://github.com/opensourcepos/opensourcepos/compare/3.3.9...HEAD
[3.3.9]: https://github.com/opensourcepos/opensourcepos/compare/3.3.8...3.3.9
[3.3.8]: https://github.com/opensourcepos/opensourcepos/compare/3.3.7...3.3.8
[3.3.7]: https://github.com/opensourcepos/opensourcepos/compare/3.3.6...3.3.7
[3.3.6]: https://github.com/opensourcepos/opensourcepos/compare/3.3.5...3.3.6
[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
@@ -19,29 +22,41 @@
[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
[2.3.1]: https://github.com/opensourcepos/opensourcepos/compare/2.3...2.3.1
[2.3.0]: https://github.com/opensourcepos/opensourcepos/compare/2.2.2...2.3
# Changelog
All notable changes to this project will be documented here.
All notable changes to this project will be documented in this file.
## [Unreleased]
List of changes in the `master` branch.
- Bump framework to CodeIgniter `4.x.x`
- Improve security performance against bots
- N/A
## [3.3.9] - 2023-11-06
## [3.3.7] - 2022-04-26
- Translation updates (Arabic, Central Khmer, Croatian, Czech, Danish, English, French, Indonesian, Lao, Russian, Spanish, Thai)
- Fix logout race condition issue ([#3578](https://github.com/opensourcepos/opensourcepos/issues/3578))
- Fix docker compose file ([#3754](https://github.com/opensourcepos/opensourcepos/issues/3754))
- Minor report fixes
- Translation updates (Thai, Indonesian, Swedish, Italian)
## [3.3.8] - 2022-08-03
- Translation updates (Azerbaijani, Flemish, French, Spanish, Thai, Vietnamese)
- Fix logo removal issue (CSRF regression) ([#3533](https://github.com/opensourcepos/opensourcepos/issues/3533))
- Substract refunds from total rewards as payment method ([#3536](https://github.com/opensourcepos/opensourcepos/issues/3536))
## [3.3.7] - 2022-03-29
- Translation updates (Chinese, French, Indonesian, Italian, Polish, Swedish, Thai)
- 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
## [3.3.6] - 2021-10-31
- Translation updates (Hungarian, Indonesian, Bosnian, Ukranian, Vietnamese, Spanish)
- Translation updates (Bosnian, Dutch, Indonesian, Polish, Russian, Spanish)
- Make footer revision clickable (ref to github)
- Minor reporting adjustments
- Introduced new global keyboard shortcuts (see overview below)
@@ -57,9 +72,9 @@ List of changes in the `master` branch.
- Type juggling password fix for old logins
## [3.3.5] - 2021-08-26
## [3.3.5] - 2021-08-26 [YANKED]
- Translation updates (Romanian, Ukrainian, Vietnamese, Thai, Polish, Swedish, Portuguese, Arabic, French, Chinese, Dutch, Tamil, Turkish, Spanish)
- Translation updates (Arabic, Azerbaijani, Bulgarian, Chinese, Dutch, French, Indonesian, Polish, Portuguese, Romanian, Spanish, Swedish, Tamil, Thai, Turkish, Ukrainian, Vietnamese)
- 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
@@ -75,7 +90,7 @@ List of changes in the `master` branch.
- Fixes for Docker to make it run on Windows
- Blind SQL injection fix
## [3.3.4] - 2021-04-18
## [3.3.4] - 2021-04-20
- Translation updates (Hungarian, Indonesian, Bosnian, Ukrainian, Vietnamese, Spanish)
- Prevent data wipeout when calling GET directly on the save endpoint
@@ -90,7 +105,7 @@ List of changes in the `master` branch.
- Add barcode field to item kits
- Fix discount register parsing in some specific locales
## [3.3.3] - 2020-12-31
## [3.3.3] - 2021-01-01
- PHP `7.4` support
- Set PHP `7.2` to be the minimum level due to older version deprecations
@@ -100,13 +115,13 @@ List of changes in the `master` branch.
- Improved security (CSRF protection)
- Various small improvements and bug fixes
## [3.3.2] - 2020-09-02
## [3.3.2] - 2020-09-03
- 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
## [3.3.1] - 2019-12-14
- Various bug fixes (please disable `only_full_group_by` option from MySQL/MariaDB to avoid issues)
@@ -235,7 +250,7 @@ List of changes in the `master` branch.
- Fixed `phppos to ospos` database migration script
- Minor bug fixes and some general code clean up
## [3.0.0] 2016-10-21
## [3.0.0] 2016-10-22
- Upgrade CodeIgniter to version `3.1.0`
- Major UI overhaul based on Bootstrap `3.0` and Bootswatch Themes
@@ -254,7 +269,7 @@ List of changes in the `master` branch.
- 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
## [2.4.0] - 2016-10-03
- Upgrade CodeIgniter to version `3.0.5`
- Fix for spurious logouts
@@ -283,7 +298,7 @@ List of changes in the `master` branch.
- Minor code cleanup
- Removal of annoying backup prompt on logout
## [2.3.3] - 2016-01-05
## [2.3.3] - 2016-01-06
- Item kit fixes (search, list, ...)
- Add date picker widgets in sale/receiving edit forms
@@ -305,7 +320,7 @@ List of changes in the `master` branch.
- Add SQL script to clean zeroes in sales/receivings comments
- Numerous other bug fixes
## [2.3.2] - 2015-07-15
## [2.3.2] - 2016-01-25
- Nominatim (OpenStreetMap) customer address autocompletion
- Sale invoice templating
@@ -336,7 +351,7 @@ List of changes in the `master` branch.
- Fix item import through CSV
- Bug fixes for reports
## [2.3.0] - 2014-08-19
## [2.3.0] - 2014-08-20
- Support for multiple stock locations

View File

@@ -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

View File

@@ -1,19 +1,15 @@
FROM php:7.4-apache AS ospos
FROM php:8.2-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 apt update && apt-get install -y libicu-dev libgd-dev
RUN a2enmod rewrite
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
RUN chmod -R 770 /app/writable/uploads /app/writable/logs /app/writable/cache && chown -R www-data:www-data /app
FROM ospos AS ospos_test
@@ -23,17 +19,20 @@ 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
#RUN sed -i 's/backupGlobals="true"/backupGlobals="false"/g' /app/tests/phpunit.xml
WORKDIR /app/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
ARG USERID
ARG GROUPID
RUN echo "Adding user uid $USERID with gid $GROUPID"
RUN ( addgroup --gid $GROUPID ospos || true ) && ( adduser --uid $USERID --gid $GROUPID ospos )
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.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini

View File

@@ -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']);
};

View File

@@ -1,27 +1,27 @@
## 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).
- PHP version `7.4` is supported, PHP version `≤7.3` is NOT supported. Please note that PHP needs to have the extensions `php-gd`, `php-bcmath`, `php-intl`, `php-openssl`, `php-mbstring` , `php-curl` and `php-xml` installed and enabled. PHP version `8.x` is only supported by the code that is still under development in master branch.
- MySQL `5.6` and `5.7` are supported, also MariaDB replacement `10.x` is supported and might offer better performance.
- Apache `2.4` is 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.
First of all, if you're seeing the message `system folder missing` after launching your browser, or cannot find `database.php`, that most likely means you have cloned the repository and have not built the project. To build the project from a source commit point instead of from an official release check out [Building OSPOS](BUILD.md). Otherwise, continue with the following steps.
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.
5. Open `app/Config/database.php` and modify credentials to connect to your database if needed.
6. Open `app/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.
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` app/Config/.env` file from the `.env.example` to enable it in a development environment.
## Local install using Docker

22
LICENSE
View File

@@ -1,11 +1,11 @@
MIT License
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) 2013-2023 jekkos
Copyright (c) 2015-2023 FrancescoUK (aka daN4cat)
Copyright (c) 2017-2023 Steve Ireland
Copyright (c) 2017-2023 objecttothis
Copyright (c) 2017-2023 odiea
Copyright (c) 2017-2023 WebShells
Copyright (c) 2020-2021 Andriux1990
Copyright (c) 2021 BudsieBuds
Copyright (c) 2019 Loyd Jayme (aka loydjayme25)
@@ -19,7 +19,7 @@ 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-2022 Aamir Shahzad (aka asakpke), RoshanTech, eSite.pk
Copyright (c) 2015 Toni Haryanto (aka yllumi)
Copyright (c) 2013 Rob Garrison
Copyright (c) 2013 Parq
@@ -34,16 +34,16 @@ 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 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.
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.

View File

@@ -1,4 +1,4 @@
<p align="center"><img src="branding/emblem.svg" alt="Open Source Point of Sale Logo" width="auto" height="200"></p>
<p align="center"><img src="https://raw.githubusercontent.com/opensourcepos/opensourcepos/master/branding/emblem.svg" alt="Open Source Point of Sale Logo" width="auto" height="200"></p>
<h3 align="center">Open Source Point of Sale</h3>
<p align="center">
@@ -8,17 +8,17 @@
</p>
<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>
<a href="https://app.travis-ci.com/opensourcepos/opensourcepos" target="_blank"><img src="https://api.travis-ci.com/opensourcepos/opensourcepos.svg?branch=master" alt="Build Status"></a>
<a href="https://app.gitter.im/#/room/#opensourcepos_Lobby:gitter.im?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://app.gitter.im"></a>
<a href="https://badge.fury.io/gh/opensourcepos%2Fopensourcepos" target="_blank"><img src="https://badge.fury.io/gh/opensourcepos%2Fopensourcepos.svg" alt="Project Version"></a>
<a href="https://translate.opensourcepos.org/engage/opensourcepos/?utm_source=widget" target="_blank"><img src="https://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.
Open Source Point of Sale is a web-based point of sale system. The application is written in PHP, uses MySQL (or MariaDB) as the 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 latest `3.4` version is a complete overhaul of the original software. It uses CodeIgniter 4 as a framework and is based on Bootstrap 3 using Bootswatch themes. Along with improved functionality and security.
The features include:
@@ -40,8 +40,8 @@ The features include:
- Messaging (SMS)
- Multilanguage
- Selectable Bootstrap based UI theme with Bootswatch
- Mailchimp integration
- Optional Google reCAPTCHA to protect login page from brute force attacks
- MailChimp integration
- Optional Google reCAPTCHA to protect the login page from brute force attacks
- GDPR ready
## 🧪 Live Demo
@@ -70,7 +70,7 @@ For more information and recommendations on support hardware, like receipt print
## ✨ 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]().
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]() or join the conversation on [Element](https://app.gitter.im/#/room/#opensourcepos_Lobby:gitter.im).
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.
@@ -82,7 +82,7 @@ Before creating a new issue, you'll need copy and include the info under the `Sy
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.
NOTE: If you're running non-release code, please make sure you always run the latest database upgrade script and download the latest master code.
## 📖 FAQ
@@ -90,7 +90,7 @@ NOTE: If you're running non-release code, please make sure you always run the la
- 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.
- 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.
@@ -98,11 +98,11 @@ NOTE: If you're running non-release code, please make sure you always run the la
- 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 install OSPOS behind a proxy and OSPOS constantly drops your session, consider whitelisting the proxy IP address by setting `$config['proxy_ips'] = '<proxy ip>';` in the [main PHP config file](https://github.com/opensourcepos/opensourcepos/blob/master/application/config/config.php). In extreme instances, changing `$config['sess_match_ip'] = true;` to `FALSE` may also help.
- 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.
- PHP `≥ 8.1` is required to run this app.
## 🏃 Keep the Machine Running
@@ -111,13 +111,13 @@ If you like our project, please consider buying us a coffee through the button b
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](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).
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 $200, 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.
The footer signature "© 2010 - _current year_ · opensourcepos.org · 3.x.x - _hash_" including the version, hash and link to our website MUST BE RETAINED, MUST BE VISIBLE IN EVERY PAGE and CANNOT BE MODIFIED.
Also worth noting:
@@ -125,13 +125,13 @@ _The above copyright notice and this permission notice shall be included in all
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:
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.
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.
@@ -139,5 +139,5 @@ Any person or company found breaching the license agreement might find a bunch o
| <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. |
| <div align="center"><a href="https://www.jetbrains.com/idea/" target="_blank"><img src="https://github.com/opensourcepos/opensourcepos/assets/12870258/187f9bbe-4484-475c-9b58-5e5d5f931f09" alt="IntelliJ IDEA Logo" height="50"></a></div> | <div align="center"><a href="https://www.travis-ci.com/" target="_blank"><img src="https://github.com/opensourcepos/opensourcepos/assets/12870258/71cc2b44-83af-4510-a543-6358285f43c6" alt="Travis CI Logo" height="50"></a></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://www.travis-ci.com/) for providing a free continuous integration service for open source projects. |

6
app/.htaccess Normal file
View File

@@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

15
app/Common.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/

290
app/Config/App.php Normal file
View File

@@ -0,0 +1,290 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\DatabaseHandler;
class App extends BaseConfig
{
/**
* This is the code version of the Open Source Point of Sale you're running.
*
* @var string
*/
public string $application_version = '3.4.0-dev';
/**
* This is the commit hash for the version you are currently using.
*
* @var string
*/
public string $commit_sha1 = 'dev';
/**
* Logs are stored in writable/logs
*
* @var bool
*/
public bool $db_log_enabled = false;
/**
* DB Query Log only long-running queries
*
* @var bool
*/
public bool $db_log_only_long = false;
/**
* Defines whether to require/reroute to HTTPS
*
* @var bool
*/
public bool $https_on; //Set in the constructor
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL; //Defined in the constructor
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
public string $indexPage = '';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which server global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' 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']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public string $uriProtocol = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| 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.
|
| 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~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = true;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string>
*/
public array $supportedLocales = [
'ar-EG',
'ar-LB',
'az',
'bg',
'bs',
'cs',
'da',
'de-CH',
'de-DE',
'el',
'en',
'en-GB',
'es-ES',
'es-MX',
'fa',
'fr',
'he',
'hr-HR',
'hu',
'hy',
'id',
'it',
'km',
'lo',
'ml',
'nb',
'nl-BE',
'nl-NL',
'pl',
'pt-BR',
'ro',
'ru',
'sv',
'ta',
'th',
'tl',
'tr',
'uk',
'ur',
'vi',
'zh-Hans',
'zh-Hant',
];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/
public string $appTimezone = 'UTC';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* 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.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security (HSTS) header will be set.
*/
public bool $forceGlobalSecureRequests = 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
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false; //TODO: Currently CSP3 tags are not supported so enabling this causes problems with script-src-elem, style-src-attr and style-src-elem
public function __construct()
{
parent::__construct();
$this->https_on = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_ENV['FORCE_HTTPS']) && $_ENV['FORCE_HTTPS'] == 'true');
$this->baseURL = $this->https_on ? 'https' : 'http';
$this->baseURL .= '://' . ((isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : 'localhost') . '/';
$this->baseURL .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
}

210
app/Config/Autoload.php Normal file
View File

@@ -0,0 +1,210 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH,
'Config' => APPPATH . 'Config',
'dompdf' => APPPATH . 'ThirdParty/dompdf/src'
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [
//Controllers
'Attributes' => '/App/Controllers/Attributes.php',
'Cashups' => '/App/Controllers/Cashups.php',
'Config' => '/App/Controllers/Config.php',
'Customers' => '/App/Controllers/Customers.php',
'Employees' => '/App/Controllers/Employees.php',
'Expenses' => '/App/Controllers/Expenses.php',
'Expenses_categories' => '/App/Controllers/Expenses_categories.php',
'Giftcards' => '/App/Controllers/Giftcards.php',
'Home' => '/App/Controllers/Home.php',
'Item_kits' => '/App/Controllers/Item_kits.php',
'Items' => '/App/Controllers/Items.php',
'Login' => '/App/Controllers/Login.php',
'Messages' => '/App/Controllers/Messages.php',
'No_access' => '/App/Controllers/No_access.php',
'Office' => '/App/Controllers/Office.php',
'Persons' => '/App/Controllers/Persons.php',
'Receivings' => '/App/Controllers/Receivings.php',
'Reports' => '/App/Controllers/Reports.php',
'Sales' => '/App/Controllers/Sales.php',
'Secure_Controller' => '/App/Controllers/Secure_Controller.php',
'Suppliers' => '/App/Controllers/Suppliers.php',
'Tax_categories' => '/App/Controllers/Tax_categories.php',
'Tax_codes' => '/App/Controllers/Tax_codes.php',
'Tax_jurisdictions' => '/App/Controllers/Tax_jurisdictions.php',
'Taxes' => '/App/Controllers/Taxes.php',
//Models
'Appconfig' => '/App/Models/Appconfig.php',
'Attribute' => '/App/Models/Attribute.php',
'Cashup' => '/App/Models/Cashup.php',
'Customer' => '/App/Models/Customer.php',
'Customer_rewards' => '/App/Models/Customer_rewards.php',
'Dinner_table' => '/App/Models/Dinner_table.php',
'Employee' => '/App/Models/Employee.php',
'Expense' => '/App/Models/Expense.php',
'Expense_category' => '/App/Models/Expense_category.php',
'Giftcard' => '/App/Models/Giftcard.php',
'Inventory' => '/App/Models/Inventory.php',
'Item_kit' => '/App/Models/Item_kit.php',
'Item_kit_items' => '/App/Models/Item_kit_items.php',
'Item_quantity' => '/App/Models/Item_quantity.php',
'Item_taxes' => '/App/Models/Item_taxes.php',
'Module' => '/App/Models/Module.php',
'Person' => '/App/Models/Person.php',
'Receiving' => '/App/Models/Receiving.php',
'Rewards' => '/App/Models/Rewards.php',
'Sale' => '/App/Models/Sale.php',
'Stock_location' => '/App/Models/Stock_location.php',
'Supplier' => '/App/Models/Supplier.php',
'Tax' => '/App/Models/Tax.php',
'Tax_category' => '/App/Models/Tax_category.php',
'Tax_code' => '/App/Models/Tax_code.php',
'Tax_jurisdiction' => '/App/Models/Tax_jurisdiction.php',
//Reports
'Report' => '/App/Models/Reports/Report.php',
'Detailed_receiving' => '/App/Models/Reports/Detailed_receiving.php',
'Detailed_sales' => '/App/Models/Reports/Detailed_sales.php',
'Inventory_low' => '/App/Models/Reports/Inventory_low.php',
'Inventory_summary' => '/App/Models/Reports/Inventory_summary.php',
'Specific_customer' => '/App/Models/Reports/Specific_customer.php',
'Specific_discount' => '/App/Models/Reports/Specific_discount.php',
'Specific_employee' => '/App/Models/Reports/Specific_employee.php',
'Specific_supplier' => '/App/Models/Reports/Specific_supplier.php',
'Summary_categories' => '/App/Models/Reports/Summary_categories.php',
'Summary_customers' => '/App/Models/Reports/Summary_customers.php',
'Summary_discounts' => '/App/Models/Reports/Summary_discounts.php',
'Summary_employees' => '/App/Models/Reports/Summary_employees.php',
'Summary_expenses_categories' => '/App/Models/Reports/Summary_expenses_categories.php',
'Summary_items' => '/App/Models/Reports/Summary_items.php',
'Summary_payments' => '/App/Models/Reports/Summary_payments.php',
'Summary_report' => '/App/Models/Reports/Summary_report.php',
'Summary_sales' => '/App/Models/Reports/Summary_sales.php',
'Summary_sales_taxes' => '/App/Models/Reports/Summary_sales_taxes.php',
'Summary_suppliers' => '/App/Models/Reports/Summary_suppliers.php',
'Summary_taxes' => '/App/Models/Reports/Summary_taxes.php',
//Tokens
'Token' => '/App/Models/Tokens/Token.php',
'Token_barcode_ean' => '/App/Models/Tokens/Token_barcode_ean.php',
'Token_barcode_price' => '/App/Models/Tokens/Token_barcode_price.php',
'Token_barcode_weight' => '/App/Models/Tokens/Token_barcode_weight.php',
'Token_customer' => '/App/Models/Tokens/Token_customer.php',
'Token_invoice_count' => '/App/Models/Tokens/Token_invoice_count.php',
'Token_invoice_sequence' => '/App/Models/Tokens/Token_invoice_sequence.php',
'Token_quote_sequence' => '/App/Models/Tokens/Token_quote_sequence.php',
'Token_suspended_invoice_count' => '/App/Models/Tokens/Token_suspended_invoice_count.php',
'Token_work_order_sequence' => '/App/Models/Tokens/Token_work_order_sequence.php',
'Token_year_invoice_count' => '/App/Models/Tokens/Token_year_invoice_count.php',
'Token_year_quote_count' => '/App/Models/Tokens/Token_year_quote_count.php',
//Libraries
'Barcode_lib' => '/App/Libraries/Barcode_lib.php',
'Email_lib' => '/App/Libraries/Email_lib.php',
'Item_lib' => '/App/Libraries/Item_lib.php',
'Mailchimp_lib' => '/App/Libraries/Mailchimp_lib.php',
'MY_Email' => '/App/Libraries/MY_Email.php',
'MY_Migration' => '/App/Libraries/MY_Migration.php',
'Receving_lib' => '/App/Libraries/Receiving_lib.php',
'Sale_lib' => '/App/Libraries/Sale_lib.php',
'Sms_lib' => '/App/Libraries/Sms_lib.php',
'Tax_lib' => '/App/Libraries/Tax_lib.php',
'Token_lib' => '/App/Libraries/Token_lib.php',
//Miscellaneous
'Rounding_mode' => '/App/Models/Enums/Rounding_mode.php'
];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [
'form',
'cookie',
'tabular',
'locale',
'security'
];
}

View File

@@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

View File

@@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@@ -0,0 +1,20 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

171
app/Config/Cache.php Normal file
View File

@@ -0,0 +1,171 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 300;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, int|string|null>
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, bool|int|string>
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, int|string|null>
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: 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.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
}

187
app/Config/Constants.php Normal file
View File

@@ -0,0 +1,187 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
defined('DEFAULT_DATE') || define('DEFAULT_DATE', mktime(0, 0, 0, 1, 1, 2010));
defined('DEFAULT_DATETIME') || define('DEFAULT_DATETIME', mktime(0, 0, 0, 1, 1, 2010));
defined('NOW') || define('NOW', time());
/*
| --------------------------------------------------------------------------
| 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') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);
/**
* Global Constants.
*/
const NEW_ENTRY = -1;
const ACTIVE = 0;
const DELETED = 1;
/**
* Attribute Related Constants.
*/
const GROUP = 'GROUP';
const DROPDOWN = 'DROPDOWN';
const DECIMAL = 'DECIMAL';
const DATE = 'DATE';
const TEXT = 'TEXT';
const CHECKBOX = 'CHECKBOX';
const NO_DEFINITION_ID = 0;
const CATEGORY_DEFINITION_ID = -1;
const DEFINITION_TYPES = [GROUP, DROPDOWN, DECIMAL, TEXT, DATE, CHECKBOX];
/**
* Item Related Constants.
*/
const HAS_STOCK = 0;
const HAS_NO_STOCK = 1;
const ITEM = 0;
const ITEM_KIT = 1;
const ITEM_AMOUNT_ENTRY = 2;
const ITEM_TEMP = 3;
const NEW_ITEM = -1;
const PRINT_ALL = 0;
const PRINT_PRICED = 1;
const PRINT_KIT = 2;
const PRINT_YES = 0;
const PRINT_NO = 1;
const PRICE_ALL = 0;
const PRICE_KIT = 1;
const PRICE_KIT_ITEMS = 2;
const PRICE_OPTION_ALL = 0;
const PRICE_OPTION_KIT = 1;
const PRICE_OPTION_KIT_STOCK = 2;
const NAME_SEPARATOR = ' | ';
/**
* Sale Related Constants.
*/
const COMPLETED = 0;
const SUSPENDED = 1;
const CANCELED = 2;
const SALE_TYPE_POS = 0;
const SALE_TYPE_INVOICE = 1;
const SALE_TYPE_WORK_ORDER = 2;
const SALE_TYPE_QUOTE = 3;
const SALE_TYPE_RETURN = 4;
const PERCENT = 0;
const FIXED = 1;
const PRICE_MODE_STANDARD = 0;
const PRICE_MODE_KIT = 1;
const PAYMENT_TYPE_UNASSIGNED = '--';
const CASH_ADJUSTMENT_TRUE = 1;
const CASH_ADJUSTMENT_FALSE = 0;
const CASH_MODE_TRUE = 1;
const CASH_MODE_FALSE = 0;
/**
* Supplier Related Constants
*/
const GOODS_SUPPLIER = 0;
const COST_SUPPLIER = 1;
/**
* Locale Related Constants
*/
const MAX_PRECISION = 1e14;
const DEFAULT_PRECISION = 2;
const DEFAULT_LANGUAGE = 'english';
const DEFAULT_LANGUAGE_CODE = 'en';

View File

@@ -0,0 +1,200 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// Sources allowed
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc = [
'self',
'www.google.com',
];
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = [
'self',
'unsafe-inline',
'unsafe-eval',
'www.google.com www.gstatic.com'
];
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = [
'self',
'unsafe-inline',
'nonce-{csp-style-nonce}',
'https://fonts.googleapis.com',
];
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = [
'self',
'data:',
'blob:',
];
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = [
'self',
'nominatim.openstreetmap.org',
];
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc = [
'self',
'fonts.googleapis.com',
'fonts.gstatic.com',
];
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'none';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

107
app/Config/Cookie.php Normal file
View File

@@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @phpstan-var 'None'|'Lax'|'Strict'|''
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

105
app/Config/Cors.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}

146
app/Config/Database.php Normal file
View File

@@ -0,0 +1,146 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'admin',
'password' => 'pointofsale',
'database' => 'ospos',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'ospos_',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
/**
* This database connection is used when
* running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'admin',
'password' => 'pointofsale',
'database' => 'ospos',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'ospos_',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'numberNative' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
/**
* This database connection is used when
* developing against non-production data.
*
* @var array
*/
public $development = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'admin',
'password' => 'pointofsale',
'database' => 'ospos',
'DBDriver' => 'MySQLi',
'DBPrefix' => 'ospos_',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'numberNative' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
switch(ENVIRONMENT)
{
case 'testing':
$this->defaultGroup = 'tests';
break;
case 'development';
$this->defaultGroup = 'development';
break;
}
foreach ([&$this->development, &$this->tests, &$this->default] as &$config)
{
$config['hostname'] = !getenv('MYSQL_HOST_NAME') ? $config['hostname'] : getenv('MYSQL_HOST_NAME');
$config['username'] = !getenv('MYSQL_USERNAME') ? $config['username'] : getenv('MYSQL_USERNAME');
$config['password'] = !getenv('MYSQL_PASSWORD') ? $config['password'] : getenv('MYSQL_PASSWORD');
$config['database'] = !getenv('MYSQL_DB_NAME') ? $config['database'] : getenv('MYSQL_DB_NAME');
}
}
}

46
app/Config/DocTypes.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace Config;
/**
* @immutable
*/
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'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">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

121
app/Config/Email.php Normal file
View File

@@ -0,0 +1,121 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = 'noreply@opensourcepos.org';
public string $fromName = 'Opensource Point of Sale';
public string $recipients = 'blackhole@none.com';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = 'mail.mxserver.com';
/**
* SMTP Username
*/
public string $SMTPUser = 'user';
/**
* SMTP Password
*/
public string $SMTPPass = 'pass';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'html';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

92
app/Config/Encryption.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = false;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

67
app/Config/Events.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace Config;
use App\Events\Db_log;
use App\Events\Load_config;
use App\Events\Method;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function (): void {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function (): void {
(new HotReloader())->run();
});
}
}
});
$config = new Load_config();
Events::on('post_controller_constructor', [$config, 'load_config']);
$db_log = new Db_log();
Events::on('DBQuery', [$db_log, 'db_log_queries']);
$method = new Method();
Events::on('pre_controller', [$method, 'validate_method']);

106
app/Config/Exceptions.php Normal file
View File

@@ -0,0 +1,106 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS
* --------------------------------------------------------------------------
* If set to `true`, DEPRECATED errors are only logged and no exceptions are
* thrown. This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/**
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

29
app/Config/Feature.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the default legacy version.
*/
public bool $autoRoutesImproved = true;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
}

108
app/Config/Filters.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
'honeypot',
//'csrf' => ['except' => 'login'], //TODO: Temporarily disable CSRF until we get everything sorted.
'invalidchars',
],
'after' => [
'toolbar',
'honeypot',
'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

77
app/Config/Format.php Normal file
View File

@@ -0,0 +1,77 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
}

44
app/Config/Generators.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config/Honeypot.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config/Images.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

65
app/Config/Kint.php Normal file
View File

@@ -0,0 +1,65 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

150
app/Config/Logger.php Normal file
View File

@@ -0,0 +1,150 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of '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 'log'.
*/
'fileExtension' => '',
/*
* 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.)
*/
'filePermissions' => 0660,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

50
app/Config/Migrations.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* 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
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'YmdHis_';
}

537
app/Config/Mimes.php Normal file
View File

@@ -0,0 +1,537 @@
<?php
namespace Config;
/**
* Mimes
*
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*
* @immutable
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'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' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'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' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'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' => [
'application/x-php',
'application/x-httpd-php',
'application/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' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'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' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'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',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'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' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'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' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension): array|string|null
{
$extension = trim(strtolower($extension), '. ');
if (!array_key_exists($extension, static::$mimes))
{
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null): ?string
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

84
app/Config/Modules.php Normal file
View File

@@ -0,0 +1,84 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

57
app/Config/OSPOS.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
namespace Config;
use App\Models\Appconfig;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Config\BaseConfig;
/**
* This class holds the configuration options stored from the database so that on launch those settings can be cached
* once in memory. The settings are referenced frequently, so there is a significant performance hit to not storing
* them.
*/
class OSPOS extends BaseConfig
{
public array $settings;
public string $commit_sha1 = 'dev'; //TODO: Travis scripts need to be updated to replace this with the commit hash on build
private CacheInterface $cache;
public function __construct()
{
parent::__construct();
$this->cache = Services::cache();
$this->set_settings();
}
/**
* @return void
*/
public function set_settings(): void
{
$cache = $this->cache->get('settings');
if($cache)
{
$this->settings = decode_array($cache);
}
else
{
$appconfig = model(Appconfig::class);
foreach($appconfig->get_all()->getResult() as $app_config)
{
$this->settings[$app_config->key] = $app_config->value;
}
$this->cache->save('settings', encode_array($this->settings));
}
}
/**
* @return void
*/
public function update_settings(): void
{
$this->cache->delete('settings');
$this->set_settings();
}
}

32
app/Config/Optimize.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*
* @immutable
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}

61
app/Config/Pager.php Normal file
View File

@@ -0,0 +1,61 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
/**
* --------------------------------------------------------------------------
* Bootstrap 3 pagination links styling
* --------------------------------------------------------------------------
*
* Source code from http://stackoverflow.com/questions/20088779/bootstrap-3-pagination-with-codeigniter
*/
public $config = [
'full_tag_open' => "<ul class='pagination pagination-sm'>",
'full_tag_close' => '</ul>',
'num_tag_open' => '<li>',
'num_tag_close' => '</li>',
'cur_tag_open' => "<li class='disabled'><li class='active'><a href='#'>",
'cur_tag_close' => "<span class='sr-only'></span></a></li>",
'next_tag_open' => "<li>",
'next_tagl_close' => "</li>",
'prev_tag_open' => "<li>",
'prev_tagl_close' => "</li>",
'first_tag_open' => "<li>",
'first_tagl_close' => "</li>",
'last_tag_open' => "<li>",
'last_tagl_close' => "</li>"
];
}

80
app/Config/Paths.php Normal file
View File

@@ -0,0 +1,80 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

41
app/Config/Routes.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
$routes->setDefaultController('Login');
$routes->get('/', 'Login::index');
$routes->get('login', 'Login::index');
$routes->post('login', 'Login::index');
$routes->add('no_access/index/(:segment)', 'No_access::index/$1');
$routes->add('no_access/index/(:segment)/(:segment)', 'No_access::index/$1/$2');
$routes->add('reports/summary_(:any)/(:any)/(:any)', 'Reports::Summary_$1/$2/$3/$4');
$routes->add('reports/summary_expenses_categories', 'Reports::date_input_only');
$routes->add('reports/summary_payments', 'Reports::date_input_only');
$routes->add('reports/summary_discounts', 'Reports::summary_discounts_input');
$routes->add('reports/summary_(:any)', 'Reports::date_input');
$routes->add('reports/graphical_(:any)/(:any)/(:any)', 'Reports::Graphical_$1/$2/$3/$4');
$routes->add('reports/graphical_summary_expenses_categories', 'Reports::date_input_only');
$routes->add('reports/graphical_summary_discounts', 'Reports::summary_discounts_input');
$routes->add('reports/graphical_(:any)', 'Reports::date_input');
$routes->add('reports/inventory_(:any)/(:any)', 'Reports::Inventory_$1/$2');
$routes->add('reports/inventory_low', 'Reports::inventory_low');
$routes->add('reports/inventory_summary', 'Reports::inventory_summary_input');
$routes->add('reports/inventory_summary/(:any)/(:any)/(:any)', 'Reports::inventory_summary/$1/$2/$3');
$routes->add('reports/detailed_(:any)/(:any)/(:any)/(:any)', 'Reports::Detailed_$1/$2/$3/$4');
$routes->add('reports/detailed_sales', 'Reports::date_input_sales');
$routes->add('reports/detailed_receivings', 'Reports::date_input_recv');
$routes->add('reports/specific_(:any)/(:any)/(:any)/(:any)', 'Reports::Specific_$1/$2/$3/$4');
$routes->add('reports/specific_customers', 'Reports::specific_customer_input');
$routes->add('reports/specific_employees', 'Reports::specific_employee_input');
$routes->add('reports/specific_discounts', 'Reports::specific_discount_input');
$routes->add('reports/specific_suppliers', 'Reports::specific_supplier_input');

140
app/Config/Routing.php Normal file
View File

@@ -0,0 +1,140 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Login';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = true;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = false;
}

103
app/Config/Security.php Normal file
View File

@@ -0,0 +1,103 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_ospos_v4';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
}

77
app/Config/Services.php Normal file
View File

@@ -0,0 +1,77 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
use CodeIgniter\HTTP\IncomingRequest;
use Config\Services as AppServices;
use HTMLPurifier;
use HTMLPurifier_Config;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
/**
* Responsible for loading the language string translations.
*
* @return MY_Language
*/
public static function language(?string $locale = null, bool $getShared = true)
{
if ($getShared) {
return static::getSharedInstance('language', $locale)->setLocale($locale);
}
if (AppServices::get('request') instanceof IncomingRequest) {
$requestLocale = AppServices::get('request')->getLocale();
} else {
$requestLocale = Locale::getDefault();
}
// Use '?:' for empty string check
$locale = $locale ?: $requestLocale;
return new \App\Libraries\MY_Language($locale);
}
private static $htmlPurifier;
public static function htmlPurifier($getShared = true)
{
if ($getShared)
{
return static::getSharedInstance('htmlPurifier');
}
if (!isset(static::$htmlPurifier))
{
$config = HTMLPurifier_Config::createDefault();
static::$htmlPurifier = new HTMLPurifier($config);
}
return static::$htmlPurifier;
}
}

127
app/Config/Session.php Normal file
View File

@@ -0,0 +1,127 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\DatabaseHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = DatabaseHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ospos_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is 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!
*/
public string $savePath = 'sessions';
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $matchIP = true;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $regenerateDestroy = true;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}

122
app/Config/Toolbar.php Normal file
View File

@@ -0,0 +1,122 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}

252
app/Config/UserAgents.php Normal file
View File

@@ -0,0 +1,252 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* 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
* and the array values are used to set the actual name of the item.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'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',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'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',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// 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',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => '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',
// 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',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'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',
];
}

46
app/Config/Validation.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
namespace Config;
use App\Config\Validation\OSPOSRules;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
OSPOSRules::class
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

View File

@@ -0,0 +1,162 @@
<?php
namespace App\Config\Validation;
use App\Models\Employee;
use CodeIgniter\HTTP\IncomingRequest;
use Config\OSPOS;
use Config\Services;
/**
* @property Employee employee
* @property IncomingRequest request
*/
class OSPOSRules
{
private IncomingRequest $request;
private array $config;
/**
* Validates the username and password sent to the login view. User is logged in on successful validation.
*
* @param string $username Username to check against.
* @param string $fields Comma separated string of the fields for validation.
* @param array $data Data sent to the view.
* @param string|null $error The error sent back to the validation handler on failure.
* @return bool True if validation passes or false if there are errors.
* @noinspection PhpUnused
*/
public function login_check(string $username, string $fields , array $data, ?string &$error = null): bool
{
$employee = model(Employee::class);
$this->request = Services::request();
$this->config = config(OSPOS::class)->settings;
//Installation Check
if(!$this->installation_check())
{
$error = lang('Login.invalid_installation');
return false;
}
$password = $data['password'];
if(!$employee->login($username, $password))
{
$error = lang('Login.invalid_username_and_password');
return false;
}
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', $this->config) && $this->config['gcaptcha_enable'];
if($gcaptcha_enabled)
{
$g_recaptcha_response = $this->request->getPost('g-recaptcha-response');
if(!$this->gcaptcha_check($g_recaptcha_response))
{
$error = lang('Login.invalid_gcaptcha');
return false;
}
}
return true;
}
/**
* Checks to see if GCaptcha verification was successful.
*
* @param $response
* @return bool true on successful GCaptcha verification or false if GCaptcha failed.
*/
private function gcaptcha_check($response): bool
{
if(!empty($response))
{
$check = [
'secret' => $this->config['gcaptcha_secret_key'],
'response' => $response,
'remoteip' => $this->request->getIPAddress()
];
$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;
}
/**
* Checks to make sure dependency PHP extensions are installed
*
* @return bool
*/
private function installation_check(): bool
{
$installed_extensions = implode(', ', get_loaded_extensions());
$required_extensions = ['bcmath', 'intl', 'gd', 'openssl', 'mbstring', 'curl'];
$pattern = '/';
foreach($required_extensions as $extension)
{
$pattern .= '(?=.*\b' . preg_quote($extension, '/') . '\b)';
}
$pattern .= '/i';
$is_installed = preg_match($pattern, $installed_extensions);
if(!$is_installed)
{
log_message('error', '[ERROR] Check your php.ini.');
log_message('error',"PHP installed extensions: $installed_extensions");
log_message('error','PHP required extensions: ' . implode(', ', $required_extensions));
}
return $is_installed;
}
/**
* Validates the candidate as a decimal number. Takes the locale into account. Used in validation rule calls.
*
* @param string $candidate
* @param string|null $error
* @return bool
* @noinspection PhpUnused
*/
public function decimal_locale(string $candidate, ?string &$error = null): bool
{
$candidate = prepare_decimal($candidate);
$validation = Services::validation();
$validation->setRules([
'candidate' => 'decimal'
]);
$data = [
'candidate' => $candidate
];
if (!$validation->run($data))
{
$error = $validation->getErrors();
return false;
}
return true;
}
}

62
app/Config/View.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
}

View File

@@ -0,0 +1,262 @@
<?php
namespace App\Controllers;
use App\Models\Attribute;
use Config\Services;
require_once('Secure_Controller.php');
/**
* Attributes controls the custom attributes assigned to items
**/
class Attributes extends Secure_Controller
{
private Attribute $attribute;
public function __construct()
{
parent::__construct('attributes');
$this->attribute = model(Attribute::class);
}
/**
* Gets and sends the main view for Attributes to the browser.
*
* @return void
**/
public function getIndex(): void
{
$data['table_headers'] = get_attribute_definition_manage_table_headers();
echo view('attributes/manage', $data);
}
/**
* Returns attribute table data rows. This will be called with AJAX.
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(ATTRIBUTE_DEFINITION_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'definition_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$attributes = $this->attribute->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->attribute->get_found_rows($search);
$data_rows = [];
foreach($attributes->getResult() as $attribute_row)
{
$attribute_row->definition_flags = $this->get_attributes($attribute_row->definition_flags);
$data_rows[] = get_attribute_definition_data_row($attribute_row);
}
echo json_encode(['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* AJAX called function which saves the attribute value sent via POST by using the model save function.
* @return void
* @noinspection PhpUnused
*/
public function postSaveAttributeValue(): void
{
$success = $this->attribute->saveAttributeValue(
html_entity_decode($this->request->getPost('attribute_value')),
$this->request->getPost('definition_id', FILTER_SANITIZE_NUMBER_INT),
$this->request->getPost('item_id', FILTER_SANITIZE_NUMBER_INT),
$this->request->getPost('attribute_id', FILTER_SANITIZE_NUMBER_INT)
);
echo json_encode(['success' => $success != 0]);
}
/**
* AJAX called function deleting an attribute value using the model delete function.
* @return void
* @noinspection PhpUnused
*/
public function postDelete_attribute_value(): void
{
$success = $this->attribute->delete_value(
html_entity_decode($this->request->getPost('attribute_value')),
$this->request->getPost('definition_id', FILTER_SANITIZE_NUMBER_INT)
);
echo json_encode(['success' => $success]);
}
/**
* AJAX called function which saves the attribute definition.
*
* @param int $definition_id
* @return void
* @noinspection PhpUnused
*/
public function postSaveDefinition(int $definition_id = NO_DEFINITION_ID): void
{
$definition_flags = 0;
$flags = (empty($this->request->getPost('definition_flags'))) ? [] : $this->request->getPost('definition_flags', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
foreach($flags as $flag)
{
$definition_flags |= $flag;
}
//Save definition data
$definition_data = [
'definition_name' => $this->request->getPost('definition_name'),
'definition_unit' => $this->request->getPost('definition_unit') != '' ? $this->request->getPost('definition_unit') : null,
'definition_flags' => $definition_flags,
'definition_fk' => $this->request->getPost('definition_group') != '' ? $this->request->getPost('definition_group') : null
];
if ($this->request->getPost('definition_type') != null)
{
$definition_data['definition_type'] = DEFINITION_TYPES[$this->request->getPost('definition_type')];
}
$definition_name = $definition_data['definition_name'];
if($this->attribute->save_definition($definition_data, $definition_id))
{
//New definition
if($definition_id == NO_DEFINITION_ID)
{
$definition_values = json_decode(html_entity_decode($this->request->getPost('definition_values')));
foreach($definition_values as $definition_value)
{
$this->attribute->saveAttributeValue($definition_value, $definition_data['definition_id']);
}
echo json_encode([
'success' => true,
'message' => lang('Attributes.definition_successful_adding') . ' ' . $definition_name,
'id' => $definition_data['definition_id']
]);
}
//Existing definition
else
{
echo json_encode([
'success' => true,
'message' => lang('Attributes.definition_successful_updating') . ' ' . $definition_name,
'id' => $definition_id
]);
}
}
//Failure
else
{
echo json_encode([
'success' => false,
'message' => lang('Attributes.definition_error_adding_updating', [$definition_name]),
'id' => NEW_ENTRY
]);
}
}
/**
*
* @param int $definition_id
* @return void
* @noinspection PhpUnused
*/
public function getSuggestAttribute(int $definition_id): void
{
$suggestions = $this->attribute->get_suggestions($definition_id, html_entity_decode($this->request->getGet('term')));
echo json_encode($suggestions);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$attribute_definition_info = $this->attribute->getAttributeInfo($row_id);
$attribute_definition_info->definition_flags = $this->get_attributes($attribute_definition_info->definition_flags);
$data_row = get_attribute_definition_data_row($attribute_definition_info);
echo json_encode($data_row);
}
/**
* @param int $definition_flags
* @return array
*/
private function get_attributes(int $definition_flags = 0): array
{
$definition_flag_names = [];
foreach (Attribute::get_definition_flags() as $id => $term)
{
if ($id & $definition_flags)
{
$definition_flag_names[$id] = lang('Attributes.' . strtolower($term) . '_visibility');
}
}
return $definition_flag_names;
}
/**
* @param int $definition_id
* @return void
*/
public function getView(int $definition_id = NO_DEFINITION_ID): void
{
$info = $this->attribute->getAttributeInfo($definition_id);
foreach(get_object_vars($info) as $property => $value)
{
$info->$property = $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'][''] = lang('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);
echo view('attributes/form', $data);
}
/**
* AJAX called function to delete an attribute value. This is never called in the code. Perhaps it was boiler plate code that just isn't needed?
* @param int $attribute_id
* @return bool
* @noinspection PhpUnused
*/
public function delete_value(int $attribute_id): bool //TODO: This function appears to never be used in the codebase. Is it needed?
{
return $this->attribute->delete_value($attribute_id, NO_DEFINITION_ID);
}
/**
* Deletes an attribute definition
* @return void
*/
public function postDelete(): void
{
$attributes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->attribute->delete_definition_list($attributes_to_delete))
{
$message = lang('Attributes.definition_successful_deleted') . ' ' . count($attributes_to_delete) . ' ' . lang('Attributes.definition_one_or_multiple');
echo json_encode(['success' => true, 'message' => $message]);
}
else
{
echo json_encode(['success' => false, 'message' => lang('Attributes.definition_cannot_be_deleted')]);
}
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var list<string>
*/
protected $helpers = [];
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
}
}

325
app/Controllers/Cashups.php Normal file
View File

@@ -0,0 +1,325 @@
<?php
namespace App\Controllers;
use App\Models\Cashup;
use App\Models\Expense;
use App\Models\Reports\Summary_payments;
use Config\OSPOS;
use Config\Services;
class Cashups extends Secure_Controller
{
private Cashup $cashup;
private Expense $expense;
private Summary_payments $summary_payments;
private array $config;
public function __construct()
{
parent::__construct('cashups');
$this->cashup = model(Cashup::class);
$this->expense = model(Expense::class);
$this->summary_payments = model(Summary_payments::class);
$this->config = config(OSPOS::class)->settings;
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_cashups_manage_table_headers();
// filters that will be loaded in the multiselect dropdown
$data['filters'] = ['is_deleted' => lang('Cashups.is_deleted')];
echo view('cashups/manage', $data);
}
/**
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(CASHUPS_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'cashup_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$filters = [
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS), //TODO: Is this the best way to filter dates
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'is_deleted' => false
];
// check if any filter is set in the multiselect dropdown
$request_filters = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS) ?? [], true);
$filters = array_merge($filters, $request_filters);
$cash_ups = $this->cashup->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->cashup->get_found_rows($search, $filters);
$data_rows = [];
foreach($cash_ups->getResult() as $cash_up)
{
$data_rows[] = get_cash_up_data_row($cash_up);
}
echo json_encode(['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @param int $cashup_id
* @return void
*/
public function getView(int $cashup_id = NEW_ENTRY): void
{
$data = [];
$data['employees'] = [];
foreach($this->employee->get_all()->getResult() as $employee)
{
foreach(get_object_vars($employee) as $property => $value)
{
$employee->$property = $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 = $value;
}
// open cashup
if($cash_ups_info->cashup_id == NEW_ENTRY)
{
$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['date_or_time_format']))
{
if($cash_ups_info->open_date != null)
{
$start_date = substr($cash_ups_info->open_date, 0, 10);
}
else
{
$start_date = null;
}
if($cash_ups_info->close_date != null)
{
$end_date = substr($cash_ups_info->close_date, 0, 10);
}
else
{
$end_date = null;
}
// search for all the payments given the time range
$inputs = [
'start_date' => $start_date,
'end_date' => $end_date,
'sale_type' => 'complete',
'location_id' => 'all'
];
}
else
{
// search for all the payments given the time range
$inputs = [
'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
$reports_data = $this->summary_payments->getData($inputs);
foreach($reports_data as $row)
{
if($row['trans_group'] == lang('Reports.trans_payments'))
{
if($row['trans_type'] == lang('Sales.cash'))
{
$cash_ups_info->closed_amount_cash += $row['trans_amount'];
}
elseif($row['trans_type'] == lang('Sales.due'))
{
$cash_ups_info->closed_amount_due += $row['trans_amount'];
}
elseif($row['trans_type'] == lang('Sales.debit') ||
$row['trans_type'] == lang('Sales.credit'))
{
$cash_ups_info->closed_amount_card += $row['trans_amount'];
}
elseif($row['trans_type'] == lang('Sales.check'))
{
$cash_ups_info->closed_amount_check += $row['trans_amount'];
}
}
}
// lookup expenses paid in cash
$filters = [
'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 -= $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;
echo view("cashups/form", $data);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$cash_ups_info = $this->cashup->get_info($row_id);
$data_row = get_cash_up_data_row($cash_ups_info);
echo json_encode($data_row);
}
/**
* @param int $cashup_id
* @return void
*/
public function postSave(int $cashup_id = NEW_ENTRY): void
{
$open_date = $this->request->getPost('open_date');
$open_date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $open_date);
$close_date = $this->request->getPost('close_date');
$close_date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $close_date);
$open_amount_cash = prepare_decimal($this->request->getPost('open_amount_cash'));
$transfer_amount_cash = prepare_decimal($this->request->getPost('transfer_amount_cash'));
$closed_amount_cash = prepare_decimal($this->request->getPost('closed_amount_cash'));
$closed_amount_due = prepare_decimal($this->request->getPost('closed_amount_due'));
$closed_amount_card = prepare_decimal($this->request->getPost('closed_amount_card'));
$closed_amount_check = prepare_decimal($this->request->getPost('closed_amount_check'));
$closed_amount_total = prepare_decimal($this->request->getPost('closed_amount_total'));
$cash_up_data = [
'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(filter_var($open_amount_cash, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'transfer_amount_cash' => parse_decimals(filter_var($transfer_amount_cash, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_cash' => parse_decimals(filter_var($closed_amount_cash, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_due' => parse_decimals(filter_var($closed_amount_due, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_card' => parse_decimals(filter_var($closed_amount_card, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_check' => parse_decimals(filter_var($closed_amount_check, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'closed_amount_total' => parse_decimals(filter_var($closed_amount_total, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'note' => $this->request->getPost('note') != null,
'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'open_employee_id' => $this->request->getPost('open_employee_id', FILTER_SANITIZE_NUMBER_INT),
'close_employee_id' => $this->request->getPost('close_employee_id', FILTER_SANITIZE_NUMBER_INT),
'deleted' => $this->request->getPost('deleted') != null
];
if($this->cashup->save_value($cash_up_data, $cashup_id))
{
//New cashup_id
if($cashup_id == NEW_ENTRY)
{
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_adding'), 'id' => $cash_up_data['cashup_id']]);
}
else // Existing Cashup
{
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_updating'), 'id' => $cashup_id]);
}
}
else//failure
{
echo json_encode(['success' => false, 'message' => lang('Cashups.error_adding_updating'), 'id' => NEW_ENTRY]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$cash_ups_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->cashup->delete_list($cash_ups_to_delete))
{
echo json_encode(['success' => true, 'message' => lang('Cashups.successful_deleted') . ' ' . count($cash_ups_to_delete) . ' ' . lang('Cashups.one_or_multiple'), 'ids' => $cash_ups_to_delete]);
}
else
{
echo json_encode(['success' => false, 'message' => lang('Cashups.cannot_be_deleted'), 'ids' => $cash_ups_to_delete]);
}
}
/**
* Calculate the total for cashups. Used in app\Views\cashups\form.php
*
* @return void
* @noinspection PhpUnused
*/
public function ajax_cashup_total(): void
{
$raw_open_amount_cash = $this->request->getPost('open_amount_cash');
$raw_transfer_amount_cash = $this->request->getPost('transfer_amount_cash');
$raw_closed_amount_cash = $this->request->getPost('closed_amount_cash');
$raw_closed_amount_due = $this->request->getPost('closed_amount_due');
$raw_closed_amount_card = $this->request->getPost('closed_amount_card');
$raw_closed_amount_check = $this->request->getPost('closed_amount_check');
$open_amount_cash = parse_decimals(filter_var(prepare_decimal($raw_open_amount_cash), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$transfer_amount_cash = parse_decimals(filter_var(prepare_decimal($raw_transfer_amount_cash), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$closed_amount_cash = parse_decimals(filter_var(prepare_decimal($raw_closed_amount_cash), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$closed_amount_due = parse_decimals(filter_var(prepare_decimal($raw_closed_amount_due), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$closed_amount_card = parse_decimals(filter_var(prepare_decimal($raw_closed_amount_card), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$closed_amount_check = parse_decimals(filter_var(prepare_decimal($raw_closed_amount_check), FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$total = $this->_calculate_total($open_amount_cash, $transfer_amount_cash, $closed_amount_due, $closed_amount_cash, $closed_amount_card, $closed_amount_check); //TODO: hungarian notation
echo json_encode(['total' => to_currency_no_money($total)]);
}
/**
* Calculate total
*/
private function _calculate_total(float $open_amount_cash, float $transfer_amount_cash, float $closed_amount_due, float $closed_amount_cash, float $closed_amount_card, $closed_amount_check): float //TODO: need to get rid of hungarian notation here. Also, the signature is pretty long. Perhaps they need to go into an object or array?
{
return ($closed_amount_cash - $open_amount_cash - $transfer_amount_cash + $closed_amount_due + $closed_amount_card + $closed_amount_check);
}
}

973
app/Controllers/Config.php Normal file
View File

@@ -0,0 +1,973 @@
<?php
namespace App\Controllers;
use App\Libraries\Barcode_lib;
use App\Libraries\Mailchimp_lib;
use App\Libraries\Receiving_lib;
use App\Libraries\Sale_lib;
use App\Libraries\Tax_lib;
use App\Models\Appconfig;
use App\Models\Attribute;
use App\Models\Customer_rewards;
use App\Models\Dinner_table;
use App\Models\Module;
use App\Models\Enums\Rounding_mode;
use App\Models\Stock_location;
use App\Models\Tax;
use CodeIgniter\Database\BaseConnection;
use CodeIgniter\Encryption\EncrypterInterface;
use Config\Database;
use Config\OSPOS;
use Config\Services;
use DirectoryIterator;
use NumberFormatter;
use ReflectionException;
class Config extends Secure_Controller
{
protected $helpers = ['security'];
private BaseConnection $db;
private EncrypterInterface $encrypter;
private Barcode_lib $barcode_lib;
private Sale_lib $sale_lib;
private Receiving_lib $receiving_lib;
private Tax_lib $tax_lib;
private Appconfig $appconfig;
private Attribute $attribute;
private Customer_rewards $customer_rewards;
private Dinner_table $dinner_table;
protected Module $module;
private Stock_location $stock_location;
private Tax $tax;
private array $config;
public function __construct()
{
parent::__construct('config');
$this->barcode_lib = new Barcode_lib();
$this->sale_lib = new Sale_lib();
$this->receiving_lib = new receiving_lib();
$this->tax_lib = new Tax_lib();
$this->appconfig = model(Appconfig::class);
$this->attribute = model(Attribute::class);
$this->customer_rewards = model(Customer_rewards::class);
$this->dinner_table = model(Dinner_table::class);
$this->module = model(Module::class);
$this->stock_location = model(Stock_location::class);
$this->tax = model(Tax::class);
$this->config = config(OSPOS::class)->settings;
$this->db = Database::connect();
helper('security');
if (check_encryption()) {
$this->encrypter = Services::encrypter();
} else {
log_message('alert', 'Error preparing encryption key');
}
}
/**
* This function loads all the licenses starting with the first one being OSPOS one
*/
private function _licenses(): array //TODO: remove hungarian notation. Super long function. Perhaps we need to refactor out functions?
{
$i = 0;
$bower = false;
$composer = false;
$license = [];
$license[$i]['title'] = 'Open Source Point Of Sale ' . config('App')->application_version;
if (file_exists('license/LICENSE')) {
$license[$i]['text'] = file_get_contents('license/LICENSE', false, 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) { //TODO: $fileinfo doesn't match our variable naming convention
// 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'] = file_get_contents($basename . '.version', false, null, 0, 100);
$license_text_file = $basename . '.license';
if (file_exists($license_text_file)) {
$license[$i]['text'] = file_get_contents($license_text_file, false, 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"; //TODO: Duplicated Code
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";
}
}
}
}
}
// 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"; //TODO: Duplicated Code.
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';
}
}
}
return $license;
}
/**
* This function loads all the available themes in the dist/bootswatch directory
* @return array
*/
private function _themes(): array //TODO: Hungarian notation
{
$themes = [];
// read all themes in the dist folder
$dir = new DirectoryIterator('resources/bootswatch');
foreach ($dir as $dirinfo) { //TODO: $dirinfo doesn't follow naming convention
if ($dirinfo->isDir() && !$dirinfo->isDot() && $dirinfo->getFileName() != 'fonts') {
$file = $dirinfo->getFileName();
$themes[$file] = ucfirst($file);
}
}
asort($themes);
return $themes;
}
/**
*/
public function getIndex(): void
{
$data['stock_locations'] = $this->stock_location->get_all()->getResultArray();
$data['dinner_tables'] = $this->dinner_table->get_all()->getResultArray();
$data['customer_rewards'] = $this->customer_rewards->get_all()->getResultArray();
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
$data['barcode_fonts'] = $this->barcode_lib->listfonts('fonts');
$data['logo_exists'] = $this->config['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['currency_code'] ?? '';
$data['dbVersion'] = mysqli_get_server_info($this->db->getConnection());
//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();
//General related fields
$image_allowed_types = ['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['image_allowed_types']);
//Integrations Related fields
$data['mailchimp'] = [];
if (check_encryption()) { //TODO: Hungarian notation
if (!isset($this->encrypter)) {
helper('security');
$this->encrypter = Services::encrypter();
}
$data['mailchimp']['api_key'] = (isset($this->config['mailchimp_api_key']) && !empty($this->config['mailchimp_api_key']))
? $this->encrypter->decrypt($this->config['mailchimp_api_key'])
: '';
$data['mailchimp']['list_id'] = (isset($this->config['mailchimp_list_id']) && !empty($this->config['mailchimp_list_id']))
? $this->encrypter->decrypt($this->config['mailchimp_list_id'])
: '';
//Remove any backup of .env created by check_encryption()
remove_backup();
} else {
$data['mailchimp']['api_key'] = '';
$data['mailchimp']['list_id'] = '';
}
$data['mailchimp']['lists'] = $this->_mailchimp();
echo view('configs/manage', $data);
}
/**
* Saves company information. Used in app/Views/configs/info_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveInfo(): void
{
$upload_data = $this->upload_logo();
$upload_success = empty($upload_data['error']);
$batch_save_data = [
'company' => $this->request->getPost('company'),
'address' => $this->request->getPost('address'),
'phone' => $this->request->getPost('phone'),
'email' => strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL)),
'fax' => $this->request->getPost('fax'),
'website' => $this->request->getPost('website', FILTER_SANITIZE_URL),
'return_policy' => $this->request->getPost('return_policy')
];
if (!empty($upload_data['orig_name']) && $upload_data['raw_name']) {
$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;
$message = lang('Config.saved_' . ($success ? '' : 'un') . 'successfully');
$message = $upload_success ? $message : strip_tags($upload_data['error']);
echo json_encode(['success' => $success, 'message' => $message]);
}
/**
* @return array
*/
private function upload_logo(): array
{
$file = $this->request->getFile('company_logo');
if (!$file) {
return [];
}
helper(['form']);
$validation_rule = [
'company_logo' => [
'label' => 'Company logo',
'rules' => [
'uploaded[company_logo]',
'is_image[company_logo]',
'max_size[company_logo,1024]',
'mime_in[company_logo,image/png,image/jpg,image/jpeg,image/gif]',
'ext_in[company_logo,png,jpg,gif]',
'max_dims[company_logo,800,680]',
]
]
];
if (!$this->validate($validation_rule)) {
return (['error' => $this->validator->getError('company_logo')]);
}
$filename = $file->getClientName();
$info = pathinfo($filename);
$file_info = [
'orig_name' => $filename,
'raw_name' => $info['filename'],
'file_ext' => $file->guessExtension()
];
$file->move(FCPATH . 'uploads/', $file_info['raw_name'] . '.' . $file_info['file_ext'], true);
return ($file_info);
}
/**
* Saves general configuration. Used in app/Views/configs/general_config.php
*
* @throws ReflectionException
* @noinspection PhpUnused
*/
public function postSaveGeneral(): void
{
$default_sales_discount = prepare_decimal($this->request->getPost('default_sales_discount'));
$default_receivings_discount = prepare_decimal($this->request->getPost('default_receivings_discount'));
$batch_save_data = [
'theme' => $this->request->getPost('theme'),
'login_form' => $this->request->getPost('login_form'),
'default_sales_discount_type' => $this->request->getPost('default_sales_discount_type') != null,
'default_sales_discount' => filter_var($default_sales_discount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'default_receivings_discount_type' => $this->request->getPost('default_receivings_discount_type') != null,
'default_receivings_discount' => filter_var($default_receivings_discount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'enforce_privacy' => $this->request->getPost('enforce_privacy') != null,
'receiving_calculate_average_price' => $this->request->getPost('receiving_calculate_average_price') != null,
'lines_per_page' => $this->request->getPost('lines_per_page', FILTER_SANITIZE_NUMBER_INT),
'notify_horizontal_position' => $this->request->getPost('notify_horizontal_position'),
'notify_vertical_position' => $this->request->getPost('notify_vertical_position'),
'image_max_width' => $this->request->getPost('image_max_width', FILTER_SANITIZE_NUMBER_INT),
'image_max_height' => $this->request->getPost('image_max_height', FILTER_SANITIZE_NUMBER_INT),
'image_max_size' => $this->request->getPost('image_max_size', FILTER_SANITIZE_NUMBER_INT),
'image_allowed_types' => implode(',', $this->request->getPost('image_allowed_types')),
'gcaptcha_enable' => $this->request->getPost('gcaptcha_enable') != null,
'gcaptcha_secret_key' => $this->request->getPost('gcaptcha_secret_key'),
'gcaptcha_site_key' => $this->request->getPost('gcaptcha_site_key'),
'suggestions_first_column' => $this->request->getPost('suggestions_first_column'),
'suggestions_second_column' => $this->request->getPost('suggestions_second_column'),
'suggestions_third_column' => $this->request->getPost('suggestions_third_column'),
'giftcard_number' => $this->request->getPost('giftcard_number'),
'derive_sale_quantity' => $this->request->getPost('derive_sale_quantity') != null,
'multi_pack_enabled' => $this->request->getPost('multi_pack_enabled') != null,
'include_hsn' => $this->request->getPost('include_hsn') != null,
'category_dropdown' => $this->request->getPost('category_dropdown') != null
];
$this->module->set_show_office_group($this->request->getPost('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);
} elseif ($batch_save_data['category_dropdown'] == NO_DEFINITION_ID) {
$this->attribute->delete_definition(CATEGORY_DEFINITION_ID);
}
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Checks a number against the currently selected locale. Used in app/Views/configs/locale_config.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckNumberLocale(): void
{
$number_locale = $this->request->getPost('number_locale');
$save_number_locale = $this->request->getPost('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->request->getPost('currency_symbol')) ? $fmt->getSymbol(NumberFormatter::CURRENCY_SYMBOL) : $this->request->getPost('currency_symbol');
$currency_code = empty($this->request->getPost('currency_code')) ? $fmt->getTextAttribute(NumberFormatter::CURRENCY_CODE) : $this->request->getPost('currency_code');
}
if ($this->request->getPost('thousands_separator') == 'false') {
$fmt->setTextAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
}
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $currency_symbol);
$number_local_example = $fmt->format(1234567890.12300);
echo json_encode([
'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,
]);
}
/**
* Saves locale configuration. Used in app/Views/configs/locale_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveLocale(): void
{
$exploded = explode(":", $this->request->getPost('language'));
$batch_save_data = [
'currency_symbol' => $this->request->getPost('currency_symbol'),
'currency_code' => $this->request->getPost('currency_code'),
'language_code' => $exploded[0],
'language' => $exploded[1],
'timezone' => $this->request->getPost('timezone'),
'dateformat' => $this->request->getPost('dateformat'),
'timeformat' => $this->request->getPost('timeformat'),
'thousands_separator' => $this->request->getPost('thousands_separator') != null,
'number_locale' => $this->request->getPost('number_locale'),
'currency_decimals' => $this->request->getPost('currency_decimals', FILTER_SANITIZE_NUMBER_INT),
'tax_decimals' => $this->request->getPost('tax_decimals', FILTER_SANITIZE_NUMBER_INT),
'quantity_decimals' => $this->request->getPost('quantity_decimals', FILTER_SANITIZE_NUMBER_INT),
'country_codes' => htmlspecialchars($this->request->getPost('country_codes')),
'payment_options_order' => $this->request->getPost('payment_options_order'),
'date_or_time_format' => $this->request->getPost('date_or_time_format') != null,
'cash_decimals' => $this->request->getPost('cash_decimals', FILTER_SANITIZE_NUMBER_INT),
'cash_rounding_code' => $this->request->getPost('cash_rounding_code'),
'financial_year' => $this->request->getPost('financial_year', FILTER_SANITIZE_NUMBER_INT)
];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves email configuration. Used in app/Views/configs/email_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveEmail(): void
{
$password = '';
if (check_encryption() && !empty($this->request->getPost('smtp_pass'))) {
$password = $this->encrypter->encrypt($this->request->getPost('smtp_pass'));
}
$batch_save_data = [
'protocol' => $this->request->getPost('protocol'),
'mailpath' => $this->request->getPost('mailpath'),
'smtp_host' => $this->request->getPost('smtp_host'),
'smtp_user' => $this->request->getPost('smtp_user'),
'smtp_pass' => $password,
'smtp_port' => $this->request->getPost('smtp_port', FILTER_SANITIZE_NUMBER_INT),
'smtp_timeout' => $this->request->getPost('smtp_timeout', FILTER_SANITIZE_NUMBER_INT),
'smtp_crypto' => $this->request->getPost('smtp_crypto')
];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves SMS message configuration. Used in app/Views/configs/message_config.php.
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveMessage(): void
{
$password = '';
if (check_encryption() && !empty($this->request->getPost('msg_pwd'))) {
$password = $this->encrypter->encrypt($this->request->getPost('msg_pwd'));
}
$batch_save_data = [
'msg_msg' => $this->request->getPost('msg_msg'),
'msg_uid' => $this->request->getPost('msg_uid'),
'msg_pwd' => $password,
'msg_src' => $this->request->getPost('msg_src')
];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* This function fetches all the available lists from Mailchimp for the given API key
*/
private function _mailchimp(string $api_key = ''): array //TODO: Hungarian notation
{
$mailchimp_lib = new Mailchimp_lib(['api_key' => $api_key]);
$result = [];
$lists = $mailchimp_lib->getLists();
if ($lists !== false) {
if (is_array($lists) && !empty($lists['lists']) && is_array($lists['lists'])) {
foreach ($lists['lists'] as $list) {
$result[$list['id']] = $list['name'] . ' [' . $list['stats']['member_count'] . ']';
}
}
}
return $result;
}
/**
* Gets Mailchimp lists when a valid API key is inserted. Used in app/Views/configs/integrations_config.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckMailchimpApiKey(): void
{
$lists = $this->_mailchimp($this->request->getPost('mailchimp_api_key'));
$success = count($lists) > 0;
echo json_encode([
'success' => $success,
'message' => lang('Config.mailchimp_key_' . ($success ? '' : 'un') . 'successfully'),
'mailchimp_lists' => $lists
]);
}
/**
* Saves Mailchimp configuration. Used in app/Views/configs/integrations_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveMailchimp(): void
{
$api_key = '';
$list_id = '';
if (check_encryption()) {
$api_key_unencrypted = $this->request->getPost('mailchimp_api_key');
if (!empty($api_key_unencrypted)) {
$api_key = $this->encrypter->encrypt($api_key_unencrypted);
}
$list_id_unencrypted = $this->request->getPost('mailchimp_list_id');
if (!empty($list_id_unencrypted)) {
$list_id = $this->encrypter->encrypt($list_id_unencrypted);
}
}
$batch_save_data = ['mailchimp_api_key' => $api_key, 'mailchimp_list_id' => $list_id];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Gets all stock locations. Used in app/Views/configs/stock_config.php
*
* @return void
* @noinspection PhpUnused
*/
public function getStockLocations(): void
{
$stock_locations = $this->stock_location->get_all()->getResultArray();
echo view('partial/stock_locations', ['stock_locations' => $stock_locations]);
}
/**
* @return void
*/
public function getDinnerTables(): void
{
$dinner_tables = $this->dinner_table->get_all()->getResultArray();
echo view('partial/dinner_tables', ['dinner_tables' => $dinner_tables]);
}
/**
* Gets all tax categories.
*
* @return void
*/
public function ajax_tax_categories(): void //TODO: Is this function called anywhere in the code?
{
$tax_categories = $this->tax->get_all_tax_categories()->getResultArray();
echo view('partial/tax_categories', ['tax_categories' => $tax_categories]);
}
/**
* Gets all customer rewards. Used in app/Views/configs/reward_config.php
*
* @return void
* @noinspection PhpUnused
*/
public function getCustomerRewards(): void
{
$customer_rewards = $this->customer_rewards->get_all()->getResultArray();
echo view('partial/customer_rewards', ['customer_rewards' => $customer_rewards]);
}
/**
* @return void
*/
private function _clear_session_state(): void //TODO: Hungarian notation
{
$this->sale_lib->clear_sale_location();
$this->sale_lib->clear_table();
$this->sale_lib->clear_all();
$this->receiving_lib = new Receiving_lib();
$this->receiving_lib->clear_stock_source();
$this->receiving_lib->clear_stock_destination();
$this->receiving_lib->clear_all();
}
/**
* Saves stock locations. Used in app/Views/configs/stock_config.php
*
* @return void
* @noinspection PhpUnused
*/
public function postSaveLocations(): void
{
$this->db->transStart();
$not_to_delete = [];
foreach ($this->request->getPost() as $key => $value) {
if (str_contains($key, 'stock_location')) {
// save or update
foreach ($value as $location_id => $location_name) {
$location_data = ['location_name' => $location_name];
if ($this->stock_location->save_value($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()->getResultArray();
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->transComplete();
$success = $this->db->transStatus();
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves all dinner tables. Used in app/Views/configs/table_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveTables(): void
{
$this->db->transStart();
$dinner_table_enable = $this->request->getPost('dinner_table_enable') != null;
$this->appconfig->save(['dinner_table_enable' => $dinner_table_enable]);
if ($dinner_table_enable) {
$not_to_delete = [];
foreach ($this->request->getPost() as $key => $value) { //TODO: Not sure if this is the best way to filter the array
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 = ['name' => $value];
if ($this->dinner_table->save_value($table_data, $dinner_table_id)) {
$this->_clear_session_state(); //TODO: Remove hungarian notation.
}
}
}
// all tables not available in post will be deleted now
$deleted_tables = $this->dinner_table->get_all()->getResultArray();
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->transComplete();
$success = $this->db->transStatus();
echo json_encode(['success' => $success,'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves tax configuration. Used in app/Views/configs/tax_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveTax(): void
{
$default_tax_1_rate = prepare_decimal($this->request->getPost('default_tax_1_rate'));
$default_tax_2_rate = prepare_decimal($this->request->getPost('default_tax_2_rate'));
$batch_save_data = [
'default_tax_1_rate' => parse_tax(filter_var($default_tax_1_rate, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'default_tax_1_name' => $this->request->getPost('default_tax_1_name'),
'default_tax_2_rate' => parse_tax(filter_var($default_tax_2_rate, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)),
'default_tax_2_name' => $this->request->getPost('default_tax_2_name'),
'tax_included' => $this->request->getPost('tax_included') != null,
'use_destination_based_tax' => $this->request->getPost('use_destination_based_tax') != null,
'default_tax_code' => $this->request->getPost('default_tax_code'),
'default_tax_category' => $this->request->getPost('default_tax_category'),
'default_tax_jurisdiction' => $this->request->getPost('default_tax_jurisdiction'),
'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_NUMBER_INT)
];
$success = $this->appconfig->batch_save($batch_save_data);
$message = lang('Config.saved_' . ($success ? '' : 'un') . 'successfully');
echo json_encode(['success' => $success, 'message' => $message]);
}
/**
* Saves customer rewards configuration. Used in app/Views/configs/reward_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveRewards(): void
{
$this->db->transStart();
$customer_reward_enable = $this->request->getPost('customer_reward_enable') != null;
$this->appconfig->save(['customer_reward_enable' => $customer_reward_enable]);
if ($customer_reward_enable) {
$not_to_delete = [];
$array_save = [];
foreach ($this->request->getPost() 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 (str_contains($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 = ['package_name' => $value['package_name'], 'points_percent' => $value['points_percent']];
$this->customer_rewards->save_value($package_data, $key); //TODO: reflection exception
}
}
// all packages not available in post will be deleted now
$deleted_packages = $this->customer_rewards->get_all()->getResultArray();
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->transComplete();
$success = $this->db->transStatus();
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves barcode configuration. Used in app/Views/configs/barcode_config.php
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveBarcode(): void
{
$batch_save_data = [
'barcode_type' => $this->request->getPost('barcode_type'),
'barcode_width' => $this->request->getPost('barcode_width', FILTER_SANITIZE_NUMBER_INT),
'barcode_height' => $this->request->getPost('barcode_height', FILTER_SANITIZE_NUMBER_INT),
'barcode_font' => $this->request->getPost('barcode_font'),
'barcode_font_size' => $this->request->getPost('barcode_font_size', FILTER_SANITIZE_NUMBER_INT),
'barcode_first_row' => $this->request->getPost('barcode_first_row'),
'barcode_second_row' => $this->request->getPost('barcode_second_row'),
'barcode_third_row' => $this->request->getPost('barcode_third_row'),
'barcode_num_in_row' => $this->request->getPost('barcode_num_in_row', FILTER_SANITIZE_NUMBER_INT),
'barcode_page_width' => $this->request->getPost('barcode_page_width', FILTER_SANITIZE_NUMBER_INT),
'barcode_page_cellspacing' => $this->request->getPost('barcode_page_cellspacing', FILTER_SANITIZE_NUMBER_INT),
'barcode_generate_if_empty' => $this->request->getPost('barcode_generate_if_empty') != null,
'allow_duplicate_barcodes' => $this->request->getPost('allow_duplicate_barcodes') != null,
'barcode_content' => $this->request->getPost('barcode_content'),
'barcode_formats' => json_encode($this->request->getPost('barcode_formats'))
];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves receipt configuration. Used in app/Views/configs/receipt_config.php.
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveReceipt(): void
{
$batch_save_data = [
'receipt_template' => $this->request->getPost('receipt_template'),
'receipt_font_size' => $this->request->getPost('receipt_font_size', FILTER_SANITIZE_NUMBER_INT),
'print_delay_autoreturn' => $this->request->getPost('print_delay_autoreturn', FILTER_SANITIZE_NUMBER_INT),
'email_receipt_check_behaviour' => $this->request->getPost('email_receipt_check_behaviour'),
'print_receipt_check_behaviour' => $this->request->getPost('print_receipt_check_behaviour'),
'receipt_show_company_name' => $this->request->getPost('receipt_show_company_name') != null,
'receipt_show_taxes' => $this->request->getPost('receipt_show_taxes') != null,
'receipt_show_tax_ind' => $this->request->getPost('receipt_show_tax_ind') != null,
'receipt_show_total_discount' => $this->request->getPost('receipt_show_total_discount') != null,
'receipt_show_description' => $this->request->getPost('receipt_show_description') != null,
'receipt_show_serialnumber' => $this->request->getPost('receipt_show_serialnumber') != null,
'print_silently' => $this->request->getPost('print_silently') != null,
'print_header' => $this->request->getPost('print_header') != null,
'print_footer' => $this->request->getPost('print_footer') != null,
'print_top_margin' => $this->request->getPost('print_top_margin', FILTER_SANITIZE_NUMBER_INT),
'print_left_margin' => $this->request->getPost('print_left_margin', FILTER_SANITIZE_NUMBER_INT),
'print_bottom_margin' => $this->request->getPost('print_bottom_margin', FILTER_SANITIZE_NUMBER_INT),
'print_right_margin' => $this->request->getPost('print_right_margin', FILTER_SANITIZE_NUMBER_INT)
];
$success = $this->appconfig->batch_save($batch_save_data);
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Saves invoice configuration. Used in app/Views/configs/invoice_config.php.
*
* @throws ReflectionException
* @return void
* @noinspection PhpUnused
*/
public function postSaveInvoice(): void
{
$batch_save_data = [
'invoice_enable' => $this->request->getPost('invoice_enable') != null,
'sales_invoice_format' => $this->request->getPost('sales_invoice_format'),
'sales_quote_format' => $this->request->getPost('sales_quote_format'),
'recv_invoice_format' => $this->request->getPost('recv_invoice_format'),
'invoice_default_comments' => $this->request->getPost('invoice_default_comments'),
'invoice_email_message' => $this->request->getPost('invoice_email_message'),
'line_sequence' => $this->request->getPost('line_sequence'),
'last_used_invoice_number' => $this->request->getPost('last_used_invoice_number', FILTER_SANITIZE_NUMBER_INT),
'last_used_quote_number' => $this->request->getPost('last_used_quote_number', FILTER_SANITIZE_NUMBER_INT),
'quote_default_comments' => $this->request->getPost('quote_default_comments'),
'work_order_enable' => $this->request->getPost('work_order_enable') != null,
'work_order_format' => $this->request->getPost('work_order_format'),
'last_used_work_order_number' => $this->request->getPost('last_used_work_order_number', FILTER_SANITIZE_NUMBER_INT),
'invoice_type' => $this->request->getPost('invoice_type')
];
$success = $this->appconfig->batch_save($batch_save_data);
// 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) {
if ($this->config['invoice_enable']) {
$this->sale_lib->set_mode($this->config['default_register_mode']);
} else {
$this->sale_lib->set_mode('sale');
}
}
echo json_encode(['success' => $success, 'message' => lang('Config.saved_' . ($success ? '' : 'un') . 'successfully')]);
}
/**
* Removes the company logo from the database. Used in app/Views/configs/info_config.php.
*
* @return void
* @throws ReflectionException
* @noinspection PhpUnused
*/
public function postRemoveLogo(): void
{
$success = $this->appconfig->save(['company_logo' => '']);
echo json_encode(['success' => $success]);
}
}

View File

@@ -0,0 +1,536 @@
<?php
namespace App\Controllers;
use App\Libraries\Mailchimp_lib;
use App\Models\Customer;
use App\Models\Customer_rewards;
use App\Models\Tax_code;
use CodeIgniter\HTTP\DownloadResponse;
use Config\OSPOS;
use Config\Services;
use stdClass;
class Customers extends Persons
{
private string $_list_id;
private Mailchimp_lib $mailchimp_lib;
private Customer_rewards $customer_rewards;
private Customer $customer;
private Tax_code $tax_code;
private array $config;
public function __construct()
{
parent::__construct('customers');
$this->mailchimp_lib = new Mailchimp_lib();
$this->customer_rewards = model(Customer_rewards::class);
$this->customer = model(Customer::class);
$this->tax_code = model(Tax_code::class);
$this->config = config(OSPOS::class)->settings;
$encrypter = Services::encrypter();
if(!empty($this->config['mailchimp_list_id']))
{
$this->_list_id = $encrypter->decrypt($this->config['mailchimp_list_id']);
}
else
{
$this->_list_id = '';
}
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_customer_manage_table_headers();
echo view('people/manage', $data);
}
/**
* Gets one row for a customer manage table. This is called using AJAX to update one row.
*/
public function getRow(int $row_id): void
{
$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); //TODO: This and the next 11 lines are duplicated in search(). Extract a method.
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 = get_customer_data_row($person, $stats);
echo json_encode($data_row);
}
/**
* Returns customer table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(CUSTOMER_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'people.person_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$customers = $this->customer->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->customer->get_found_rows($search);
$data_rows = [];
foreach($customers->getResult() 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); //TODO: duplicated... see above
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[] = get_customer_data_row($person, $stats);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* Gives search suggestions based on what is being searched for
*/
public function getSuggest(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->customer->get_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* @return void
*/
public function suggest_search(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->customer->get_search_suggestions($search, 25, false);
echo json_encode($suggestions);
}
/**
* Loads the customer edit form
*/
public function getView(int $customer_id = NEW_ENTRY): void
{
// Set default values
if($customer_id == null) $customer_id = NEW_ENTRY;
$info = $this->customer->get_info($customer_id);
foreach(get_object_vars($info) as $property => $value)
{
$info->$property = $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'] = $employee_info->first_name . ' ' . $employee_info->last_name;
$tax_code_info = $this->tax_code->get_info($info->sales_tax_code_id);
if($tax_code_info->tax_code != null)
{
$data['sales_tax_code_label'] = $tax_code_info->tax_code . ' ' . $tax_code_info->tax_code_name;
}
else
{
$data['sales_tax_code_label'] = '';
}
$packages = ['' => lang('Items.none')];
foreach($this->customer_rewards->get_all()->getResultArray() as $row)
{
$packages[$row['package_id']] = $row['package_name'];
}
$data['packages'] = $packages;
$data['selected_package'] = $info->package_id;
$data['use_destination_based_tax'] = $this->config['use_destination_based_tax'];
// 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 = $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'] = $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;
}
}
}
}
echo view("customers/form", $data);
}
/**
* Inserts/updates a customer
*/
public function postSave(int $customer_id = NEW_ENTRY): void
{
$first_name = $this->request->getPost('first_name');
$last_name = $this->request->getPost('last_name');
$email = strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL));
// format first and last name properly
$first_name = $this->nameize($first_name);
$last_name = $this->nameize($last_name);
$person_data = [
'first_name' => $first_name,
'last_name' => $last_name,
'gender' => $this->request->getPost('gender', FILTER_SANITIZE_NUMBER_INT),
'email' => $email,
'phone_number' => $this->request->getPost('phone_number'),
'address_1' => $this->request->getPost('address_1'),
'address_2' => $this->request->getPost('address_2'),
'city' => $this->request->getPost('city'),
'state' => $this->request->getPost('state'),
'zip' => $this->request->getPost('zip'),
'country' => $this->request->getPost('country'),
'comments' => $this->request->getPost('comments')
];
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $this->request->getPost('date'));
$discount = prepare_decimal($this->request->getPost('discount'));
$customer_data = [
'consent' => $this->request->getPost('consent') != null,
'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number'),
'tax_id' => $this->request->getPost('tax_id'),
'company_name' => $this->request->getPost('company_name') == '' ? null : $this->request->getPost('company_name'),
'discount' => $this->request->getPost('discount') == '' ? 0.00 : filter_var($discount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'discount_type' => $this->request->getPost('discount_type') == null ? PERCENT : $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT),
'package_id' => $this->request->getPost('package_id') == '' ? null : $this->request->getPost('package_id'),
'taxable' => $this->request->getPost('taxable') != null,
'date' => $date_formatter->format('Y-m-d H:i:s'),
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'sales_tax_code_id' => $this->request->getPost('sales_tax_code_id') == '' ? null : $this->request->getPost('sales_tax_code_id', FILTER_SANITIZE_NUMBER_INT)
];
if($this->customer->save_customer($person_data, $customer_data, $customer_id))
{
// save customer to Mailchimp selected list //TODO: addOrUpdateMember should be refactored... potentially pass an array or object instead of 6 parameters.
$mailchimp_status = $this->request->getPost('mailchimp_status');
$this->mailchimp_lib->addOrUpdateMember(
$this->_list_id,
$email,
$first_name,
$last_name,
$mailchimp_status == null ? "" : $mailchimp_status,
['vip' => $this->request->getPost('mailchimp_vip') != null]
);
// New customer
if($customer_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Customers.successful_adding') . ' ' . $first_name . ' ' . $last_name,
'id' => $customer_data['person_id']
]);
}
else // Existing customer
{
echo json_encode ([
'success' => true,
'message' => lang('Customers.successful_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => $customer_id
]);
}
}
else // Failure
{
echo json_encode ([
'success' => false,
'message' => lang('Customers.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => NEW_ENTRY
]);
}
}
/**
* Verifies if an email address already exists. Used in app/Views/customers/form.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckEmail(): void
{
$email = strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL));
$person_id = $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT);
$exists = $this->customer->check_email_exists($email, $person_id);
echo !$exists ? 'true' : 'false';
}
/**
* Verifies if an account number already exists. Used in app/Views/customers/form.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckAccountNumber(): void
{
$exists = $this->customer->check_account_number_exists($this->request->getPost('account_number'), $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT));
echo !$exists ? 'true' : 'false';
}
/**
* This deletes customers from the customers table
*/
public function postDelete(): void
{
$customers_to_delete = $this->request->getPost('ids');
$customers_info = $this->customer->get_multiple_info($customers_to_delete);
$count = 0;
foreach($customers_info->getResult() 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 (['success' => true,
'message' => lang('Customers.successful_deleted') . ' ' . $count . ' ' . lang('Customers.one_or_multiple')]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Customers.cannot_be_deleted')]);
}
}
/**
* Customers import from csv spreadsheet
*
* @return DownloadResponse The template for Customer CSV imports is returned and download forced.
* @noinspection PhpUnused
*/
public function getCsv(): DownloadResponse
{
$name = 'importCustomers.csv';
$data = file_get_contents(WRITEPATH . "uploads/$name");
return $this->response->download($name, $data);
}
/**
* Displays the customer CSV import modal. Used in app/Views/people/manage.php
*
* @return void
* @noinspection PhpUnused
*/
public function getCsvImport(): void
{
echo view('customers/form_csv_import');
}
/**
* Imports a CSV file containing customers. Used in app/Views/customers/form_csv_import.php
*
* @return void
* @noinspection PhpUnused
*/
public function postImportCsvFile(): void
{
if($_FILES['file_path']['error'] != UPLOAD_ERR_OK)
{
echo json_encode (['success' => false, 'message' => lang('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 = [];
while(($data = fgetcsv($handle)) !== false)
{
$consent = $data[3] == '' ? 0 : 1;
if(sizeof($data) >= 16 && $consent)
{
$email = strtolower($data[4]);
$person_data = [
'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 = [
'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;
log_message('error',"Row $i was not imported: Either email or account number already exist or data was invalid.");
}
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 = lang('Customers.csv_import_partially_failed', [count($failCodes), implode(', ', $failCodes)]);
echo json_encode (['success' => false, 'message' => $message]);
}
else
{
echo json_encode (['success' => true, 'message' => lang('Customers.csv_import_success')]);
}
}
else
{
echo json_encode (['success' => false, 'message' => lang('Customers.csv_import_nodata_wrongformat')]);
}
}
}
}

View File

@@ -0,0 +1,234 @@
<?php
namespace App\Controllers;
use App\Models\Module;
use Config\Services;
/**
*
*
* @property module module
*
*/
class Employees extends Persons
{
public function __construct()
{
parent::__construct('employees');
$this->module = model('Module');
}
/**
* Returns employee table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(PERSON_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'people.person_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$employees = $this->employee->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->employee->get_found_rows($search);
$data_rows = [];
foreach($employees->getResult() as $person)
{
$data_rows[] = get_person_data_row($person);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* AJAX called function gives search suggestions based on what is being searched for.
*
* @return void
*/
public function getSuggest(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->employee->get_search_suggestions($search, 25, true);
echo json_encode($suggestions);
}
/**
* @return void
*/
public function suggest_search(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->employee->get_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* Loads the employee edit form
*/
public function getView(int $employee_id = NEW_ENTRY): void
{
$person_info = $this->employee->get_info($employee_id);
foreach(get_object_vars($person_info) as $property => $value)
{
$person_info->$property = $value;
}
$data['person_info'] = $person_info;
$data['employee_id'] = $employee_id;
$modules = [];
foreach($this->module->get_all_modules()->getResult() as $module)
{
$module->grant = $this->employee->has_grant($module->module_id, $person_info->person_id);
$module->menu_group = $this->employee->get_menu_group($module->module_id, $person_info->person_id);
$modules[] = $module;
}
$data['all_modules'] = $modules;
$permissions = [];
foreach($this->module->get_all_subpermissions()->getResult() as $permission) //TODO: subpermissions does not follow naming standards.
{
$permission->permission_id = str_replace(' ', '_', $permission->permission_id);
$permission->grant = $this->employee->has_grant($permission->permission_id, $person_info->person_id);
$permissions[] = $permission;
}
$data['all_subpermissions'] = $permissions;
echo view('employees/form', $data);
}
/**
* Inserts/updates an employee
*/
public function postSave(int $employee_id = NEW_ENTRY): void
{
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS); //TODO: duplicated code
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$email = strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL));
// format first and last name properly
$first_name = $this->nameize($first_name);
$last_name = $this->nameize($last_name);
$person_data = [
'first_name' => $first_name,
'last_name' => $last_name,
'gender' => $this->request->getPost('gender', FILTER_SANITIZE_NUMBER_INT),
'email' => $email,
'phone_number' => $this->request->getPost('phone_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_1' => $this->request->getPost('address_1', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_2' => $this->request->getPost('address_2', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'city' => $this->request->getPost('city', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'state' => $this->request->getPost('state', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'zip' => $this->request->getPost('zip', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'country' => $this->request->getPost('country', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
];
$grants_array = [];
foreach($this->module->get_all_permissions()->getResult() as $permission)
{
$grants = [];
$grant = $this->request->getPost('grant_'.$permission->permission_id) != null ? $this->request->getPost('grant_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '';
if($grant == $permission->permission_id)
{
$grants['permission_id'] = $permission->permission_id;
$grants['menu_group'] = $this->request->getPost('menu_group_'.$permission->permission_id) != null ? $this->request->getPost('menu_group_' . $permission->permission_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS) : '--';
$grants_array[] = $grants;
}
}
//Password has been changed OR first time password set
if(!empty($this->request->getPost('password')) && ENVIRONMENT != 'testing')
{
$exploded = explode(":", $this->request->getPost('language', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$employee_data = [
'username' => $this->request->getPost('username', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'password' => password_hash($this->request->getPost('password'), PASSWORD_DEFAULT),
'hash_version' => 2,
'language_code' => $exploded[0],
'language' => $exploded[1]
];
}
else //Password not changed
{
$exploded = explode(":", $this->request->getPost('language', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
$employee_data = [
'username' => $this->request->getPost('username', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'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 == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Employees.successful_adding') . ' ' . $first_name . ' ' . $last_name,
'id' => $employee_data['person_id']
]);
}
else // Existing employee
{
echo json_encode ([
'success' => true,
'message' => lang('Employees.successful_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => $employee_id
]);
}
}
else // Failure
{
echo json_encode ([
'success' => false,
'message' => lang('Employees.error_adding_updating') . ' ' . $first_name . ' ' . $last_name,
'id' => NEW_ENTRY
]);
}
}
/**
* This deletes employees from the employees table
*/
public function postDelete(): void
{
$employees_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->employee->delete_list($employees_to_delete)) //TODO: this is passing a string, but delete_list expects an array
{
echo json_encode ([
'success' => true,
'message' => lang('Employees.successful_deleted') . ' ' . count($employees_to_delete) . ' ' . lang('Employees.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Employees.cannot_be_deleted')]);
}
}
/**
* Checks an employee username against the database. Used in app\Views\employees\form.php
*
* @param $employee_id
* @return void
* @noinspection PhpUnused
*/
public function getCheckUsername($employee_id): void
{
$exists = $this->employee->username_exists($employee_id, $this->request->getGet('username'));
echo !$exists ? 'true' : 'false';
}
}

View File

@@ -0,0 +1,211 @@
<?php
namespace App\Controllers;
use App\Models\Expense;
use App\Models\Expense_category;
use Config\OSPOS;
use Config\Services;
class Expenses extends Secure_Controller
{
private Expense $expense;
private Expense_category $expense_category;
public function __construct()
{
parent::__construct('expenses');
$this->expense = model(Expense::class);
$this->expense_category = model(Expense_category::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_expenses_manage_table_headers();
// filters that will be loaded in the multiselect dropdown
$data['filters'] = [
'only_cash' => lang('Expenses.cash_filter'),
'only_due' => lang('Expenses.due_filter'),
'only_check' => lang('Expenses.check_filter'),
'only_credit' => lang('Expenses.credit_filter'),
'only_debit' => lang('Expenses.debit_filter'),
'is_deleted' => lang('Expenses.is_deleted')
];
echo view('expenses/manage', $data);
}
/**
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(EXPENSE_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'expense_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$filters = [
'start_date' => $this->request->getGet('start_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'end_date' => $this->request->getGet('end_date', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'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
$request_filters = array_fill_keys($this->request->getGet('filters', FILTER_SANITIZE_FULL_SPECIAL_CHARS) ?? [], true);
$filters = array_merge($filters, $request_filters);
$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 = [];
foreach($expenses->getResult() as $expense)
{
$data_rows[] = get_expenses_data_row($expense);
}
if($total_rows > 0)
{
$data_rows[] = get_expenses_data_last_row($expenses);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows, 'payment_summary' => $payment_summary]);
}
/**
* @param int $expense_id
* @return void
*/
public function getView(int $expense_id = NEW_ENTRY): void
{
$data = []; //TODO: Duplicated code
$data['employees'] = [];
foreach($this->employee->get_all()->getResult() as $employee)
{
foreach(get_object_vars($employee) as $property => $value)
{
$employee->$property = $value;
}
$data['employees'][$employee->person_id] = $employee->first_name . ' ' . $employee->last_name;
}
$data['expenses_info'] = $this->expense->get_info($expense_id);
$expense_categories = [];
foreach($this->expense_category->get_all(0, 0, true)->getResultArray() as $row)
{
$expense_categories[$row['expense_category_id']] = $row['category_name'];
}
$data['expense_categories'] = $expense_categories;
$expense_id = $data['expenses_info']->expense_id;
if($expense_id == NEW_ENTRY)
{
$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'] = [];
foreach($this->expense->get_expense_payment($expense_id)->getResult() as $payment)
{
foreach(get_object_vars($payment) as $property => $value)
{
$payment->$property = $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->expense->get_payment_options();
echo view("expenses/form", $data);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$expense_info = $this->expense->get_info($row_id);
$data_row = get_expenses_data_row($expense_info);
echo json_encode($data_row);
}
/**
* @param int $expense_id
* @return void
*/
public function postSave(int $expense_id = NEW_ENTRY): void
{
$config = config(OSPOS::class)->settings;
$newdate = $this->request->getPost('date', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$date_formatter = date_create_from_format($config['dateformat'] . ' ' . $config['timeformat'], $newdate);
$amount = prepare_decimal($this->request->getPost('amount'));
$tax_amount = prepare_decimal($this->request->getPost('tax_amount'));
$expense_data = [
'date' => $date_formatter->format('Y-m-d H:i:s'),
'supplier_id' => $this->request->getPost('supplier_id') == '' ? null : $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT),
'supplier_tax_code' => $this->request->getPost('supplier_tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'amount' => filter_var($amount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'tax_amount' => filter_var($tax_amount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'payment_type' => $this->request->getPost('payment_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'expense_category_id' => $this->request->getPost('expense_category_id', FILTER_SANITIZE_NUMBER_INT),
'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'deleted' => $this->request->getPost('deleted') != null
];
if($this->expense->save_value($expense_data, $expense_id))
{
//New Expense
if($expense_id == NEW_ENTRY)
{
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_adding'), 'id' => $expense_data['expense_id']]);
}
else // Existing Expense
{
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_updating'), 'id' => $expense_id]);
}
}
else//failure
{
echo json_encode (['success' => false, 'message' => lang('Expenses.error_adding_updating'), 'id' => NEW_ENTRY]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$expenses_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->expense->delete_list($expenses_to_delete))
{
echo json_encode (['success' => true, 'message' => lang('Expenses.successful_deleted') . ' ' . count($expenses_to_delete) . ' ' . lang('Expenses.one_or_multiple'), 'ids' => $expenses_to_delete]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Expenses.cannot_be_deleted'), 'ids' => $expenses_to_delete]);
}
}
}

View File

@@ -0,0 +1,134 @@
<?php
namespace App\Controllers;
use App\Models\Expense_category;
use Config\Services;
class Expenses_categories extends Secure_Controller //TODO: Is this class ever used?
{
private Expense_category $expense_category;
public function __construct()
{
parent::__construct('expenses_categories');
$this->expense_category = model(Expense_category::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_expense_category_manage_table_headers();
echo view('expenses_categories/manage', $data);
}
/**
* Returns expense_category_manage table data rows. This will be called with AJAX.
**/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(EXPENSE_CATEGORY_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'expense_category_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$expense_categories = $this->expense_category->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->expense_category->get_found_rows($search);
$data_rows = [];
foreach($expense_categories->getResult() as $expense_category)
{
$data_rows[] = get_expense_category_data_row($expense_category);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$data_row = get_expense_category_data_row($this->expense_category->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $expense_category_id
* @return void
*/
public function getView(int $expense_category_id = NEW_ENTRY): void
{
$data['category_info'] = $this->expense_category->get_info($expense_category_id);
echo view("expenses_categories/form", $data);
}
/**
* @param int $expense_category_id
* @return void
*/
public function postSave(int $expense_category_id = NEW_ENTRY): void
{
$expense_category_data = [
'category_name' => $this->request->getPost('category_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'category_description' => $this->request->getPost('category_description', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
];
if($this->expense_category->save_value($expense_category_data, $expense_category_id))
{
// New expense_category
if($expense_category_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Expenses_categories.successful_adding'),
'id' => $expense_category_data['expense_category_id']
]);
}
else // Existing Expense Category
{
echo json_encode ([
'success' => true,
'message' => lang('Expenses_categories.successful_updating'),
'id' => $expense_category_id
]);
}
}
else//failure
{
echo json_encode ([
'success' => true,
'message' => lang('Expenses_categories.error_adding_updating') . ' ' . $expense_category_data['category_name'],
'id' => NEW_ENTRY
]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$expense_category_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->expense_category->delete_list($expense_category_to_delete)) //TODO: Convert to ternary notation.
{
echo json_encode([
'success' => true,
'message' => lang('Expenses_categories.successful_deleted') . ' ' . count($expense_category_to_delete) . ' ' . lang('Expenses_categories.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Expenses_categories.cannot_be_deleted')]);
}
}
}

View File

@@ -0,0 +1,199 @@
<?php
namespace App\Controllers;
use App\Models\Giftcard;
use Config\OSPOS;
use Config\Services;
class Giftcards extends Secure_Controller
{
private Giftcard $giftcard;
public function __construct()
{
parent::__construct('giftcards');
$this->giftcard = model(Giftcard::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_giftcards_manage_table_headers();
echo view('giftcards/manage', $data);
}
/**
* Returns Giftcards table data rows. This will be called with AJAX.
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(GIFTCARD_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'giftcard_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$giftcards = $this->giftcard->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->giftcard->get_found_rows($search);
$data_rows = [];
foreach($giftcards->getResult() as $giftcard)
{
$data_rows[] = get_giftcard_data_row($giftcard);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* Gets search suggestions for giftcards. Used in app\Views\sales\register.php
*
* @return void
* @noinspection PhpUnused
*/
public function getSuggest(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->giftcard->get_search_suggestions($search, true);
echo json_encode($suggestions);
}
/**
* @return void
*/
public function suggest_search(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->giftcard->get_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$data_row = get_giftcard_data_row($this->giftcard->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $giftcard_id
* @return void
*/
public function getView(int $giftcard_id = NEW_ENTRY): void
{
$config = config(OSPOS::class)->settings;
$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($config['giftcard_number'] == 'random')
{
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : '';
}
else
{
$max_number_obj = $this->giftcard->get_max_number();
$max_giftnumber = isset($max_number_obj) ? $this->giftcard->get_max_number()->giftcard_number : 0; //TODO: variable does not follow naming standard.
$data['giftcard_number'] = $giftcard_id > 0 ? $giftcard_info->giftcard_number : $max_giftnumber + 1;
}
$data['giftcard_id'] = $giftcard_id;
$data['giftcard_value'] = $giftcard_info->value;
echo view("giftcards/form", $data);
}
/**
* @param int $giftcard_id
* @return void
*/
public function postSave(int $giftcard_id = NEW_ENTRY): void
{
$giftcard_number = $this->request->getPost('giftcard_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$giftcard_amount = prepare_decimal($this->request->getPost('giftcard_amount'));
if($giftcard_id == NEW_ENTRY && trim($giftcard_number) == '')
{
$giftcard_number = $this->giftcard->generate_unique_giftcard_name(filter_var($giftcard_amount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
}
$giftcard_data = [
'record_time' => date('Y-m-d H:i:s'),
'giftcard_number' => $giftcard_number,
'value' => filter_var($giftcard_amount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'person_id' => $this->request->getPost('person_id') == '' ? null : $this->request->getPost('person_id', FILTER_SANITIZE_NUMBER_INT)
];
if($this->giftcard->save_value($giftcard_data, $giftcard_id))
{
//New giftcard
if($giftcard_id == NEW_ENTRY) //TODO: Constant needed
{
echo json_encode ([
'success' => true,
'message' => lang('Giftcards.successful_adding') . ' ' . $giftcard_data['giftcard_number'],
'id' => $giftcard_data['giftcard_id']
]);
}
else //Existing giftcard
{
echo json_encode ([
'success' => true,
'message' => lang('Giftcards.successful_updating') . ' ' . $giftcard_data['giftcard_number'],
'id' => $giftcard_id
]);
}
}
else //failure
{
echo json_encode ([
'success' => false,
'message' => lang('Giftcards.error_adding_updating') . ' ' . $giftcard_data['giftcard_number'],
'id' => NEW_ENTRY
]);
}
}
/**
* Checks the giftcard number validity. Used in app\Views\giftcards\form.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckNumberGiftcard(): void
{
$giftcard_amount = parse_decimals($this->request->getPost('giftcard_amount'));
$parsed_value = filter_var($giftcard_amount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
echo json_encode (['success' => $parsed_value !== false && $parsed_value > 0 && $giftcard_amount !== false, 'giftcard_amount' => to_currency_no_money($parsed_value)]);
}
/**
* @return void
*/
public function postDelete(): void
{
$giftcards_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->giftcard->delete_list($giftcards_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Giftcards.successful_deleted') . ' ' . count($giftcards_to_delete).' '.lang('Giftcards.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Giftcards.cannot_be_deleted')]);
}
}
}

102
app/Controllers/Home.php Normal file
View File

@@ -0,0 +1,102 @@
<?php
namespace App\Controllers;
use CodeIgniter\HTTP\RedirectResponse;
class Home extends Secure_Controller
{
public function __construct()
{
parent::__construct('home', null, 'home');
}
/**
* @return void
*/
public function getIndex(): void
{
$logged_in = $this->employee->is_logged_in();
echo view('home/home');
}
/**
* Logs the currently logged in employee out of the system. Used in app/Views/partial/header.php
*
* @return RedirectResponse
* @noinspection PhpUnused
*/
public function getLogout(): RedirectResponse
{
$this->employee->logout();
return redirect()->to('login');
}
/**
* Load "change employee password" form
*
* @noinspection PhpUnused
*/
public function getChangePassword(int $employee_id = -1): void //TODO: Replace -1 with a constant
{
$person_info = $this->employee->get_info($employee_id);
foreach(get_object_vars($person_info) as $property => $value)
{
$person_info->$property = $value;
}
$data['person_info'] = $person_info;
echo view('home/form_change_password', $data);
}
/**
* Change employee password
*/
public function save(int $employee_id = -1): void //TODO: Replace -1 with a constant
{
if(!empty($this->request->getPost('current_password')) && $employee_id != -1)
{
if($this->employee->check_password($this->request->getPost('username', FILTER_SANITIZE_FULL_SPECIAL_CHARS), $this->request->getPost('current_password')))
{
$employee_data = [
'username' => $this->request->getPost('username', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'password' => password_hash($this->request->getPost('password'), PASSWORD_DEFAULT),
'hash_version' => 2
];
if($this->employee->change_password($employee_data, $employee_id))
{
echo json_encode ([
'success' => true,
'message' => lang('Employees.successful_change_password'),
'id' => $employee_id
]);
}
else//failure
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => false,
'message' => lang('Employees.unsuccessful_change_password'),
'id' => -1
]);
}
}
else
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => false,
'message' => lang('Employees.current_password_invalid'),
'id' => -1
]);
}
}
else
{//TODO: Replace -1 with constant
echo json_encode ([
'success' => false,
'message' => lang('Employees.current_password_invalid'),
'id' => -1
]);
}
}
}

View File

@@ -0,0 +1,321 @@
<?php
namespace App\Controllers;
use App\Libraries\Barcode_lib;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Item_kit_items;
use Config\Services;
class Item_kits extends Secure_Controller
{
private Item $item;
private Item_kit $item_kit;
private Item_kit_items $item_kit_items;
public function __construct()
{
parent::__construct('item_kits');
$this->item = model(Item::class);
$this->item_kit = model(Item_kit::class);
$this->item_kit_items = model(Item_kit_items::class);
}
/**
* Add the total cost and retail price to a passed item_kit retrieving the data from each singular item part of the kit
*/
private function _add_totals_to_item_kit(object $item_kit): object //TODO: Hungarian notation
{
$kit_item_info = $this->item->get_info($item_kit->kit_item_id ?? $item_kit->item_id);
$item_kit->total_cost_price = 0;
$item_kit->total_unit_price = $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 = $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;
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_item_kits_manage_table_headers();
echo view('item_kits/manage', $data);
}
/**
* Returns Item_kit table data rows. This will be called with AJAX.
*/
public function getSearch(): void
{
$search = $this->request->getGet('search') ?? '';
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(ITEM_KIT_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'item_kit_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$item_kits = $this->item_kit->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->item_kit->get_found_rows($search);
$data_rows = [];
foreach($item_kits->getResult() 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[] = get_item_kit_data_row($item_kit);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @return void
*/
public function suggest_search(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->item_kit->get_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
// 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));
}
/**
* @param int $item_kit_id
* @return void
*/
public function getView(int $item_kit_id = NEW_ENTRY): void
{
$info = $this->item_kit->get_info($item_kit_id);
if($item_kit_id == NEW_ENTRY)
{
$info->price_option = '0';
$info->print_option = PRINT_ALL;
$info->kit_item_id = 0;
$info->item_number = '';
$info->kit_discount = 0;
}
foreach(get_object_vars($info) as $property => $value)
{
$info->$property = $value;
}
$data['item_kit_info'] = $info;
$items = [];
foreach($this->item_kit_items->get_info($item_kit_id) as $item_kit_item)
{
$item['kit_sequence'] = $item_kit_item['kit_sequence'];
$item['name'] = $this->item->get_info($item_kit_item['item_id'])->name;
$item['item_id'] = $item_kit_item['item_id'];
$item['quantity'] = $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 : '';
echo view("item_kits/form", $data);
}
/**
* @param int $item_kit_id
* @return void
*/
public function postSave(int $item_kit_id = NEW_ENTRY): void
{
$kit_discount = prepare_decimal($this->request->getPost('kit_discount'));
$item_kit_data = [
'name' => $this->request->getPost('name'),
'item_kit_number' => $this->request->getPost('item_kit_number'),
'item_id' => $this->request->getPost('kit_item_id') ? null : intval($this->request->getPost('kit_item_id')),
'kit_discount' => filter_var($kit_discount,FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'kit_discount_type' => $this->request->getPost('kit_discount_type') === null ? PERCENT : intval($this->request->getPost('kit_discount_type')),
'price_option' => $this->request->getPost('price_option') === null ? PRICE_ALL : intval($this->request->getPost('price_option')),
'print_option' => $this->request->getPost('print_option') === null ? PRINT_ALL : intval($this->request->getPost('print_option')),
'description' => $this->request->getPost('description')
];
if($this->item_kit->save_value($item_kit_data, $item_kit_id))
{
$new_item = false;
//New item kit
if($item_kit_id == NEW_ENTRY)
{
$item_kit_id = $item_kit_data['item_kit_id'];
$new_item = true;
}
$item_kit_items_array = $this->request->getPost('item_kit_qty') === null ? null : $this->request->getPost('item_kit_qty');
if($item_kit_items_array != null)
{
$item_kit_items = [];
foreach($item_kit_items_array as $item_id => $item_kit_qty)
{
$item_kit_items[] = [
'item_id' => $item_id,
'quantity' => $item_kit_qty === null ? 0 : parse_quantity($item_kit_qty),
'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === null ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]"))
];
}
}
if (!empty($item_kit_items))
{
$success = $this->item_kit_items->save_value($item_kit_items, $item_kit_id);
}
else
{
$success = true;
}
if($new_item)
{
echo json_encode ([
'success' => $success,
'message' => lang('Item_kits.successful_adding').' '.$item_kit_data['name'],
'id' => $item_kit_id
]);
}
else
{
echo json_encode ([
'success' => $success,
'message' => lang('Item_kits.successful_updating').' '.$item_kit_data['name'],
'id' => $item_kit_id
]);
}
}
else//failure
{
echo json_encode ([
'success' => false,
'message' => lang('Item_kits.error_adding_updating') . ' ' . $item_kit_data['name'],
'id' => NEW_ENTRY
]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$item_kits_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
if($this->item_kit->delete_list($item_kits_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Item_kits.successful_deleted') . ' ' . count($item_kits_to_delete) . ' ' . lang('Item_kits.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Item_kits.cannot_be_deleted')]);
}
}
/**
* Checks the validity of the item kit number. Used in app/Views/item_kits/form.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCheckItemNumber(): void
{
$exists = $this->item_kit->item_number_exists($this->request->getPost('item_kit_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS), $this->request->getPost('item_kit_id', FILTER_SANITIZE_NUMBER_INT));
echo !$exists ? 'true' : 'false';
}
/**
* AJAX called function that generates barcodes for selected item_kits.
*
* @param string $item_kit_ids Colon separated list of item_kit_id values to generate barcodes for.
* @return void
* @noinspection PhpUnused
*/
public function getGenerateBarcodes(string $item_kit_ids): void
{
$barcode_lib = new Barcode_lib();
$result = [];
$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[] = [
'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 = $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'] != 'C39' && $barcode_config['barcode_type'] != 'C128')
{
$barcode_config['barcode_type'] = 'C128';
}
$data['barcode_config'] = $barcode_config;
// display barcodes
echo view("barcodes/barcode_sheet", $data);
}
}

1460
app/Controllers/Items.php Normal file
View File

File diff suppressed because it is too large Load Diff

78
app/Controllers/Login.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
namespace App\Controllers;
use App\Libraries\MY_Migration;
use App\Models\Employee;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\Model;
use Config\OSPOS;
use Config\Services;
/**
* @property employee employee
*/
class Login extends BaseController
{
public Model $employee;
/**
* @return RedirectResponse|string
*/
public function index(): string|RedirectResponse
{
$this->employee = model(Employee::class);
if(!$this->employee->is_logged_in())
{
$migration = new MY_Migration(config('Migrations'));
$config = config(OSPOS::class)->settings;
$gcaptcha_enabled = array_key_exists('gcaptcha_enable', $config)
? $config['gcaptcha_enable']
: false;
$migration->migrate_to_ci4();
$validation = Services::validation();
$data = [
'has_errors' => false,
'is_latest' => $migration->is_latest(),
'latest_version' => $migration->get_latest_migration(),
'gcaptcha_enabled' => $gcaptcha_enabled,
'config' => $config,
'validation' => $validation
];
if($this->request->getMethod() !== 'POST')
{
return view('login', $data);
}
$rules = ['username' => 'required|login_check[data]'];
$messages = [
'username' => [
'required' => lang('Login.required_username'),
'login_check' => lang('Login.invalid_username_and_password'),
]
];
if(!$this->validate($rules, $messages))
{
$data['has_errors'] = !empty($validation->getErrors());
return view('login', $data);
}
if(!$data['is_latest'])
{
set_time_limit(3600);
$migration->setNamespace('App')->latest();
return redirect()->to('login');
}
}
return redirect()->to('home');
}
}

View File

@@ -0,0 +1,97 @@
<?php
namespace App\Controllers;
use App\Libraries\Sms_lib;
use App\Models\Person;
class Messages extends Secure_Controller
{
private Sms_lib $sms_lib;
public function __construct()
{
parent::__construct('messages');
$this->sms_lib = new Sms_lib();
}
/**
* @return void
*/
public function getIndex(): void
{
echo view('messages/sms');
}
/**
* @param int $person_id
* @return void
*/
public function getView(int $person_id = NEW_ENTRY): void
{
$person = model(Person::class);
$info = $person->get_info($person_id);
foreach(get_object_vars($info) as $property => $value)
{
$info->$property = $value;
}
$data['person_info'] = $info;
echo view('messages/form_sms', $data);
}
/**
* @return void
*/
public function send(): void
{
$phone = $this->request->getPost('phone', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$message = $this->request->getPost('message', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$response = $this->sms_lib->sendSMS($phone, $message);
if($response)
{
echo json_encode (['success' => true, 'message' => lang('Messages.successfully_sent') . ' ' . esc($phone)]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone)]);
}
}
/**
* Sends an SMS message to a user. Used in app/Views/messages/form_sms.php.
*
* @param int $person_id
* @return void
* @noinspection PhpUnused
*/
public function send_form(int $person_id = NEW_ENTRY): void
{
$phone = $this->request->getPost('phone', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$message = $this->request->getPost('message', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$response = $this->sms_lib->sendSMS($phone, $message);
if($response)
{
echo json_encode ([
'success' => true,
'message' => lang('Messages.successfully_sent') . ' ' . esc($phone),
'person_id' => $person_id
]);
}
else
{
echo json_encode ([
'success' => false,
'message' => lang('Messages.unsuccessfully_sent') . ' ' . esc($phone),
'person_id' => NEW_ENTRY
]);
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Controllers;
use App\Models\Module;
/**
* Part of the grants mechanism to restrict access to modules that the user doesn't have permission for.
* Instantiated in the views.
*
* @property module module
*/
class No_access extends BaseController
{
private Module $module;
public function __construct()
{
$this->module = model(Module::class);
}
/**
* @param string $module_id
* @param string $permission_id
* @return void
*/
public function getIndex(string $module_id = '', string $permission_id = ''): void
{
$data['module_name'] = $this->module->get_module_name($module_id);
$data['permission_id'] = $permission_id;
echo view('no_access', $data);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Controllers;
use App\Models\Employee;
/**
* @property Employee employee
*/
class Office extends Secure_Controller
{
protected Employee $employee;
public function __construct()
{
parent::__construct('office', null, 'office');
}
/**
* @return void
*/
public function getIndex(): void
{
echo view('home/office');
}
/**
* @return void
*/
public function logout(): void
{
$this->employee = model(Employee::class);
$this->employee->logout();
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Controllers;
use App\Models\Person;
use Config\Services;
use function Tamtamchik\NameCase\str_name_case;
abstract class Persons extends Secure_Controller
{
protected Person $person;
/**
* @param string|null $module_id
*/
public function __construct(string $module_id = null)
{
parent::__construct($module_id);
$this->person = model(Person::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_people_manage_table_headers();
echo view('people/manage', $data);
}
/**
* Gives search suggestions based on what is being searched for
*/
public function getSuggest(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->person->get_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* Gets one row for a person manage table. This is called using AJAX to update one row.
*/
public function getRow(int $row_id): void
{
$data_row = 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 strings
*
* Example:
* i.e. <?php echo nameize("john o'grady-smith"); ?>
*
* returns John O'Grady-Smith
*/
protected function nameize(string $input): string
{
$adjusted_name = str_name_case($input);
//TODO:Use preg_replace to match HTML entities and convert them to lowercase. This is a workaround for https://github.com/tamtamchik/namecase/issues/20
return preg_replace_callback('/&[a-zA-Z0-9#]+;/', function($matches) { return strtolower($matches[0]); }, $adjusted_name);
}
}

View File

@@ -0,0 +1,564 @@
<?php
namespace App\Controllers;
use App\Libraries\Receiving_lib;
use App\Libraries\Token_lib;
use App\Libraries\Barcode_lib;
use App\Models\Inventory;
use App\Models\Item;
use App\Models\Item_kit;
use App\Models\Receiving;
use App\Models\Stock_location;
use App\Models\Supplier;
use Config\OSPOS;
use Config\Services;
use ReflectionException;
class Receivings extends Secure_Controller
{
private Receiving_lib $receiving_lib;
private Token_lib $token_lib;
private Barcode_lib $barcode_lib;
private Inventory $inventory;
private Item $item;
private Item_kit $item_kit;
private Receiving $receiving;
private Stock_location $stock_location;
private Supplier $supplier;
private array $config;
public function __construct()
{
parent::__construct('receivings');
$this->receiving_lib = new Receiving_lib();
$this->token_lib = new Token_lib();
$this->barcode_lib = new Barcode_lib();
$this->inventory = model(Inventory::class);
$this->item_kit = model(Item_kit::class);
$this->item = model(Item::class);
$this->receiving = model(Receiving::class);
$this->stock_location = model(Stock_location::class);
$this->supplier = model(Supplier::class);
$this->config = config(OSPOS::class)->settings;
}
/**
* @return void
*/
public function getIndex(): void
{
$this->_reload();
}
/**
* Returns search suggestions for an item. Used in app/Views/sales/register.php
*
* @return void
* @noinspection PhpUnused
*/
public function getItemSearch(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->item->get_search_suggestions($search, ['search_custom' => false, 'is_deleted' => false], true);
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($search));
echo json_encode($suggestions);
}
/**
* Gets search suggestions for a stock item. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function getStockItemSearch(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->item->get_stock_search_suggestions($search, ['search_custom' => false, 'is_deleted' => false], true);
$suggestions = array_merge($suggestions, $this->item_kit->get_search_suggestions($search));
echo json_encode($suggestions);
}
/**
* Set supplier if it exists in the database. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postSelectSupplier(): void
{
$supplier_id = $this->request->getPost('supplier', FILTER_SANITIZE_NUMBER_INT);
if($this->supplier->exists($supplier_id))
{
$this->receiving_lib->set_supplier($supplier_id);
}
$this->_reload(); //TODO: Hungarian notation
}
/**
* Change receiving mode for current receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postChangeMode(): void
{
$stock_destination = $this->request->getPost('stock_destination', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$stock_source = $this->request->getPost('stock_source', FILTER_SANITIZE_NUMBER_INT);
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->request->getPost('mode', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$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(); //TODO: Hungarian notation
}
/**
* Sets receiving comment. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postSetComment(): void
{
$this->receiving_lib->set_comment($this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
/**
* Sets the print after sale flag for the receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postSetPrintAfterSale(): void
{
$this->receiving_lib->set_print_after_sale($this->request->getPost('recv_print_after_sale') != null);
}
/**
* Sets the reference number for the receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postSetReference(): void
{
$this->receiving_lib->set_reference($this->request->getPost('recv_reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS));
}
/**
* Add an item to the receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postAdd(): void
{
$data = [];
$mode = $this->receiving_lib->get_mode();
$item_id_or_number_or_item_kit_or_receipt = (int)$this->request->getPost('item', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$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['default_receivings_discount'];
$discount_type = $this->config['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'] = lang('Receivings.unable_to_add_item');
}
$this->_reload($data); //TODO: Hungarian notation
}
/**
* Edit line item in current receiving. Used in app/Views/receivings/receiving.php
*
* @param $item_id
* @return void
* @noinspection PhpUnused
*/
public function postEditItem($item_id): void
{
$data = [];
$validation_rule = [
'price' => 'trim|required|numeric',
'quantity' => 'trim|required|numeric',
'discount' => 'trim|required|numeric',
];
$raw_price = prepare_decimal($this->request->getPost('price'));
$raw_quantity = prepare_decimal($this->request->getPost('quantity'));
$raw_discount = prepare_decimal($this->request->getPost('discount'));
$raw_receiving_quantity = prepare_decimal($this->request->getPost('receiving_quantity'));
$description = $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS); //TODO: Duplicated code
$serialnumber = $this->request->getPost('serialnumber', FILTER_SANITIZE_FULL_SPECIAL_CHARS) ?? '';
$price = filter_var($raw_price, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$quantity = filter_var($raw_quantity, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$discount_type = $this->request->getPost('discount_type', FILTER_SANITIZE_NUMBER_INT);
$discount = $discount_type
? parse_quantity(filter_var($raw_discount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION))
: parse_decimals(filter_var($raw_discount, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
$receiving_quantity = filter_var($raw_receiving_quantity, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
if($this->validate($validation_rule))
{
$this->receiving_lib->edit_item($item_id, $description, $serialnumber, $quantity, $discount, $discount_type, $price, $receiving_quantity);
}
else
{
$data['error']=lang('Receivings.error_editing_item');
}
$this->_reload($data); //TODO: Hungarian notation
}
/**
* Edit a receiving. Used in app/Controllers/Receivings.php
*
* @param $receiving_id
* @return void
* @noinspection PhpUnused
*/
public function getEdit($receiving_id): void
{
$data = [];
$data['suppliers'] = ['' => 'No Supplier'];
foreach($this->supplier->get_all()->getResult() as $supplier)
{
$data['suppliers'][$supplier->person_id] = $supplier->first_name . ' ' . $supplier->last_name;
}
$data['employees'] = [];
foreach($this->employee->get_all()->getResult() as $employee)
{
$data['employees'][$employee->person_id] = $employee->first_name . ' '. $employee->last_name;
}
$receiving_info = $this->receiving->get_info($receiving_id)->getRowArray();
$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;
echo view('receivings/form', $data);
}
/**
* Deletes an item from the current receiving. Used in app/Views/receivings/receiving.php
*
* @param $item_number
* @return void
* @noinspection PhpUnused
*/
public function getDeleteItem($item_number): void
{
$this->receiving_lib->delete_item($item_number);
$this->_reload(); //TODO: Hungarian notation
}
/**
* @throws ReflectionException
*/
public function postDelete(int $receiving_id = -1, bool $update_inventory = true) : void
{
$employee_id = $this->employee->get_logged_in_employee_info()->person_id;
$receiving_ids = $receiving_id == -1 ? $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT) : [$receiving_id]; //TODO: Replace -1 with constant
if($this->receiving->delete_list($receiving_ids, $employee_id, $update_inventory)) //TODO: Likely need to surround this block of code in a try-catch to catch the ReflectionException
{
echo json_encode ([
'success' => true,
'message' => lang('Receivings.successfully_deleted') . ' ' . count($receiving_ids) . ' ' . lang('Receivings.one_or_multiple'),
'ids' => $receiving_ids]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Receivings.cannot_be_deleted')]);
}
}
/**
* Removes a supplier from a receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function getRemoveSupplier(): void
{
$this->receiving_lib->clear_reference();
$this->receiving_lib->remove_supplier();
$this->_reload(); //TODO: Hungarian notation
}
/**
* Complete and finalize receiving. Used in app/Views/receivings/receiving.php
*
* @throws ReflectionException
* @noinspection PhpUnused
*/
public function postComplete(): void
{
$amount_tendered = prepare_decimal($this->request->getPost('amount_tendered'));
$data = [];
$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->request->getPost('payment_type', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$data['show_stock_locations'] = $this->stock_location->show_locations('receivings');
$data['stock_location'] = $this->receiving_lib->get_stock_source();
if($this->request->getPost('amount_tendered') != null)
{
$data['amount_tendered'] = filter_var($amount_tendered, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$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_id = $this->receiving_lib->get_supplier();
if($supplier_id != -1)
{
$supplier_info = $this->supplier->get_info($supplier_id);
$data['supplier'] = $supplier_info->company_name; //TODO: duplicated code
$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_value($data['cart'], $supplier_id, $employee_id, $data['comment'], $data['reference'], $data['payment_type'], $data['stock_location']);
if($data['receiving_id'] == 'RECV -1')
{
$data['error_message'] = lang('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();
echo view("receivings/receipt",$data);
$this->receiving_lib->clear_all();
}
/**
* Complete a receiving requisition. Used in app/Views/receivings/receiving.php.
*
* @throws ReflectionException
* @noinspection PhpUnused
*/
public function postRequisitionComplete(): void
{
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'] = lang('Receivings.error_requisition');
$this->_reload($data); //TODO: Hungarian notation
}
}
/**
* Gets the receipt for a receiving. Used in app/Views/receivings/form.php
*
* @param $receiving_id
* @return void
* @noinspection PhpUnused
*/
public function getReceipt($receiving_id): void
{
$receiving_info = $this->receiving->get_info($receiving_id)->getRowArray();
$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(); //TODO: Duplicated code
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;
echo view("receivings/receipt", $data);
$this->receiving_lib->clear_all();
}
/**
* @param array $data
* @return void
*/
private function _reload(array $data = []): void //TODO: Hungarian notation
{
$data['cart'] = $this->receiving_lib->get_cart();
$data['modes'] = ['receive' => lang('Receivings.receiving'), 'return' => lang('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'] = lang('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();
if($supplier_id != -1) //TODO: Duplicated Code... replace -1 with a constant
{
$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();
echo view("receivings/receiving", $data);
}
/**
* @throws ReflectionException
*/
public function save(int $receiving_id = -1): void //TODO: Replace -1 with a constant
{
$newdate = $this->request->getPost('date', FILTER_SANITIZE_FULL_SPECIAL_CHARS); //TODO: newdate does not follow naming conventions
$date_formatter = date_create_from_format($this->config['dateformat'] . ' ' . $this->config['timeformat'], $newdate);
$receiving_time = $date_formatter->format('Y-m-d H:i:s');
$receiving_data = [
'receiving_time' => $receiving_time,
'supplier_id' => $this->request->getPost('supplier_id') ? $this->request->getPost('supplier_id', FILTER_SANITIZE_NUMBER_INT) : null,
'employee_id' => $this->request->getPost('employee_id', FILTER_SANITIZE_NUMBER_INT),
'comment' => $this->request->getPost('comment', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'reference' => $this->request->getPost('reference') != '' ? $this->request->getPost('reference', FILTER_SANITIZE_FULL_SPECIAL_CHARS) : null
];
$this->inventory->update('RECV '.$receiving_id, ['trans_date' => $receiving_time]);
if($this->receiving->update($receiving_id, $receiving_data))
{
echo json_encode ([
'success' => true,
'message' => lang('Receivings.successfully_updated'),
'id' => $receiving_id
]);
}
else
{
echo json_encode ([
'success' => false,
'message' => lang('Receivings.unsuccessfully_updated'),
'id' => $receiving_id
]);
}
}
/**
* Cancel an in-process receiving. Used in app/Views/receivings/receiving.php
*
* @return void
* @noinspection PhpUnused
*/
public function postCancelReceiving(): void
{
$this->receiving_lib->clear_all();
$this->_reload(); //TODO: Hungarian Notation
}
}

2195
app/Controllers/Reports.php Normal file
View File

File diff suppressed because it is too large Load Diff

1904
app/Controllers/Sales.php Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,151 @@
<?php
namespace App\Controllers;
use App\Models\Employee;
use App\Models\Module;
use CodeIgniter\Model;
use CodeIgniter\Session\Session;
use Config\OSPOS;
use Config\Services;
/**
* 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.
*
* @property employee employee
* @property module module
* @property array global_view_data
* @property session session
*
*/
class Secure_Controller extends BaseController
{
public array $global_view_data;
protected Employee $employee;
protected Module $module;
protected Session $session;
/**
* @param string $module_id
* @param string|null $submodule_id
* @param string|null $menu_group
*/
public function __construct(string $module_id = '', string $submodule_id = null, string $menu_group = null)
{
$this->employee = model(Employee::class);
$this->module = model(Module::class);
$config = config(OSPOS::class)->settings;
$validation = Services::validation();
if(!$this->employee->is_logged_in())
{
header("Location:".base_url('login'));
exit();
}
$logged_in_employee_info = $this->employee->get_logged_in_employee_info();
if(!$this->employee->has_module_grant($module_id, $logged_in_employee_info->person_id)
|| (isset($submodule_id) && !$this->employee->has_module_grant($submodule_id, $logged_in_employee_info->person_id)))
{
header("Location:".base_url("no_access/$module_id/$submodule_id"));
exit();
}
// load up global global_view_data visible to all the loaded views
$this->session = session();
if($menu_group == null)
{
$menu_group = $this->session->get('menu_group');
}
else
{
$this->session->set('menu_group', $menu_group);
}
$allowed_modules = $menu_group == 'home'
? $this->module->get_allowed_home_modules($logged_in_employee_info->person_id)
: $this->module->get_allowed_office_modules($logged_in_employee_info->person_id);
$this->global_view_data = [];
foreach($allowed_modules->getResult() as $module)
{
$this->global_view_data['allowed_modules'][] = $module;
}
$this->global_view_data += [
'user_info' => $logged_in_employee_info,
'controller_name' => $module_id,
'config' => $config
];
view('viewData', $this->global_view_data);
}
public function sanitizeSortColumn($headers, $field, $default): string
{
return $field != null && in_array($field, array_keys(array_merge(...$headers))) ? $field : $default;
}
/**
* AJAX function used to confirm whether values sent in the request are numeric
* @return void
* @noinspection PhpUnused
*/
public function getCheckNumeric(): void
{
foreach($this->request->getGet(null, FILTER_SANITIZE_FULL_SPECIAL_CHARS) as $value)
{
if (parse_decimals($value) === false)
{
echo 'false';
return;
}
}
echo 'true';
}
/**
* @param $key
* @return mixed|void
*/
public function getConfig($key)
{
if (isset($config[$key]))
{
return $config[$key];
}
}
/**
* @return false
*/
public function getIndex() { return false; }
/**
* @return false
*/
public function getSearch() { return false; }
/**
* @return false
*/
public function suggest_search() { return false; }
/**
* @param int $data_item_id
* @return false
*/
public function getView(int $data_item_id = -1) { return false; }
/**
* @param int $data_item_id
* @return false
*/
public function postSave(int $data_item_id = -1) { return false; }
/**
* @return false
*/
public function postDelete() { return false; }
}

View File

@@ -0,0 +1,199 @@
<?php
namespace App\Controllers;
use App\Models\Supplier;
use Config\Services;
class Suppliers extends Persons
{
private Supplier $supplier;
public function __construct()
{
parent::__construct('suppliers');
$this->supplier = model(Supplier::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_suppliers_manage_table_headers();
echo view('people/manage', $data);
}
/**
* Gets one row for a supplier manage table. This is called using AJAX to update one row.
* @param $row_id
* @return void
*/
public function getRow($row_id): void
{
$data_row = 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.
* @return void
**/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->sanitizeSortColumn(SUPPLIER_HEADERS, $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS), 'people.person_id');
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$suppliers = $this->supplier->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->supplier->get_found_rows($search);
$data_rows = [];
foreach($suppliers->getResult() as $supplier)
{
$row = get_supplier_data_row($supplier);
$row['category'] = $this->supplier->get_category_name($row['category']);
$data_rows[] = $row;
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* Gives search suggestions based on what is being searched for
**/
public function getSuggest(): void
{
$search = $this->request->getGet('term');
$suggestions = $this->supplier->get_search_suggestions($search, true);
echo json_encode($suggestions);
}
/**
* @return void
*/
public function suggest_search(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->supplier->get_search_suggestions($search, false);
echo json_encode($suggestions);
}
/**
* Loads the supplier edit form
*
* @param int $supplier_id
* @return void
*/
public function getView(int $supplier_id = NEW_ENTRY): void
{
$info = $this->supplier->get_info($supplier_id);
foreach(get_object_vars($info) as $property => $value)
{
$info->$property = $value;
}
$data['person_info'] = $info;
$data['categories'] = $this->supplier->get_categories();
echo view("suppliers/form", $data);
}
/**
* Inserts/updates a supplier
*
* @param int $supplier_id
* @return void
*/
public function postSave(int $supplier_id = NEW_ENTRY): void
{
$first_name = $this->request->getPost('first_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS); //TODO: Duplicate code
$last_name = $this->request->getPost('last_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$email = strtolower($this->request->getPost('email', FILTER_SANITIZE_EMAIL));
// format first and last name properly
$first_name = $this->nameize($first_name);
$last_name = $this->nameize($last_name);
$person_data = [
'first_name' => $first_name,
'last_name' => $last_name,
'gender' => $this->request->getPost('gender'),
'email' => $email,
'phone_number' => $this->request->getPost('phone_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_1' => $this->request->getPost('address_1', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'address_2' => $this->request->getPost('address_2', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'city' => $this->request->getPost('city', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'state' => $this->request->getPost('state', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'zip' => $this->request->getPost('zip', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'country' => $this->request->getPost('country', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'comments' => $this->request->getPost('comments', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
];
$supplier_data = [
'company_name' => $this->request->getPost('company_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'agency_name' => $this->request->getPost('agency_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'category' => $this->request->getPost('category', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'account_number' => $this->request->getPost('account_number') == '' ? null : $this->request->getPost('account_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_id' => $this->request->getPost('tax_id', FILTER_SANITIZE_NUMBER_INT)
];
if($this->supplier->save_supplier($person_data, $supplier_data, $supplier_id))
{
//New supplier
if($supplier_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Suppliers.successful_adding') . ' ' . $supplier_data['company_name'],
'id' => $supplier_data['person_id']
]);
}
else //Existing supplier
{
echo json_encode ([
'success' => true,
'message' => lang('Suppliers.successful_updating') . ' ' . $supplier_data['company_name'],
'id' => $supplier_id]);
}
}
else//failure
{
echo json_encode ([
'success' => false,
'message' => lang('Suppliers.error_adding_updating') . ' ' . $supplier_data['company_name'],
'id' => NEW_ENTRY
]);
}
}
/**
* This deletes suppliers from the suppliers table
*
* @return void
*/
public function postDelete(): void
{
$suppliers_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
if($this->supplier->delete_list($suppliers_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Suppliers.successful_deleted') . ' ' . count($suppliers_to_delete) . ' ' . lang('Suppliers.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Suppliers.cannot_be_deleted')]);
}
}
}

View File

@@ -0,0 +1,141 @@
<?php
namespace App\Controllers;
use App\Models\Tax_category;
use Config\Services;
/**
* @property tax_category tax_category
*/
class Tax_categories extends Secure_Controller
{
private Tax_category $tax_category;
public function __construct()
{
parent::__construct('tax_categories');
$this->tax_category = model(Tax_category::class);
}
/**
* @return void
*/
public function getIndex(): void
{
$data['tax_categories_table_headers'] = get_tax_categories_table_headers();
echo view('taxes/tax_categories', $data);
}
/**
* Returns tax_category table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_categories = $this->tax_category->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->tax_category->get_found_rows($search);
$data_rows = [];
foreach($tax_categories->getResult() as $tax_category)
{
$data_rows[] = get_tax_categories_data_row($tax_category);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @param $row_id
* @return void
*/
public function getRow($row_id): void
{
$data_row = get_tax_categories_data_row($this->tax_category->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $tax_category_id
* @return void
*/
public function getView(int $tax_category_id = NEW_ENTRY): void
{
$data['tax_category_info'] = $this->tax_category->get_info($tax_category_id);
echo view("taxes/tax_category_form", $data);
}
/**
* @param int $tax_category_id
* @return void
*/
public function postSave(int $tax_category_id = NEW_ENTRY): void
{
$tax_category_data = [
'tax_category' => $this->request->getPost('tax_category', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_category_code' => $this->request->getPost('tax_category_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_group_sequence' => $this->request->getPost('tax_group_sequence', FILTER_SANITIZE_NUMBER_INT)
];
if($this->tax_category->save_value($tax_category_data, $tax_category_id))
{
// New tax_category_id
if($tax_category_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_categories.successful_adding'),
'id' => $tax_category_data['tax_category_id']
]);
}
else
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_categories.successful_updating'),
'id' => $tax_category_id
]);
}
}
else
{
echo json_encode ([
'success' => false,
'message' => lang('Tax_categories.error_adding_updating') . ' ' . $tax_category_data['tax_category'],
'id' => NEW_ENTRY
]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$tax_categories_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
if($this->tax_category->delete_list($tax_categories_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_categories.successful_deleted') . ' ' . count($tax_categories_to_delete) . ' ' . lang('Tax_categories.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Tax_categories.cannot_be_deleted')]);
}
}
}

View File

@@ -0,0 +1,152 @@
<?php
namespace App\Controllers;
use App\Models\Tax_code;
use Config\Services;
/**
* @property tax_code tax_code
*/
class Tax_codes extends Secure_Controller
{
private Tax_code $tax_code;
public function __construct()
{
parent::__construct('tax_codes');
$this->tax_code = model(Tax_code::class);
helper('tax_helper');
}
/**
* @return void
*/
public function getIndex(): void
{
echo view('taxes/tax_codes', $this->get_data());
}
/**
* @return array
*/
public function get_data(): array
{
$data['table_headers'] = get_tax_code_table_headers();
return $data;
}
/**
* Returns tax_category table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_codes = $this->tax_code->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->tax_code->get_found_rows($search);
$data_rows = [];
foreach($tax_codes->getResult() as $tax_code)
{
$data_rows[] = get_tax_code_data_row($tax_code);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$data_row = get_tax_code_data_row($this->tax_code->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $tax_code_id
* @return void
*/
public function getView(int $tax_code_id = NEW_ENTRY): void
{
$data['tax_code_info'] = $this->tax_code->get_info($tax_code_id);
echo view("taxes/tax_code_form", $data);
}
/**
* @param int $tax_code_id
* @return void
*/
public function postSave(int $tax_code_id = NEW_ENTRY): void
{
$tax_code_data = [
'tax_code' => $this->request->getPost('tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'tax_code_name' => $this->request->getPost('tax_code_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'city' => $this->request->getPost('city', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'state' => $this->request->getPost('state', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
];
if($this->tax_code->save($tax_code_data))
{
if($tax_code_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_codes.successful_adding'),
'id' => $tax_code_data['tax_code_id']
]);
}
else
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_codes.successful_updating'),
'id' => $tax_code_id
]);
}
}
else
{
echo json_encode ([
'success' => false,
'message' => lang('Tax_codes.error_adding_updating') . ' ' . $tax_code_data['tax_code_id'],
'id' => NEW_ENTRY
]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$tax_codes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
if($this->tax_code->delete_list($tax_codes_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_codes.successful_deleted') . ' ' . count($tax_codes_to_delete) . ' ' . lang('Tax_codes.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Tax_codes.cannot_be_deleted')]);
}
}
}

View File

@@ -0,0 +1,142 @@
<?php
namespace App\Controllers;
use App\Models\Tax_jurisdiction;
use Config\Services;
/**
* @property tax_jurisdiction tax_jurisdiction
*/
class Tax_jurisdictions extends Secure_Controller
{
private Tax_jurisdiction $tax_jurisdiction;
public function __construct()
{
parent::__construct('tax_jurisdictions');
$this->tax_jurisdiction = model(Tax_jurisdiction::class);
helper('tax_helper');
}
/**
* @return void
*/
public function getIndex(): void
{
$data['table_headers'] = get_tax_jurisdictions_table_headers();
echo view('taxes/tax_jurisdictions', $data);
}
/**
* Returns tax_category table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_jurisdictions = $this->tax_jurisdiction->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->tax_jurisdiction->get_found_rows($search);
$data_rows = [];
foreach($tax_jurisdictions->getResult() as $tax_jurisdiction)
{
$data_rows[] = get_tax_jurisdictions_data_row($tax_jurisdiction);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$data_row = get_tax_jurisdictions_data_row($this->tax_jurisdiction->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $tax_jurisdiction_id
* @return void
*/
public function getView(int $tax_jurisdiction_id = NEW_ENTRY): void
{
$data['tax_jurisdiction_info'] = $this->tax_jurisdiction->get_info($tax_jurisdiction_id);
echo view("taxes/tax_jurisdiction_form", $data);
}
/**
* @param int $jurisdiction_id
* @return void
*/
public function postSave(int $jurisdiction_id = NEW_ENTRY): void
{
$tax_jurisdiction_data = [
'jurisdiction_name' => $this->request->getPost('jurisdiction_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'reporting_authority' => $this->request->getPost('reporting_authority', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
];
if($this->tax_jurisdiction->save_value($tax_jurisdiction_data))
{
if($jurisdiction_id == NEW_ENTRY)
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_jurisdictions.successful_adding'),
'id' => $tax_jurisdiction_data['jurisdiction_id']
]);
}
else
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_jurisdictions.successful_updating'),
'id' => $jurisdiction_id
]);
}
}
else
{
echo json_encode ([
'success' => false,
'message' => lang('Tax_jurisdictions.error_adding_updating') . ' ' . $tax_jurisdiction_data['jurisdiction_name'],
'id' => NEW_ENTRY
]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$tax_jurisdictions_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
if($this->tax_jurisdiction->delete_list($tax_jurisdictions_to_delete))
{
echo json_encode ([
'success' => true,
'message' => lang('Tax_jurisdictions.successful_deleted') . ' ' . count($tax_jurisdictions_to_delete) . ' ' . lang('Tax_jurisdictions.one_or_multiple')
]);
}
else
{
echo json_encode (['success' => false, 'message' => lang('Tax_jurisdictions.cannot_be_deleted')]);
}
}
}

641
app/Controllers/Taxes.php Normal file
View File

@@ -0,0 +1,641 @@
<?php
namespace App\Controllers;
use App\Libraries\Tax_lib;
use App\Models\enums\Rounding_mode;
use App\Models\Tax;
use App\Models\Tax_category;
use App\Models\Tax_code;
use App\Models\Tax_jurisdiction;
use Config\OSPOS;
use Config\Services;
class Taxes extends Secure_Controller
{
private array $config;
private Tax_lib $tax_lib;
private Tax $tax;
private Tax_category $tax_category;
private Tax_code $tax_code;
private Tax_jurisdiction $tax_jurisdiction;
public function __construct()
{
parent::__construct('taxes');
$this->tax = model(Tax::class);
$this->tax_category = model(Tax_category::class);
$this->tax_code = model(Tax_code::class);
$this->tax_jurisdiction = model(Tax_jurisdiction::class);
$this->tax_lib = new Tax_lib();
$this->config = config(OSPOS::class)->settings;
helper('tax_helper');
}
/**
* @return void
*/
public function getIndex(): void
{
$data['tax_codes'] = $this->tax_code->get_all()->getResultArray();
if (count($data['tax_codes']) == 0)
{
$data['tax_codes'] = $this->tax_code->get_empty_row();
}
$data['tax_categories'] = $this->tax_category->get_all()->getResultArray();
if (count($data['tax_categories']) == 0)
{
$data['tax_categories'] = $this->tax_category->get_empty_row();
}
$data['tax_jurisdictions'] = $this->tax_jurisdiction->get_all()->getResultArray();
if (count($data['tax_jurisdictions']) == 0)
{
$data['tax_jurisdictions'] = $this->tax_jurisdiction->get_empty_row();
}
$data['tax_rate_table_headers'] = get_tax_rates_manage_table_headers();
$data['tax_categories_table_headers'] = get_tax_categories_table_headers();
$data['tax_types'] = $this->tax_lib->get_tax_types();
if($this->config['tax_included'])
{
$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']);
echo view('taxes/manage', $data);
}
/**
* Returns tax_codes table data rows. This will be called with AJAX.
*
* @return void
*/
public function getSearch(): void
{
$search = $this->request->getGet('search');
$limit = $this->request->getGet('limit', FILTER_SANITIZE_NUMBER_INT);
$offset = $this->request->getGet('offset', FILTER_SANITIZE_NUMBER_INT);
$sort = $this->request->getGet('sort', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$order = $this->request->getGet('order', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_rates = $this->tax->search($search, $limit, $offset, $sort, $order);
$total_rows = $this->tax->get_found_rows($search);
$data_rows = [];
foreach($tax_rates->getResult() as $tax_rate_row)
{
$data_rows[] = get_tax_rates_data_row($tax_rate_row);
}
echo json_encode (['total' => $total_rows, 'rows' => $data_rows]);
}
/**
* Gives search suggestions based on what is being searched for
*/
public function suggest_search(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->tax->get_search_suggestions($search); //TODO: There is no get_search_suggestions function in the tax model
echo json_encode($suggestions);
}
/**
* Provides list of tax categories to select from
*
* @return void
*/
public function suggest_tax_categories(): void
{
$search = $this->request->getPost('term');
$suggestions = $this->tax_category->get_tax_category_suggestions($search);
echo json_encode($suggestions);
}
/**
* @param int $row_id
* @return void
*/
public function getRow(int $row_id): void
{
$data_row = get_tax_rates_data_row($this->tax->get_info($row_id));
echo json_encode($data_row);
}
/**
* @param int $tax_code
* @return void
*/
public function getView_tax_codes(int $tax_code = NEW_ENTRY): void
{
$tax_code_info = $this->tax->get_info($tax_code);
$default_tax_category_id = 1; // Tax category id is always the default tax category //TODO: Replace 1 with constant
$default_tax_category = $this->tax->get_tax_category($default_tax_category_id); //TODO: this variable is never used in the code.
$tax_rate_info = $this->tax->get_rate_info($tax_code, $default_tax_category_id);
if($this->config['tax_included'])
{
$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 == NEW_ENTRY)
{//TODO: Duplicated code
$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;
}
$tax_rates = [];
foreach($this->tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate) //TODO: get_tax_code_rate_exceptions doesn't exist. This was deleted by @steveireland in https://github.com/opensourcepos/opensourcepos/commit/32204698379c230f2a6756655f40334308023de9#diff-e746bab6720cf5dbf855de6cda68f7aca9ecea7ddd5a39bb852e9b9047a7a838L435 but it's unclear if that was on purpose or accidental.
{
$tax_rate_row = [];
$tax_rate_row['rate_tax_category_id'] = $tax_code_rate['rate_tax_category_id'];
$tax_rate_row['tax_category'] = $tax_code_rate['tax_category'];
$tax_rate_row['tax_rate'] = $tax_code_rate['tax_rate'];
$tax_rate_row['rounding_code'] = $tax_code_rate['rounding_code'];
$tax_rates[] = $tax_rate_row;
}
$data['tax_rates'] = $tax_rates;
echo view('taxes/tax_code_form', $data);
}
/**
* @param int $tax_rate_id
* @return void
*/
public function getView(int $tax_rate_id = NEW_ENTRY): void
{
$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 == NEW_ENTRY)
{
$data['rate_tax_code_id'] = $this->config['default_tax_code'];
$data['rate_tax_category_id'] = $this->config['default_tax_category'];
$data['rate_jurisdiction_id'] = $this->config['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;
}
echo view('taxes/tax_rates_form', $data);
}
/**
* @param int $tax_code
* @return void
*/
public function getView_tax_categories(int $tax_code = NEW_ENTRY): void //TODO: This appears to be called no where in the code.
{
$tax_code_info = $this->tax->get_info($tax_code); //TODO: Duplicated Code
$default_tax_category_id = 1; // Tax category id is always the default tax category //TODO: replace with a constant.
$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['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
else
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
}
if($tax_code == NEW_ENTRY)
{
$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;
}
$tax_rates = [];
foreach($this->tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate) //TODO: get_tax_code_rate_exceptions doesn't exist in the tax model
{
$tax_rate_row = [];
$tax_rate_row['rate_tax_category_id'] = $tax_code_rate['rate_tax_category_id'];
$tax_rate_row['tax_category'] = $tax_code_rate['tax_category'];
$tax_rate_row['tax_rate'] = $tax_code_rate['tax_rate'];
$tax_rate_row['rounding_code'] = $tax_code_rate['rounding_code'];
$tax_rates[] = $tax_rate_row;
}
$data['tax_rates'] = $tax_rates;
echo view('taxes/tax_category_form', $data);
}
/**
* @param int $tax_code
* @return void
*/
public function getView_tax_jurisdictions(int $tax_code = NEW_ENTRY): void //TODO: This appears to be called no where in the code.
{
$tax_code_info = $this->tax->get_info($tax_code); //TODO: Duplicated 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); //TODO: This variable is not used anywhere in the code
$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['tax_included'])
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_INCLUDED;
}
else
{
$data['default_tax_type'] = Tax_lib::TAX_TYPE_EXCLUDED;
}
if($tax_code == NEW_ENTRY)
{
$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;
}
$tax_rates = [];
foreach($this->tax->get_tax_code_rate_exceptions($tax_code) as $tax_code_rate) //TODO: get_tax_code_rate_exceptions doesn't exist in the tax model
{
$tax_rate_row = [];
$tax_rate_row['rate_tax_category_id'] = $tax_code_rate['rate_tax_category_id'];
$tax_rate_row['tax_category'] = $tax_code_rate['tax_category'];
$tax_rate_row['tax_rate'] = $tax_code_rate['tax_rate'];
$tax_rate_row['rounding_code'] = $tax_code_rate['rounding_code'];
$tax_rates[] = $tax_rate_row;
}
$data['tax_rates'] = $tax_rates;
echo view('taxes/tax_jurisdiction_form', $data);
}
/**
* @return string
*/
public static function get_html_rounding_options(): string
{
return rounding_mode::get_html_rounding_options();
}
/**
* @param int $tax_rate_id
* @return void
*/
public function postSave(int $tax_rate_id = NEW_ENTRY): void
{
$raw_tax_rate = prepare_decimal($this->request->getPost('tax_rate'));
$tax_category_id = $this->request->getPost('rate_tax_category_id', FILTER_SANITIZE_NUMBER_INT);
$tax_rate = parse_tax(filter_var($raw_tax_rate, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION));
if ($tax_rate == 0) //TODO: Replace 0 with constant?
{
$tax_category_info = $this->tax_category->get_info($tax_category_id); //TODO: this variable is not used anywhere in the code
}
$tax_rate_data = [
'rate_tax_code_id' => $this->request->getPost('rate_tax_code_id', FILTER_SANITIZE_NUMBER_INT),
'rate_tax_category_id' => $this->request->getPost('rate_tax_category_id', FILTER_SANITIZE_NUMBER_INT),
'rate_jurisdiction_id' => $this->request->getPost('rate_jurisdiction_id', FILTER_SANITIZE_NUMBER_INT),
'tax_rate' => $tax_rate,
'tax_rounding_code' => $this->request->getPost('tax_rounding_code', FILTER_SANITIZE_NUMBER_INT)
];
if($this->tax->save_value($tax_rate_data, $tax_rate_id))
{
if($tax_rate_id == NEW_ENTRY)
{//TODO: this needs to be replaced with ternary notation
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successfully_added')]);
}
else //Existing tax_code
{
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_rate_successful_updated')]);
}
}
else
{
echo json_encode (['success' => false, 'message' => lang('Taxes.tax_rate_error_adding_updating')]);
}
}
/**
* @return void
*/
public function postDelete(): void
{
$tax_codes_to_delete = $this->request->getPost('ids', FILTER_SANITIZE_NUMBER_INT);
if($this->tax->delete_list($tax_codes_to_delete)) //TODO: this needs to be replaced with ternary notation
{
echo json_encode (['success' => true, 'message' => lang('Taxes.tax_code_successful_deleted')]);
} else
{
echo json_encode (['success' => false, 'message' => lang('Taxes.tax_code_cannot_be_deleted')]);
}
}
/**
* Get search suggestions for tax codes. Used in app/Views/customers/form.php
*
* @return void
* @noinspection PhpUnused
*/
public function getSuggestTaxCodes(): void
{
$search = $this->request->getPostGet('term');
$suggestions = $this->tax_code->get_tax_codes_search_suggestions($search);
echo json_encode($suggestions);
}
/**
* Saves Tax Codes. Used in app/Views/taxes/tax_codes.php
*
* @return void
* @noinspection PhpUnused
*/
public function save_tax_codes(): void
{
$tax_code_id = $this->request->getPost('tax_code_id', FILTER_SANITIZE_NUMBER_INT);
$tax_code = $this->request->getPost('tax_code', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_code_name = $this->request->getPost('tax_code_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$city = $this->request->getPost('city', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$state = $this->request->getPost('state', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$array_save = []; //TODO: the naming of this variable is not good.
foreach($tax_code_id as $key=>$val)
{
$array_save[] = [
'tax_code_id'=>$val,
'tax_code'=>$tax_code[$key],
'tax_code_name'=>$tax_code_name[$key],
'city'=>$city[$key],
'state'=>$state[$key]
];
}
$success = $this->tax_code->save_tax_codes($array_save);
echo json_encode ([
'success' => $success,
'message' => lang('Taxes.tax_codes_saved_' . ($success ? '' : 'un') . 'successfully')
]);
}
/**
* Saves given tax jurisdiction. Used in app/Views/taxes/tax_jurisdictions.php.
*
* @return void
* @noinspection PhpUnused
*/
public function save_tax_jurisdictions(): void
{
$jurisdiction_id = $this->request->getPost('jurisdiction_id', FILTER_SANITIZE_NUMBER_INT);
$jurisdiction_name = $this->request->getPost('jurisdiction_name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_group = $this->request->getPost('tax_group', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_type = $this->request->getPost('tax_type', FILTER_SANITIZE_NUMBER_INT);
$reporting_authority = $this->request->getPost('reporting_authority', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_group_sequence = $this->request->getPost('tax_group_sequence', FILTER_SANITIZE_NUMBER_INT);
$cascade_sequence = $this->request->getPost('cascade_sequence', FILTER_SANITIZE_NUMBER_INT);
$array_save = [];
$unique_tax_groups = [];
foreach($jurisdiction_id as $key => $val)
{
$array_save[] = [
'jurisdiction_id'=>$val,
'jurisdiction_name'=>$jurisdiction_name[$key],
'tax_group'=>$tax_group[$key],
'tax_type'=>$tax_type[$key],
'reporting_authority'=>$reporting_authority[$key],
'tax_group_sequence'=>$tax_group_sequence[$key],
'cascade_sequence'=>$cascade_sequence[$key]
];
if (in_array($tax_group[$key], $unique_tax_groups)) //TODO: This can be replaced with `in_array($tax_group[$key], $unique_tax_groups)`
{
echo json_encode ([
'success' => false,
'message' => lang('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 ([
'success' => $success,
'message' => lang('Taxes.tax_jurisdictions_saved_' . ($success ? '' : 'un') . 'successfully')
]);
}
/**
* Saves tax categories. Used in app/Views/taxes/tax_categories.php
*
* @return void
* @noinspection PhpUnused
*/
public function save_tax_categories(): void
{
$tax_category_id = $this->request->getPost('tax_category_id', FILTER_SANITIZE_NUMBER_INT);
$tax_category = $this->request->getPost('tax_category', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$tax_group_sequence = $this->request->getPost('tax_group_sequence', FILTER_SANITIZE_NUMBER_INT);
$array_save= [];
foreach($tax_category_id as $key => $val)
{
$array_save[] = [
'tax_category_id'=>$val,
'tax_category'=>$tax_category[$key],
'tax_group_sequence'=>$tax_group_sequence[$key]
];
}
$success = $this->tax_category->save_categories($array_save);
echo json_encode ([
'success' => $success,
'message' => lang('Taxes.tax_categories_saved_' . ($success ? '' : 'un') . 'successfully')
]);
}
/**
* Gets tax codes partial view. Used in app/Views/taxes/tax_codes.php.
*
* @return void
* @noinspection PhpUnused
*/
public function ajax_tax_codes(): void
{
$tax_codes = $this->tax_code->get_all()->getResultArray();
echo view('partial/tax_codes', ['tax_codes' => $tax_codes]);
}
/**
* Gets current tax categories. Used in app/Views/taxes/tax_categories.php
*
* @return void
* @noinspection PhpUnused
*/
public function ajax_tax_categories(): void
{
$tax_categories = $this->tax_category->get_all()->getResultArray();
echo view('partial/tax_categories', ['tax_categories' => $tax_categories]);
}
/**
* Gets the tax jurisdiction partial view. Used in app/Views/taxes/tax_jurisdictions.php.
*
* @return void
* @noinspection PhpUnused
*/
public function ajax_tax_jurisdictions(): void
{
$tax_jurisdictions = $this->tax_jurisdiction->get_all()->getResultArray();
if($this->config['tax_included']) //TODO: ternary notation
{
$default_tax_type = Tax_lib::TAX_TYPE_INCLUDED;
}
else
{
$default_tax_type = Tax_lib::TAX_TYPE_EXCLUDED;
}
$tax_types = $this->tax_lib->get_tax_types();
echo view('partial/tax_jurisdictions', [
'tax_jurisdictions' => $tax_jurisdictions,
'tax_types' => $tax_types,
'default_tax_type' => $default_tax_type
]);
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_Upgrade_To_3_1_1 extends Migration
{
public function __construct()
{
parent::__construct();
}
/**
* Perform a migration step.
*/
public function up(): void
{
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.0.2_to_3.1.1.sql');
}
/**
* Revert a migration step.
*/
public function down(): void
{
}
}

View File

@@ -0,0 +1,437 @@
<?php
namespace App\Database\Migrations;
use App\Libraries\Tax_lib;
use App\Models\Appconfig;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\ResultInterface;
/**
* @property tax_lib tax_lib
* @property appconfig appconfig
*/
class Migration_Sales_Tax_Data extends Migration
{
public const ROUND_UP = 5; //TODO: These need to be moved to constants.php
public const ROUND_DOWN = 6;
public const HALF_FIVE = 7;
public const YES = '1';
public const VAT_TAX = '0';
public const SALES_TAX = '1';
private Appconfig $appconfig;
public function __construct()
{
parent::__construct();
$this->appconfig = model(Appconfig::class);
}
//TODO: we need to figure out why we get a server error when uncommented portions of this migration run
/**
* Perform a migration step.
*/
public function up(): void
{
$number_of_unmigrated = $this->get_count_of_unmigrated();
error_log("Migrating sales tax history. The number of sales that will be migrated is $number_of_unmigrated");
if($number_of_unmigrated > 0)
{
$unmigrated_invoices = $this->get_unmigrated($number_of_unmigrated)->getResultArray();
foreach($unmigrated_invoices as $key => $unmigrated_invoice)
{
$this->upgrade_tax_history_for_sale($unmigrated_invoice['sale_id']);
}
}
error_log('Migrating sales tax history. The number of sales that will be migrated is finished.');
}
/**
* Revert a migration step.
*/
public function down(): void
{
}
/**
* @param int $sale_id
* @return void
*/
private function upgrade_tax_history_for_sale(int $sale_id): void
{
$tax_decimals = $this->appconfig->get_value('tax_decimals', 2);
$tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES;
$customer_sales_tax_support = false;
if($tax_included) //TODO: Convert to ternary notation.
{
$tax_type = Migration_Sales_Tax_Data::VAT_TAX;
}
else
{
$tax_type = Migration_Sales_Tax_Data::SALES_TAX;
}
$sales_taxes = [];
$tax_group_sequence = 0;
$items = $this->get_sale_items_for_migration($sale_id)->getResultArray();
foreach($items as $item)
{
// This computes tax for each line item and adds it to the tax type total
$tax_group = (float)$item['percent'] . '% ' . $item['name'];
$tax_basis = $this->get_item_total($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], true);
$item_tax_amount = $tax_included
? $this->get_item_tax($item['quantity_purchased'], $item['item_unit_price'], $item['discount_percent'], $item['percent'])
: $this->get_sales_tax_for_amount($tax_basis, $item['percent'], PHP_ROUND_HALF_UP, $tax_decimals);
$this->update_sales_items_taxes_amount($sale_id, $item['line'], $item['name'], $item['percent'], $tax_type, $item_tax_amount);
$this->update_sales_taxes($sales_taxes, $tax_type, $tax_group, $item['percent'], $tax_basis, $item_tax_amount, $tax_group_sequence, PHP_ROUND_HALF_UP, $sale_id, $item['name']);
$tax_group_sequence++;
}
//Not sure when this would ever kick in, but this is technically the correct logic.
if($customer_sales_tax_support) //TODO: This will always evaluate to false
{
$this->apply_invoice_taxing($sales_taxes);
}
$this->round_sales_taxes($sales_taxes);
$this->save_sales_tax($sales_taxes);
}
/**
* @param int $block_count
* @return ResultInterface
*/
private function get_unmigrated(int $block_count): ResultInterface
{
$builder = $this->db->table('sales_items_taxes as SIT');
$builder->select('SIT.sale_id');
$builder->select('ST.sale_id as sales_taxes_sale_id');
$builder->join('sales_taxes as ST','SIT.sale_id = ST.sale_id', 'left');
$builder->where('ST.sale_id', null);
$builder->groupBy('SIT.sale_id');
$builder->groupBy('ST.sale_id');
$builder->orderBy('SIT.sale_id');
$builder->limit($block_count);
return $builder->get();
}
/**
* @param int $sale_id
* @return ResultInterface
*/
private function get_sale_items_for_migration(int $sale_id): ResultInterface
{
$builder = $this->db->table('sales_items as sales_items');
$builder->select('sales_items.sale_id as sale_id');
$builder->select('sales_items.line as line');
$builder->select('item_unit_price');
$builder->select('discount_percent');
$builder->select('quantity_purchased');
$builder->select('percent');
$builder->select('name');
$builder->join('sales_items_taxes as sales_items_taxes', 'sales_items.sale_id = sales_items_taxes.sale_id and sales_items.line = sales_items_taxes.line');
$builder->where('sales_items.sale_id', $sale_id);
return $builder->get();
}
/**
* @return int
*/
private function get_count_of_unmigrated(): int
{
$result = $this->db->query('SELECT COUNT(*) FROM(SELECT SIT.sale_id, ST.sale_id as sales_taxes_sale_id FROM '
. $this->db->prefixTable('sales_items_taxes')
. ' as SIT LEFT JOIN '
. $this->db->prefixTable('sales_taxes')
. ' as ST ON SIT.sale_id = ST.sale_id WHERE ST.sale_id is null GROUP BY SIT.sale_id, ST.sale_id'
. ' ORDER BY SIT.sale_id) as US')->getResultArray();
if(!$result)
{
error_log('Database error in 20170502221506_sales_tax_data.php related to sales_taxes or sales_items_taxes.');
return 0;
}
return $result[0]['COUNT(*)'] ?: 0;
}
/**
* @param int $sale_id
* @param int $line
* @param string $name
* @param float $percent
* @param int $tax_type
* @param float $item_tax_amount
* @return void
*/
private function update_sales_items_taxes_amount(int $sale_id, int $line, string $name, float $percent, int $tax_type, float $item_tax_amount): void
{
$builder = $this->db->table('sales_items_taxes');
$builder->where('sale_id', $sale_id);
$builder->where('line', $line);
$builder->where('name', $name);
$builder->where('percent', $percent);
$builder->update(['tax_type' => $tax_type, 'item_tax_amount' => $item_tax_amount]);
}
/**
* @param array $sales_taxes
* @return void
*/
private function save_sales_tax(array &$sales_taxes): void
{
$builder = $this->db->Table('sales_taxes');
foreach($sales_taxes as $line => $sales_tax)
{
$builder->insert($sales_tax);
}
}
/**
* @param string $quantity
* @param string $price
* @param string $discount_percentage
* @param bool $include_discount
* @return string
*/
public function get_item_total(string $quantity, string $price, string $discount_percentage, bool $include_discount = false): string
{
$total = bcmul($quantity, $price);
if($include_discount)
{
$discount_amount = $this->get_item_discount($quantity, $price, $discount_percentage);
return bcsub($total, $discount_amount);
}
return $total;
}
/**
* @param string $quantity
* @param string $price
* @param string $discount
* @return float
*/
public function get_item_discount(string $quantity, string $price, string $discount): float
{
$total = bcmul($quantity, $price);
$discount_fraction = bcdiv($discount, 100);
$discount = bcmul($total, $discount_fraction);
return round($discount, totals_decimals(), PHP_ROUND_HALF_UP); //TODO: I don't think this is currency safe. Round will cast it's first parameter to a float. It also returns a float.
}
/**
* @param string $quantity
* @param string $price
* @param string $discount_percentage
* @param string $tax_percentage
* @return string
*/
public function get_item_tax(string $quantity, string $price, string $discount_percentage, string $tax_percentage): string
{
$tax_included = $this->appconfig->get_value('tax_included', Migration_Sales_Tax_Data::YES) == Migration_Sales_Tax_Data::YES;
$price = $this->get_item_total($quantity, $price, $discount_percentage, true);
if($tax_included)
{
$tax_fraction = bcadd('100', $tax_percentage);
$tax_fraction = bcdiv($tax_fraction, '100');
$price_tax_excl = bcdiv($price, $tax_fraction);
return bcsub($price, $price_tax_excl);
}
$tax_fraction = bcdiv($tax_percentage, '100');
return bcmul($price, $tax_fraction);
}
/**
* @param string $tax_basis
* @param string $tax_percentage
* @param int $rounding_mode
* @param int $decimals
* @return float
*/
public function get_sales_tax_for_amount(string $tax_basis, string $tax_percentage, int $rounding_mode, int $decimals): float
{
$tax_fraction = bcdiv($tax_percentage, '100');
$tax_amount = bcmul($tax_basis, $tax_fraction);
return $this->round_number($rounding_mode, $tax_amount, $decimals);
}
/**
* @param int $rounding_mode
* @param string $amount
* @param int $decimals
* @return float
*/
public function round_number(int $rounding_mode, string $amount, int $decimals): float
{
if($rounding_mode == Migration_Sales_Tax_Data::ROUND_UP)
{
$fig = pow(10,$decimals);
$rounded_total = (ceil($fig * $amount) + ceil($fig * $amount - ceil($fig * $amount)))/$fig;
}
elseif($rounding_mode == Migration_Sales_Tax_Data::ROUND_DOWN)
{
$fig = pow(10,$decimals);
$rounded_total = (floor($fig * $amount) + floor($fig * $amount - floor($fig * $amount)))/$fig;
}
elseif($rounding_mode == Migration_Sales_Tax_Data::HALF_FIVE)
{
$rounded_total = round($amount / 5) * 5;
}
else
{
$rounded_total = round($amount, $decimals, $rounding_mode);
}
return $rounded_total; //TODO: I don't think this is currency safe. I think we need to be using bcmath() functions like we are in the rest of the code.
}
/**
* @param array $sales_taxes
* @param string $tax_type
* @param string $tax_group
* @param float $tax_rate
* @param string $tax_basis
* @param string $item_tax_amount
* @param int $tax_group_sequence
* @param int $rounding_code
* @param int $sale_id
* @param string $name
* @param string $tax_code
* @return void
*/
public function update_sales_taxes(array &$sales_taxes, string $tax_type, string $tax_group, float $tax_rate, string $tax_basis, string $item_tax_amount, int $tax_group_sequence, int $rounding_code, int $sale_id, string $name = '', string $tax_code = ''): void
{
$tax_group_index = $this->clean('X'.$tax_group);
if(!array_key_exists($tax_group_index, $sales_taxes))
{
$insertkey = $tax_group_index; //TODO: $insertkey does not follow naming conventions.
$sales_tax = [
$insertkey => [
'sale_id' => $sale_id,
'tax_type' => $tax_type,
'tax_group' => $tax_group,
'sale_tax_basis' => $tax_basis,
'sale_tax_amount' => $item_tax_amount,
'print_sequence' => $tax_group_sequence,
'name' => $name,
'tax_rate' => $tax_rate,
'sales_tax_code' => $tax_code,
'rounding_code' => $rounding_code
]
];
//add to existing array
$sales_taxes += $sales_tax;
}
else
{
// Important ... the sales amounts are accumulated for the group at the maximum configurable scale value of 4
// but the scale will in reality be the scale specified by the tax_decimal configuration value used for sales_items_taxes
$sales_taxes[$tax_group_index]['sale_tax_basis'] = bcadd($sales_taxes[$tax_group_index]['sale_tax_basis'], $tax_basis, 4);
$sales_taxes[$tax_group_index]['sale_tax_amount'] = bcadd($sales_taxes[$tax_group_index]['sale_tax_amount'], $item_tax_amount, 4);
}
}
/**
* @param string $string
* @return string
*/
public function clean(string $string): string //TODO: $string is not a good name for this variable
{
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
}
/**
* @param array $sales_taxes
* @return void
*/
public function apply_invoice_taxing(array &$sales_taxes): void
{
if(!empty($sales_taxes)) //TODO: Duplicated code
{
$sort = [];
foreach($sales_taxes as $key => $value)
{
$sort['print_sequence'][$key] = $value['print_sequence'];
}
array_multisort($sort['print_sequence'], SORT_ASC, $sales_taxes);
}
$decimals = totals_decimals();
foreach($sales_taxes as $row_number => $sales_tax)
{
$sales_taxes[$row_number]['sale_tax_amount'] = $this->get_sales_tax_for_amount($sales_tax['sale_tax_basis'], $sales_tax['tax_rate'], $sales_tax['rounding_code'], $decimals);
}
}
/**
* @param array $sales_taxes
* @return void
*/
public function round_sales_taxes(array &$sales_taxes): void
{
if(!empty($sales_taxes))
{
$sort = [];
foreach($sales_taxes as $k=>$v)
{
$sort['print_sequence'][$k] = $v['print_sequence'];
}
array_multisort($sort['print_sequence'], SORT_ASC, $sales_taxes);
}
$decimals = totals_decimals();
foreach($sales_taxes as $row_number => $sales_tax)
{
$sale_tax_amount = $sales_tax['sale_tax_amount'];
$rounding_code = $sales_tax['rounding_code'];
$rounded_sale_tax_amount = $sale_tax_amount;
if ($rounding_code == PHP_ROUND_HALF_UP
|| $rounding_code == PHP_ROUND_HALF_DOWN
|| $rounding_code == PHP_ROUND_HALF_EVEN
|| $rounding_code == PHP_ROUND_HALF_ODD)
{
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, $rounding_code);
}
elseif($rounding_code == Migration_Sales_Tax_Data::ROUND_UP)
{
$fig = (int) str_pad('1', $decimals, '0');
$rounded_sale_tax_amount = (ceil($sale_tax_amount * $fig) / $fig);
}
elseif($rounding_code == Migration_Sales_Tax_Data::ROUND_DOWN)
{
$fig = (int) str_pad('1', $decimals, '0');
$rounded_sale_tax_amount = (floor($sale_tax_amount * $fig) / $fig);
}
elseif($rounding_code == Migration_Sales_Tax_Data::HALF_FIVE)
{
$rounded_sale_tax_amount = round($sale_tax_amount / 5) * 5;
}
$sales_taxes[$row_number]['sale_tax_amount'] = $rounded_sale_tax_amount;
}
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_Upgrade_To_3_2_0 extends Migration
{
/**
* Perform a migration step.
*/
public function up(): void
{
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.1.1_to_3.2.0.sql');
}
/**
* Revert a migration step.
*/
public function down(): void
{
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_Upgrade_To_3_2_1 extends Migration
{
/**
* Perform a migration step.
*/
public function up(): void
{
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.2.0_to_3.2.1.sql');
}
/**
* Revert a migration step.
*/
public function down(): void
{
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_Attributes extends Migration
{
/**
* Perform a migration step.
*/
public function up(): void
{
helper('migration');
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.3.0_attributes.sql');
}
/**
* Revert a migration step.
*/
public function down(): void
{
}
}

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