├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.yml ├── dependabot.yml ├── label-commenter-config.yml ├── pull_request_template.md └── workflows │ ├── auto-tag-new-version.yml │ ├── close_stale_issue.yml │ ├── continuous-integration.yml │ ├── label-commenter.yml │ ├── locales-sync.yml │ ├── locales-update-source.yml │ └── release.yml ├── .gitignore ├── .phpcs.xml ├── .twig_cs.dist.php ├── .tx └── config ├── CHANGELOG.md ├── LICENSE ├── README.md ├── SECURITY.md ├── ajax ├── billactions.php ├── dropdownReference.php ├── dropdownSupplier.php ├── inputnumber.php ├── linkactions.php ├── massreception.php └── referencespecifications.php ├── composer.json ├── composer.lock ├── front ├── accountsection.form.php ├── accountsection.php ├── analyticnature.form.php ├── analyticnature.php ├── bill.form.php ├── bill.php ├── billstate.form.php ├── billstate.php ├── billtype.form.php ├── billtype.php ├── config.form.php ├── deliverystate.form.php ├── deliverystate.php ├── documentcategory.form.php ├── export.php ├── menu.php ├── order.form.php ├── order.php ├── order_item.form.php ├── order_supplier.form.php ├── orderpayment.form.php ├── orderpayment.php ├── orderstate.form.php ├── orderstate.php ├── ordertax.form.php ├── ordertax.php ├── ordertype.form.php ├── ordertype.php ├── othertype.form.php ├── othertype.php ├── preference.form.php ├── profile.form.php ├── reception.form.php ├── reference.form.php ├── reference.php ├── reference_supplier.form.php ├── signature.php └── surveysupplier.form.php ├── generate └── custom.php.example ├── glpi_network.png ├── hook.php ├── inc ├── accountsection.class.php ├── analyticnature.class.php ├── bill.class.php ├── billstate.class.php ├── billtype.class.php ├── config.class.php ├── deliverystate.class.php ├── documentcategory.class.php ├── link.class.php ├── menu.class.php ├── notificationtargetorder.class.php ├── order.class.php ├── order_item.class.php ├── order_supplier.class.php ├── orderinjection.class.php ├── orderpayment.class.php ├── orderstate.class.php ├── ordertax.class.php ├── ordertype.class.php ├── other.class.php ├── othertype.class.php ├── preference.class.php ├── profile.class.php ├── reception.class.php ├── reference.class.php ├── reference_supplier.class.php ├── referencefree.class.php ├── referenceinjection.class.php └── surveysupplier.class.php ├── locales ├── cs_CZ.mo ├── cs_CZ.po ├── de_DE.mo ├── de_DE.po ├── en_GB.mo ├── en_GB.po ├── es_EC.mo ├── es_EC.po ├── es_ES.mo ├── es_ES.po ├── fi_FI.mo ├── fi_FI.po ├── fr_CA.mo ├── fr_CA.po ├── fr_FR.mo ├── fr_FR.po ├── hr_HR.mo ├── hr_HR.po ├── it_IT.mo ├── it_IT.po ├── ko_KR.mo ├── ko_KR.po ├── order.pot ├── pl_PL.mo ├── pl_PL.po ├── pt_BR.mo ├── pt_BR.po ├── pt_PT.mo ├── pt_PT.po ├── ro_RO.mo ├── ro_RO.po ├── ru_RU.mo ├── ru_RU.po ├── tr_TR.mo ├── tr_TR.po ├── zh_CN.mo └── zh_CN.po ├── logo └── logo.jpg ├── order.css ├── order.png ├── phpstan.neon ├── pics ├── bill-icon.png ├── budget-icon.png ├── nothing.gif ├── order-icon.png └── reference-icon.png ├── plugin.xml ├── report ├── deliveryinfos │ └── deliveryinfos.php └── orderdelivery │ └── orderdelivery.php ├── screenshots ├── screenshot1.png ├── screenshot2.png └── screenshot3.png ├── setup.php ├── templates ├── example.odt ├── generate_item.html.twig ├── order_getitems.html.twig ├── order_infocom.html.twig └── order_link_item.html.twig └── tools └── HEADER /.eslintrc.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | "root": true, 4 | "ignorePatterns": [ 5 | "/node_modules/*", 6 | "/vendor/*", 7 | ], 8 | "env": { 9 | "browser": true, 10 | "es6": true, 11 | "jquery": true, 12 | }, 13 | "extends": "eslint:recommended", 14 | "globals": { 15 | "CFG_GLPI": true, 16 | "GLPI_PLUGINS_PATH": true, 17 | "__": true, 18 | "_n": true, 19 | "_x": true, 20 | "_nx": true 21 | }, 22 | "parserOptions": { 23 | "ecmaVersion": 8, 24 | }, 25 | "plugins": [ 26 | "@stylistic/js", 27 | ], 28 | "rules": { 29 | "no-console": ["error", {"allow": ["warn", "error"]}], 30 | "no-unused-vars": ["error", {"vars": "local"}], 31 | "@stylistic/js/eol-last": ["error", "always"], 32 | "@stylistic/js/indent": ["error", 4], 33 | "@stylistic/js/linebreak-style": ["error", "unix"], 34 | "@stylistic/js/semi": ["error", "always"], 35 | }, 36 | "overrides": [ 37 | { 38 | "files": [".eslintrc.js"], 39 | "env": { 40 | "node": true 41 | } 42 | }, 43 | ], 44 | }; 45 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: Create a report to help us improve order 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | 8 | Dear GLPI plugin user. 9 | 10 | **⚠️ Please never use standard issues to report security problems. See [security policy](https://github.com/pluginsGLPI/order/security/policy) for more details. ⚠️** 11 | 12 | BEFORE SUBMITTING YOUR ISSUE, please make sure to read and follow these steps: 13 | 14 | * We do not track feature requests nor enhancements here. Propose them on the [suggest dedicated site](https://suggest.glpi-project.org). 15 | * Keep this tracker in ENGLISH. If you want support in your language, the [community forum](https://forum.glpi-project.org) is the best place. 16 | * Always try to reproduce your issue at least on latest stable release. 17 | 18 | The GLPI team. 19 | - type: markdown 20 | attributes: 21 | value: | 22 | ## Professional Support 23 | 24 | We do not guarantee any processing / resolution time for community issues. 25 | 26 | If you need a quick fix or any guarantee, you should consider to buy a GLPI Network Subscription. 27 | 28 | More information here: https://glpi-project.org/subscriptions/ 29 | - type: checkboxes 30 | id: terms 31 | attributes: 32 | label: Code of Conduct 33 | description: By submitting this issue, you agree to follow hereinabove rules and [Contribution guide](https://github.com/glpi-project/glpi/blob/main/CONTRIBUTING.md) 34 | options: 35 | - label: I agree to follow this project's Code of Conduct 36 | validations: 37 | required: true 38 | - type: checkboxes 39 | attributes: 40 | label: Is there an existing issue for this? 41 | description: Please search to see if an issue already exists for the bug you encountered. 42 | options: 43 | - label: I have searched the existing issues 44 | validations: 45 | required: true 46 | - type: input 47 | id: glpi-version 48 | attributes: 49 | label: GLPI Version 50 | description: What version of our GLPI are you running? 51 | validations: 52 | required: true 53 | - type: input 54 | id: plugin-version 55 | attributes: 56 | label: Plugin version 57 | description: What version of `order` are you running? 58 | validations: 59 | required: true 60 | - type: textarea 61 | attributes: 62 | label: Bug description 63 | description: A concise description of the problem you are experiencing and what you expected to happen. 64 | validations: 65 | required: false 66 | - type: textarea 67 | id: logs 68 | attributes: 69 | label: Relevant log output 70 | description: | 71 | Please copy and paste any relevant log output. Find them in `*-error.log` files under `glpi/files/_log/`. 72 | 73 | Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. 74 | render: shell 75 | - type: input 76 | id: url 77 | attributes: 78 | label: Page URL 79 | description: If applicable, page URL where the bug happens. 80 | validations: 81 | required: false 82 | - type: textarea 83 | attributes: 84 | label: Steps To reproduce 85 | description: Steps to reproduce the behavior. 86 | placeholder: | 87 | 1. With this config... 88 | 2. Go to... 89 | 3. Scroll down to... 90 | 4. See error... 91 | validations: 92 | required: false 93 | - type: textarea 94 | attributes: 95 | label: Your GLPI setup information 96 | description: Please copy and paste information you will find in GLPI in `Setup > General` menu, `System` tab. 97 | validations: 98 | required: false 99 | - type: textarea 100 | attributes: 101 | label: Anything else? 102 | description: Add any other context about the problem here. 103 | validations: 104 | required: false 105 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Ensure GitHub Actions are used in their latest version 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "monthly" 8 | 9 | # Strategy for composer dependencies 10 | - package-ecosystem: "composer" 11 | directory: "/" 12 | schedule: 13 | interval: "monthly" 14 | allow: 15 | - dependency-type: "direct" 16 | open-pull-requests-limit: 100 17 | versioning-strategy: "increase" 18 | groups: 19 | dev-dependencies: 20 | dependency-type: "development" 21 | -------------------------------------------------------------------------------- /.github/label-commenter-config.yml: -------------------------------------------------------------------------------- 1 | labels: 2 | - name: "invalid" 3 | labeled: 4 | issue: 5 | body: | 6 | This issue has been closed because you did not provide the requested information. 7 | action: "close" 8 | - name: "support" 9 | labeled: 10 | issue: 11 | body: | 12 | This issue has been closed as we only track bugs here. 13 | 14 | You can get community support on [forums](https://forum.glpi-project.org/) or you can consider [taking a subscription](https://glpi-project.org/subscriptions/) to get professional support. 15 | You can also [contact GLPI editor team](https://portal.glpi-network.com/contact-us) directly. 16 | action: close 17 | - name: "feature suggestion" 18 | labeled: 19 | issue: 20 | body: | 21 | This issue has been closed as we only track bugs here. 22 | 23 | You can open a topic to discuss with community about this enhancement on [suggestion website](https://glpi.userecho.com/). 24 | You can also [contact GLPI editor team](https://portal.glpi-network.com/contact-us) directly if you are willing to sponsor this feature. 25 | action: close 26 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Checklist before requesting a review 2 | 3 | *Please delete options that are not relevant.* 4 | 5 | - [ ] I have performed a self-review of my code. 6 | - [ ] I have added tests (when available) that prove my fix is effective or that my feature works. 7 | - [ ] I have updated the CHANGELOG with a short functional description of the fix or new feature. 8 | - [ ] This change requires a documentation update. 9 | 10 | ## Description 11 | 12 | - It fixes # (issue number, if applicable) 13 | - Here is a brief description of what this PR does 14 | 15 | ## Screenshots (if appropriate): 16 | -------------------------------------------------------------------------------- /.github/workflows/auto-tag-new-version.yml: -------------------------------------------------------------------------------- 1 | name: "Automatically tag new version" 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | paths: 8 | - "setup.php" 9 | 10 | jobs: 11 | auto-tag-new-version: 12 | name: "Automatically tag new version" 13 | uses: "glpi-project/plugin-release-workflows/.github/workflows/auto-tag-new-version.yml@v1" 14 | secrets: 15 | github-token: "${{ secrets.AUTOTAG_TOKEN }}" 16 | -------------------------------------------------------------------------------- /.github/workflows/close_stale_issue.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues' 2 | on: 3 | schedule: 4 | - cron: '0 8 * * *' 5 | 6 | jobs: 7 | stale: 8 | if: github.repository == 'pluginsGLPI/order' 9 | permissions: 10 | issues: write # for actions/stale to close stale issues 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/stale@v9 14 | with: 15 | stale-issue-message: >- 16 | There has been no activity on this issue for some time and therefore it is considered stale 17 | and will be closed automatically in 10 days. 18 | 19 | 20 | If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, 21 | feel free to add a comment to revive this issue. 22 | 23 | If it is related to a new feature, please open a topic to discuss with community about this enhancement 24 | on [suggestion website](https://glpi.userecho.com/). 25 | 26 | 27 | You may also consider taking a [subscription](https://glpi-project.org/subscriptions/) to get professionnal 28 | support or [contact GLPI editor team](https://portal.glpi-network.com/contact-us) directly. 29 | days-before-issue-stale: 15 30 | days-before-pr-stale: -1 # PR will be marked as stale manually. 31 | days-before-close: 5 32 | exempt-issue-labels: "bug,enhancement,question,security" # Issues with "bug", "enhancement", "question" or "security" labels will not be marked as stale 33 | exempt-all-milestones: true # Do not check issues/PR with defined milestone. 34 | ascending: true # First check older issues/PR. 35 | operations-per-run: 750 # Max API calls per run. 36 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration.yml: -------------------------------------------------------------------------------- 1 | name: "Continuous integration" 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | tags: 8 | - "*" 9 | pull_request: 10 | schedule: 11 | - cron: "0 0 * * *" 12 | workflow_dispatch: 13 | 14 | concurrency: 15 | group: "${{ github.workflow }}-${{ github.ref }}" 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | generate-ci-matrix: 20 | name: "Generate CI matrix" 21 | uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1" 22 | with: 23 | glpi-version: "10.0.x" 24 | ci: 25 | name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}" 26 | needs: "generate-ci-matrix" 27 | strategy: 28 | fail-fast: false 29 | matrix: ${{ fromJson(needs.generate-ci-matrix.outputs.matrix) }} 30 | uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1" 31 | with: 32 | plugin-key: "order" 33 | glpi-version: "${{ matrix.glpi-version }}" 34 | php-version: "${{ matrix.php-version }}" 35 | db-image: "${{ matrix.db-image }}" 36 | -------------------------------------------------------------------------------- /.github/workflows/label-commenter.yml: -------------------------------------------------------------------------------- 1 | name: "Label commenter" 2 | 3 | on: 4 | issues: 5 | types: 6 | - "labeled" 7 | - "unlabeled" 8 | 9 | jobs: 10 | comment: 11 | permissions: 12 | contents: "read" 13 | issues: "write" 14 | runs-on: "ubuntu-latest" 15 | steps: 16 | - name: "Checkout" 17 | uses: "actions/checkout@v4" 18 | 19 | - name: "Label commenter" 20 | uses: "peaceiris/actions-label-commenter@v1" 21 | -------------------------------------------------------------------------------- /.github/workflows/locales-sync.yml: -------------------------------------------------------------------------------- 1 | name: "Synchronize locales" 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * 1-5" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | sync-with-transifex: 10 | name: "Sync with transifex" 11 | uses: "glpi-project/plugin-translation-workflows/.github/workflows/transifex-sync.yml@v1" 12 | secrets: 13 | github-token: "${{ secrets.LOCALES_SYNC_TOKEN }}" 14 | transifex-token: "${{ secrets.TRANSIFEX_TOKEN }}" 15 | -------------------------------------------------------------------------------- /.github/workflows/locales-update-source.yml: -------------------------------------------------------------------------------- 1 | name: "Update locales sources" 2 | 3 | on: 4 | push: 5 | branches: 6 | - "main" 7 | 8 | jobs: 9 | push-on-transifex: 10 | name: "Push locales sources" 11 | uses: "glpi-project/plugin-translation-workflows/.github/workflows/transifex-push-sources.yml@v1" 12 | secrets: 13 | transifex-token: "${{ secrets.TRANSIFEX_TOKEN }}" 14 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Publish release" 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | publish-release: 10 | permissions: 11 | contents: "write" 12 | name: "Publish release" 13 | uses: "glpi-project/plugin-release-workflows/.github/workflows/publish-release.yml@v1" 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | vendor/ 3 | .gh_token 4 | *.min.* 5 | -------------------------------------------------------------------------------- /.phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | . 4 | /.git/ 5 | ^node_modules/ 6 | ^vendor/ 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.twig_cs.dist.php: -------------------------------------------------------------------------------- 1 | in(__DIR__ . '/templates') 9 | ->name('*.html.twig') 10 | ->ignoreVCSIgnored(true); 11 | 12 | return Twigcs\Config\Config::create() 13 | ->setFinder($finder) 14 | ->setRuleSet(\Glpi\Tools\GlpiTwigRuleset::class) 15 | ; 16 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | 4 | [o:teclib:p:glpi-project-plugin-order:r:order-pot] 5 | file_filter = locales/.po 6 | source_file = locales/order.pot 7 | source_lang = en 8 | type = PO 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/). 7 | 8 | ## [Unreleased] 9 | 10 | ### Added 11 | 12 | - Batch data entry for item generation 13 | - Add massive selection for delivered items 14 | - Duplicate the delivery button at the top of the reception list 15 | 16 | ### Changed 17 | 18 | - Implement `Twig` template for order items list and associated items 19 | 20 | ## [2.10.7] - 2025-03-19 21 | 22 | - Fixed the cumulative total order price (TTC) calculation in budgets. 23 | - Paid invoice changes status to Paid 24 | 25 | ## [2.10.6] - 2024-03-08 26 | 27 | ### Changed 28 | 29 | - Fix error message during plugin update 30 | - Fix few errors messages in debug mode 31 | 32 | 33 | ## [2.10.5] - 2024-02-23 34 | 35 | ### Changed 36 | 37 | - Restores the ability to clone an order 38 | 39 | 40 | ## [1.9.6] - 2017-03-03 41 | 42 | **Compatible with GLPI 0.85 and above** 43 | 44 | ### Added 45 | 46 | - add parameter in config (Ask) to allow change of these 3 fields during each reception 47 | 48 | ### Changed 49 | 50 | - fix bill creation on non default GLPI display method 51 | - fix error in supplier notation 52 | - fix various minor issues on ODT generation 53 | - fix wrong call to CONFIG_ASK constant 54 | - missing getTable function preventing data injection 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Order GLPI plugin 2 | 3 | [![License](https://img.shields.io/github/license/pluginsGLPI/order.svg?&label=License)](https://github.com/pluginsGLPI/order/blob/develop/LICENSE) 4 | [![Follow twitter](https://img.shields.io/twitter/follow/Teclib.svg?style=social&label=Twitter&style=flat-square)](https://twitter.com/teclib) 5 | [![Telegram Group](https://img.shields.io/badge/Telegram-Group-blue.svg)](https://t.me/glpien) 6 | [![Project Status: Active](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) 7 | [![GitHub release](https://img.shields.io/github/release/pluginsGLPI/order.svg)](https://github.com/pluginsGLPI/order/releases) 8 | [![GitHub build](https://travis-ci.org/pluginsGLPI/order.svg?)](https://travis-ci.org/pluginsGLPI/order/) 9 | 10 | ![Screenshot1](./screenshots/screenshot1.png) 11 | ![Screenshot2](./screenshots/screenshot2.png) 12 | ![Screenshot3](./screenshots/screenshot3.png) 13 | 14 | This plugin allows you to manage order management within GLPIi: 15 | 16 | - Products references management 17 | - Order management (with approval workflow) 18 | - Budgets management 19 | 20 | ## Documentation 21 | 22 | We maintain a detailed documentation here -> [Documentation](https://glpi-plugins.readthedocs.io/en/latest/order/index.html) 23 | 24 | ## Contact 25 | 26 | For notices about major changes and general discussion of order, subscribe to the [/r/glpi](https://www.reddit.com/r/glpi/) subreddit. 27 | You can also chat with us via IRC in [#glpi on freenode](http://webchat.freenode.net/?channels=glpi) or [@glpi on Telegram](https://t.me/glpien). 28 | 29 | ## Professional Services 30 | 31 | ![GLPI Network](./glpi_network.png "GLPI network") 32 | 33 | The GLPI Network services are available through our [Partner's Network](http://www.teclib-edition.com/en/partners/). We provide special training, bug fixes with editor subscription, contributions for new features, and more. 34 | 35 | Obtain a personalized service experience, associated with benefits and opportunities. 36 | 37 | ## Contributing 38 | 39 | * Open a ticket for each bug/feature so it can be discussed 40 | * Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins/index.html) 41 | * Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching 42 | * Work on a new branch on your own fork 43 | * Open a PR that will be reviewed by a developer 44 | 45 | ## Copying 46 | 47 | * **Code**: you can redistribute it and/or modify 48 | it under the terms of the GNU General Public License ([GPL-2.0](https://www.gnu.org/licenses/gpl-2.0.en.html)). 49 | 50 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | **⚠️ Please never use standard issues to report security problems; vulnerabilities are published once a fix release is available. ⚠️** 4 | 5 | ## Reporting a Vulnerability 6 | 7 | If you found a security issue, please contact us by: 8 | 9 | - [our huntr page](https://huntr.dev/repos/pluginsGLPI/order/) 10 | - a mail to \[glpi-security AT ow2.org\] 11 | 12 | You should provide us all details about the issue and the way to reproduce it. 13 | You may also provide a script that can be used to check the issue exists. 14 | 15 | Once the report will be handled, and if the issue is not yet fixed (or in progress) 16 | we'll add it to the GitHub security tab, and add you as observer. Meanwhile, 17 | you will reserve a CVE for the issue. 18 | 19 | Thank you for improving the security of GLPI and its plugins. 20 | 21 | ## Supported Versions 22 | 23 | We follow the same version support policy as GLPI. 24 | This means that we provide security patches to versions of the plugin that target a version of GLPI itself maintained from a security point of view. 25 | -------------------------------------------------------------------------------- /ajax/billactions.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | 33 | Session::checkRight("plugin_order_bill", READ); 34 | 35 | header("Content-Type: text/html; charset=UTF-8"); 36 | 37 | Html::header_nocache(); 38 | 39 | if (!defined('GLPI_ROOT')) { 40 | die("Can not acces directly to this file"); 41 | } 42 | 43 | if (isset($_POST["action"])) { 44 | switch ($_POST["action"]) { 45 | case "bill": 46 | echo " "; 47 | echo Html::hidden('plugin_order_orders_id', ['value' => $_POST["plugin_order_orders_id"]]); 48 | PluginOrderBill::Dropdown([ 49 | 'condition' => ['plugin_order_orders_id' => $_POST['plugin_order_orders_id']], 50 | ]); 51 | break; 52 | } 53 | 54 | PluginOrderBillState::Dropdown(['comments' => true]); 55 | echo " "; 56 | } 57 | -------------------------------------------------------------------------------- /ajax/dropdownReference.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var DBmysql $DB */ 32 | global $DB; 33 | 34 | include_once("../../../inc/includes.php"); 35 | 36 | Session::checkRight("plugin_order_reference", READ); 37 | 38 | // Make a select box for references 39 | if (isset($_POST["itemtype"])) { 40 | $entity_restrict = getEntitiesRestrictRequest("AND", 'r', '', $_POST['entities_id'], true); 41 | $query = "SELECT s.`plugin_order_references_id` as id, s.`price_taxfree`, s.`reference_code`, r.`name` 42 | FROM `glpi_plugin_order_references_suppliers` s 43 | LEFT JOIN `glpi_plugin_order_references` r 44 | ON (s.`plugin_order_references_id` = r.`id` 45 | AND r.`is_active` = 1 46 | AND r.`is_deleted` = 0) 47 | WHERE s.`suppliers_id` = '{$_POST['suppliers_id']}' 48 | AND r.`itemtype` = '{$_POST['itemtype']}' 49 | $entity_restrict 50 | ORDER BY s.`reference_code`"; 51 | $result = $DB->query($query); 52 | $number = $DB->numrows($result); 53 | $values = [0 => Dropdown::EMPTY_VALUE]; 54 | if ($number) { 55 | while ($data = $DB->fetchAssoc($result)) { 56 | $values[$data['id']] = $data['name'] . " - " . $data['reference_code']; 57 | } 58 | } 59 | Dropdown::showFromArray( 60 | $_POST['fieldname'], 61 | $values, 62 | ['rand' => $_POST['rand'], 'width' => '100%'] 63 | ); 64 | Ajax::updateItemOnSelectEvent( 65 | 'dropdown_plugin_order_references_id' . $_POST['rand'], 66 | 'show_priceht', 67 | '../ajax/dropdownReference.php', 68 | [ 69 | 'reference_id' => '__VALUE__', 70 | 'suppliers_id' => $_POST['suppliers_id'], 71 | ] 72 | ); 73 | } else if (isset($_POST['reference_id'])) { 74 | // Get price 75 | $query = "SELECT `price_taxfree` 76 | FROM `glpi_plugin_order_references_suppliers` 77 | WHERE `plugin_order_references_id` = '{$_POST['reference_id']}' AND suppliers_id = '{$_POST['suppliers_id']}'"; 78 | $result = $DB->query($query); 79 | $price = $DB->result($result, 0, 'price_taxfree'); 80 | $price = Html::formatNumber($price, true); 81 | echo ""; 82 | } 83 | -------------------------------------------------------------------------------- /ajax/dropdownSupplier.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var \DBmysql $DB */ 32 | global $DB; 33 | 34 | if (strpos($_SERVER['PHP_SELF'], "dropdownSupplier.php")) { 35 | include("../../../inc/includes.php"); 36 | header("Content-Type: text/html; charset=UTF-8"); 37 | Html::header_nocache(); 38 | } 39 | 40 | Session::checkRight("contact_enterprise", READ); 41 | 42 | // Make a select box 43 | if (isset($_POST["suppliers_id"])) { 44 | // Make a select box 45 | $query = "SELECT c.`id`, c.`name`, c.`firstname` 46 | FROM `glpi_contacts` c 47 | LEFT JOIN `glpi_contacts_suppliers` s ON (s.`contacts_id` = c.`id`) 48 | WHERE s.`suppliers_id` = '{$_POST['suppliers_id']}' 49 | ORDER BY c.`name`"; 50 | $result = $DB->query($query); 51 | $number = $DB->numrows($result); 52 | 53 | $values = [0 => Dropdown::EMPTY_VALUE]; 54 | if ($number) { 55 | while ($data = $DB->fetchAssoc($result)) { 56 | $values[$data['id']] = formatUserName('', '', $data['name'], $data['firstname']); 57 | } 58 | } 59 | Dropdown::showFromArray($_POST['fieldname'], $values); 60 | } 61 | -------------------------------------------------------------------------------- /ajax/inputnumber.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @file 32 | * @brief 33 | */ 34 | 35 | use Glpi\Toolbox\Sanitizer; 36 | 37 | include('../../../inc/includes.php'); 38 | 39 | header("Content-Type: text/html; charset=UTF-8"); 40 | Html::header_nocache(); 41 | Session::checkLoginUser(); 42 | 43 | if (isset($_POST['name'])) { 44 | $step = 1; 45 | if (!isset($_REQUEST['force_integer'])) { 46 | $step = PLUGIN_ORDER_NUMBER_STEP; 47 | } 48 | 49 | $class = ""; 50 | if (isset($_REQUEST['class'])) { 51 | $class = "class='" . $_REQUEST['class'] . "'"; 52 | } 53 | 54 | $min = 0; 55 | if (isset($_REQUEST['min'])) { 56 | if (isset($_REQUEST['force_integer']) && $_REQUEST['force_integer']) { 57 | $min = (int)$_REQUEST['min']; 58 | } else { 59 | $min = (float)$_REQUEST['min']; 60 | } 61 | } 62 | 63 | $data = Html::cleanInputText(Sanitizer::sanitize(rawurldecode(stripslashes($_POST["data"])))); 64 | 65 | echo ""; 66 | } 67 | -------------------------------------------------------------------------------- /ajax/linkactions.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | Session::checkLoginUser(); 35 | 36 | if (!defined('GLPI_ROOT')) { 37 | die("Can not acces directly to this file"); 38 | } 39 | 40 | $reference = new PluginOrderReference(); 41 | 42 | if (isset($_POST["action"])) { 43 | switch ($_POST["action"]) { 44 | case "generation": 45 | echo Html::hidden( 46 | 'plugin_order_references_id', 47 | ['value' => $_POST["plugin_order_references_id"]] 48 | ); 49 | echo " "; 50 | echo Html::submit(_sx('button', 'Post'), ['name' => 'generation']); 51 | break; 52 | 53 | case "createLink": 54 | echo Html::hidden('itemtype', ['value' => $_POST["itemtype"]]); 55 | echo Html::hidden( 56 | 'plugin_order_orders_id', 57 | ['value' => $_POST["plugin_order_orders_id"]] 58 | ); 59 | 60 | $reference->getFromDB($_POST["plugin_order_references_id"]); 61 | $reference->dropdownAllItemsByType( 62 | "items_id", 63 | $_POST["itemtype"], 64 | $_SESSION["glpiactiveentities"], 65 | $reference->fields["types_id"], 66 | $reference->fields["models_id"] 67 | ); 68 | echo " "; 69 | echo Html::submit(_sx('button', 'Post'), ['name' => 'createLinkWithItem']); 70 | 71 | break; 72 | 73 | case "deleteLink": 74 | echo " "; 75 | echo Html::submit(_sx('button', 'Post'), ['name' => 'deleteLinkWithItem']); 76 | break; 77 | 78 | case "show_location_by_entity": 79 | Location::dropdown(['name' => "id[" . $_POST['id'] . "][locations_id]", 80 | 'value' => $_POST['value'] ?? 0, 81 | 'entity' => $_POST['entities'] 82 | ]); 83 | 84 | if (isset($_POST['massaction'])) { 85 | $order_web_dir = Plugin::getWebDir('order'); 86 | Ajax::updateItemOnSelectEvent( 87 | $_POST['id'] . "[entities_id]", 88 | "show_location_by_entity_id_" . $_POST['id'], 89 | "$order_web_dir/ajax/linkactions.php", 90 | ['entities' => '__VALUE__', 91 | 'action' => 'show_location_by_entity', 92 | 'id' => $_POST['id'] 93 | ] 94 | ); 95 | } 96 | break; 97 | 98 | case "show_group_by_entity": 99 | Group::dropdown(['name' => "id[" . $_POST['id'] . "][groups_id]", 100 | 'entity' => $_POST['entities'], 101 | 'value' => $_POST['value'] ?? 0, 102 | 'condition' => ['is_assign' => 1], 103 | ]); 104 | 105 | if (isset($_POST['massaction'])) { 106 | $order_web_dir = Plugin::getWebDir('order'); 107 | Ajax::updateItemOnSelectEvent( 108 | $_POST['id'] . "[entities_id]", 109 | "show_group_by_entity_id_" . $_POST['id'], 110 | "$order_web_dir/ajax/linkactions.php", 111 | ['entities' => '__VALUE__', 112 | 'action' => 'show_group_by_entity', 113 | 'id' => $_POST['id'] 114 | ] 115 | ); 116 | } 117 | break; 118 | 119 | case "show_state_by_entity": 120 | $condition = PluginOrderLink::getCondition($_POST["itemtype"] ?? ""); 121 | State::dropdown(['name' => "id[" . $_POST['id'] . "][states_id]", 122 | 'entity' => $_POST['entities'], 123 | 'value' => $_POST['value'] ?? 0, 124 | 'condition' => $condition 125 | ]); 126 | 127 | if (isset($_POST['massaction'])) { 128 | $order_web_dir = Plugin::getWebDir('order'); 129 | Ajax::updateItemOnSelectEvent( 130 | $_POST['id'] . "[entities_id]", 131 | "show_state_by_entity_id_" . $_POST['id'], 132 | "$order_web_dir/ajax/linkactions.php", 133 | ['entities' => '__VALUE__', 134 | 'action' => 'show_state_by_entity', 135 | 'id' => $_POST['id'] 136 | ] 137 | ); 138 | } 139 | break; 140 | 141 | case "update_entity": 142 | Entity::dropdown(['name' => "id[" . $_POST['id'] . "][entities_id]", 143 | 'value' => $_POST['value'], 144 | 'on_change' => "plugin_order_adaptOnSelectedEntity(" . $_POST['id'] . ", this.value);", 145 | ]); 146 | 147 | $order_web_dir = Plugin::getWebDir('order'); 148 | Ajax::updateItemOnSelectEvent( 149 | "dropdown_id[" . $_POST['id'] . "][entities_id]", 150 | "show_location_by_entity_id_" . $_POST['id'], 151 | "$order_web_dir/ajax/linkactions.php", 152 | ['entities' => '__VALUE__', 153 | 'action' => 'show_location_by_entity', 154 | 'id' => $_POST['id'] 155 | ] 156 | ); 157 | Ajax::updateItemOnSelectEvent( 158 | "dropdown_id[" . $_POST['id'] . "][entities_id]", 159 | "show_group_by_entity_id_" . $_POST['id'], 160 | "$order_web_dir/ajax/linkactions.php", 161 | ['entities' => '__VALUE__', 162 | 'action' => 'show_group_by_entity', 163 | 'id' => $_POST['id'] 164 | ] 165 | ); 166 | Ajax::updateItemOnSelectEvent( 167 | "dropdown_id[" . $_POST['id'] . "][entities_id]", 168 | "show_state_by_entity_id_" . $_POST['id'], 169 | "$order_web_dir/ajax/linkactions.php", 170 | ['entities' => '__VALUE__', 171 | 'action' => 'show_state_by_entity', 172 | 'id' => $_POST['id'] 173 | ] 174 | ); 175 | break; 176 | 177 | case "check_unicity": 178 | $itemtype = new $_POST['itemtype'](); 179 | if (count($itemtype->find([$_POST['field'] => $_POST['field_value'], ])) > 0) { 180 | echo "false"; 181 | } else { 182 | echo "true"; 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /ajax/massreception.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | 35 | Html::header_nocache(); 36 | 37 | Session::checkLoginUser(); 38 | 39 | $PluginOrderReception = new PluginOrderReception(); 40 | 41 | echo ""; 42 | echo ""; 69 | 70 | echo ""; 71 | $config = PluginOrderConfig::getConfig(); 72 | if ($config->canGenerateAsset() == PluginOrderConfig::CONFIG_ASK) { 73 | echo ""; 74 | echo ""; 77 | echo "  "; 80 | 81 | echo ""; 82 | echo "  "; 85 | 86 | echo ""; 87 | echo ""; 90 | } 91 | echo "
" . __("Delivery date") . ""; 43 | Html::showDateField("delivery_date", [ 44 | 'value' => date("Y-m-d"), 45 | 'maybeempty' => true, 46 | 'canedit' => true 47 | ]); 48 | echo ""; 49 | echo __("Delivery form") . ""; 50 | echo ""; 51 | echo ""; 52 | echo Html::hidden('plugin_order_references_id', ['value' => $_POST["plugin_order_references_id"]]); 53 | echo Html::hidden('plugin_order_orders_id', ['value' => $_POST["plugin_order_orders_id"]]); 54 | echo __("Number to deliver", "order") . ""; 55 | $nb = $PluginOrderReception->checkItemStatus( 56 | $_POST['plugin_order_orders_id'], 57 | $_POST['plugin_order_references_id'], 58 | PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED 59 | ); 60 | Dropdown::showNumber('number_reception', [ 61 | 'value' => '', 62 | 'min' => 1, 63 | 'max' => $nb 64 | ]); 65 | echo ""; 66 | echo __("Delivery status", "order") . " "; 67 | PluginOrderDeliveryState::Dropdown(['name' => "plugin_order_deliverystates_id"]); 68 | echo "
" . __("Enable automatic generation", "order") . ""; 75 | Dropdown::showYesNo("manual_generate", $config->canGenerateAsset()); 76 | echo "" . __("Default name", "order") . " "; 78 | Html::autocompletionTextField($config, "generated_name"); 79 | echo "" . __("Default serial number", "order") . " "; 83 | Html::autocompletionTextField($config, "generated_serial"); 84 | echo "" . __("Default inventory number", "order") . " "; 88 | Html::autocompletionTextField($config, "generated_otherserial"); 89 | echo "
"; 93 | 94 | Html::ajaxFooter(); 95 | -------------------------------------------------------------------------------- /ajax/referencespecifications.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | 33 | header("Content-Type: text/html; charset=UTF-8"); 34 | 35 | Html::header_nocache(); 36 | 37 | if (!defined('GLPI_ROOT')) { 38 | die("Can not acces directly to this file"); 39 | } 40 | 41 | Session::checkCentralAccess(); 42 | 43 | $PluginOrderReference = new PluginOrderReference(); 44 | 45 | if ($_POST["itemtype"]) { 46 | switch ($_POST["field"]) { 47 | case "types_id": 48 | if (class_exists($_POST["itemtype"] . 'Type')) { 49 | Dropdown::show($_POST["itemtype"] . "Type", ['name' => "types_id"]); 50 | } 51 | break; 52 | case "models_id": 53 | if (class_exists($_POST["itemtype"] . 'Model')) { 54 | Dropdown::show($_POST["itemtype"] . "Model", ['name' => "models_id"]); 55 | } else { 56 | return ""; 57 | } 58 | break; 59 | case "templates_id": 60 | $item = new $_POST['itemtype'](); 61 | if ($item->maybeTemplate()) { 62 | $table = getTableForItemType($_POST["itemtype"]); 63 | $PluginOrderReference->dropdownTemplate("templates_id", $_POST["entity_restrict"], $table); 64 | } else { 65 | return ""; 66 | } 67 | break; 68 | } 69 | } else { 70 | return ''; 71 | } 72 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": ">=7.4", 4 | "masnathan/odtphp": "dev-teclib" 5 | }, 6 | "require-dev": { 7 | "friendsoftwig/twigcs": "^6.1", 8 | "glpi-project/tools": "^0.7", 9 | "php-parallel-lint/php-parallel-lint": "^1.4", 10 | "phpstan/extension-installer": "^1.4", 11 | "phpstan/phpstan": "^2.1", 12 | "phpstan/phpstan-deprecation-rules": "^2.0", 13 | "squizlabs/php_codesniffer": "^3.13" 14 | }, 15 | "config": { 16 | "optimize-autoloader": true, 17 | "platform": { 18 | "php": "7.4.0" 19 | }, 20 | "sort-packages": true, 21 | "allow-plugins": { 22 | "phpstan/extension-installer": true 23 | } 24 | }, 25 | "repositories": [ 26 | { 27 | "type": "vcs", 28 | "url": "https://github.com/teclib/odtphp/" 29 | } 30 | ], 31 | "autoload-dev": { 32 | "psr-4": { 33 | "Glpi\\Tools\\": "../../tools/src/" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /front/accountsection.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderAccountSection(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/accountsection.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderAccountSection(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/analyticnature.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderAnalyticNature(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/analyticnature.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderAnalyticNature(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/bill.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $bill = new PluginOrderBill(); 35 | 36 | if (isset($_REQUEST['add'])) { 37 | $bill->add($_REQUEST); 38 | Html::back(); 39 | } 40 | 41 | if (isset($_REQUEST['update'])) { 42 | $bill->update($_REQUEST); 43 | Html::back(); 44 | } 45 | 46 | if (isset($_REQUEST['purge'])) { 47 | $bill->delete($_REQUEST); 48 | $bill->redirectToList(); 49 | } 50 | 51 | if (isset($_POST['action'])) { 52 | // Retrieve configuration for generate assets feature 53 | 54 | $order_item = new PluginOrderOrder_Item(); 55 | switch ($_POST['chooseAction']) { 56 | case 'bill': 57 | case 'state': 58 | if (isset($_POST["item"])) { 59 | foreach ($_POST["item"] as $key => $val) { 60 | if ($val == 1) { 61 | $tmp = $_POST; 62 | $tmp['id'] = $key; 63 | $order_item->update($tmp); 64 | 65 | // Update infocom 66 | $ic = new Infocom(); 67 | $ic->getFromDBforDevice($order_item->fields['itemtype'], $order_item->fields['items_id']); 68 | 69 | $config = PluginOrderConfig::getConfig(); 70 | if ($config->canAddBillDetails()) { 71 | if ($bill->getFromDB($_POST["plugin_order_bills_id"])) { 72 | $ic->update([ 73 | 'id' => $ic->fields['id'], 74 | 'bill' => $bill->fields['number'], 75 | 'warranty_date' => $bill->fields['billdate'], 76 | ]); 77 | } 78 | } 79 | } 80 | } 81 | } 82 | break; 83 | } 84 | PluginOrderOrder::updateBillState($order_item->fields['plugin_order_orders_id']); 85 | Html::back(); 86 | } 87 | 88 | Session::checkRight("plugin_order_bill", READ); 89 | 90 | Html::header(PluginOrderBill::getTypeName(), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill"); 91 | if (isset($_REQUEST['id'])) { 92 | $bill->display($_REQUEST); 93 | } else { 94 | $bill->display([]); 95 | } 96 | 97 | Html::footer(); 98 | -------------------------------------------------------------------------------- /front/bill.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | 33 | Session::checkRight("plugin_order_bill", READ); 34 | 35 | Html::header(PluginOrderBill::getTypeName(), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill"); 36 | 37 | Search::show('PluginOrderBill'); 38 | 39 | Html::footer(); 40 | -------------------------------------------------------------------------------- /front/billstate.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderBillState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/billstate.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderBillState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/billtype.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderBillType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/billtype.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderBillType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/config.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $config = new PluginOrderConfig(); 35 | 36 | if (isset($_POST["update"])) { 37 | $config->update($_POST); 38 | //Update singelton 39 | PluginOrderConfig::getConfig(true); 40 | Html::back(); 41 | } else { 42 | Html::header(__("Orders", "order"), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "order"); 43 | 44 | Session::checkRight("config", UPDATE); 45 | $config->showForm(1); 46 | 47 | Html::footer(); 48 | } 49 | -------------------------------------------------------------------------------- /front/deliverystate.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderDeliveryState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/deliverystate.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderDeliveryState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/documentcategory.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include('../../../inc/includes.php'); 32 | Session::checkLoginUser(); 33 | 34 | $documentCategory = new PluginOrderDocumentCategory(); 35 | 36 | if (isset($_POST["update"])) { 37 | if (!$documentCategory->getFromDBByCrit(['documentcategories_id' => $_POST['documentcategories_id']])) { 38 | $documentCategory->add($_POST); 39 | } else { 40 | $_POST['id'] = $documentCategory->fields['id']; 41 | $documentCategory->update($_POST); 42 | } 43 | 44 | Html::back(); 45 | } 46 | -------------------------------------------------------------------------------- /front/export.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $PluginOrderOrder = new PluginOrderOrder(); 35 | $PluginOrderOrder->generateOrder($_GET); 36 | -------------------------------------------------------------------------------- /front/menu.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var array $CFG_GLPI */ 32 | global $CFG_GLPI; 33 | 34 | include("../../../inc/includes.php"); 35 | Session::checkLoginUser(); 36 | 37 | Html::header( 38 | __("Orders management", "order"), 39 | $_SERVER['PHP_SELF'], 40 | "management", 41 | "PluginOrderMenu" 42 | ); 43 | 44 | //If there's only one possibility, do not display menu! 45 | if (PluginOrderOrder::canView() && !PluginOrderReference::canView() && !PluginOrderBill::canView()) { 46 | Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderOrder')); 47 | } else if (!PluginOrderOrder::canView() && PluginOrderReference::canView() && !PluginOrderBill::canView()) { 48 | Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderReference')); 49 | } else if (!PluginOrderOrder::canView() && !PluginOrderReference::canView() && PluginOrderBill::canView()) { 50 | Html::redirect(Toolbox::getItemTypeSearchURL('PluginOrderBill')); 51 | } 52 | 53 | if (PluginOrderOrder::canView() || PluginOrderReference::canView()) { 54 | echo "
"; 55 | echo ""; 56 | echo ""; 57 | 58 | if (PluginOrderOrder::canView()) { 59 | echo ""; 60 | echo ""; 61 | echo ""; 63 | } 64 | 65 | if (PluginOrderReference::canView()) { 66 | echo ""; 67 | echo ""; 68 | echo ""; 70 | } 71 | 72 | if (PluginOrderBill::canView()) { 73 | echo ""; 74 | echo ""; 75 | echo ""; 77 | } 78 | 79 | echo "
" . __("Orders management", "order") . "
" . 62 | __("Orders", "order") . "
" . 69 | __("Products references", "order") . "
" . 76 | __("Bills", "order") . "
"; 80 | } else { 81 | echo "


\"warning\"

"; 83 | echo "" . __("Access denied") . "
"; 84 | } 85 | 86 | Html::footer(); 87 | -------------------------------------------------------------------------------- /front/order.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var array $CFG_GLPI */ 32 | global $CFG_GLPI; 33 | 34 | include("../../../inc/includes.php"); 35 | Session::checkLoginUser(); 36 | 37 | Html::header( 38 | __("Orders", "order"), 39 | $_SERVER['PHP_SELF'], 40 | "management", 41 | "PluginOrderMenu", 42 | "order" 43 | ); 44 | 45 | if (PluginOrderOrder::canView() || Session::haveRight("config", UPDATE)) { 46 | Search::show("PluginOrderOrder"); 47 | } else { 48 | echo "


\"warning\"

"; 50 | echo "" . __("Access denied") . "
"; 51 | } 52 | 53 | Html::footer(); 54 | -------------------------------------------------------------------------------- /front/order_item.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | $item = new PluginOrderOrder_Item(); 34 | 35 | if (isset($_POST['update'])) { 36 | $item->update($_POST); 37 | $item->updatePrices($_POST['id']); 38 | Html::redirect($_SERVER['HTTP_REFERER']); 39 | } 40 | 41 | Html::header( 42 | __("Orders management", "order"), 43 | $_SERVER['PHP_SELF'], 44 | "management", 45 | "PluginOrderMenu", 46 | "order" 47 | ); 48 | 49 | $item->display($_REQUEST); 50 | 51 | Html::footer(); 52 | -------------------------------------------------------------------------------- /front/order_supplier.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | if (!isset($_GET["withtemplate"])) { 38 | $_GET["withtemplate"] = ""; 39 | } 40 | if (!isset($_GET["plugin_order_orders_id"])) { 41 | $_GET["plugin_order_orders_id"] = ""; 42 | } 43 | 44 | $supplier = new PluginOrderOrder_Supplier(); 45 | $order = new PluginOrderOrder(); 46 | 47 | if (isset($_POST["add"])) { 48 | if (PluginOrderOrder_Supplier::canCreate()) { 49 | if (isset($_POST["plugin_order_orders_id"]) && $_POST["plugin_order_orders_id"] > 0) { 50 | if ($supplier->add($_POST)) { 51 | $new_value = __("Add") . " "; 52 | if ($_POST["num_quote"]) { 53 | $new_value .= __("Quote number", "order") . " " . $_POST["num_quote"]; 54 | } 55 | if ($_POST["num_order"]) { 56 | $new_value .= " - " . __("Order number") . " : " . $_POST["num_order"]; 57 | } 58 | $order->addHistory('PluginOrderOrder', "", $new_value, $_POST["plugin_order_orders_id"]); 59 | } 60 | } 61 | } 62 | Html::back(); 63 | } else if (isset($_POST["delete"])) { 64 | if (PluginOrderOrder_Supplier::canCreate()) { 65 | foreach ($_POST["check"] as $ID => $value) { 66 | if ($supplier->delete(["id" => $ID], false, false)) { 67 | $new_value = __("Delete", "order") . " " . __("Supplier Detail", "order") . " : " . $ID; 68 | $order->addHistory('PluginOrderOrder', "", $new_value, $_POST["plugin_order_orders_id"]); 69 | } 70 | } 71 | } 72 | Html::back(); 73 | } else if (isset($_POST["update"])) { 74 | if (PluginOrderOrder_Supplier::canCreate()) { 75 | $supplier->update($_POST); 76 | } 77 | Html::back(); 78 | } else { 79 | Html::header(__("Orders management", "order"), '', "plugins", "order", "order"); 80 | $supplier->showForm( 81 | $_GET["id"], 82 | ['plugin_order_orders_id' => $_GET["plugin_order_orders_id"]] 83 | ); 84 | Html::footer(); 85 | } 86 | -------------------------------------------------------------------------------- /front/orderpayment.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderPayment(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/orderpayment.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderPayment(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/orderstate.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/orderstate.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderState(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/ordertax.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderTax(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/ordertax.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderTax(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/ordertype.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/ordertype.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOrderType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/othertype.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOtherType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.form.php"); 37 | -------------------------------------------------------------------------------- /front/othertype.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $dropdown = new PluginOrderOtherType(); 35 | 36 | include(GLPI_ROOT . "/front/dropdown.common.php"); 37 | -------------------------------------------------------------------------------- /front/preference.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | 38 | $PluginOrderPreference = new PluginOrderPreference(); 39 | 40 | if (isset($_POST["update"])) { 41 | $PluginOrderPreference->update($_POST); 42 | Html::redirect($_SERVER['HTTP_REFERER']); 43 | } else { 44 | Html::header(__("Orders", "order"), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu"); 45 | $PluginOrderPreference->showForm($_GET["id"]); 46 | Html::footer(); 47 | } 48 | -------------------------------------------------------------------------------- /front/profile.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | 33 | Session::checkRight("profile", UPDATE); 34 | 35 | $prof = new PluginOrderProfile(); 36 | 37 | //Save profile 38 | if (isset($_POST['update'])) { 39 | $prof->update($_POST); 40 | Html::redirect($_SERVER['HTTP_REFERER']); 41 | } 42 | -------------------------------------------------------------------------------- /front/reception.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var \DBmysql $DB */ 32 | global $DB; 33 | 34 | include("../../../inc/includes.php"); 35 | Session::checkLoginUser(); 36 | 37 | if (!isset($_GET["id"])) { 38 | $_GET["id"] = ""; 39 | } 40 | if (!isset($_GET["withtemplate"])) { 41 | $_GET["withtemplate"] = ""; 42 | } 43 | 44 | $reception = new PluginOrderReception(); 45 | $order_item = new PluginOrderOrder_Item(); 46 | 47 | if (isset($_POST["update"])) { 48 | if (PluginOrderReception::canCreate()) { 49 | $order_item->getFromDB($_POST["id"]); 50 | if ($order_item->fields["itemtype"] == 'SoftwareLicense') { 51 | $result = $order_item->queryRef( 52 | $order_item->fields["plugin_order_orders_id"], 53 | $order_item->fields["plugin_order_references_id"], 54 | $order_item->fields["price_taxfree"], 55 | $order_item->fields["discount"], 56 | PluginOrderOrder::ORDER_DEVICE_DELIVRED 57 | ); 58 | $nb = $DB->numrows($result); 59 | 60 | if ($nb) { 61 | for ($i = 0; $i < $nb; $i++) { 62 | $ID = $DB->result($result, $i, 'id'); 63 | $reception->update([ 64 | "id" => $ID, 65 | "delivery_date" => $_POST["delivery_date"], 66 | "delivery_number" => $_POST["delivery_number"], 67 | "plugin_order_deliverystates_id" => $_POST["plugin_order_deliverystates_id"], 68 | "delivery_comment" => $_POST["delivery_comment"], 69 | ]); 70 | } 71 | } 72 | } else { 73 | $reception->update($_POST); 74 | } 75 | } 76 | $reception->updateReceptionStatus([ 77 | 'items' => [ 78 | 'PluginOrderReception' => [ 79 | $_POST['id'] => 'on' 80 | ] 81 | ] 82 | ]); 83 | Html::redirect($_SERVER['HTTP_REFERER']); 84 | } else if (isset($_POST["delete"])) { 85 | $reception->deleteDelivery($_POST["id"]); 86 | $reception->updateReceptionStatus([ 87 | 'items' => [ 88 | 'PluginOrderReception' => [ 89 | $_POST['id'] => 'on' 90 | ] 91 | ] 92 | ]); 93 | Html::redirect(Toolbox::getItemTypeFormURL('PluginOrderOrder') . "?id=" . $_POST["plugin_order_orders_id"]); 94 | } else if (isset($_POST["bulk_reception"])) { 95 | //Several new items are delivered 96 | $reception->updateBulkReceptionStatus($_POST); 97 | Html::redirect($_SERVER["HTTP_REFERER"]); 98 | } else { 99 | Html::header(__("Orders management", "order"), '', "management", "PluginOrderMenu", "reception"); 100 | $reception->showForm($_GET["id"]); 101 | Html::footer(); 102 | } 103 | -------------------------------------------------------------------------------- /front/reference.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | if (!isset($_GET["withtemplate"])) { 38 | $_GET["withtemplate"] = ""; 39 | } 40 | if (isset($_POST["popup"])) { 41 | $_GET["popup"] = $_POST["popup"]; 42 | } else { 43 | $_GET["popup"] = ""; 44 | } 45 | if (!isset($_GET["itemtype"])) { 46 | $_GET["itemtype"] = ""; 47 | } 48 | 49 | $reference = new PluginOrderReference(); 50 | 51 | if (isset($_POST["add"])) { 52 | $reference->check(-1, UPDATE, $_POST); 53 | $newID = $reference->add($_POST); 54 | $url = Toolbox::getItemTypeFormURL('PluginOrderReference') . "?id=$newID"; 55 | if ($_GET["popup"] == 1) { 56 | $url .= "&popup=1"; 57 | } 58 | if ($_SESSION['glpibackcreated']) { 59 | Html::redirect($reference->getFormURL() . "?id=" . $newID); 60 | } else { 61 | Html::redirect($url); 62 | } 63 | 64 | /* delete order */ 65 | } else if (isset($_POST["delete"])) { 66 | $reference->check($_POST['id'], UPDATE); 67 | $reference->delete($_POST); 68 | $reference->redirectToList(); 69 | 70 | /* restore order */ 71 | } else if (isset($_POST["restore"])) { 72 | $reference->check($_POST['id'], UPDATE); 73 | $reference->restore($_POST); 74 | $reference->redirectToList(); 75 | 76 | /* purge order */ 77 | } else if (isset($_POST["purge"])) { 78 | $reference->check($_POST['id'], UPDATE); 79 | $reference->delete($_POST, true); 80 | $reference->redirectToList(); 81 | 82 | /* update order */ 83 | } else if (isset($_POST["update"])) { 84 | $reference->check($_POST['id'], UPDATE); 85 | $reference->update($_POST); 86 | Html::back(); 87 | } 88 | 89 | if ($_GET["popup"] == 1) { 90 | Html::popheader( 91 | PluginOrderReference::getTypeName(1), 92 | $_SERVER['PHP_SELF'], 93 | true, 94 | "PluginOrderMenu", 95 | "references" 96 | ); 97 | } else { 98 | Html::header( 99 | PluginOrderReference::getTypeName(1), 100 | $_SERVER['PHP_SELF'], 101 | "management", 102 | "PluginOrderMenu", 103 | "references" 104 | ); 105 | } 106 | 107 | if ($_GET['id'] == "") { 108 | $reference->showForm(-1); 109 | } else { 110 | $_GET['item'] = $_GET['itemtype']; 111 | $reference->display($_GET); 112 | } 113 | 114 | if ($_GET["popup"] == 1) { 115 | Html::popfooter(); 116 | } else { 117 | Html::footer(); 118 | } 119 | -------------------------------------------------------------------------------- /front/reference.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /** @var array $CFG_GLPI */ 32 | global $CFG_GLPI; 33 | 34 | include("../../../inc/includes.php"); 35 | Session::checkLoginUser(); 36 | 37 | Html::header( 38 | PluginOrderReference::getTypeName(), 39 | $_SERVER['PHP_SELF'], 40 | "management", 41 | "PluginOrderMenu", 42 | "references" 43 | ); 44 | 45 | if (PluginOrderReference::canView()) { 46 | Search::show("PluginOrderReference"); 47 | } else { 48 | echo "


\"warning\"

"; 50 | echo "" . __("Access denied") . "
"; 51 | } 52 | 53 | Html::footer(); 54 | -------------------------------------------------------------------------------- /front/reference_supplier.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | if (!isset($_GET["withtemplate"])) { 38 | $_GET["withtemplate"] = ""; 39 | } 40 | if (!isset($_GET["plugin_order_references_id"])) { 41 | $_GET["plugin_order_references_id"] = ""; 42 | } 43 | 44 | $PluginOrderReference_Supplier = new PluginOrderReference_Supplier(); 45 | 46 | if (isset($_POST["add"])) { 47 | if (PluginOrderReference_Supplier::canCreate()) { 48 | if (isset($_POST["suppliers_id"]) && $_POST["suppliers_id"] > 0) { 49 | $PluginOrderReference_Supplier->add($_POST); 50 | } 51 | } 52 | Html::redirect($_SERVER['HTTP_REFERER']); 53 | } else if (isset($_POST["update"])) { 54 | if (PluginOrderReference_Supplier::canCreate()) { 55 | $PluginOrderReference_Supplier->update($_POST); 56 | } 57 | Html::redirect($_SERVER['HTTP_REFERER']); 58 | } else if (isset($_POST["delete"])) { 59 | if (PluginOrderReference_Supplier::canCreate()) { 60 | foreach ($_POST["check"] as $ID => $value) { 61 | $PluginOrderReference_Supplier->delete(["id" => $ID]); 62 | } 63 | } 64 | Html::redirect($_SERVER['HTTP_REFERER']); 65 | } else { 66 | $PluginOrderReference_Supplier->checkGlobal(READ); 67 | Html::header( 68 | __("Supplier for the reference", "order"), 69 | $_SERVER['PHP_SELF'], 70 | "management", 71 | "PluginOrderMenu", 72 | "references" 73 | ); 74 | 75 | /* load order form */ 76 | $PluginOrderReference_Supplier->display($_GET); 77 | 78 | Html::footer(); 79 | } 80 | -------------------------------------------------------------------------------- /front/signature.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | $sign = array_key_exists('sign', $_GET) ? $_GET['sign'] : ''; 35 | 36 | // Avoid access to another directory or to files that does not match allowed extension 37 | $extensionPattern = '/\.(' . implode('|', array_map(function ($ext) { 38 | return preg_quote($ext, '/'); 39 | }, PLUGIN_ORDER_SIGNATURE_EXTENSION)) . ')$/'; 40 | 41 | if (preg_match('/[\\\\\/]/', $sign) !== 0 || preg_match($extensionPattern, $sign) === 0) { 42 | header('HTTP/1.1 403 Forbidden'); 43 | exit(); 44 | } 45 | 46 | $filename = PLUGIN_ORDER_SIGNATURE_DIR . $sign; 47 | 48 | if (empty($sign) || !@is_file($filename)) { 49 | header('HTTP/1.1 404 Not Found'); 50 | exit(); 51 | } 52 | 53 | Toolbox::sendFile($filename, $sign); 54 | -------------------------------------------------------------------------------- /front/surveysupplier.form.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | include("../../../inc/includes.php"); 32 | Session::checkLoginUser(); 33 | 34 | if (!isset($_GET["id"])) { 35 | $_GET["id"] = ""; 36 | } 37 | if (!isset($_GET["withtemplate"])) { 38 | $_GET["withtemplate"] = ""; 39 | } 40 | if (!isset($_GET["plugin_order_orders_id"])) { 41 | $_GET["plugin_order_orders_id"] = ""; 42 | } 43 | 44 | $PluginOrderSurveySupplier = new PluginOrderSurveySupplier(); 45 | 46 | if (isset($_POST["add"])) { 47 | if (PluginOrderSurveySupplier::canCreate()) { 48 | if (isset($_POST["plugin_order_orders_id"]) && $_POST["plugin_order_orders_id"] > 0) { 49 | $PluginOrderSurveySupplier->add($_POST); 50 | } 51 | } 52 | Html::redirect($_SERVER['HTTP_REFERER']); 53 | } else if (isset($_POST["delete"])) { 54 | if (PluginOrderSurveySupplier::canCreate()) { 55 | foreach ($_POST["check"] as $ID => $value) { 56 | $PluginOrderSurveySupplier->delete(["id" => $ID], false, false); 57 | } 58 | } 59 | Html::redirect($_SERVER['HTTP_REFERER']); 60 | } else if (isset($_POST["update"])) { 61 | if (PluginOrderSurveySupplier::canCreate()) { 62 | $PluginOrderSurveySupplier->update($_POST); 63 | } 64 | Html::redirect($_SERVER['HTTP_REFERER']); 65 | } else { 66 | $PluginOrderSurveySupplier->checkGlobal(READ); 67 | Html::header( 68 | __("Orders management", "order"), 69 | $_SERVER['PHP_SELF'], 70 | "management", 71 | "PluginOrderMenu", 72 | "order" 73 | ); 74 | $PluginOrderSurveySupplier->display($_GET); 75 | Html::footer(); 76 | } 77 | -------------------------------------------------------------------------------- /generate/custom.php.example: -------------------------------------------------------------------------------- 1 | . 20 | -------------------------------------------------------------------------- 21 | @package order 22 | @author the order plugin team 23 | @copyright Copyright (c) 2010-2011 Order plugin team 24 | @license GPLv2+ 25 | http://www.gnu.org/licenses/gpl.txt 26 | @link https://forge.indepnet.net/projects/order 27 | @link http://www.glpi-project.org/ 28 | @since 2009 29 | ---------------------------------------------------------------------- */ 30 | 31 | function plugin_order_getCustomFieldsForODT($ID, $odttemplates_id, $odf, $signature) { 32 | /** @var \DBmysql $DB */ 33 | global $DB; 34 | 35 | $order = new PluginOrderOrder(); 36 | $order->getFromDB($ID); 37 | $PluginOrderOrder_Item = new PluginOrderOrder_Item(); 38 | $PluginOrderReference_Supplier = new PluginOrderReference_Supplier(); 39 | 40 | $odf->setImage('logo', PLUGIN_ORDER_TEMPLATE_LOGO_DIR.'/logo.jpg'); 41 | 42 | $odf->setVars('title_order', __("Order number", "order"), true, 'UTF-8'); 43 | $odf->setVars('num_order', $order->fields["num_order"], true, 'UTF-8'); 44 | //$odf->setVars('comment', $order->fields["comment"], true, 'UTF-8'); 45 | 46 | $odf->setVars('title_invoice_address', __("Invoice address", "order"), true, 'UTF-8'); 47 | 48 | $entity = new Entity(); 49 | $entity->getFromDB($order->fields["entities_id"]); 50 | $town = ''; 51 | 52 | if ($order->fields["entities_id"]!=0) { 53 | $name_entity = $entity->fields["name"]; 54 | } else { 55 | $name_entity = __("Root entity"); 56 | } 57 | 58 | $odf->setVars('entity_name', $name_entity, true, 'UTF-8'); 59 | if ($entity->getFromDB($order->fields["entities_id"])) { 60 | $odf->setVars('entity_address', $entity->fields["address"], true, 'UTF-8'); 61 | $odf->setVars('entity_postcode', $entity->fields["postcode"],true, 'UTF-8'); 62 | $town = $entity->fields["town"]; 63 | $odf->setVars('entity_town', $town,true,'UTF-8'); 64 | $odf->setVars('entity_country', $entity->fields["country"], true, 'UTF-8'); 65 | $odf->setVars('entity_ldapdn', $entity->fields["ldap_dn"], true, 'UTF-8'); 66 | } 67 | 68 | $supplier = new Supplier(); 69 | if ($supplier->getFromDB($order->fields["suppliers_id"])) { 70 | $odf->setVars('supplier_name', $supplier->fields["name"],true,'UTF-8'); 71 | $odf->setVars('supplier_address', $supplier->fields["address"],true,'UTF-8'); 72 | $odf->setVars('supplier_postcode', $supplier->fields["postcode"],true,'UTF-8'); 73 | $odf->setVars('supplier_town', $supplier->fields["town"],true,'UTF-8'); 74 | $odf->setVars('supplier_country', $supplier->fields["country"],true,'UTF-8'); 75 | } 76 | 77 | $odf->setVars('title_delivery_address',__("Delivery address", "order"),true,'UTF-8'); 78 | $tmpname=Dropdown::getDropdownName("glpi_locations",$order->fields["locations_id"],1); 79 | $comment=$tmpname["comment"]; 80 | $odf->setVars('comment_delivery_address',$comment,true,'UTF-8'); 81 | 82 | if ($town) { 83 | $town = $town. ", "; 84 | } 85 | $odf->setVars('title_date_order', $town.__("The", "order")." ",true,'UTF-8'); 86 | $odf->setVars('date_order', Html::convDate($order->fields["order_date"]),true,'UTF-8'); 87 | 88 | $odf->setVars('title_sender', __("Issuer order", "order"),true,'UTF-8'); 89 | $odf->setVars('sender', getUserName(Session::getLoginUserID()),true,'UTF-8'); 90 | 91 | $output=''; 92 | $contact = new Contact(); 93 | if ($contact->getFromDB($order->fields["contacts_id"])) { 94 | $output=formatUserName($contact->fields["id"], "", $contact->fields["name"], 95 | $contact->fields["firstname"], 0); 96 | } 97 | $odf->setVars('title_recipient',__("Recipient", "order"),true,'UTF-8'); 98 | $odf->setVars('recipient',$output,true,'UTF-8'); 99 | $odf->setVars('nb',__("Quantity", "order"),true,'UTF-8'); 100 | $odf->setVars('title_item',__("Designation", "order"),true,'UTF-8'); 101 | $odf->setVars('title_ref',__("Reference"),true,'UTF-8'); 102 | $odf->setVars('HTPrice_item',__("Unit price", "order"),true,'UTF-8'); 103 | $odf->setVars('TVA_item',__("VAT", "order"),true,'UTF-8'); 104 | $odf->setVars('title_discount',__("Discount rate", "order"),true,'UTF-8'); 105 | $odf->setVars('HTPriceTotal_item',__("Sum tax free", "order"),true,'UTF-8'); 106 | $odf->setVars('ATIPriceTotal_item',__("Price ATI", "order"),true,'UTF-8'); 107 | 108 | $listeArticles = []; 109 | $result = $PluginOrderOrder_Item->queryDetail($ID); 110 | $num = $DB->numrows($result); 111 | while ($data = $DB->fetchArray($result)) { 112 | $quantity = $PluginOrderOrder_Item->getTotalQuantityByRefAndDiscount($ID, $data["id"], 113 | $data["price_taxfree"], 114 | $data["discount"]); 115 | 116 | $listeArticles[] = [ 117 | 'quantity' => $quantity, 118 | 'ref' => $data["name"], 119 | 'taxe' => Dropdown::getDropdownName(PluginOrderOrderTax::getTable(), 120 | $data["plugin_order_ordertaxes_id"]), 121 | 'refnumber' => $PluginOrderReference_Supplier->getReferenceCodeByReferenceAndSupplier($data["id"], 122 | $order->fields["suppliers_id"]), 123 | 'price_taxfree' => $data["price_taxfree"], 124 | 'discount' => $data["discount"], false, 0, 125 | 'price_discounted' => $data["price_discounted"]*$quantity, 126 | 'price_ati' => $data["price_ati"] 127 | ]; 128 | } 129 | 130 | $article = $odf->setSegment('articles'); 131 | foreach($listeArticles AS $element) { 132 | $articleValues = []; 133 | $articleValues['nbA'] = $element['quantity']; 134 | $articleValues['titleArticle'] = $element['ref']; 135 | $articleValues['refArticle'] = $element['refnumber']; 136 | $articleValues['TVAArticle'] = $element['taxe']; 137 | $articleValues['HTPriceArticle'] = Html::formatNumber($element['price_taxfree']); 138 | if ($element['discount'] != 0) { 139 | $articleValues['discount'] = Html::formatNumber($element['discount'])." %"; 140 | } else { 141 | $articleValues['discount'] = ""; 142 | } 143 | $articleValues['HTPriceTotalArticle'] = Html::formatNumber($element['price_discounted']); 144 | 145 | $total_TTC_Article = $element['price_discounted'] * (1 + ($element['taxe'] / 100)); 146 | $articleValues['ATIPriceTotalArticle'] = Html::formatNumber($total_TTC_Article); 147 | 148 | // Set variables in odt segment 149 | foreach ($articleValues as $field => $val) { 150 | try { 151 | $article->setVars($field, $val, true, 'UTF-8'); 152 | } catch (\Odtphp\Exceptions\OdfException $e) { 153 | $is_cs_happy = true; 154 | } 155 | } 156 | $article->merge(); 157 | } 158 | 159 | $odf->mergeSegment($article); 160 | $prices = $PluginOrderOrder_Item->getAllPrices($ID); 161 | 162 | // total price (with postage) 163 | $tax = new PluginOrderOrderTax(); 164 | $tax->getFromDB($order->fields["plugin_order_ordertaxes_id"]); 165 | 166 | $postagewithTVA = $PluginOrderOrder_Item->getPricesATI( 167 | $order->fields["port_price"], 168 | $tax->getRate() 169 | ); 170 | 171 | $total_HT = $prices["priceHT"] + $order->fields["port_price"]; 172 | $total_TVA = $prices["priceTVA"] + $postagewithTVA - $order->fields["port_price"]; 173 | $total_TTC = $prices["priceTTC"] + $postagewithTVA; 174 | 175 | $odf->setVars('title_totalht',__("Price tax free", "order"),true,'UTF-8'); 176 | $odf->setVars('totalht',Html::formatNumber($prices['priceHT']),true,'UTF-8'); 177 | 178 | $odf->setVars('title_port',__("Price tax free with postage", "order"),true,'UTF-8'); 179 | $odf->setVars('totalht_port_price',Html::formatNumber($total_HT),true,'UTF-8'); 180 | 181 | $odf->setVars('title_price_port',__("Postage", "order"),true,'UTF-8'); 182 | $odf->setVars('price_port_tva'," (".Dropdown::getDropdownName("glpi_plugin_order_ordertaxes", 183 | $order->fields["plugin_order_ordertaxes_id"])."%)",true,'UTF-8'); 184 | $odf->setVars('port_price',Html::formatNumber($postagewithTVA),true,'UTF-8'); 185 | 186 | $odf->setVars('title_tva',__("VAT", "order"),true,'UTF-8'); 187 | $odf->setVars('totaltva',Html::formatNumber($total_TVA),true,'UTF-8'); 188 | 189 | $odf->setVars('title_totalttc',__("Price ATI", "order"),true,'UTF-8'); 190 | $odf->setVars('totalttc',Html::formatNumber($total_TTC),true,'UTF-8'); 191 | 192 | $odf->setVars('title_money',__("€", "order"),true,'UTF-8'); 193 | $odf->setVars('title_sign',__("Signature of issuing order", "order"),true,'UTF-8'); 194 | 195 | if ($signature) { 196 | $odf->setImage('sign', PLUGIN_ORDER_SIGNATURE_DIR . $signature); 197 | } else { 198 | $odf->setImage('sign', '../pics/nothing.gif'); 199 | } 200 | //$odf->setVars('title_conditions',__("Payment conditions", "order"),true,'UTF-8'); 201 | $odf->setVars('payment_conditions', 202 | Dropdown::getDropdownName("glpi_plugin_order_orderpayments", 203 | $order->fields["plugin_order_orderpayments_id"]), 204 | true,'UTF-8'); 205 | } 206 | -------------------------------------------------------------------------------- /glpi_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/glpi_network.png -------------------------------------------------------------------------------- /inc/accountsection.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderAccountSection extends CommonDropdown 36 | { 37 | public static $rightname = 'plugin_order_order'; 38 | 39 | public static function getTypeName($nb = 0) 40 | { 41 | 42 | return __("Account section", "order"); 43 | } 44 | 45 | public static function install(Migration $migration) 46 | { 47 | /** @var \DBmysql $DB */ 48 | global $DB; 49 | 50 | $default_charset = DBConnection::getDefaultCharset(); 51 | $default_collation = DBConnection::getDefaultCollation(); 52 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 53 | 54 | $table = getTableForItemType(__CLASS__); 55 | if (!$DB->tableExists($table)) { 56 | $migration->displayMessage("Installing $table"); 57 | 58 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_accountsections` ( 59 | `id` int {$default_key_sign} NOT NULL AUTO_INCREMENT, 60 | `name` varchar(255) DEFAULT NULL, 61 | `comment` text, 62 | PRIMARY KEY (`id`), 63 | KEY `name` (`name`) 64 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 65 | $DB->query($query) or die($DB->error()); 66 | } 67 | } 68 | 69 | public static function uninstall() 70 | { 71 | /** @var \DBmysql $DB */ 72 | global $DB; 73 | 74 | $DB->query("DROP TABLE IF EXISTS `" . getTableForItemType(__CLASS__) . "`") or die($DB->error()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /inc/analyticnature.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderAnalyticNature extends CommonDropdown 36 | { 37 | public static $rightname = 'plugin_order_order'; 38 | 39 | public static function getTypeName($nb = 0) 40 | { 41 | 42 | return __("Analytic nature", "order"); 43 | } 44 | 45 | public static function install(Migration $migration) 46 | { 47 | /** @var \DBmysql $DB */ 48 | global $DB; 49 | 50 | $default_charset = DBConnection::getDefaultCharset(); 51 | $default_collation = DBConnection::getDefaultCollation(); 52 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 53 | 54 | $table = getTableForItemType(__CLASS__); 55 | if (!$DB->tableExists($table)) { 56 | $migration->displayMessage("Installing $table"); 57 | 58 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_analyticnatures` ( 59 | `id` int {$default_key_sign} NOT NULL AUTO_INCREMENT, 60 | `name` varchar(255) DEFAULT NULL, 61 | `comment` text, 62 | PRIMARY KEY (`id`), 63 | KEY `name` (`name`) 64 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 65 | $DB->query($query) or die($DB->error()); 66 | } 67 | } 68 | 69 | public static function uninstall() 70 | { 71 | /** @var \DBmysql $DB */ 72 | global $DB; 73 | 74 | $DB->query("DROP TABLE IF EXISTS `" . getTableForItemType(__CLASS__) . "`") or die($DB->error()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /inc/billstate.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderBillState extends CommonDropdown 36 | { 37 | const NOTPAID = 0; 38 | const PAID = 1; 39 | 40 | public static $rightname = 'plugin_order_bill'; 41 | 42 | 43 | public static function getTypeName($nb = 0) 44 | { 45 | return __("Bill status", "order"); 46 | } 47 | 48 | 49 | public function pre_deleteItem() 50 | { 51 | if ($this->getID() <= self::PAID) { 52 | Session::addMessageAfterRedirect( 53 | __("You cannot remove this status", "order") . 54 | ": " . $this->fields['name'], 55 | false, 56 | ERROR 57 | ); 58 | return false; 59 | } else { 60 | return true; 61 | } 62 | } 63 | 64 | 65 | public static function getStates() 66 | { 67 | return [self::NOTPAID => __("Being paid", "order"), 68 | self::PAID => __("Paid", "order") 69 | ]; 70 | } 71 | 72 | 73 | public static function getState($states_id) 74 | { 75 | $states = self::getStates(); 76 | if (isset($states[$states_id])) { 77 | return $states[$states_id]; 78 | } else { 79 | return ''; 80 | } 81 | } 82 | 83 | 84 | public static function install(Migration $migration) 85 | { 86 | /** @var \DBmysql $DB */ 87 | global $DB; 88 | 89 | $default_charset = DBConnection::getDefaultCharset(); 90 | $default_collation = DBConnection::getDefaultCollation(); 91 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 92 | 93 | $table = self::getTable(); 94 | if (!$DB->tableExists($table)) { 95 | $migration->displayMessage("Installing $table"); 96 | 97 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_billstates` ( 98 | `id` int {$default_key_sign} NOT NULL AUTO_INCREMENT, 99 | `name` varchar(255) DEFAULT NULL, 100 | `comment` text, 101 | PRIMARY KEY (`id`), 102 | KEY `name` (`name`) 103 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 104 | $DB->query($query) or die($DB->error()); 105 | } 106 | if (countElementsInTable($table) < 2) { 107 | $state = new self(); 108 | foreach ( 109 | [self::PAID => __("Paid", "order"), 110 | self::NOTPAID => __("Not paid", "order") 111 | ] as $id => $label 112 | ) { 113 | $state->add(['id' => $id, 114 | 'name' => Toolbox::addslashes_deep($label) 115 | ]); 116 | } 117 | } 118 | } 119 | 120 | 121 | public static function uninstall() 122 | { 123 | /** @var \DBmysql $DB */ 124 | global $DB; 125 | 126 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /inc/billtype.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderBillType extends CommonDropdown 36 | { 37 | public static $rightname = 'plugin_order_bill'; 38 | 39 | 40 | public static function getTypeName($nb = 0) 41 | { 42 | return __("Bill type", "order"); 43 | } 44 | 45 | 46 | public static function install(Migration $migration) 47 | { 48 | /** @var \DBmysql $DB */ 49 | global $DB; 50 | 51 | $default_charset = DBConnection::getDefaultCharset(); 52 | $default_collation = DBConnection::getDefaultCollation(); 53 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 54 | 55 | $table = self::getTable(); 56 | if (!$DB->tableExists($table)) { 57 | $migration->displayMessage("Installing $table"); 58 | 59 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_billtypes` ( 60 | `id` int {$default_key_sign} NOT NULL AUTO_INCREMENT, 61 | `name` varchar(255) DEFAULT NULL, 62 | `comment` text, 63 | PRIMARY KEY (`id`), 64 | KEY `name` (`name`) 65 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 66 | $DB->query($query) or die($DB->error()); 67 | } 68 | } 69 | 70 | 71 | public static function uninstall() 72 | { 73 | /** @var \DBmysql $DB */ 74 | global $DB; 75 | 76 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /inc/deliverystate.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderDeliveryState extends CommonDropdown 36 | { 37 | public static function getTypeName($nb = 0) 38 | { 39 | return __("Delivery status", "order"); 40 | } 41 | 42 | 43 | public static function install(Migration $migration) 44 | { 45 | /** @var \DBmysql $DB */ 46 | global $DB; 47 | 48 | $default_charset = DBConnection::getDefaultCharset(); 49 | $default_collation = DBConnection::getDefaultCollation(); 50 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 51 | 52 | $table = self::getTable(); 53 | if ( 54 | !$DB->tableExists($table) 55 | && !$DB->tableExists("glpi_dropdown_plugin_order_deliverystate") 56 | ) { 57 | $migration->displayMessage("Installing $table"); 58 | 59 | //Install 60 | $query = "CREATE TABLE `glpi_plugin_order_deliverystates` ( 61 | `id` int {$default_key_sign} NOT NULL auto_increment, 62 | `name` varchar(255) default NULL, 63 | `comment` text, 64 | PRIMARY KEY (`id`), 65 | KEY `name` (`name`) 66 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 67 | $DB->query($query) or die($DB->error()); 68 | } else { 69 | $migration->displayMessage("Upgrading $table"); 70 | 71 | //Upgrade 1.2.0 72 | $migration->renameTable("glpi_dropdown_plugin_order_deliverystate", $table); 73 | $migration->changeField($table, "ID", "id", "int {$default_key_sign} NOT NULL auto_increment"); 74 | $migration->changeField($table, "name", "name", "varchar(255) default NULL"); 75 | $migration->changeField($table, "comments", "comment", "text"); 76 | $migration->migrationOneTable($table); 77 | } 78 | } 79 | 80 | 81 | public static function uninstall() 82 | { 83 | /** @var \DBmysql $DB */ 84 | global $DB; 85 | 86 | //Old table 87 | $DB->query("DROP TABLE IF EXISTS `glpi_dropdown_plugin_order_deliverystate`") or die($DB->error()); 88 | 89 | //New table 90 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /inc/documentcategory.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderDocumentCategory extends CommonDBTM 36 | { 37 | public static function getTypeName($nb = 0) 38 | { 39 | return __("Document category", "order"); 40 | } 41 | 42 | 43 | public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) 44 | { 45 | $config = PluginOrderConfig::getConfig(); 46 | 47 | if ($item->getType() == "DocumentCategory" && $config->canRenameDocuments()) { 48 | return __("Orders", "order"); 49 | } 50 | 51 | return ''; 52 | } 53 | 54 | 55 | public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) 56 | { 57 | $config = PluginOrderConfig::getConfig(); 58 | 59 | if ($item->getType() == "DocumentCategory" && $config->canRenameDocuments()) { 60 | self::showForDocumentCategory($item); 61 | } 62 | return true; 63 | } 64 | 65 | 66 | public static function purgeItem($item) 67 | { 68 | $temp = new self(); 69 | $temp->deleteByCriteria([ 70 | 'documentcategories_id' => $item->getField("id") 71 | ]); 72 | } 73 | 74 | 75 | public static function showForDocumentCategory($item) 76 | { 77 | $documentCategory = new self(); 78 | if (!$documentCategory->getFromDBByCrit(['documentcategories_id' => $item->fields['id']])) { 79 | $documentCategory->getEmpty(); 80 | } 81 | 82 | echo "
"; 84 | 85 | echo "
"; 86 | echo ""; 87 | 88 | echo ""; 89 | // Dropdown group 90 | echo ""; 93 | echo ""; 96 | echo ""; 97 | 98 | echo ""; 99 | echo ""; 103 | echo ""; 104 | echo "
" . __('Document category prefix', 'order') . "
"; 91 | echo __('Document category prefix', 'order'); 92 | echo ""; 94 | echo ""; 95 | echo "
"; 100 | echo ""; 101 | echo Html::hidden('documentcategories_id', ['value' => $item->getID()]); 102 | echo "
"; 105 | Html::closeForm(); 106 | } 107 | 108 | 109 | //------------------------------------------------------------ 110 | //--------------------Install / uninstall -------------------- 111 | //------------------------------------------------------------ 112 | 113 | public static function install(Migration $migration) 114 | { 115 | /** @var \DBmysql $DB */ 116 | global $DB; 117 | 118 | $default_charset = DBConnection::getDefaultCharset(); 119 | $default_collation = DBConnection::getDefaultCollation(); 120 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 121 | 122 | $table = self::getTable(); 123 | //Installation 124 | if ( 125 | !$DB->tableExists($table) 126 | && !$DB->tableExists("glpi_plugin_order_documentcategories") 127 | ) { 128 | $migration->displayMessage("Installing $table"); 129 | 130 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_documentcategories` ( 131 | `id` int {$default_key_sign} NOT NULL auto_increment, 132 | `documentcategories_id` int {$default_key_sign} NOT NULL default '0', 133 | `documentcategories_prefix` varchar(255) default NULL, 134 | PRIMARY KEY (`id`), 135 | KEY `documentcategories_id` (`documentcategories_id`), 136 | UNIQUE KEY `unicity` (`documentcategories_id`, `documentcategories_prefix`) 137 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 138 | $DB->query($query) or die($DB->error()); 139 | } 140 | } 141 | 142 | 143 | public static function uninstall() 144 | { 145 | /** @var \DBmysql $DB */ 146 | global $DB; 147 | //Current table name 148 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /inc/menu.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | class PluginOrderMenu extends CommonGLPI 32 | { 33 | public static function getTypeName($nb = 0) 34 | { 35 | return __("Orders", "order"); 36 | } 37 | 38 | 39 | public static function getMenuContent() 40 | { 41 | $menu = [ 42 | 'title' => self::getTypeName(2), 43 | 'page' => self::getSearchURL(false), 44 | 'icon' => PluginOrderOrder::getIcon(), 45 | ]; 46 | if (PluginOrderConfig::canView()) { 47 | $menu['links']['config'] = PluginOrderConfig::getFormURL(false); 48 | } 49 | 50 | if (PluginOrderOrder::canView()) { 51 | $menu['options']['order'] = [ 52 | 'title' => PluginOrderOrder::getTypeName(2), 53 | 'page' => PluginOrderOrder::getSearchURL(false), 54 | 'icon' => PluginOrderOrder::getIcon(), 55 | ]; 56 | if (PluginOrderOrder::canCreate()) { 57 | $menu['options']['order']['links'] = [ 58 | 'search' => PluginOrderOrder::getSearchURL(false), 59 | 'add' => "/front/setup.templates.php?itemtype=PluginOrderOrder&add=1", 60 | ]; 61 | } 62 | $menu['options']['order']['links']['template'] = "/front/setup.templates.php?itemtype=PluginOrderOrder&add=0"; 63 | if (PluginOrderConfig::canView()) { 64 | $menu['options']['order']['links']['config'] = PluginOrderConfig::getFormURL(false); 65 | } 66 | $menu['options']['order']['links']['lists'] = ""; 67 | $menu['options']['order']['lists_itemtype'] = PluginOrderOrder::getType(); 68 | } 69 | 70 | if (PluginOrderBill::canView()) { 71 | $menu['options']['bill'] = [ 72 | 'title' => PluginOrderBill::getTypeName(2), 73 | 'page' => PluginOrderBill::getSearchURL(false), 74 | 'links' => [ 75 | 'search' => PluginOrderBill::getSearchURL(false) 76 | ], 77 | 'icon' => PluginOrderBill::getIcon(), 78 | ]; 79 | if (PluginOrderBill::canCreate()) { 80 | $menu['options']['bill']['links']['add'] = PluginOrderBill::getFormURL(false); 81 | } 82 | if (PluginOrderConfig::canView()) { 83 | $menu['options']['bill']['links']['config'] = PluginOrderConfig::getFormURL(false); 84 | } 85 | $menu['options']['bill']['links']['lists'] = ""; 86 | $menu['options']['bill']['lists_itemtype'] = PluginOrderBill::getType(); 87 | } 88 | 89 | if (PluginOrderReference::canView()) { 90 | $menu['options']['references'] = [ 91 | 'title' => PluginOrderReference::getTypeName(2), 92 | 'page' => PluginOrderReference::getSearchURL(false), 93 | 'links' => [ 94 | 'search' => PluginOrderReference::getSearchURL(false) 95 | ], 96 | 'icon' => PluginOrderReference::getIcon(), 97 | ]; 98 | if (PluginOrderReference::canCreate()) { 99 | $menu['options']['references']['links']['add'] = PluginOrderReference::getFormURL(false); 100 | } 101 | if (PluginOrderConfig::canView()) { 102 | $menu['options']['references']['links']['config'] = PluginOrderConfig::getFormURL(false); 103 | } 104 | $menu['options']['references']['links']['lists'] = ""; 105 | $menu['options']['references']['lists_itemtype'] = PluginOrderReference::getType(); 106 | } 107 | return $menu; 108 | } 109 | 110 | 111 | public function install() 112 | { 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /inc/orderinjection.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderOrderInjection extends PluginOrderOrder implements PluginDatainjectionInjectionInterface 36 | { 37 | public function __construct() 38 | { 39 | $this->table = getTableForItemType(get_parent_class($this)); 40 | } 41 | 42 | 43 | /** 44 | * Returns the name of the table used to store this object parent 45 | * 46 | * @return string (table name) 47 | **/ 48 | public static function getTable($classname = null) 49 | { 50 | 51 | $parenttype = get_parent_class(); 52 | return $parenttype::getTable(); 53 | } 54 | 55 | 56 | public function isPrimaryType() 57 | { 58 | return true; 59 | } 60 | 61 | 62 | public function connectedTo() 63 | { 64 | return []; 65 | } 66 | 67 | public function addOrUpdateObject($values = [], $options = []) 68 | { 69 | $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options); 70 | $lib->processAddOrUpdate(); 71 | return $lib->getInjectionResults(); 72 | } 73 | 74 | 75 | public function getOptions($primary_type = '') 76 | { 77 | return Search::getOptions(get_parent_class($this)); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /inc/orderpayment.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | // Class for a Dropdown 36 | class PluginOrderOrderPayment extends CommonDropdown 37 | { 38 | public static $rightname = 'plugin_order_order'; //'plugin_order_order'; 39 | 40 | public static function getTypeName($nb = 0) 41 | { 42 | return __("Payment conditions", "order"); 43 | } 44 | 45 | 46 | public static function install(Migration $migration) 47 | { 48 | /** @var \DBmysql $DB */ 49 | global $DB; 50 | 51 | $default_charset = DBConnection::getDefaultCharset(); 52 | $default_collation = DBConnection::getDefaultCollation(); 53 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 54 | 55 | $table = self::getTable(); 56 | if (!$DB->tableExists($table) && !$DB->tableExists("glpi_dropdown_plugin_order_payment")) { 57 | $migration->displayMessage("Installing $table"); 58 | 59 | $query = "CREATE TABLE `glpi_plugin_order_orderpayments` ( 60 | `id` int {$default_key_sign} NOT NULL auto_increment, 61 | `name` varchar(255) default NULL, 62 | `comment` text, 63 | PRIMARY KEY (`id`), 64 | KEY `name` (`name`) 65 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 66 | $DB->query($query) or die($DB->error()); 67 | } else { 68 | $migration->displayMessage("Upgrading $table"); 69 | 70 | //1.2.0 71 | $migration->renameTable("glpi_dropdown_plugin_order_payment", $table); 72 | $migration->changeField($table, "ID", "id", "int {$default_key_sign} NOT NULL auto_increment"); 73 | $migration->changeField($table, "name", "name", "varchar(255) default NULL"); 74 | $migration->changeField($table, "comments", "comment", "text"); 75 | $migration->migrationOneTable($table); 76 | } 77 | } 78 | 79 | 80 | public static function uninstall() 81 | { 82 | /** @var \DBmysql $DB */ 83 | global $DB; 84 | 85 | //Old table name 86 | $DB->query("DROP TABLE IF EXISTS `glpi_dropdown_plugin_order_payment`") or die($DB->error()); 87 | //Current table name 88 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /inc/orderstate.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | // Class for a Dropdown 36 | class PluginOrderOrderState extends CommonDropdown 37 | { 38 | const DRAFT = 1; 39 | const WAITING_FOR_APPROVAL = 2; 40 | const VALIDATED = 3; 41 | const BEING_DELIVERING = 4; 42 | const DELIVERED = 5; 43 | const CANCELED = 6; 44 | const PAID = 7; 45 | 46 | public static $rightname = 'plugin_order_order'; 47 | 48 | 49 | public static function getTypeName($nb = 0) 50 | { 51 | return __("Order status", "order"); 52 | } 53 | 54 | 55 | public function pre_deleteItem() 56 | { 57 | if ($this->getID() <= self::CANCELED) { 58 | Session::addMessageAfterRedirect( 59 | __("You cannot remove this status", "order") . ": " 60 | . $this->fields['name'], 61 | false, 62 | ERROR 63 | ); 64 | return false; 65 | } else { 66 | return true; 67 | } 68 | } 69 | 70 | 71 | public static function install(Migration $migration) 72 | { 73 | /** @var \DBmysql $DB */ 74 | global $DB; 75 | 76 | $default_charset = DBConnection::getDefaultCharset(); 77 | $default_collation = DBConnection::getDefaultCollation(); 78 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 79 | 80 | $table = self::getTable(); 81 | 82 | //1.2.0 83 | $DB->query("DROP TABLE IF EXISTS `glpi_dropdown_plugin_order_status`;"); 84 | 85 | if (!$DB->tableExists($table)) { 86 | $migration->displayMessage("Installing $table"); 87 | 88 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_orderstates` ( 89 | `id` int {$default_key_sign} NOT NULL auto_increment, 90 | `name` varchar(255) default NULL, 91 | `comment` text, 92 | PRIMARY KEY (`id`), 93 | KEY `name` (`name`) 94 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 95 | $DB->query($query) or die($DB->error()); 96 | } 97 | 98 | $state = new self(); 99 | foreach ( 100 | [ 101 | 1 => __("Draft", "order"), 102 | 2 => __("Waiting for approval", "order"), 103 | 3 => __("Validated", "order"), 104 | 4 => __("Being delivered", "order"), 105 | 5 => __("Delivered", "order"), 106 | 6 => __("Canceled", "order"), 107 | 7 => __("Paid", "order") 108 | ] as $id => $label 109 | ) { 110 | if (!countElementsInTable($table, ['id' => $id])) { 111 | $state->add([ 112 | 'id' => $id, 113 | 'name' => Toolbox::addslashes_deep($label) 114 | ]); 115 | } 116 | } 117 | } 118 | 119 | 120 | public static function uninstall() 121 | { 122 | /** @var \DBmysql $DB */ 123 | global $DB; 124 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /inc/ordertax.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | // Class for a Dropdown 36 | class PluginOrderOrderTax extends CommonDropdown 37 | { 38 | public static $rightname = 'plugin_order_order'; 39 | 40 | 41 | public static function getTypeName($nb = 0) 42 | { 43 | return __("VAT", "order"); 44 | } 45 | 46 | 47 | public static function install(Migration $migration) 48 | { 49 | /** @var \DBmysql $DB */ 50 | global $DB; 51 | 52 | $default_charset = DBConnection::getDefaultCharset(); 53 | $default_collation = DBConnection::getDefaultCollation(); 54 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 55 | 56 | $table = self::getTable(); 57 | 58 | if (!$DB->tableExists($table) && !$DB->tableExists("glpi_dropdown_plugin_order_taxes")) { 59 | $migration->displayMessage("Installing $table"); 60 | 61 | //Install 62 | $query = "CREATE TABLE `glpi_plugin_order_ordertaxes` ( 63 | `id` int {$default_key_sign} NOT NULL auto_increment, 64 | `name` varchar(255) default NULL, 65 | `comment` text, 66 | PRIMARY KEY (`id`), 67 | KEY `name` (`name`) 68 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 69 | $DB->query($query) or die($DB->error()); 70 | 71 | $taxes = new self(); 72 | foreach (['20', '5.5', '19.6'] as $tax) { 73 | $taxes->add(['name' => $tax]); 74 | } 75 | } else { 76 | //Update 77 | 78 | $migration->displayMessage("Migrating $table"); 79 | 80 | //1.2.0 81 | $migration->renameTable("glpi_dropdown_plugin_order_taxes", $table); 82 | $migration->changeField($table, "ID", "id", "int {$default_key_sign} NOT NULL auto_increment"); 83 | $migration->changeField($table, "name", "name", "varchar(255) default NULL"); 84 | $migration->changeField($table, "comments", "comment", "text"); 85 | $migration->migrationOneTable($table); 86 | 87 | //Remplace , by . in taxes 88 | foreach ($DB->request("SELECT `name` FROM `$table`") as $data) { 89 | if (strpos($data["name"], ',')) { 90 | $name = str_replace(',', '.', $data["name"]); 91 | $query = "UPDATE `$table` 92 | SET `name` = '" . $name . "' 93 | WHERE `name`= '" . $data["name"] . "'"; 94 | $DB->query($query) or die($DB->error()); 95 | } 96 | } 97 | } 98 | } 99 | 100 | 101 | public static function uninstall() 102 | { 103 | /** @var \DBmysql $DB */ 104 | global $DB; 105 | 106 | //Old table 107 | $DB->query("DROP TABLE IF EXISTS `glpi_dropdown_plugin_order_taxes`") or die($DB->error()); 108 | 109 | //New table 110 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 111 | } 112 | 113 | /** 114 | * Get the tax rate of loaded item. 115 | * 116 | * @return number 117 | */ 118 | public function getRate() 119 | { 120 | 121 | if (array_key_exists('name', $this->fields) && !empty($this->fields['name'])) { 122 | return floatval($this->fields['name']); 123 | } 124 | 125 | return 0; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /inc/ordertype.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | // Class for a Dropdown 36 | class PluginOrderOrderType extends CommonDropdown 37 | { 38 | public static $rightname = 'plugin_order_order'; 39 | 40 | 41 | public static function getTypeName($nb = 0) 42 | { 43 | return __("Type"); 44 | } 45 | 46 | 47 | public static function install(Migration $migration) 48 | { 49 | /** @var \DBmysql $DB */ 50 | global $DB; 51 | //Only avaiable since 1.3.0 52 | 53 | $default_charset = DBConnection::getDefaultCharset(); 54 | $default_collation = DBConnection::getDefaultCollation(); 55 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 56 | 57 | $table = self::getTable(); 58 | 59 | if (!$DB->tableExists($table)) { 60 | $migration->displayMessage("Installing $table"); 61 | 62 | $query = "CREATE TABLE `glpi_plugin_order_ordertypes` ( 63 | `id` int {$default_key_sign} NOT NULL auto_increment, 64 | `name` varchar(255) default NULL, 65 | `comment` text, 66 | PRIMARY KEY (`id`), 67 | KEY `name` (`name`) 68 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 69 | $DB->query($query) or die($DB->error()); 70 | } 71 | } 72 | 73 | 74 | public static function uninstall() 75 | { 76 | /** @var \DBmysql $DB */ 77 | global $DB; 78 | 79 | //Current table name 80 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /inc/other.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderOther extends CommonDBTM 36 | { 37 | public static $rightname = 'plugin_order_order'; 38 | 39 | 40 | public static function getTypeName($nb = 0) 41 | { 42 | return __("Other kind of items"); 43 | } 44 | 45 | 46 | public static function install(Migration $migration) 47 | { 48 | /** @var \DBmysql $DB */ 49 | global $DB; 50 | 51 | $default_charset = DBConnection::getDefaultCharset(); 52 | $default_collation = DBConnection::getDefaultCollation(); 53 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 54 | 55 | //Only avaiable since 1.2.0 56 | $table = self::getTable(); 57 | if (!$DB->tableExists($table)) { 58 | $migration->displayMessage("Installing $table"); 59 | 60 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_others` ( 61 | `id` int {$default_key_sign} NOT NULL auto_increment, 62 | `entities_id` int {$default_key_sign} NOT NULL default '0', 63 | `name` varchar(255) default NULL, 64 | `plugin_order_othertypes_id` int {$default_key_sign} NOT NULL default '0', 65 | PRIMARY KEY (`ID`), 66 | KEY `name` (`name`), 67 | KEY `entities_id` (`entities_id`), 68 | KEY `plugin_order_othertypes_id` (`plugin_order_othertypes_id`) 69 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 70 | $DB->query($query) or die($DB->error()); 71 | } else { 72 | $migration->displayMessage("Rename 'othertypes_id' to 'plugin_order_othertypes_id'"); 73 | $migration->changeField($table, "othertypes_id", "plugin_order_othertypes_id", "int {$default_key_sign} NOT NULL default '0'"); 74 | } 75 | } 76 | 77 | 78 | public static function uninstall() 79 | { 80 | /** @var \DBmysql $DB */ 81 | global $DB; 82 | 83 | //Current table name 84 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /inc/othertype.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderOtherType extends CommonDropdown 36 | { 37 | public static $rightname = 'plugin_order_order'; 38 | 39 | 40 | public static function getTypeName($nb = 0) 41 | { 42 | return __("Other type of item", "order"); 43 | } 44 | 45 | 46 | public static function install(Migration $migration) 47 | { 48 | /** @var \DBmysql $DB */ 49 | global $DB; 50 | 51 | $default_charset = DBConnection::getDefaultCharset(); 52 | $default_collation = DBConnection::getDefaultCollation(); 53 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 54 | 55 | //Only avaiable since 1.2.0 56 | $table = self::getTable(); 57 | if (!$DB->tableExists($table)) { 58 | $migration->displayMessage("Installing $table"); 59 | 60 | $query = "CREATE TABLE IF NOT EXISTS `$table` ( 61 | `id` int {$default_key_sign} NOT NULL auto_increment, 62 | `name` varchar(255) default NULL, 63 | `comment` text, 64 | PRIMARY KEY (`ID`), 65 | KEY `name` (`name`) 66 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 67 | $DB->query($query) or die($DB->error()); 68 | } 69 | } 70 | 71 | 72 | public static function uninstall() 73 | { 74 | /** @var \DBmysql $DB */ 75 | global $DB; 76 | 77 | //Current table name 78 | $DB->query("DROP TABLE IF EXISTS `" . self::getTable() . "`") or die($DB->error()); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /inc/referencefree.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderReferenceFree extends CommonDBTM 36 | { 37 | public static $rightname = 'plugin_order_order'; 38 | public $dohistory = true; 39 | 40 | public static function getTypeName($nb = 0) 41 | { 42 | return __("Reference free", "order"); 43 | } 44 | 45 | public static function install(Migration $migration) 46 | { 47 | /** @var \DBmysql $DB */ 48 | global $DB; 49 | 50 | $default_charset = DBConnection::getDefaultCharset(); 51 | $default_collation = DBConnection::getDefaultCollation(); 52 | $default_key_sign = DBConnection::getDefaultPrimaryKeySignOption(); 53 | 54 | $table = getTableForItemType(__CLASS__); 55 | if (!$DB->tableExists($table)) { 56 | $migration->displayMessage("Installing $table"); 57 | 58 | //Install 59 | $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_order_referencefrees` ( 60 | `id` int {$default_key_sign} NOT NULL auto_increment, 61 | `entities_id` int {$default_key_sign} NOT NULL default '0', 62 | `is_recursive` tinyint NOT NULL default '0', 63 | `plugin_order_orders_id` int {$default_key_sign} NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_order_orders (id)', 64 | `name` varchar(255) default NULL, 65 | `manufacturers_id` int {$default_key_sign} NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 66 | `manufacturers_reference` varchar(255) NOT NULL DEFAULT '', 67 | `itemtype` varchar(100) NOT NULL COMMENT 'see .class.php file', 68 | `templates_id` int {$default_key_sign} NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 69 | `comment` text, 70 | `price_taxfree` decimal(20,6) NOT NULL DEFAULT '0.000000', 71 | `price_discounted` decimal(20,6) NOT NULL DEFAULT '0.000000', 72 | `discount` decimal(20,6) NOT NULL DEFAULT '0.000000', 73 | `price_ati` decimal(20,6) NOT NULL DEFAULT '0.000000', 74 | `states_id` int {$default_key_sign} NOT NULL default 1, 75 | `delivery_date` date default NULL, 76 | `plugin_order_ordertaxes_id` int {$default_key_sign} NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_order_ordertaxes (id)', 77 | `is_deleted` tinyint NOT NULL default '0', 78 | `is_active` tinyint NOT NULL default '1', 79 | `notepad` longtext, 80 | `date_mod` timestamp NULL default NULL, 81 | PRIMARY KEY (`id`), 82 | KEY `name` (`name`), 83 | KEY `entities_id` (`entities_id`), 84 | KEY `manufacturers_id` (`manufacturers_id`), 85 | KEY `templates_id` (`templates_id`), 86 | KEY `plugin_order_ordertaxes_id` (`plugin_order_ordertaxes_id`), 87 | KEY `states_id` (`states_id`), 88 | KEY `is_active` (`is_active`), 89 | KEY `is_deleted` (`is_deleted`), 90 | KEY date_mod (date_mod) 91 | ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; 92 | $DB->query($query) or die($DB->error()); 93 | } 94 | } 95 | 96 | public static function uninstall() 97 | { 98 | /** @var \DBmysql $DB */ 99 | global $DB; 100 | 101 | $table = getTableForItemType(__CLASS__); 102 | foreach ( 103 | ["glpi_displaypreferences", "glpi_documents_items", "glpi_savedsearches", 104 | "glpi_logs" 105 | ] as $t 106 | ) { 107 | $query = "DELETE FROM `$t` WHERE `itemtype`='" . __CLASS__ . "'"; 108 | $DB->query($query); 109 | } 110 | 111 | $DB->query("DROP TABLE IF EXISTS `$table`") or die($DB->error()); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /inc/referenceinjection.class.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | if (!defined('GLPI_ROOT')) { 32 | die("Sorry. You can't access directly to this file"); 33 | } 34 | 35 | class PluginOrderReferenceInjection extends PluginOrderReference implements PluginDatainjectionInjectionInterface 36 | { 37 | public function __construct() 38 | { 39 | $this->table = getTableForItemType(get_parent_class($this)); 40 | } 41 | 42 | 43 | /** 44 | * Returns the name of the table used to store this object parent 45 | * 46 | * @return string (table name) 47 | **/ 48 | public static function getTable($classname = null) 49 | { 50 | 51 | $parenttype = get_parent_class(); 52 | return $parenttype::getTable(); 53 | } 54 | 55 | 56 | public function isPrimaryType() 57 | { 58 | return true; 59 | } 60 | 61 | 62 | public function connectedTo() 63 | { 64 | return []; 65 | } 66 | 67 | 68 | public function addOrUpdateObject($values = [], $options = []) 69 | { 70 | $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options); 71 | $lib->processAddOrUpdate(); 72 | return $lib->getInjectionResults(); 73 | } 74 | 75 | 76 | public function getOptions($primary_type = '') 77 | { 78 | return Search::getOptions(get_parent_class($this)); 79 | } 80 | 81 | 82 | public function getSpecificFieldValue($itemtype, $searchOption, $field, &$values) 83 | { 84 | $value = $values[$itemtype][$field]; 85 | switch ($searchOption['displaytype']) { 86 | case "reference_itemtype": 87 | unset($values[$itemtype]['itemtype']); 88 | $classes = PluginOrderOrder_Item::getClasses(); 89 | if (in_array($value, $classes)) { 90 | $value[$itemtype]['itemtype'] = $value; 91 | } else { 92 | foreach ($classes as $class) { 93 | if (call_user_func([$class, 'getTypeName']) == $value) { 94 | $values[$itemtype]['itemtype'] = $class; 95 | break; 96 | } 97 | } 98 | } 99 | break; 100 | case "reference_model": 101 | case "reference_type": 102 | if ($searchOption['displaytype'] == 'reference_model') { 103 | $type_prefix = 'Model'; 104 | } else { 105 | $type_prefix = 'Type'; 106 | } 107 | 108 | if (isset($values[$itemtype]['itemtype']) && class_exists($values[$itemtype]['itemtype'])) { 109 | $itemtype_formodel = $values[$itemtype]['itemtype'] . $type_prefix; 110 | if (class_exists($itemtype_formodel)) { 111 | $values[$itemtype][$field] = Dropdown::getDropdownName($itemtype_formodel::getTable(), $value); 112 | } 113 | } 114 | break; 115 | } 116 | return $value; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /locales/cs_CZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/cs_CZ.mo -------------------------------------------------------------------------------- /locales/de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/de_DE.mo -------------------------------------------------------------------------------- /locales/en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/en_GB.mo -------------------------------------------------------------------------------- /locales/es_EC.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/es_EC.mo -------------------------------------------------------------------------------- /locales/es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/es_ES.mo -------------------------------------------------------------------------------- /locales/fi_FI.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/fi_FI.mo -------------------------------------------------------------------------------- /locales/fr_CA.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/fr_CA.mo -------------------------------------------------------------------------------- /locales/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/fr_FR.mo -------------------------------------------------------------------------------- /locales/hr_HR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/hr_HR.mo -------------------------------------------------------------------------------- /locales/it_IT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/it_IT.mo -------------------------------------------------------------------------------- /locales/ko_KR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/ko_KR.mo -------------------------------------------------------------------------------- /locales/pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/pl_PL.mo -------------------------------------------------------------------------------- /locales/pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/pt_BR.mo -------------------------------------------------------------------------------- /locales/pt_PT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/pt_PT.mo -------------------------------------------------------------------------------- /locales/ro_RO.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/ro_RO.mo -------------------------------------------------------------------------------- /locales/ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/ru_RU.mo -------------------------------------------------------------------------------- /locales/tr_TR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/tr_TR.mo -------------------------------------------------------------------------------- /locales/zh_CN.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/locales/zh_CN.mo -------------------------------------------------------------------------------- /logo/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/logo/logo.jpg -------------------------------------------------------------------------------- /order.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * ------------------------------------------------------------------------- 3 | * Order plugin for GLPI 4 | * ------------------------------------------------------------------------- 5 | * 6 | * LICENSE 7 | * 8 | * This file is part of Order. 9 | * 10 | * Order is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * Order is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with Order. If not, see . 22 | * ------------------------------------------------------------------------- 23 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 24 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 25 | * @link https://github.com/pluginsGLPI/order 26 | * ------------------------------------------------------------------------- 27 | */ 28 | 29 | input[type=number].decimal, 30 | input[type=number].smalldecimal, 31 | input[type=number].quantity { 32 | text-align:center; 33 | padding: 0; 34 | position: relative; 35 | } 36 | input[type=number].decimal, 37 | input[type=number].smalldecimal, 38 | input[type=number].quantity { 39 | width: 100px; 40 | } 41 | 42 | input[type=number].decimal::-webkit-inner-spin-button, 43 | input[type=number].quantity::-webkit-inner-spin-button { 44 | opacity: 1; 45 | } 46 | 47 | .tab_order_fixed { 48 | margin: 0; 49 | width:100%; 50 | border-collapse:collapse; 51 | table-layout: fixed; 52 | } 53 | 54 | .tab_order_fixed th, 55 | .tab_order_fixed td { 56 | padding: 1px; 57 | width: 75px; 58 | } 59 | 60 | /* product type */ 61 | .tab_order_add_items th:nth-child(1), 62 | .tab_order_add_items td:nth-child(1) { 63 | width: 90px; 64 | } 65 | 66 | /* product reference */ 67 | .tab_order_add_items th:nth-child(2), 68 | .tab_order_add_items td:nth-child(2) { 69 | width: 25%; 70 | } 71 | 72 | /* ADD button */ 73 | .tab_order_add_items th:nth-child(8), 74 | .tab_order_add_items td:nth-child(8) { 75 | width: 40px; 76 | } 77 | 78 | /* Massive actions */ 79 | label.order_ma { 80 | display: block; 81 | margin-top: 10px; 82 | } 83 | -------------------------------------------------------------------------------- /order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/order.png -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | parallel: 3 | maximumNumberOfProcesses: 2 4 | level: 5 5 | bootstrapFiles: 6 | - ../../inc/based_config.php 7 | paths: 8 | - ajax 9 | - front 10 | - inc 11 | - hook.php 12 | - setup.php 13 | scanDirectories: 14 | - ../../inc 15 | - ../../src 16 | stubFiles: 17 | - ../../stubs/glpi_constants.php 18 | ignoreErrors: 19 | - '#Call to deprecated method query\(\) of class DBmysql:#' 20 | - '#Path in include_once\(\) ".*?/files/_plugins/order/generate/custom\.php" is not a file or it does not exist\.#' 21 | excludePaths: 22 | - 'inc/referenceinjection.class.php' 23 | - 'inc/orderinjection.class.php' 24 | rules: 25 | - GlpiProject\Tools\PHPStan\Rules\GlobalVarTypeRule 26 | -------------------------------------------------------------------------------- /pics/bill-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/pics/bill-icon.png -------------------------------------------------------------------------------- /pics/budget-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/pics/budget-icon.png -------------------------------------------------------------------------------- /pics/nothing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/pics/nothing.gif -------------------------------------------------------------------------------- /pics/order-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/pics/order-icon.png -------------------------------------------------------------------------------- /pics/reference-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/pics/reference-icon.png -------------------------------------------------------------------------------- /report/deliveryinfos/deliveryinfos.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /* 32 | * ---------------------------------------------------------------------- 33 | * Original Author of file: Nelly Lasson 34 | * 35 | * Purpose of file: 36 | * Generate location report 37 | * Illustrate use of simpleReport 38 | * ---------------------------------------------------------------------- 39 | */ 40 | 41 | //Options for GLPI 0.71 and newer : need slave db to access the report 42 | $USEDBREPLICATE = 1; 43 | $DBCONNECTION_REQUIRED = 0; // Really a big SQL request 44 | 45 | include("../../../../inc/includes.php"); 46 | 47 | $report = new PluginReportsAutoReport(__("deliveryinfos_report_title", "order")); 48 | new PluginReportsDateIntervalCriteria($report, 'order_date', __("Date of order", "order")); 49 | new PluginReportsDateIntervalCriteria($report, 'deliverydate', __("Delivery date")); 50 | new PluginReportsLocationCriteria($report, 'locations_id', __("Delivery location", "order")); 51 | new PluginReportsSupplierCriteria($report, 'suppliers_id', __("Supplier")); 52 | new PluginReportsDropdownCriteria( 53 | $report, 54 | 'plugin_order_orderstates_id', 55 | 'PluginOrderOrderState', 56 | __("Status") 57 | ); 58 | $report->displayCriteriasForm(); 59 | 60 | if ($report->criteriasValidated()) { 61 | $report->setSubNameAuto(); 62 | 63 | $report->setColumns([ 64 | new PluginReportsColumnLink( 65 | 'suppliers_id', 66 | __("Supplier"), 67 | 'Supplier' 68 | ), 69 | new PluginReportsColumnLink( 70 | 'entities_id', 71 | __("Entity"), 72 | 'Entity' 73 | ), 74 | new PluginReportsColumnInteger('total', __("Orders total", "order")), 75 | new PluginReportsColumnInteger('late', __("Late orders total", "order")), 76 | ]); 77 | //TODO : ne pas chercher dans la poublelles 78 | 79 | $query_total = "SELECT count(*) FROM `glpi_plugin_order_orders`"; 80 | $query_total .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders"); 81 | $query_total .= $report->addSqlCriteriasRestriction(); 82 | $query_total .= "AND `glpi_plugin_order_orders`.`suppliers_id`=`suppliers`.`id`"; 83 | $query_late = $query_total . " AND `is_late`='1' AND `is_deleted`='0' AND `is_template`='0'"; 84 | 85 | $supplier = "JOIN `glpi_suppliers`as suppliers 86 | ON (`glpi_plugin_order_orders`.`suppliers_id` = suppliers.`id`)"; 87 | 88 | 89 | $query = "SELECT DISTINCT `suppliers_id`, ($query_total) AS `total`, ($query_late) AS `late` 90 | FROM `glpi_plugin_order_orders` $supplier"; 91 | $query .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders"); 92 | $query .= $report->addSqlCriteriasRestriction(); 93 | $report->setGroupBy("suppliers_id"); 94 | $report->setSqlRequest($query); 95 | $report->execute(); 96 | } 97 | -------------------------------------------------------------------------------- /report/orderdelivery/orderdelivery.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | /* 32 | * ---------------------------------------------------------------------- 33 | * Original Author of file: Nelly Lasson 34 | * 35 | * Purpose of file: 36 | * Generate location report 37 | * Illustrate use of simpleReport 38 | * ---------------------------------------------------------------------- 39 | */ 40 | 41 | //Options for GLPI 0.71 and newer : need slave db to access the report 42 | $USEDBREPLICATE = 1; 43 | $DBCONNECTION_REQUIRED = 0; // Really a big SQL request 44 | 45 | include("../../../../inc/includes.php"); 46 | 47 | $report = new PluginReportsAutoReport(__("orderdelivery_report_title", "order")); 48 | new PluginReportsDateIntervalCriteria($report, 'order_date', __("Date of order", "order")); 49 | new PluginReportsDateIntervalCriteria($report, 'deliverydate', __("Delivery date")); 50 | new PluginReportsLocationCriteria($report, 'locations_id', __("Delivery location", "order")); 51 | new PluginReportsSupplierCriteria($report, 'suppliers_id', __("Supplier")); 52 | new PluginReportsDropdownCriteria( 53 | $report, 54 | 'plugin_order_orderstates_id', 55 | 'PluginOrderOrderState', 56 | __("Status") 57 | ); 58 | $report->displayCriteriasForm(); 59 | 60 | if ($report->criteriasValidated()) { 61 | $report->setSubNameAuto(); 62 | 63 | $report->setColumns([ 64 | new PluginReportsColumnLink( 65 | 'entities_id', 66 | __("Entity"), 67 | 'Entity' 68 | ), 69 | new PluginReportsColumnLink( 70 | 'id', 71 | __("Name"), 72 | 'PluginOrderOrder', 73 | [ 74 | 'with_comment' => true, 75 | 'with_navigate' => true 76 | ] 77 | ), 78 | new PluginReportsColumn('num_order', __("Order number", "order")), 79 | new PluginReportsColumnLink( 80 | 'suppliers_id', 81 | __("Supplier"), 82 | 'Supplier' 83 | ), 84 | new PluginReportsColumnLink( 85 | 'plugin_order_orderstates_id', 86 | __("Status"), 87 | 'PluginOrderOrderState', 88 | ['with_comment' => true] 89 | ), 90 | new PluginReportsColumnDateTime('order_date', __("Date of order", "order")), 91 | new PluginReportsColumnDateTime('duedate', __("Estimated due date", "order")), 92 | new PluginReportsColumnDateTime('deliverydate', __("Delivery date")), 93 | new PluginReportsColumnLink( 94 | 'locations_id', 95 | __("Delivery location", "order"), 96 | 'Location', 97 | ['with_comment' => true] 98 | ) 99 | ]); 100 | 101 | //TODO : ne pas chercher dans la poublelles 102 | $query = "SELECT * FROM `glpi_plugin_order_orders`"; 103 | $query .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders"); 104 | $query .= $report->addSqlCriteriasRestriction(); 105 | $query .= " AND `is_deleted`='0' AND `is_template`='0' "; 106 | $query .= "GROUP BY `entities_id`, `plugin_order_orderstates_id`, `num_order`, `order_date`"; 107 | $report->setGroupBy("entities_id", "plugin_order_orderstates_id", "num_order", "order_date"); 108 | $report->setSqlRequest($query); 109 | $report->execute(); 110 | } 111 | -------------------------------------------------------------------------------- /screenshots/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/screenshots/screenshot1.png -------------------------------------------------------------------------------- /screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/screenshots/screenshot2.png -------------------------------------------------------------------------------- /screenshots/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/screenshots/screenshot3.png -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | . 24 | * ------------------------------------------------------------------------- 25 | * @copyright Copyright (C) 2009-2023 by Order plugin team. 26 | * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 27 | * @link https://github.com/pluginsGLPI/order 28 | * ------------------------------------------------------------------------- 29 | */ 30 | 31 | define('PLUGIN_ORDER_VERSION', '2.10.7'); 32 | 33 | // Minimal GLPI version, inclusive 34 | define("PLUGIN_ORDER_MIN_GLPI", "10.0.0"); 35 | // Maximum GLPI version, exclusive 36 | define("PLUGIN_ORDER_MAX_GLPI", "10.0.99"); 37 | 38 | if (!defined('PLUGIN_ORDER_DIR')) { 39 | define("PLUGIN_ORDER_DIR", Plugin::getPhpDir('order')); 40 | } 41 | 42 | if (!defined('PLUGIN_ORDER_TEMPLATE_DIR')) { 43 | define("PLUGIN_ORDER_TEMPLATE_DIR", GLPI_PLUGIN_DOC_DIR . "/order/templates/"); 44 | } 45 | if (!defined('PLUGIN_ORDER_SIGNATURE_DIR')) { 46 | define("PLUGIN_ORDER_SIGNATURE_DIR", GLPI_PLUGIN_DOC_DIR . "/order/signatures/"); 47 | } 48 | if (!defined('PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR')) { 49 | define("PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR", GLPI_PLUGIN_DOC_DIR . "/order/generate/"); 50 | } 51 | if (!defined('PLUGIN_ORDER_TEMPLATE_LOGO_DIR')) { 52 | define("PLUGIN_ORDER_TEMPLATE_LOGO_DIR", GLPI_PLUGIN_DOC_DIR . "/order/logo/"); 53 | } 54 | 55 | if (!defined('PLUGIN_ORDER_TEMPLATE_EXTENSION')) { 56 | define("PLUGIN_ORDER_TEMPLATE_EXTENSION", ["odt"]); 57 | } 58 | if (!defined('PLUGIN_ORDER_SIGNATURE_EXTENSION')) { 59 | define("PLUGIN_ORDER_SIGNATURE_EXTENSION", ["png"]); 60 | } 61 | /** @var array $CFG_GLPI */ 62 | global $CFG_GLPI; 63 | if (!defined('PLUGIN_ORDER_NUMBER_STEP')) { 64 | define("PLUGIN_ORDER_NUMBER_STEP", 1 / pow(10, $CFG_GLPI["decimal_number"])); 65 | } 66 | 67 | // Autoload 68 | if (!defined('PCLZIP_TEMPORARY_DIR')) { 69 | define('PCLZIP_TEMPORARY_DIR', GLPI_DOC_DIR . '/_tmp/pclzip'); 70 | } 71 | include_once PLUGIN_ORDER_DIR . "/vendor/autoload.php"; 72 | 73 | 74 | /** 75 | * Init hooks of the plugin. 76 | * REQUIRED 77 | * 78 | * @return void 79 | */ 80 | function plugin_init_order() 81 | { 82 | /** 83 | * @var object $PLUGIN_HOOKS 84 | * @var array $CFG_GLPI 85 | * @var array $ORDER_TYPES 86 | */ 87 | global $PLUGIN_HOOKS, $CFG_GLPI, $ORDER_TYPES; 88 | 89 | Plugin::registerClass('PluginOrderProfile'); 90 | $PLUGIN_HOOKS['csrf_compliant']['order'] = true; 91 | 92 | /* Init current profile */ 93 | $PLUGIN_HOOKS['change_profile']['order'] = ['PluginOrderProfile', 'initProfile']; 94 | 95 | $plugin = new Plugin(); 96 | if ($plugin->isActivated('order')) { 97 | $PLUGIN_HOOKS['migratetypes']['order'] = 'plugin_order_migratetypes'; 98 | 99 | $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; 100 | 101 | //Itemtypes in use for an order 102 | $ORDER_TYPES = [ 103 | 'Computer', 104 | 'Monitor', 105 | 'NetworkEquipment', 106 | 'Peripheral', 107 | 'Printer', 108 | 'Phone', 109 | 'ConsumableItem', 110 | 'CartridgeItem', 111 | 'Contract', 112 | 'PluginOrderOther', 113 | 'SoftwareLicense', 114 | 'Certificate', 115 | 'Rack', 116 | 'Enclosure', 117 | 'Pdu', 118 | ]; 119 | 120 | $CFG_GLPI['plugin_order_types'] = $ORDER_TYPES; 121 | 122 | $PLUGIN_HOOKS['pre_item_purge']['order'] = [ 123 | 'Profile' => ['PluginOrderProfile', 'purgeProfiles'], 124 | 'DocumentCategory' => ['PluginOrderDocumentCategory', 'purgeItem'], 125 | ]; 126 | 127 | $PLUGIN_HOOKS['pre_item_update']['order'] = [ 128 | 'Infocom' => ['PluginOrderOrder_Item', 'updateItem'], 129 | 'Contract' => ['PluginOrderOrder_Item', 'updateItem'], 130 | ]; 131 | $PLUGIN_HOOKS['item_add']['order'] = [ 132 | 'Document' => ['PluginOrderOrder', 'addDocumentCategory'] 133 | ]; 134 | 135 | include_once(PLUGIN_ORDER_DIR . "/inc/order_item.class.php"); 136 | foreach (PluginOrderOrder_Item::getClasses(true) as $type) { 137 | $PLUGIN_HOOKS['item_purge']['order'][$type] = 'plugin_item_purge_order'; 138 | } 139 | 140 | Plugin::registerClass('PluginOrderOrder', [ 141 | 'document_types' => true, 142 | 'unicity_types' => true, 143 | 'notificationtemplates_types' => true, 144 | 'helpdesk_visible_types' => true, 145 | 'ticket_types' => true, 146 | 'contract_types' => true, 147 | 'linkuser_types' => true, 148 | 'addtabon' => ['Budget'] 149 | ]); 150 | 151 | Plugin::registerClass('PluginOrderReference', ['document_types' => true]); 152 | Plugin::registerClass('PluginOrderProfile', ['addtabon' => ['Profile']]); 153 | 154 | $values['notificationtemplates_types'] = true; 155 | $PLUGIN_HOOKS['infocom']['order'] = ['PluginOrderOrder_Item', 'showForInfocom']; 156 | Plugin::registerClass('PluginOrderOrder_Item', $values); 157 | 158 | if (PluginOrderOrder::canView()) { 159 | Plugin::registerClass('PluginOrderDocumentCategory', ['addtabon' => ['DocumentCategory']]); 160 | Plugin::registerClass('PluginOrderOrder_Supplier', ['addtabon' => ['Supplier']]); 161 | Plugin::registerClass('PluginOrderPreference', ['addtabon' => ['Preference']]); 162 | } 163 | 164 | /*if glpi is loaded */ 165 | if (Session::getLoginUserID()) { 166 | $PLUGIN_HOOKS['add_css']['order'][] = 'order.css'; 167 | 168 | /* link to the config page in plugins menu */ 169 | if (Session::haveRight("config", UPDATE)) { 170 | $PLUGIN_HOOKS['config_page']['order'] = 'front/config.form.php'; 171 | } 172 | 173 | if ( 174 | PluginOrderOrder::canView() 175 | || PluginOrderReference::canView() 176 | || PluginOrderBill::canView() 177 | ) { 178 | $PLUGIN_HOOKS['menu_toadd']['order']['management'] = 'PluginOrderMenu'; 179 | } 180 | 181 | $PLUGIN_HOOKS['assign_to_ticket']['order'] = true; 182 | $PLUGIN_HOOKS['use_massive_action']['order'] = 1; 183 | $PLUGIN_HOOKS['plugin_datainjection_populate']['order'] = "plugin_datainjection_populate_order"; 184 | } 185 | } 186 | } 187 | 188 | 189 | /** 190 | * Get the name and the version of the plugin 191 | * REQUIRED 192 | * 193 | * @return array 194 | */ 195 | function plugin_version_order() 196 | { 197 | return [ 198 | 'name' => __("Orders management", "order"), 199 | 'version' => PLUGIN_ORDER_VERSION, 200 | 'author' => 'The plugin order team', 201 | 'homepage' => 'https://github.com/pluginsGLPI/order', 202 | 'license' => 'GPLv2+', 203 | 'requirements' => [ 204 | 'glpi' => [ 205 | 'min' => PLUGIN_ORDER_MIN_GLPI, 206 | 'max' => PLUGIN_ORDER_MAX_GLPI, 207 | ] 208 | ] 209 | ]; 210 | } 211 | 212 | 213 | /** 214 | * Check pre-requisites before install 215 | * OPTIONNAL, but recommanded 216 | * 217 | * @return boolean 218 | */ 219 | function plugin_order_check_prerequisites() 220 | { 221 | if (!is_readable(__DIR__ . '/vendor/autoload.php') || !is_file(__DIR__ . '/vendor/autoload.php')) { 222 | echo "Run composer install --no-dev in the plugin directory
"; 223 | return false; 224 | } 225 | 226 | return true; 227 | } 228 | -------------------------------------------------------------------------------- /templates/example.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/order/8bad480006027bab7ddcac2d7ff80bac89f4becd/templates/example.odt -------------------------------------------------------------------------------- /templates/order_infocom.html.twig: -------------------------------------------------------------------------------- 1 | {# 2 | # ------------------------------------------------------------------------- 3 | # Order plugin for GLPI 4 | # ------------------------------------------------------------------------- 5 | # 6 | # LICENSE 7 | # 8 | # This file is part of Order. 9 | # 10 | # Order is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 3 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # Order is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with Order. If not, see . 22 | # ------------------------------------------------------------------------- 23 | # @copyright Copyright (C) 2009-2023 by Order plugin team. 24 | # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 25 | # @link https://github.com/pluginsGLPI/order 26 | # ------------------------------------------------------------------------- 27 | #} 28 | 29 | {% import 'components/form/fields_macros.html.twig' as fields %} 30 | 31 | {{ fields.largeTitle( 32 | __("Order informations", "order"), 33 | '', 34 | false 35 | ) }} 36 | 37 |
38 | 41 |
42 | {{ order_link|raw }} 43 |
44 |
45 | 46 |
47 | 50 |
51 | {{ reference_link|raw }} 52 |
53 |
54 | 55 |
56 | 59 |
60 | {{ delivery_date|raw }} 61 |
62 |
63 | -------------------------------------------------------------------------------- /tools/HEADER: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------- 2 | Order plugin for GLPI 3 | ------------------------------------------------------------------------- 4 | 5 | LICENSE 6 | 7 | This file is part of Order. 8 | 9 | Order is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | Order is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with Order. If not, see . 21 | ------------------------------------------------------------------------- 22 | @copyright Copyright (C) 2009-2023 by Order plugin team. 23 | @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html 24 | @link https://github.com/pluginsGLPI/order 25 | ------------------------------------------------------------------------- 26 | --------------------------------------------------------------------------------