Compare commits

..

111 Commits

Author SHA1 Message Date
Laurent Destailleur
4ea6af9535 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2025-12-05 16:38:15 +01:00
Laurent Destailleur
2e46ac45c5 Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-12-05 16:34:02 +01:00
Laurent Destailleur
5db0825b49 Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 2025-12-05 16:28:27 +01:00
Laurent Destailleur
a098185476 Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 2025-12-05 16:27:07 +01:00
Laurent Destailleur
7cd529a179 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2025-12-05 16:22:11 +01:00
Laurent Destailleur
82c3849baa Fix CI 2025-12-05 16:21:15 +01:00
Laurent Destailleur
d3d02d90f1 Merge pull request #36545 from BenjaminFlr/betterissue36514
FIX(propal): values lost when editing HT price
2025-12-05 12:02:44 +01:00
Benjamin Falière
2050a657cf FIX(propal): values lost when editing HT price 2025-12-05 11:23:31 +01:00
Laurent Destailleur
d2acb6010f Merge pull request #36537 from aspangaro/22_asset1
FIX Accountancy - #36090 Inconsistent date on various journal
2025-12-05 09:50:28 +01:00
Laurent Destailleur
b2fe08cd3b Merge pull request #36538 from aspangaro/22_asset2
FIX Accountancy - Not propose to write operation on draft asset
2025-12-05 09:49:08 +01:00
Laurent Destailleur
c932a1c878 Merge pull request #36542 from ATM-Consulting/FIX/155/18.0/regression-variable-renaming
FIX: fix #36401 (for v17.0) doesn't work in v18.0+ because of variable renaming
2025-12-05 09:48:32 +01:00
Laurent Destailleur
f2f8278603 Merge pull request #36539 from W1W1-M/backport-fix-propal-update-shipping-availability
FIX propal shipping and availability update (v18+)
2025-12-05 09:47:25 +01:00
Laurent Destailleur
59aa76e475 Merge pull request #36540 from aspangaro/22_asset4
FIX Accountancy - Reverse accounting account in depreciation expense entries for fixed assets
2025-12-05 09:46:45 +01:00
atm-florian
cc5a8fd15a FIX: PR#36401 fixed a missing GETPOSTISSET() but the check involves a variable ($taskid) that was renamed ($tmptaskid) in 18.0 2025-12-05 09:29:15 +01:00
Alexandre SPANGARO
c480cd4801 FIX Accountancy - Reverse accounting account in depreciation expense entries for fixed assets 2025-12-05 08:58:00 +01:00
William Mead
a567cade7d Fixed shipping and availability updating. Updated contributor details. 2025-12-05 08:56:14 +01:00
Alexandre SPANGARO
67d7fa8f78 FIX Accountancy - Not propose to write operation on draft asset 2025-12-05 06:47:49 +01:00
Alexandre SPANGARO
77e8924c93 FIX #36090 Accountancy - Inconsistent date on various journal 2025-12-05 06:41:39 +01:00
Laurent Destailleur
764bb3791b Fix CI 2025-12-04 21:51:03 +01:00
Laurent Destailleur
9ac82f488e Fix CI 2025-12-04 21:50:26 +01:00
Laurent Destailleur
8fe5d2758a Fix CI 2025-12-04 21:48:44 +01:00
Laurent Destailleur
a9d2c95fdd Fix CI 2025-12-04 21:47:02 +01:00
Laurent Destailleur
b4c374fd48 Fix CI 2025-12-04 21:45:34 +01:00
Laurent Destailleur
c9d1f3baa3 Merge pull request #36527 from FHenry/22_fix_subtotal_attribute_copy
fix: when create invoices from orders list, title and subtotal attribute is now copied
2025-12-04 21:26:01 +01:00
HENRY Florian
a3dfae7792 Merge branch '22.0' into 22_fix_subtotal_attribute_copy 2025-12-04 20:30:17 +01:00
Laurent Destailleur
78316a577d Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2025-12-04 20:26:59 +01:00
Florian HENRY
7e264b0097 Merge branch '22.0' of https://github.com/Dolibarr/dolibarr into 22_fix_subtotal_attribute_copy 2025-12-04 19:58:49 +01:00
Florian HENRY
12936afb13 review 2025-12-04 19:58:42 +01:00
Laurent Destailleur
3068a778da Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0 2025-12-04 19:51:48 +01:00
Laurent Destailleur
9d307a4238 Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0 2025-12-04 19:07:33 +01:00
Laurent Destailleur
193a42cd47 Fix #36520 2025-12-04 19:02:57 +01:00
Laurent Destailleur
222cd76799 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2025-12-04 18:53:04 +01:00
Laurent Destailleur
47799b88cf Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0 2025-12-04 18:40:23 +01:00
Laurent Destailleur
78ca968db6 Merge pull request #36517 from atm-florianm/SEC/commented-out-restrictedArea
SEC: FIX #36430 permissions not checked on other tabs of HRM evaluation card
2025-12-04 18:37:46 +01:00
Laurent Destailleur
e6f9741987 Merge pull request #36521 from JonBendtsen/BUG_35655_API_Contract_Creation_Fails_for_Non-Admin_Users_in_Version_22.0.2
FIX #35655 API Contract Creation Fails for Non-Admin Users in Version 22.0.2
2025-12-04 18:32:46 +01:00
Laurent Destailleur
50db4e6499 Merge pull request #36518 from JonBendtsen/fix_36507_commit_9801f02
Fix broken commit 9801f02 mentioned in issue #36507
2025-12-04 18:15:43 +01:00
Laurent Destailleur
0235e86f64 Merge pull request #36484 from Hystepik/fix-#36475
Fix #36475 bad value for project  gantt start
2025-12-04 17:43:03 +01:00
Laurent Destailleur
526da8e5a7 Merge pull request #36505 from otcesar/22.0
Fix translation for import error
2025-12-04 16:37:31 +01:00
Jon Bendtsen
8deec3f918 it returns an Object, but it can not be TimeSpent because that creates a infinite loop 2025-12-04 16:23:13 +01:00
Laurent Destailleur
23db225ec3 Merge pull request #36523 from FHenry/22_fix_subtotal_feature
FIX: subtotal feature button availablity according setup
2025-12-04 14:30:43 +01:00
Laurent Destailleur
d647a95de8 Merge pull request #36525 from BenjaminFlr/issue36514
FIX(propal): Incorrect HT/TTC recalculation when editing proposal lines #36514
2025-12-04 14:24:08 +01:00
Florian HENRY
7f3ac106fc fix: when create bills from orders list, title and subtotal attribute is now copied 2025-12-04 11:00:58 +01:00
Florian HENRY
c39cba8395 fix: when create bills from orders list, title and subtotal attribute is now copied 2025-12-04 10:57:24 +01:00
Laurent Destailleur
aa8fac1deb Merge pull request #36429 from atm-adrien/FIX/MulticompanyStockCompatibility
FIX : Implementation of multi-company compatibility with inventory/warehouse management
2025-12-04 10:42:35 +01:00
Benjamin Falière
68004a4009 FIX(propal): Incorrect HT/TTC recalculation when editing proposal lines 2025-12-04 10:35:42 +01:00
Florian HENRY
a38ffa02ac fix: subtotal feature button availablity according setup 2025-12-04 10:18:01 +01:00
Eric - CAP-REL
2ebdcfda5c Merge pull request #35788 from Easya-Solutions/18_allow_credit_invoice_on_situation
FIX : remove useless condition to create credit on situation invoice …
2025-12-04 09:56:30 +01:00
Eric - CAP-REL
70431043af Merge pull request #36398 from Easya-Solutions/18.0_fix-invoice-card-variables
FIX undefined variables on create invoice from shipment card (backport from v20)
2025-12-04 09:30:56 +01:00
lvessiller-opendsi
ad37ece7bc Merge pull request #36494 from atm-florianm/FIX/155/date/minute-second-vs-min-sec
FIX 18.0: `GETPOSTDATE()` and `buildParamDate()` assumed wrong HTTP param names
2025-12-04 09:27:44 +01:00
Jon Bendtsen
11cd186e9a remove debugging dol_syslog 2025-12-03 21:54:33 +01:00
Jon Bendtsen
8dc2eb0fe4 Checking for access to both new and old socid 2025-12-03 21:52:35 +01:00
Jon Bendtsen
66d3df4cc6 Fix broken commit 9801f02 mentioned in issue #36507 2025-12-03 21:06:13 +01:00
atm-florian
a1476fd221 SEC: permissions not checked on other tabs of HRM evaluation card 2025-12-03 17:11:14 +01:00
Lucas Marcouiller
59ccde0087 Merge branch '22.0' into fix-#36475 2025-12-03 09:49:23 +01:00
Jon Bendtsen
268996c672 testing for access to the thirdpartytmp 2025-12-02 17:26:53 +01:00
Jon Bendtsen
ddd2927e31 This commit has errors, if you use PUT in the API with a new socid that the user does not have permission to, then it STILL updates the contract, and then it gets the contract after update and tells me I do not have access 2025-12-02 17:23:26 +01:00
Jon Bendtsen
b48fed1719 PUT now checks both existing socid and any potentially updated socid for access 2025-12-02 17:23:26 +01:00
Jon Bendtsen
26a39d1cc8 creating Thirdparties object takes no arguments 2025-12-02 17:23:26 +01:00
Jon Bendtsen
6f18235bab both socid exists and access to is checked in api_thirdparty GET :-) 2025-12-02 17:23:26 +01:00
Jon Bendtsen
1c697607b1 default deny access, allow access if user has the right combination of permissions and/or is the sales representative for the thirdparty 2025-12-02 17:23:26 +01:00
Jon Bendtsen
36415f1fd2 giving a slight better error message 2025-12-02 17:23:26 +01:00
Jon Bendtsen
9941a20fa8 Check if API user has rights to see all thirdparties
Check if API user has rights to see all thirdparties - though perhaps we should check if the user has rights to this particular thirdparty in this contract?
2025-12-02 17:23:26 +01:00
tcesar
6545957cbd Fix traduction for import error 2025-12-02 16:37:30 +01:00
Laurent Destailleur
7828311250 Fix export pb in br 2025-12-02 15:04:14 +01:00
Laurent Destailleur
efd58a5f48 Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2025-12-02 14:54:22 +01:00
Laurent Destailleur
6fbc380e52 FIX Export of extrafield in organized events 2025-12-02 14:54:10 +01:00
Laurent Destailleur
14c949c8c9 Merge pull request #36408 from JonBendtsen/security.lib.php_checkUserAccessToObject_moduleEnabled_0permissions
Qual: DENY access to Thirdparty when module is enabled, but no permissions at all
2025-12-02 10:46:46 +01:00
Lucas Marcouiller
894bbd5786 Merge branch '22.0' into fix-#36475 2025-12-02 08:36:25 +01:00
Lucas Marcouiller
55977d16f1 fix warning 2025-12-02 08:35:53 +01:00
Lucas Marcouiller
792070b5f5 fix a potential warning 2025-12-02 08:34:41 +01:00
Laurent Destailleur
64bab261a9 Merge pull request #36495 from mapiolca/patch-67
Backport: fix intervention “Signed” confirmation when no status is selected
2025-12-01 16:47:51 +01:00
Pierre Ardoin
1c94462405 Update copyright year for Pierre Ardoin 2025-12-01 14:03:40 +01:00
Pierre Ardoin
dad4bbddd2 Report fix on 21.0
Fix an issue that have been fixed by Charlene Benke on v22
2025-12-01 14:00:38 +01:00
atm-florian
0e1c580f11 FIX 18.0: GETPOSTDATE and buildParamDate assumed HTTP param names 'minute' and 'second' instead of 'min' and 'sec' 2025-12-01 13:47:50 +01:00
Laurent Destailleur
a96727726e Merge pull request #36488 from BenjaminFlr/35411
FIX(tasks): dates in ganttview
2025-12-01 13:14:03 +01:00
Laurent Destailleur
9cd4c05f5b Merge pull request #36486 from JonBendtsen/API_Timespent_Service_Field_33899
FIX: API task getTimeSpent to actually return data
2025-12-01 13:13:03 +01:00
Laurent Destailleur
4223ff08ce Merge pull request #36491 from Easya-Solutions/18.0_fix-update-extras
FIX not remove value of others extra-fields on update extras action
2025-12-01 13:10:08 +01:00
VESSILLER
d16f8b68db FIX not remove value of others extra-fields on update extras action 2025-12-01 11:14:16 +01:00
Benjamin Falière
819453b546 FIX (tasks): dates in gantt view 2025-11-30 13:21:13 +01:00
Jon Bendtsen
9801f022f9 PHPStan fix 2025-11-30 12:09:08 +01:00
Jon Bendtsen
f7fee10e23 1 more pre-commit check fix 2025-11-30 12:03:57 +01:00
Jon Bendtsen
579f1ab1f7 actual pre-commit fix 2025-11-30 11:59:59 +01:00
Jon Bendtsen
bd31e922c8 letting API TASK PUT timespent update the product 2025-11-30 11:59:47 +01:00
Jon Bendtsen
6676171146 fix pre-commit CI check 2025-11-30 11:35:39 +01:00
Jon Bendtsen
58afc38ec4 API POST can now include a product_id 2025-11-30 11:30:01 +01:00
Jon Bendtsen
9a47931329 FIX: API task getTimeSpent to actually return data 2025-11-30 11:04:34 +01:00
Laurent Destailleur
dbd98af0c3 Merge pull request #36485 from JonBendtsen/API_Timespent_Service_Field_33899
FIX #33899 API Timespent Service Field
2025-11-30 10:25:51 +01:00
Jon Bendtsen
18d8cfd510 making a more general fix for checking access to projet_task 2025-11-30 09:35:05 +01:00
Jon Bendtsen
9b0732dd49 FIX: #33899 API Timespent Service Field 2025-11-30 00:02:34 +01:00
Lucas Marcouiller
8664f74154 Fix #36475 bad value for project gantt start 2025-11-29 21:55:45 +01:00
Laurent Destailleur
f4bcf47008 Merge pull request #36467 from emheyarssi/35061
FIX #35061
2025-11-29 11:28:03 +01:00
marc
5c6b4f62c8 FIX #35061
Signed-off-by: marc <marc.baur@ptmsoft.fr>
2025-11-28 18:25:00 +01:00
Laurent Destailleur
d8891130f5 Merge pull request #36463 from vold-lu/18.0
NEW: Automatically release docker image for each GitHub release
2025-11-28 18:13:47 +01:00
Aloïs Micard
b2f9de7489 Add new workflow to trigger Docker build 2025-11-28 17:27:32 +01:00
Laurent Destailleur
2dcdf773d0 Merge pull request #36400 from atm-jonathan/FIX/ADD_NOCRFCHECK_TO_PASSWORD_FORGOTTEN
Fix: Allow password reset link when CSRF protection is strict
2025-11-26 22:43:31 +01:00
Laurent Destailleur
63cc9127ba Merge pull request #36434 from atm-lucasmantegari/FIX/ErrorFieldFilterInEvaluation
FIX - Missing AND on fields filter on evaluation class
2025-11-26 22:27:03 +01:00
Laurent Destailleur
097168cb05 Merge branch '21.0' into FIX/ErrorFieldFilterInEvaluation 2025-11-26 22:12:22 +01:00
Laurent Destailleur
f1971e1d14 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2025-11-26 22:11:31 +01:00
Laurent Destailleur
5103e2d846 Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0 2025-11-26 22:11:31 +01:00
Laurent Destailleur
9e44c0a5c9 Fix CI 2025-11-26 22:11:09 +01:00
Laurent Destailleur
f3b467a9ba Merge branch '21.0' into FIX/ErrorFieldFilterInEvaluation 2025-11-26 22:03:40 +01:00
ATM-Lucas
4585facfcc Missing AND on fields filter on evaluation class 2025-11-26 16:47:32 +01:00
Adrien Raze
c1c2358e75 FIX : Implementation of multi-company compatibility with inventory/warehouse management 2025-11-26 12:30:22 +01:00
atm-jonathan
b2bb2fea1b Fix: use main.inc.php whitelist instead of defining NOCSRFCHECK locally 2025-11-26 11:11:56 +01:00
Jon Bendtsen
5a5764d73c remove whitespace 2025-11-25 19:28:34 +01:00
Laurent Destailleur
e9a8a4efca Update security.lib.php 2025-11-25 18:50:47 +01:00
Jon Bendtsen
3f90e51792 fix too many parentasies 2025-11-25 18:50:47 +01:00
Jon Bendtsen
966a69bab0 Qual: DENY access to Thirdparty when module is enabled, but no permissions at all 2025-11-25 18:50:47 +01:00
x
b4b202cb18 add nocrfcheck 2025-11-24 15:06:34 +01:00
VESSILLER
1cd3ca3222 FIX undefined variables on create invoice from shipment card (backport from v20) 2025-11-24 10:30:08 +01:00
tnegre
8ddf9f6075 FIX : remove useless condition to create credit on situation invoice (#35786) 2025-10-16 11:57:49 +02:00
3848 changed files with 392435 additions and 118096 deletions

View File

@@ -1,19 +1,6 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
allow:
# Allow production updates only (can do a AND, several entries are doing a OR)
- dependency-type: "production"
#- dependency-type: "direct"
exclude-paths:
- 'dev'
- 'tests/acceptance'
- 'tests/selenium'

View File

@@ -20,10 +20,10 @@ See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workf
The other worklows are:
-----------------------
- ci-stale-issues-safe to autoclose old issues.
- ci-phpstan_baseline to update the phpstan baseline file.
- ci-cache-clean-pr to clean cache when closing a PR.
- ci-test to make CI tests
- stale-issues-safe to autoclose old issues.
- phpstan_baseline to update the phpstan baseline file.
- cache-clean-pr to clean cache when closing a PR.
Some tests workflows are:
------------------------

View File

@@ -6,8 +6,6 @@ on:
pull_request:
types: [closed]
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
@@ -18,7 +16,7 @@ jobs:
contents: read
steps:
- name: Check out code
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache

View File

@@ -1,29 +0,0 @@
---
# This is a basic workflow to check the lock on major version (to lock some files on certified versions)
name: Check fileset lock
on: [push, pull_request]
concurrency:
group: check-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checkmajorversion:
name: Check lock on fileset unalterable_files with generate_filelist_xml.php
runs-on: ubuntu-latest
# Do not run schedule on forks
if: |
github.repository == 'Dolibarr/dolibarr'
|| github.event.schedule == false
steps:
- uses: actions/checkout@v6
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none # disable xdebug, pcov
- name: Run generate_filelist_xml.php
run: |
# shellcheck disable=2086
dev/build/generate_filelist_xml.php checklock=auto unalterable_files

View File

@@ -1,7 +1,6 @@
name: "CI-PULL-REQUEST"
on: [pull_request]
jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml

View File

@@ -1,7 +1,6 @@
name: "CI-PUSH"
on: [push]
jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
@@ -26,15 +25,15 @@ jobs:
uses: ./.github/workflows/windows-ci.yml
with:
gh_event: ${{ github.event_name }}
# gh-travis: # Runs travis script on github runner (not on travis)
# if: false
# # needs: [pre-commit, phan]
# # needs: [windows-ci]
# secrets: inherit
# needs: [pre-commit, phan, phpstan]
# uses: ./.github/workflows/gh-travis.yml
# with:
# gh_event: ${{ github.event_name }}
#gh-travis: # Runs travis script on github runner (not on travis)
# if: false
# # needs: [pre-commit, phan]
# # needs: [windows-ci]
# secrets: inherit
# needs: [pre-commit, phan, phpstan]
# uses: ./.github/workflows/gh-travis.yml
# with:
# gh_event: ${{ github.event_name }}
# Note (not tested, from https://github.com/orgs/community/discussions/38361)
# To cancel jobs if one fails, the following action may help

24
.github/workflows/ci-on-release.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: "CI-RELEASE"
on:
release:
types: [published]
jobs:
trigger-docker:
runs-on: ubuntu-latest
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.RELEASE_DOCKER_ID }}
private-key: ${{ secrets.RELEASE_DOCKER_SECRET }}
- uses: peter-evans/repository-dispatch@v4
with:
token: ${{ steps.generate-token.outputs.token }}
repository: Dolibarr/dolibarr-docker
event-type: new-release
client-payload: '{"version": "${{ github.event.release.tag_name }}"}'

View File

@@ -1,45 +0,0 @@
# Action to prepare the github action
# Go on Dolibarr Organization - Settings - Developer settings - GitHub App (https://github.com/organizations/Dolibarr/settings/apps)
# Create an App: Enter a name + In Home page URL use https://github.com/Dolibarr/dolibarr + Disable webhook
# Set Permissions (see other app for list of permissions)
# Click on generate the private keys
# Click on Install application - choose the repository of the bot
# Go on Organisation - Secret and variables and create a secret PR_SECRET_KEY and copy the content of received private key. Choose the repository access to "Repository Dolibarr".
# Go on Organisation - Secret and variables and create a variable PR_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr".
#
name: Set the tag with devcamp label during the session of a devcamp
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
issues: write
jobs:
add-label-devcamp:
runs-on: ubuntu-latest
steps:
#- name: Install GitHub CLI
# run: sudo apt-get install gh
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.PR_APP_ID }}
private-key: ${{ secrets.PR_SECRET_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Assign label
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
url: ${{ github.event.pull_request.html_url }}
run: |
echo "env.url=${{env.url}}"
gh pr edit "${{env.url}}" --add-label "Event: DevCamp 2025 XXX"

View File

@@ -1,24 +0,0 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: "Check tag branch"
on:
push:
tags:
- "18.*"
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify tag is on main
run: |
TAG_COMMIT=$(git rev-list -n 1 $GITHUB_REF)
if ! git branch --contains $TAG_COMMIT | grep -q "18.0"; then
echo "The tag must be on branch 18.0"
exit 1
fi

View File

@@ -28,14 +28,14 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version:
php-version:
# # PHPStan requires PHP >= 7.2.
# #- "7.2"
- "8.2"
- "8.2"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout travis file
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Run .travis.yml build script
uses: ktomk/run-travis-yml@v1
with:

View File

@@ -1,7 +1,4 @@
---
# This is a basic workflow to check code with PHPSTAN tool
name: Phan
on:
# workflow called by the parent workflow ci.yml
workflow_call:
@@ -15,15 +12,15 @@ on:
concurrency:
group: phan-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
gh_event: ${{ inputs.gh_event || github.event_name }}
PHAN_CONFIG: dev/tools/phan/config.php
PHAN_BASELINE: dev/tools/phan/baseline.txt
PHAN_MIN_PHP: 7.2
PHAN_MIN_PHP: 7.0
PHAN_QUICK: ${{ github.event.schedule && '' || '--quick' }}
GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action
name: phan
jobs:
phan:
name: Run phan
@@ -33,14 +30,26 @@ jobs:
github.repository == 'Dolibarr/dolibarr'
|| github.event.schedule == false
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none # disable xdebug, pcov
tools: phan
tools: cs2pr,phan
- name: Run Phan analysis
run: |
# shellcheck disable=2086
phan $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=github
phan $PHAN_QUICK -k "$PHAN_CONFIG" -B "$PHAN_BASELINE" --analyze-twice --minimum-target-php-version "$PHAN_MIN_PHP" --output-mode=checkstyle -o _phan.xml
- name: Add results to PR
if: ${{ always() }}
run: |
cs2pr --prepend-filename --prepend-source --notices-as-warnings _phan.xml
- name: Provide phan log as artifact
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: phan-srcrt
# path: ${{ github.workspace }}/phan.log
path: ${{ github.workspace }}/_phan.xml
retention-days: 2

View File

@@ -1,7 +1,6 @@
---
# This is a basic workflow to check code with PHPSTAN tool
name: PHPStan
# Controls when the workflow will run
on:
# workflow called by the parent workflow ci.yml
@@ -14,9 +13,8 @@ on:
workflow_dispatch:
concurrency:
group: phpstan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: stan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
gh_event: ${{ inputs.gh_event || github.event_name }}
CACHE_KEY_PART: ${{ ( inputs.gh_event == 'pull_request' || github.event_name == 'pull_request' ) && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }}
@@ -37,7 +35,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v6
- uses: actions/checkout@v4
# Get PHP and addons
- name: Setup PHP
id: setup-php
@@ -81,7 +79,7 @@ jobs:
key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{
github.run_id }}
- name: Provide phpstan log as artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: phpstan-srcrt

View File

@@ -33,7 +33,7 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:

View File

@@ -1,6 +1,5 @@
---
name: pre-commit
on:
# workflow called by the parent workflow ci.yml
workflow_call:
@@ -17,7 +16,6 @@ concurrency:
cancel-in-progress: true
env:
gh_event: ${{ inputs.gh_event || github.event_name }}
jobs:
pre-commit:
runs-on: ubuntu-latest
@@ -30,7 +28,7 @@ jobs:
# if: false
# Checkout git sources to analyze
- uses: actions/checkout@v6
- uses: actions/checkout@v4
# Try to get the list of modified files into steps.changed-php.outputs.all_changed_files
#- name: Get changed files
@@ -68,7 +66,7 @@ jobs:
run: |-
[ -r requirements.txt ] || [ -r pyproject.toml ] || touch requirements.txt
# Install python and pre-commit tool
- uses: actions/setup-python@v6
- uses: actions/setup-python@v5
with:
cache: pip
python-version: "3.11"
@@ -109,10 +107,6 @@ jobs:
coverage: none # disable xdebug, pcov
tools: phpcs
# Install perltidy and perlcritic
- name: Install perltidy and perlcritic
run: sudo apt-get update && sudo apt-get install -y perltidy libperl-critic-perl
# Run all the precommit tools (defined into pre-commit-config.yaml).
# We can force exclusion of some of them here.
- name: Run pre-commit hooks
@@ -157,7 +151,7 @@ jobs:
ls -l ~/.cache/pre-commit/
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2025.11.2
uses: mdeweerd/logToCheckStyle@v2025.1.1
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}
@@ -170,7 +164,7 @@ jobs:
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Upload result log files of precommit into the Artifact shared store
- name: Provide log as artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
if: ${{ ! cancelled() }}
with:
name: precommit-logs

View File

@@ -1,6 +1,5 @@
---
name: Win CI
# yamllint disable-line rule:truthy
on:
# workflow called by the parent workflow ci.yml
@@ -26,7 +25,6 @@ env:
PHP_INI_SCAN_DIR: C:\myphpini
CKEY: win-ci-2
GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action
jobs:
win-test:
strategy:
@@ -37,7 +35,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
@@ -59,7 +57,7 @@ jobs:
id: cache
uses: actions/cache/restore@v4
env:
HASH: ${{ hashFiles('htdocs/install/**', 'htdocs/filefunc.inc.php', 'htdocs/version.inc.php') }}
HASH: ${{ hashFiles('htdocs/install/**', 'htdocs/filefunc.inc.php') }}
KEY_ROOT: ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }}
with:
# See https://github.com/actions/cache/issues/1275#issuecomment-1925217178
@@ -167,13 +165,13 @@ jobs:
for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2025.11.2
uses: mdeweerd/logToCheckStyle@v2025.1.1
if: ${{ failure() }}
with:
in: ${{ env.PHPUNIT_LOG }}
- name: Provide dolibarr and phpunit logs as artifact
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
if: ${{ ! cancelled() }}
with:
name: win-ci-logs

1
.gitignore vendored
View File

@@ -52,7 +52,6 @@ dev/build/node_modules/
node_modules/
vendor/
php-vendor
tmp/
#yarn

View File

@@ -3,7 +3,7 @@ exclude: (?x)^( htdocs/includes/ckeditor/.*|(\.(?!github/workflows)[^/]*/.*))$
repos:
# Several miscellaneous checks and fix (on yaml files, end of files fix)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
rev: v5.0.0
hooks:
# This hook tests the name of the branch and return an error if the name is
# 'develop' or an official version 'x.y'
@@ -60,13 +60,13 @@ repos:
# Gitleaks is a SAST tool for detecting and preventing hardcoded secrets like passwords, api keys, and tokens in git repos
- repo: https://github.com/gitleaks/gitleaks.git
rev: v8.29.0
rev: v8.24.0
hooks:
- id: gitleaks
# Check github actions
- repo: https://github.com/rhysd/actionlint
rev: v1.7.8
rev: v1.7.7
hooks:
- id: actionlint
@@ -137,8 +137,6 @@ repos:
files: \.(php)$
args: [--standard=dev/setup/codesniffer/ruleset.xml]
- id: php-cs
exclude: |
(?x)^(htdocs/includes/.*)$
files: \.(php)$
args:
[
@@ -193,7 +191,7 @@ repos:
# Check format of yaml files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
rev: v1.36.2
hooks:
- id: yamllint
args:
@@ -246,7 +244,7 @@ repos:
# Check some shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
rev: v0.10.0.1
hooks:
- id: shellcheck
args: [-W, "100"]
@@ -274,21 +272,3 @@ repos:
|htdocs/install/pgsql/functions/functions.*\.sql
|htdocs/modulebuilder/template/sql/.*\.sql
)$
- repo: https://github.com/perltidy/perltidy
rev: '20250105.03'
hooks:
- id: perltidy
# virtualmin excuded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823
exclude: (?x)^
(dev/build/perl/virtualmin/dolibarr.pl
)$
args: [ --tabs, --nola ]
- repo: https://github.com/henryykt/pre-commit-perl
rev: v0.0.5
hooks:
- id: perlcritic
# virtualmin excuded - reason https://github.com/Dolibarr/dolibarr/pull/36370#issuecomment-3565101823
exclude: (?x)^
(dev/build/perl/virtualmin/dolibarr.pl
)$

View File

@@ -41,10 +41,10 @@ jobs:
include:
- stage: PHP min and max
if: type = push
php: '7.2'
php: '7.1'
env:
- DB=postgresql
- TRAVIS_PHP_VERSION=7.2
- TRAVIS_PHP_VERSION=7.1
- stage: PHP min and max
if: type = pull_request OR type = push
php: '8.4'
@@ -85,9 +85,6 @@ before_install:
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
fi
if [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
sudo apt install unzip apache2 php7.2 php7.2-cli php7.2-curl php7.2-mysql php7.2-pgsql php7.2-gd php7.2-imap php7.2-intl php7.2-ldap php7.2-xml php7.2-mbstring php7.2-xml php7.2-zip libapache2-mod-php7.2
fi
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
fi
@@ -112,8 +109,8 @@ before_install:
#ps fauxww | grep postgres
ls /etc/postgresql/13/main/
sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/14/main/pg_hba.conf
sudo cat /etc/postgresql/14/main/pg_hba.conf
sudo sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/13/main/pg_hba.conf
sudo cat /etc/postgresql/13/main/pg_hba.conf
sudo service postgresql restart
@@ -134,9 +131,6 @@ install:
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
sudo update-alternatives --set php /usr/bin/php7.1
fi
if [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
sudo update-alternatives --set php /usr/bin/php7.2
fi
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
sudo update-alternatives --set php /usr/bin/php8.1
fi
@@ -528,9 +522,6 @@ script:
php upgrade.php 21.0.0 22.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade21002200.log || cat $TRAVIS_BUILD_DIR/upgrade21002200.log
php upgrade2.php 21.0.0 22.0.0 > $TRAVIS_BUILD_DIR/upgrade21002200-2.log || cat $TRAVIS_BUILD_DIR/upgrade21002200-2.log
php step5.php 21.0.0 22.0.0 > $TRAVIS_BUILD_DIR/upgrade21002200-3.log || cat $TRAVIS_BUILD_DIR/upgrade21002200-3.log
php upgrade.php 22.0.0 23.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade22002300.log || cat $TRAVIS_BUILD_DIR/upgrade22002300.log
php upgrade2.php 22.0.0 23.0.0 > $TRAVIS_BUILD_DIR/upgrade22002300-2.log || cat $TRAVIS_BUILD_DIR/upgrade22002300-2.log
php step5.php 22.0.0 23.0.0 > $TRAVIS_BUILD_DIR/upgrade22002300-3.log || cat $TRAVIS_BUILD_DIR/upgrade22002300-3.log
set +e
echo

View File

@@ -44,6 +44,12 @@ source_file = htdocs/langs/en_US/blockedlog.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:bookmarks]
file_filter = htdocs/langs/<lang>/bookmarks.lang
source_file = htdocs/langs/en_US/bookmarks.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:boxes]
file_filter = htdocs/langs/<lang>/boxes.lang
source_file = htdocs/langs/en_US/boxes.lang
@@ -98,6 +104,12 @@ source_file = htdocs/langs/en_US/datapolicy.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:deliveries]
file_filter = htdocs/langs/<lang>/deliveries.lang
source_file = htdocs/langs/en_US/deliveries.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:dict]
file_filter = htdocs/langs/<lang>/dict.lang
source_file = htdocs/langs/en_US/dict.lang
@@ -134,6 +146,12 @@ source_file = htdocs/langs/en_US/exports.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:help]
file_filter = htdocs/langs/<lang>/help.lang
source_file = htdocs/langs/en_US/help.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:holiday]
file_filter = htdocs/langs/<lang>/holiday.lang
source_file = htdocs/langs/en_US/holiday.lang
@@ -266,6 +284,12 @@ source_file = htdocs/langs/en_US/partnership.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:paybox]
file_filter = htdocs/langs/<lang>/paybox.lang
source_file = htdocs/langs/en_US/paybox.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:paypal]
file_filter = htdocs/langs/<lang>/paypal.lang
source_file = htdocs/langs/en_US/paypal.lang
@@ -356,12 +380,6 @@ source_file = htdocs/langs/en_US/stripe.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:subtotals]
file_filter = htdocs/langs/<lang>/subtotals.lang
source_file = htdocs/langs/en_US/subtotals.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[o:dolibarr-association:p:dolibarr:r:supplier_proposal]
file_filter = htdocs/langs/<lang>/supplier_proposal.lang
source_file = htdocs/langs/en_US/supplier_proposal.lang

View File

@@ -53,7 +53,7 @@ TCPDI 1.1.0 LGPL-3+ / Apache 2.0 Yes
bacon, dasprid, swiss-qr-bill, kmukku, symfony/validator
JS libraries:
Ace 1.43.12 BSD Yes JS library to get code syntaxique coloration in a textarea (Must take src dir into https://github.com/ajaxorg/ace-builds/).
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 3.7.1 MIT License Yes JS library for graph
CKEditor 4.22.1 LGPL-2.1+ Yes Editor WYSIWYG
jQuery 3.6.4 MIT License Yes JS library

217
ChangeLog
View File

@@ -2,217 +2,6 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 23.0.0 compared to 22.0 *****
For users:
----------
NEW: Need PHP 7.2 as minimum version
NEW: Module datapolicy moved as stable (for anonimization features)
NEW: #31723 - Improve project overview: Hide paid orders (#35524)
NEW: #35700 : Throw an error when validating a propal, order, supplier with a product no more in sale/purchase… (#35709)
NEW: Accountancy - Accounting by payment type (#34729)
NEW: Accountancy - Add accounting for discounts (#35977)
NEW: Accountancy - Add a protection on various payment for auxiliary account on general account not centralized (#35720)
NEW: Accountancy - Add field centralized on import/export (#35872)
NEW: Accountancy - Add hook on export filename (#35188)
NEW: Accountancy - Add reconcile on general accounting account - SQL part (#35994)
NEW: Accountancy - Analytical axis (SQL Structure) (#34738)
NEW: Accountancy - Manual input - Add script to greyed out subledger_account if general ledger is not centralized (#35855)
NEW: Accountancy - Transaction - Add verification on centralized account (#35824)
NEW: Accountancy - Various payment - Add script to greyed out subledger_account if general ledger is not centralized (#35842)
NEW: Add a boolean for lines in api and $properties (#34293)
NEW: Add accounting export mode for ISTEA (#36006)
NEW: add a limit to avoid too many answer in agenda view. Add warning if limit has been reached.
NEW: Add a page to edit http security headers of application (#34941)
NEW: Add auto-reference generation for tasks (like in project) in API (#35981)
NEW: Add column ref_ext and note_private for membership
NEW: Add column thirdparty ref_customer and ref_supplier in project list
NEW: Add column title in emailing and add more filters
NEW: add combining characters (accents, cedilla...) codes in dol_string_unaccent() (#35130)
NEW: add company date birth (SQL structure) (#34854) (UI) (#34861)
NEW: add conditional supplier price display (#35900)
NEW: Add configuration for default timesheet menu (#35805)
NEW: Add contact tab on product service (#35914)
NEW: Add directory navigation to Web Portal Shared Documents (#35443)
NEW: Added Messaging and agenda tabs on order and shipments (#34859)
NEW: Add event when installing a module in the security event list.
NEW: add extrafield option "empty on clone" (#34866)
NEW: add fields usage_opportunity, usage_task, usage_bill_time for project import (#35301)
NEW: Add filter on agenda event progression on agenda page
NEW: add free numbering module for members (#35636)
NEW: add global search for resource object (#36043)
NEW: add hidden const to get response header in geturlcontent function (#34781) (#34824)
NEW: add hook getListOfModels (#34626)
NEW: Add hook on calcula_price() and get_default_tva()
NEW: Add hooks in webportal (#35326)
NEW: add hook when printing new card button on thirdparty list (#36350)
NEW: add hourly rate in list of users
NEW: Add missing parameters for menus on webportal hook (#35550)
NEW: Add option PDF_PURCHASE_INVOICE_HIDE_VAT
NEW: Add option PROJECT_CAN_ALWAYS_LINK_TO_ALL_CUSTOMERS
NEW: Add option to create simple standalone shipment of non origin (#35651)
NEW: Add option to create standalone reception (#36134)
NEW: add private and public note on ticket (#35303)
NEW: add product_type field on fichinter (preparing subtotal) (#36196)
NEW: Add regions for CONGO, THE DEMOCRATIC REPUBLIC OF THE;CD (#36340)
NEW: ADD Send mail for reception / Delivery (#34829)
NEW: Add setup page to concat natively files on invoice PDF.
NEW: add shipping address to propal (#34441)
NEW: Add Sign feature on shipments (#34640)
NEW: Add sms reminder in reminder of agenda events (#35239)
NEW: Add SQL table for expensereport line extrafields support (#36251)
NEW: add supplier invoice, order and supplier order tag filter and bulk insert and statistics order and supplier order (#35399)
NEW: add supplier payment mail template (#35877)
NEW: add tags on proposals and supplier proposals and in statistics (#35553)
NEW: Add task categories 1/3 (#35848)
NEW: Add tasks card hooks (#35616)
NEW: Add the "Dispute status" in list of invoice.
NEW: add the option to not synchronize thirdparty <--> member (#36033)
NEW: Add the widget funnel of opportunities
NEW: Add tpl files for standalone shipment (#35624)
NEW: Add tpl loader for discounts.tpl.php (#34798)
NEW: Add Transfer Number (#35665)
NEW: Add Type, Description columns to Project Overview Expense Reports (#36214)
NEW: Add user permission for create/edit/delete supplier prices (#35940)
NEW: Allow omission of ODT template name when generating ODT and PDF (#35701)
NEW: Better navigation and report into database admin tools
NEW: Button to create a proposal and sale order from a contract always on
NEW: Can add info of main IT service provider in setup.
NEW: can admin payments extrafields (#34822)
NEW: Can drag and drop in BOM card
NEW: Can force_install_dolibarrpassword for automatic installation (#34537)
NEW: Can have a tooltip picto on title of column and keep autotruncation of label. Tooltip is show at begin of text.
NEW: Can show both currency code and symbol into the select of currency
NEW: Can sort on employee in holiday balance. Add link to go to history.
NEW: Can update value of timespent with last task hourly rate (#36018)
NEW: Can urlencode substitution variable of constants
NEW: Can view/list/edit the dispute status of an invoice
NEW: Change the path for the mailing files (#34878)
NEW: Constant ORDER_MASS_ACTION_BILLED_LINK_EXPEDITIONS (#34617)
NEW: const MENU_HIDE_EMAIL_TEMPLATES to hide email templates setup in Tools menu (#35739)
NEW: Create simple shipment of non origin (#35604)
NEW: Currency for the Democratic Republic of Congo added. (#36104)
NEW: Customized step in duration select (#34652)
NEW: Dashboard - Add option in ihm to disable MRP thumb (#36185)
NEW: date function related to holiday can accept country id in addition to country code
NEW: DEV Can set color of the on/off button.
NEW: Disable by default obfuscation methods and function in extrafields evaluable strings. Can re-enable with MAIN_ALLOW_OBFUSCATION_METHODS_IN_DOL_EVAL=1
NEW: Discount split more than two parts (#34782)
NEW: Display company logo on kanban view (#34520)
NEW: dol_sort_array can be used with 2 sorting criteria.
NEW: Enhanced layout feature for emailing
NEW: Enhance popup for image preview (show size in title, can restore small view, always show the Rotate button).
NEW: Enhance the system for warnings on module activation
NEW: execute hook addMoreActionsButtons on bank card (#35598)
NEW: extrafields: add field to link a field to a module (#34416)
NEW: Feature to merge duplicate members (#35308)
NEW: generate renewal proposal for contracts (#35120)
NEW: Holiday - Allow to specify a specific mail address from (#36184)
NEW: hook allowing external modules to replace the behavior of fetchObjectLinked() (#34724)
NEW: hooks `showInputExtraField` and `showOutputExtraField` to override ExtraFields::show(Input|Output)Field (#35496)
NEW: implement box on product and interventional index page (#34629)
NEW: import subscriptions (#35612)
NEW: Introduce getCurrency(). $conf is no more allowed into computed formulae.
NEW: Invert logic of default date in proposal/order/invoice creation: Need option to NOT autofill instead of the opposite.
NEW: line input multicurrency price with tax (#35064)
NEW: Major overhaul of DataPolicyCron and add Recruitment policy (#34704)
NEW: Make the public contact form with experimental status
NEW: Minimal version of PHP is now 7.2
NEW: More index for memberships table
NEW: More information on the user credential section
NEW: More webportal feature - Can add shared files and thirdparty documents (#35391)
NEW: New hook mergePdf (#34707)
NEW: On invoice, show also nb of credit notes notyet converted for consumption
NEW: Option to clone parent categories on variant creation (#35806)
NEW: Output of category tag is nicer for long subcategories.
NEW: Parent project column in list of projects (#36177)
NEW: Paymentok validate invoice if not already done (#35564)
NEW: PDF Show customer balance on invoice date (#34800)
NEW: possibility to define global entity in user param (#35908)
NEW: Add messaging and agenda features to proposals (#34883)
NEW: public and private note can be shown on contact list
NEW: Public donation page (#35565)
NEW: public pages donation, ticket and member use captcha setup (#35913)
NEW: Rework of the management of the card and fields on the web portal (#36076)
NEW: Save the BAN and RUM for SEPA into database not just file.
NEW: search all facture rec (#34563)
NEW: Show cron last result and output in info (#36028)
NEW: Show full date with seconds in the tooltip of date of event
NEW: Show the link to download the zip of a module on module setup
NEW: Show warning on banner when an email is not valid
NEW: The check file feature can limit check on unalterable files only
NEW: The flag "Dispute open" make the status in Red.
NEW: The PHP info is in a popup in install page.
NEW: update country list (#34865)
NEW: Update Incoterms to 2025 standards and add new terms (#36041)
NEW: Upgrade ACE editor to 1.43.12
NEW: User/Date in the Follow tab are more condensed.
NEW: We added a hook to allow us to modify the Prospect Customer drop down… (#25635)
NEW: Withholdingtax how VatRefund (#34649)
For developers:
---------------
NEW: Introducing the TRIGGER_PREFIX property to force developers to use unique triggerkey per business object, to limit code to business CRUD events and report warning when it is not.
NEW: add extraparams field in llx_categorie (#35975)
NEW: Add prepare() method to DoliDB class (rebuild) (#35249)
NEW: Add function to split a discount in 2 by API REST (#34786)
NEW: Add a new API "product lots" (#36243)
NEW: Add API for Holidays/Leaves
NEW: add api for members statistics (#35851)
NEW: add api List VAT (#35920)
NEW: add api_paiements.class.php (#34756)
NEW: Add contact management on project Api (#35459)
NEW: Add contact support on products in REST API (#35925)
NEW: Add country ID resolution from country code for thirdparty api (#36345)
NEW: Add getcontacts on api of interventional and proposal (#35589)
NEW: Add hook initialization for interventions API (#35203)
NEW: Add option API_ENABLE_COUNT_CALLS
NEW: Add thirdparty search on api list (#34634)
NEW: add timespent API endpoints for projects and tasks add also cascading assignment of contacts to tasks (#35897)
NEW: add upload api feature for shipment (#34639)
NEW: Allow creating contact via api with ISO code (#36322)
NEW: API endpoint for getting products in a warehouse (#35918)
NEW: API for getting, adding, deleting and/or modifying email templates (#35853)
NEW: API for handling mass mailing targets (#35603)
NEW: API GET endpoint for thirdparties types listing (c_typent) (#34751)
NEW: Api mass emailing (#35531)
NEW: API user/groups/ POST, PUT, DELETE + some hurl tests (#35903)
NEW: API User - Remove user from group (#35453)
NEW: Implement listTimespent method in api_projects.class.php (#36093)
NEW: qual fixes on api contract (#36066)
NEW: stock API GET movement (#36193)
WARNING:
--------
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The deprecated column "egroupware_id" has been dropped from table llx_user.
* The property $sumpayed (duplicated of $totalpaid), $sumdeposit (duplicate of $totaldeposits) and $sumcreditnote (duplicate of $totalcreditnotes) has
been removed (there are replaced with the property that was a duplication of (same for $sumpayed_multicurrency, $sumdeposit_multicurrency, $sumcreditnote_multicurrency).
* Parameters $maxlen and $notooltip of Contract have been inverted to follow the standard. It was breaking the common use of getNomUrl() but if you were
using the parameter maxlen (rare) by using the old signature, result may be just a tooltip that is no more visible when mous over the contract ref shown by your module.
* Removed array $MAP_ID_TO_CODE that was a duplicate of the array "array_flip($categ->MAP_ID)"
* The signature of the Sale order ->cancel() method and shipment ->cancel() has been modified to introduce the $user param like for other methods that modify a status.
* Adding new "document generation templates" must be done by adding files into the mymodule/core/modules/xxx/doc directory. Adding files into custom directory with the
same path than the core path, without using a "mymodule" directory, is now forbidden.
* The directory theme/common/octicons has been removed. No resource was used by Dolibarrfrom this directory.
* The library timepicker.js has been removed. Was no more used by Dolibarr since a long time.
* Because of the new TRIGGER_PREFIX property, the triggers SUPPLIER_PRODUCT_BUYPRICE_XXX are renamed into PRODUCT_BUYPRICE_XXX.
* Function img_pdf() has been removed. Replace it with img_picto('', 'pdf') if you were using it.
* The method run_trigger() was deprecated 10+ years ago in favor of runTrigger(). It has been removed. Change your trigger file if you still use it.
* Property ->picto of module descriptors must contains the image extension if it is not a font awesome tag. Example: $this->picto="mymoduleimg.png";
* Stock movement API GET method output variable names has been harmonized with POST input parameter names
* Concatenation into computed property of extrafields is off by default. You can enable it from conf.php file by adding dol_concat to list of allowed function in $dolibarr_main_restrict_eval_methods,
For example: $dolibarr_main_restrict_eval_methods='getDolGlobalString,getDolGlobalInt,getDolCurrency,fetchNoCompute,hasRight,isModEnabled,isStringVarMatching,abs,min,max,round,dol_now,dol_concat,preg_match';
* Old variable $obj and $object are no more allowed into on the fly evaluated strings like computed or conditions on extrafields. Use $objectoffield to get current object
Also if you were using temporary variables int a computed extrafields, the nameot temporary variable must match $var123.
* The hidden constant MAIN_ALLOW_UNSECURED_SPECIAL_CHARS_IN_DOL_EVAL in database has been replaced with the
variable $dolibarr_main_allow_unsecured_special_chars_in_dol_eval into file conf/conf.php
* $conf use into "computed formulae" of etrafields is now deprecated (not yet forbidden). You can replace use of $conf->currency by the new method getCurrency() and $conf->global->xxx by getDolGlobalString('xxx').
* $user->rights->module->perms is also deprecated. You can use $user->hasRight() instead.
* The API endpoint /proposals/{id}/contact/{contactid}/{type}/{source} is now {id}/contact/{contactid}/{type} to match same behaviour than order and invoices.
***** ChangeLog for 22.0.3 compared to 22.0.2 *****
FIX: 16.0: extrafield of type link to category causes SQL error in selectForFormsList() (#36074)
@@ -388,8 +177,6 @@ FIX: Missing a column on group permissions
FIX: several minor troubles with modulebuilder
FIX: Test on mandatory product or thirdparty barcode
FIX: trigger mailmanspip when un/linking categories
FIX: Security when using Advanced Target page of emailing (feature hidden in v21, default in v22+). Possible
SQL injection by users with permission to make and send mass emailing.
***** ChangeLog for 22.0.0 compared to 21.0 *****
@@ -508,7 +295,7 @@ NEW: Add note public and private on order export
NEW: Finish dev for API_ENABLE_COUNT_CALLS (count of API use is visible on user API key field)
For developers:
---------------
----------
NEW: Add an API endpoint to get properties of a single line of an order (#34045)
NEW: add const to not include default CSS in top_htmlhead with DISABLE_CSS_DEFAULT_THEME
NEW: add const to not include default lib_head.js in top_htmlhead with DISABLE_LIB_HEAD_JS
@@ -535,6 +322,7 @@ NEW: expense report API deny
WARNING:
--------
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The use of GETPOST function is not allowed inside extrafields conditions or any strings that contains dynamic code evaluated with dol_eval().
* The deprecated variable $trigger_name (duplicate of variable $triggersendname) has been removed. You must use $triggersendname everywhere now.
@@ -583,6 +371,7 @@ FIX: trigger mailmanspip when un/linking categories
SEC: Remove functions accepting callable params - Reported by phdwg1410 - CVE-2024-40137
***** ChangeLog for 21.0.2 compared to 21.0.1 *****
FIX: 21.0: $height and $width can be ints, but also 'auto' (#34636)

View File

@@ -2,7 +2,7 @@
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
![Docker hub pulls](https://img.shields.io/docker/pulls/dolibarr/dolibarr.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg?style=flat-square)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521)

View File

@@ -1,9 +1,9 @@
# How to use or run Dolibarr with Docker (for a development environment) ?
The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the
current workspace with Docker. This docker image is intended for **development usage**.
For a production usage you should consider official packages on https://hub.docker.com/r/dolibarr/dolibarr.
# How to use it ?
The docker-compose.yml file is a sample of a config file to use to build and run
Dolibarr in the current workspace with Docker. This docker image is intended for
**development usage**. For production usage you should consider other
contributor reference like https://hub.docker.com/r/dolibarr/dolibarr.
Before build/run, define the variable HOST_USER_ID as following:
@@ -22,13 +22,18 @@ or
docker compose -f docker-compose.yml -f postgres.yml up
This will run the following Docker containers : Dolibarr, MariaDB, MailDev.
In the case of PostgreSQL, only Dolibarr, MailDev and the PostgreSQL database will be running.
This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev.
In the case of PostgreSQL, only Dolibarr, MailDev and the PostgreSQL database
will be running.
The URL to go to the installed Dolibarr is :
The URL to go to the Dolibarr is :
http://0.0.0.0
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by
Dolibarr go to maildev
@@ -37,7 +42,6 @@ Dolibarr go to maildev
Setup the database connection during the installation process, please use
mariadb or postgres (name of the database container) as database host.
## Setup your custom modules
You can setup your own modules from your development folder by using volume
@@ -57,4 +61,8 @@ will automatically be synced with your development environment.
Then, you can start by extending one of the commands above, for instance for
mariadb:
docker compose -f docker-compose.yml -f postgres.yml -f yourmodule.yml up
docker compose \
-f docker-compose.yml \
-f postgres.yml \
-f yourmodule.yml \
up

View File

@@ -1,21 +1,18 @@
# How to use or run Dolibarr with Docker ?
# How to use run Dolibarr with docker ?
## For a fast run of a demo of the local version, you can build the docker image from the source repository by running
## For a fast run of a demo of the local version, you can build the docker image from this current repository by running
git clone https://github.com/Dolibarr/dolibarr.git dolibarr
cd dolibarr/docker
sudo docker-compose build
sudo docker-compose build
sudo -s
sudo -s
export HOST_USER_ID=$(id -u)
export HOST_GROUP_ID=$(id -g)
export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13; echo)
docker-compose up -d
export HOST_USER_ID=$(id -u)
export HOST_GROUP_ID=$(id -g)
export MYSQL_ROOT_PWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13; echo)
docker-compose up -d
Warning: There is no persistency of data. This process is for dev purpose only.
@@ -23,6 +20,4 @@ Warning: There is no persistency of data. This process is for dev purpose only.
## For a more robust or a production usage
If you want to execute an official Docker package, you can find it and read the doc on
*https://hub.docker.com/r/dolibarr/dolibarr*
If you want to execute an official Docker package, you can find it and read the doc on ihttps://hub.docker.com/r/dolibarr/dolibarr

View File

@@ -1,94 +1,54 @@
#!/usr/bin/perl
##no critic (InputOutput::RequireBriefOpen)
use strict;
use warnings;
#--------------------------------------------------------------------
# Start the generation of the development documentation with doxygen
#--------------------------------------------------------------------
# Determine the patho of this script
( my $DIR = $0 ) =~ s/([^\/\\]+)$//;
$DIR ||= '.';
($DIR=$0) =~ s/([^\/\\]+)$//;
$DIR||='.';
$DIR =~ s/([^\/\\])[\\\/]+$/$1/;
my $OPTIONS = "";
$OPTIONS="";
#$OPTIONS="-d Preprocessor";
my $CONFFILE = "dolibarr-doxygen.doxyfile";
$CONFFILE="dolibarr-doxygen.doxyfile";
use Cwd;
my $dir = getcwd;
print "Current dir is: $dir\n";
#print "Running dir for doxygen must be: $DIR\n";
if ( !-s "dev/build/doxygen/$CONFFILE" ) {
print
"Error: current directory for building Dolibarr doxygen documentation is not correct.\n";
print "\n";
if (! -s "dev/build/doxygen/$CONFFILE")
{
print "Error: current directory for building Dolibarr doxygen documentation is not correct.\n";
print "\n";
print "Change your current directory then, to launch the script, run:\n";
print '> perl .\dolibarr-doxygen-build.pl (on Windows)' . "\n";
print '> perl ../dolibarr-doxygen-build.pl (on Linux or BSD)' . "\n";
sleep 4;
exit 1;
print '> perl .\dolibarr-doxygen-build.pl (on Windows)'."\n";
print '> perl ../dolibarr-doxygen-build.pl (on Linux or BSD)'."\n";
sleep 4;
exit 1;
}
my $SOURCE = ".";
$SOURCE=".";
# Get version $MAJOR, $MINOR and $BUILD
my $result = open( my $IN, "<", $SOURCE . "/htdocs/filefunc.inc.php" );
if ( !$result ) {
die "Error: Can't open descriptor file " . $SOURCE
. "/htdocs/filefunc.inc.php\n";
$result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" );
if ( !$result ) { die "Error: Can't open descriptor file " . $SOURCE . "/htdocs/filefunc.inc.php\n"; }
while (<IN>) {
if ( $_ =~ /define\('DOL_VERSION', '([\d\.a-z\-]+)'\)/ ) { $PROJVERSION = $1; break; }
}
my $PROJVERSION = "";
while (<$IN>) {
if ( $_ =~ /define\('DOL_VERSION', '([\d\.a-z\-]+)'\)/ ) {
$PROJVERSION = $1;
last;
}
}
close $IN;
close IN;
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
if ($MINOR eq '') { die "Error can't detect version into ".$SOURCE . "/htdocs/filefunc.inc.php"; }
if ( $PROJVERSION eq "" ) {
my $DOL_MAJOR_VERSION;
my $DOL_MINOR_VERSION;
my @VERSION_FILES = ( "filefunc.inc.php", "version.inc.php" );
foreach my $file (@VERSION_FILES) {
$result = open( my $IN, "<", $SOURCE . "/htdocs/$file" );
if ( !$result ) {
die "Error: Can't open descriptor file " . $SOURCE
. "/htdocs/$file\n";
}
while (<$IN>) {
if ( $_ =~ /define\('DOL_MAJOR_VERSION', '([\d\.a-z\-]+)'\)/ ) {
$DOL_MAJOR_VERSION = $1;
}
if ( $_ =~ /define\('DOL_MINOR_VERSION', '([\d\.a-z\-]+)'\)/ ) {
$DOL_MINOR_VERSION = $1;
}
}
close $IN;
}
$PROJVERSION = $DOL_MAJOR_VERSION . '.' . $DOL_MINOR_VERSION;
}
( my $MAJOR, my $MINOR, my $BUILD ) = split( /\./, $PROJVERSION, 3 );
if ( !defined($MINOR) || $MINOR eq '' ) {
die "Error can't detect version from " . $SOURCE
. "/htdocs/filefunc.inc.php";
}
$version=$MAJOR.".".$MINOR.".".$BUILD;
my $version = $MAJOR . "." . $MINOR . "." . $BUILD;
print "Running doxygen for version " . $version . ", please wait...\n";
print "cat dev/build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/" . $version
. "/' | doxygen $OPTIONS - 2>&1\n";
$result =
`cat dev/build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
print "Running doxygen for version ".$version.", please wait...\n";
print "cat dev/build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
$result=`cat dev/build/doxygen/$CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
print $result;

View File

@@ -4,79 +4,85 @@
# on PHP source files before running Doxygen.
# \author Laurent Destailleur
#--------------------------------------------------------------------
## no critic (InputOutput::RequireBriefOpen)
use strict;
use warnings;
# Usage: dolibarr-doxygen-filter.pl pathtofilefromdolibarrroot
my $file = $ARGV[0];
if ( !$file ) {
$file=$ARGV[0];
if (! $file)
{
print "Usage: dolibarr-doxygen-filter.pl pathtofilefromdolibarrroot\n";
exit;
}
open( my $fh, "<", $file ) || die "Failed to open file $file";
while (<$fh>) {
if ( $_ =~ /\\version\s/i ) {
open(FILE,$file) || die "Failed to open file $file";
while (<FILE>)
{
if ($_ =~ /\\version\s/i)
{
$_ =~ s/\$Id://i;
$_ =~ s/(Exp|)\s\$$//i;
$_ =~ s/(\\version\s+)[^\s]+\s/$1/i;
$_ =~ s/(\w)\s(\w)/$1_$2/g;
}
$_ =~ s/exit\s*;/exit(0);/i;
my $i = 0;
my $len = length($_);
my $s = "";
my $insidequote = 0;
my $insidedquote = 0;
my $ignore = "";
while ( $i < $len ) {
my $c = substr( $_, $i, 1 );
if ( $c eq "\\" ) {
if ($insidequote) { $ignore = "'"; }
if ($insidedquote) { $ignore = "\""; }
$i=0;
$len=length($_);
$s="";
$insidequote=0;
$insidedquote=0;
$ignore="";
while ($i < $len)
{
$c=substr($_,$i,1);
if ($c eq "\\")
{
if ($insidequote) { $ignore="'"; };
if ($insidedquote) { $ignore="\""; };
}
else {
if ( $c eq "'" ) {
if ( !$insidedquote ) {
$c = "\"";
else
{
if ($c eq "'")
{
if (! $insidedquote)
{
$c="\"";
#print "X".$ignore;
if ( $ignore ne "'" ) {
if ($ignore ne "'")
{
#print "Z".$ignore;
$insidequote++;
if ( $insidequote == 2 ) {
$insidequote = 0;
if ($insidequote == 2)
{
$insidequote=0;
}
}
}
#print "X".$insidequote;
}
elsif ( $c eq "\"" ) {
elsif ($c eq "\"")
{
#print "Y".$insidequote;
if ($insidequote) {
$c = "'";
if ($insidequote)
{
$c="'";
}
else {
if ( $ignore ne "\"" ) {
else
{
if ($ignore ne "\"")
{
$insidedquote++;
if ( $insidedquote == 2 ) {
$insidedquote = 0;
if ($insidedquote == 2)
{
$insidedquote=0;
}
}
}
}
$ignore = "";
$ignore="";
}
$s .= $c;
$s.=$c;
$i++;
}
print $s;
}
close($fh);
close(FILE);

View File

@@ -1,7 +1,4 @@
#!/usr/bin/perl
use strict;
use warnings;
#--------------------------------------------------------------------
# Script to get version of a source file
# Does not work with cygwin cvs command on Windows.
@@ -10,18 +7,15 @@ use warnings;
# Usage: dolibarr-doxygen-getversion.pl pathtofilefromdolibarrroot
$file = $ARGV[0];
if ( !$file ) {
$file=$ARGV[0];
if (! $file)
{
print "Usage: dolibarr-doxygen-getversion.pl pathtofilefromdolibarrroot\n";
exit;
}
$commande =
'cvs status "'
. $file
. '" | sed -n \'s/^[ \]*Working revision:[ \t]*\([0-9][0-9\.]*\).*/\1/p\'';
$commande='cvs status "'.$file.'" | sed -n \'s/^[ \]*Working revision:[ \t]*\([0-9][0-9\.]*\).*/\1/p\'';
#print $commande;
$result = `$commande 2>&1`;
$result=`$commande 2>&1`;
print $result;

View File

@@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa
OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden.
OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden.
DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2017" component. Please install the 32-bit version (vc_redist.x86.exe) first (you can find it at https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-supported-redistributable-version) and restart DoliWamp installation/upgrade after.
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2017" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen).

View File

@@ -3,8 +3,11 @@
DoliWamp is a special all in one package installer for Windows (Dolibarr+Mysql+Apache+PHP).
It's a dedicated Dolibarr version for Windows newbies with no technical knowledge. This package will install or upgrade Dolibarr but also all prerequisites like the web server, and the database in one auto-install process.
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr, or want to use Dolibarr with a different technical layer (PostgreSQL instead of MariaDB for exemple), you should not use this auto-installer assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (the .zip file).
This directory contains files used by *makepack-dolibarr.pl* script to build the all-in-on .EXE package DoliWamp, ready
to be distributed (for Windows).
The build of .exe files need to have some windows executable files already installed (Apache, MariaDb). The package to install to get this files are defined into the file *doliwamp.iss* (searhc line starting with "; Value OK:")
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).
This directory contains files used by *makepack-dolibarr.pl* script to build DoliWamp, the all-in-one .EXE package of Dolibarr, ready to be distributed on Windows (See file ../../makepack-howto.md)
The build of .exe files need to have some windows executable files already installed (Apache, MariaDb). The package to install to get this files are defined into the file *doliwamp.iss* (search line starting with "; Value OK:")
!!! See file ../../makepack-howto.md

View File

@@ -26,7 +26,6 @@
if (!defined('NOREQUIREDB')) {
define('NOREQUIREDB', '1'); // Do not create database handler $db
}
define('NOREQUIREVIRTUALURL', 1);
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
@@ -38,8 +37,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
exit(1);
}
define('DOL_DOCUMENT_ROOT', dirname(dirname($path)).'/htdocs');
require_once $path."../../htdocs/master.inc.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
@@ -51,27 +48,10 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
$includecustom = 0;
$includeconstants = array();
$buildzip = 0;
$release = '';
$checklock = '';
print '***** '.$script_file.' *****'."\n";
if (empty($argv[1])) {
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] unalterable_files\n";
print "\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=ES:CONST_XX_IS_ON includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
print "\n";
print "Generate the file filelist-x.y.z[-mybuild].xml with signature of files. ";
print "The file always includes the 3 sections:\n";
print "- dolibarr_htdocs_dir\n";
print "- dolibarr_scripts_dir\n";
print "- dolibarr_unalterable_files (only files inside the scope of the unalterable module)\n";
print "and if a specific setup/parameter need to be included into the signature for check:\n";
print "- dolibarr_constants\n";
print "\n";
print "If used with parameter 'check_unalterable_files', it will validate that the signature generated is the samethan the one found into lockedfiles.txt";
print "\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit(1);
}
@@ -85,33 +65,29 @@ while ($i < $argc) {
if (!empty($result["release"])) {
$release = $result["release"];
}
if (!empty($result["checklock"])) {
$checklock = $result["checklock"];
}
if (!empty($result["includecustom"])) {
$includecustom = $result["includecustom"];
}
if (preg_match('/unalterable_files/', strval($argv[$i]))) {
$checksource = 'unalterable_files';
if (!empty($result["includeconstant"])) {
$includeconstants[$i] = $result["includeconstant"];
}
if (!empty($result["buildzip"])) {
$buildzip = 1;
}
if (preg_match('/includeconstant=/', strval($argv[$i]))) {
$tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str()
if (count($tmp) != 3) {
print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n";
exit(1);
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
}
if (!empty($result["buildzip"])) {
$buildzip = 1;
}
$i++;
}
if (empty($release) && empty($checklock)) {
print "Error: Missing release or checklock parameter\n";
if (empty($release)) {
print "Error: Missing release parameter\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] unalterable_files\n";
exit(2);
}
@@ -121,379 +97,278 @@ $savrelease = $release;
$tmpver = explode('-', $release, 2);
if ($tmpver[0] == 'auto') {
$release = DOL_VERSION;
if (!empty($tmpver[1]) && $tmpver[0] == 'auto') {
if ($tmpver[1] && $tmpver[0] == 'auto') {
$release .= '-'.$tmpver[1];
}
}
// If release is auto, we take current version
$tmpver = explode('-', $checklock, 2);
if ($tmpver[0] == 'auto') {
$checklock = DOL_VERSION;
if (!empty($tmpver[1]) && $tmpver[0] == 'auto') {
$checklock .= '-'.$tmpver[1];
}
}
$checklockmajorversion = '';
if ($checklock) {
$checklockmajorversion = preg_replace('/-.*$/', '', $checklock);
$checklockmajorversion = preg_replace('/\..*/', '', $checklockmajorversion);
$checklockmajorversion .= '.0.0';
}
if ($release) {
if (empty($includecustom)) {
$tmpverbis = explode('-', $release, 2);
if (empty($tmpverbis[1])) {
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exactly the same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "\n";
exit(3);
}
} else {
$tmpverter = explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0]) {
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "\n";
exit(4);
}
if (empty($includecustom)) {
$tmpverbis = explode('-', $release, 2);
if (empty($tmpverbis[1])) {
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit(3);
}
} else {
if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "\n";
exit(5);
$tmpverter = explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0]) {
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit(4);
}
}
} else {
if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit(5);
}
}
if ($checklock && empty($checksource)) {
print 'Error: When action "checklock" is set, second parameter must be the scope family to check, for example "unalterable_files"'."\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] unalterable_files\n";
print "\n";
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Release : ".$release."\n";
print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) {
foreach ($tmp as $constname => $constvalue) {
print $constname.'='.$constvalue." ";
}
}
print "\n";
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
$outputdir = dirname(dirname(dirname(__FILE__))).'/htdocs/install';
print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n";
dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1);
$checksumconcat = array();
$outputfile = $outputdir.'/filelist-'.$release.'.xml';
$fp = fopen($outputfile, 'w');
if (empty($fp)) {
print 'Failed to open file '.$outputfile."\n";
exit(6);
}
if ($release) {
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Version of target release : ".$release."\n";
print "Include custom dir in signature : ".(empty($includecustom) ? 'no' : 'yes')."\n";
print "Include constants in signature : ".(empty($includeconstants) ? 'none' : '');
foreach ($includeconstants as $countrycode => $tmp) {
foreach ($tmp as $constname => $constvalue) {
print $constname.'='.$constvalue." ";
}
}
print "\n";
}
if ($checklock) {
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Version to check in lockedfiles.txt : ".$checklockmajorversion."\n";
print "Check source : ".$checksource."\n";
}
if ($release) {
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
$outputdir = dirname(dirname(dirname(__FILE__))).'/htdocs/install';
print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n";
dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1);
$gitcommit = 'seetag';
$branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release); // Keep only x.y into x.y.z
$fileforgit = dirname(dirname(dirname(__FILE__))).'/.git/refs/heads/'.$branchname;
print "Try to get last commit ID from file ".$fileforgit."\n";
$fileforgitcontent = file_get_contents($fileforgit);
if (empty($fileforgitcontent)) {
print "Failed to get the last commit ID. Are you on the branch for the release (branch name '.$branchname.') ?\n";
}
$gitcommit = trim($fileforgitcontent);
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'" gitcommit="'.$gitcommit.'">'."\n");
$needtoclose = 0;
// Build the XML file
if ($release) {
$checksumconcat = array();
$outputfile = $outputdir.'/filelist-'.$release.'.xml';
$fp = fopen($outputfile, 'w');
if (empty($fp)) {
print 'Failed to open file '.$outputfile."\n";
exit(7);
foreach ($includeconstants as $countrycode => $tmp) {
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach ($tmp as $constname => $constvalue) {
$valueforchecksum = (empty($constvalue) ? '0' : $constvalue);
$checksumconcat[] = $valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
}
$gitcommit = 'seetag';
$branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release); // Keep only x.y into x.y.z
$fileforgit = dirname(dirname(dirname(__FILE__))).'/.git/refs/heads/'.$branchname;
print "Try to get last commit ID from file ".$fileforgit."\n";
$fileforgitcontent = '';
if (file_exists($fileforgit)) {
$fileforgitcontent = file_get_contents($fileforgit);
}
if (empty($fileforgitcontent)) {
print "Failed to get the last commit ID (are you on the branch for the release branch name ".$branchname." ?). We will use an empty value for gitcommit.\n";
}
$gitcommit = trim($fileforgitcontent);
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'" gitcommit="'.$gitcommit.'">'."\n");
foreach ($includeconstants as $countrycode => $tmp) {
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach ($tmp as $constname => $constvalue) {
$valueforchecksum = (empty($constvalue) ? '0' : $constvalue);
$checksumconcat[] = $valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
}
fputs($fp, '</dolibarr_constants>'."\n\n");
}
fputs($fp, '<dolibarr_htdocs_dir includecustom="'.$includecustom.'">'."\n");
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|escpos-php\/example|escpos-php\/test|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
$md5htdocsdir = md5(join(',', $checksumconcat));
fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
fputs($fp, $md5htdocsdir."\n");
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n\n");
// Add the checksum for the part in scripts
$checksumconcat = array();
fputs($fp, '<dolibarr_scripts_dir version="'.$release.'">'."\n");
$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
$files = dol_dir_list(dirname(__FILE__).'/../../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../scripts', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, '</dolibarr_scripts_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
$md5scriptsdir = md5(join(',', $checksumconcat));
fputs($fp, '<dolibarr_scripts_dir_checksum>'."\n");
fputs($fp, $md5scriptsdir."\n");
fputs($fp, '</dolibarr_scripts_dir_checksum>'."\n\n");
fputs($fp, '</dolibarr_constants>'."\n\n");
}
fputs($fp, '<dolibarr_htdocs_dir includecustom="'.$includecustom.'">'."\n");
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|escpos-php\/doc|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
fputs($fp, md5(join(',', $checksumconcat))."\n");
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n\n");
// Add the checksum for the part in scripts
$checksumconcat = array();
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
$files = dol_dir_list(dirname(__FILE__).'/../../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../scripts', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, '</dolibarr_script_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
fputs($fp, '<dolibarr_script_dir_checksum>'."\n");
fputs($fp, md5(join(',', $checksumconcat))."\n");
fputs($fp, '</dolibarr_script_dir_checksum>'."\n\n");
// Add the checksum for the files into the scope of the unalterable system (record, read, export)
$checksumconcat = array();
if ($release) {
fputs($fp, '<dolibarr_unalterable_files version="'.$release.'">'."\n");
}
fputs($fp, '<dolibarr_unalterable_files version="'.$release.'">'."\n");
// Array of dir/files to include in the section
$arrayofunalterablefiles = array(
array('dir' => dirname(__FILE__).'/../../htdocs/', 'file' => 'version.inc.php'),
array('dir' => dirname(__FILE__).'/../../htdocs/blockedlog', 'file' => 'all', 'regextoinclude' => '(\.php|\.sql)$', 'regextoexclude' => ''),
array('dir' => dirname(__FILE__).'/../../htdocs/install/mysql/tables', 'file' => 'all', 'regextoinclude' => 'llx_blockedlog.*(\.php|\.sql)$', 'regextoexclude' => ''),
array('dir' => dirname(__FILE__).'/../../htdocs/core/triggers', 'file' => 'interface_50_modBlockedlog_ActionsBlockedLog.class.php'),
array('dir' => dirname(__FILE__).'/../../htdocs/core/class', 'file' => 'all', 'regextoinclude' => '(interfaces.class.php|commontrigger.class.php)$', 'regextoexclude' => ''),
array('dir' => dirname(__FILE__).'/../../htdocs/takepos', 'file' => 'receipt.php')
);
foreach ($arrayofunalterablefiles as $entry) {
if ($entry['file'] == 'all') {
$regextoinclude = $entry['regextoinclude'];
$regextoexclude = $entry['regextoexclude'];
$files = dol_dir_list($entry['dir'], 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
if ($release) {
fputs($fp, ' </dir>'."\n");
}
$needtoclose = 0;
}
if ($release) {
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
}
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
if ($release) {
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
}
$regextoinclude = '(\.php|\.sql)$';
$regextoexclude = ''; // Exclude dirs
$files = dol_dir_list(dirname(__FILE__).'/../../htdocs/blockedlog', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir = '';
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
if ($release) {
fputs($fp, ' </dir>'."\n");
}
$needtoclose = 0;
}
} else {
$file = $entry['dir'].'/'.$entry['file'];
$dir = '';
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
if (!file_exists($file)) {
print "Error file ".$file." does not exists.";
exit(1);
}
if ($newdir != $dir) {
if ($needtoclose) {
if ($release) {
fputs($fp, ' </dir>'."\n");
}
$needtoclose = 0;
}
if ($release) {
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
}
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
if ($release) {
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
if ($release) {
fputs($fp, ' </dir>'."\n");
}
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
// Add the SQL file
$regextoinclude = 'llx_blockedlog.*(\.php|\.sql)$';
$regextoexclude = ''; // Exclude dirs
$files = dol_dir_list(dirname(__FILE__).'/../../htdocs/install/mysql/tables', 'files', 0, $regextoinclude, $regextoexclude, 'fullname');
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
// Add the trigger file
$file = dirname(__FILE__).'/../../htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php';
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
if ($newdir != $dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose = 1;
}
if (filetype($file) == "file") {
$md5 = md5_file($file);
$checksumconcat[] = $md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
$needtoclose = 0;
}
fputs($fp, '</dolibarr_unalterable_files>'."\n");
asort($checksumconcat); // Sort list of checksum
$md5unalterable_files = md5(join(',', $checksumconcat));
fputs($fp, '<dolibarr_unalterable_files_checksum>'."\n");
fputs($fp, md5(join(',', $checksumconcat))."\n");
fputs($fp, '</dolibarr_unalterable_files_checksum>'."\n\n");
if ($release) {
fputs($fp, '</dolibarr_unalterable_files>'."\n");
fputs($fp, '<dolibarr_unalterable_files_checksum>'."\n");
fputs($fp, $md5unalterable_files."\n");
fputs($fp, '</dolibarr_unalterable_files_checksum>'."\n\n");
// End of file
// End of file
fputs($fp, '</checksum_list>'."\n");
fclose($fp);
}
fputs($fp, '</checksum_list>'."\n");
fclose($fp);
print "\n";
if ($release) {
if (empty($buildzip)) {
print "File ".$outputfile." generated.\n";
print "Signature for htdocs files: ".$md5htdocsdir."\n";
print "Signature for scripts files: ".$md5scriptsdir."\n";
print "Signature for the ".count($checksumconcat)." unalterable files: ".$md5unalterable_files."\n";
} else {
if ($buildzip == '1' || $buildzip == 'zip') {
$result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip');
if ($result > 0) {
dol_delete_file($outputfile);
print "File ".$outputfile.".zip generated.\n";
}
} elseif ($buildzip == '2' || $buildzip == 'gz') {
$result = dol_compress_file($outputfile, $outputfile.'.gz', 'gz');
if ($result > 0) {
dol_delete_file($outputfile);
print "File ".$outputfile.".gz generated.\n";
}
if (empty($buildzip)) {
print "File ".$outputfile." generated\n";
} else {
if ($buildzip == '1' || $buildzip == 'zip') {
$result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip');
if ($result > 0) {
dol_delete_file($outputfile);
print "File ".$outputfile.".zip generated\n";
}
} elseif ($buildzip == '2' || $buildzip == 'gz') {
$result = dol_compress_file($outputfile, $outputfile.'.gz', 'gz');
if ($result > 0) {
dol_delete_file($outputfile);
print "File ".$outputfile.".gz generated\n";
}
}
}
if ($checklock) {
print "Signature for unalterable files: ".$md5unalterable_files."\n";
$lockedfile = DOL_DOCUMENT_ROOT.'/../dev/lockedfiles.txt';
$checksuminlockedfile = '';
if (!file_exists($lockedfile)) {
print "Can't find the file ".$lockedfile.". No checksum to check\n";
} else {
// Now we check the content of lockedfiles.txt
$arraylocked = file($lockedfile);
foreach ($arraylocked as $line) {
$tmparray = preg_split("/\s+/", $line, 3);
if ($tmparray[0] == $checklockmajorversion) {
$checksuminlockedfile = $tmparray[2];
}
}
if (empty($checksuminlockedfile)) {
print "The major version ".$checklockmajorversion." is not locked on the scope ".$checksource." (file found but no matching entry found into dev/lockedfiles.txt).\n";
} elseif ($checksuminlockedfile != $md5unalterable_files) {
print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$checksuminlockedfile."\n";
if ($checklockmajorversion != $checksource) {
print "The checksum now differs from the locked one, so we return an error.\n";
print "\n";
exit(10);
}
}
}
}
print "\n";
exit(0);

View File

@@ -1,5 +1,4 @@
#!/usr/bin/perl
## no critic (InputOutput::RequireBriefOpen)
#fetch Gravatars
use strict;
@@ -11,44 +10,39 @@ use Digest::MD5 qw(md5_hex);
my $size = 90;
my $output_dir = './avatars';
die("no .git repository found in current path\n") unless -r './.git';
die("no .git/ directory found in current path\n") unless -d './avatars';
mkdir($output_dir) unless -d $output_dir;
open( my $GITLOG, '-|', q/git log --pretty=format:"%ae|%an" --reverse/ )
or die("failed to read git-log: $!\n");
open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");
my %processed_authors;
while (<$GITLOG>) {
chomp;
my ( $email, $author ) = split( /\|/, $_ );
while(<GITLOG>) {
chomp;
my($email, $author) = split(/\|/, $_);
next if $processed_authors{$author}++;
next if $processed_authors{$author}++;
my $author_image_file = $output_dir . '/' . $author . '.png';
my $author_image_file = $output_dir . '/' . $author . '.png';
#skip images we have
next if -e $author_image_file;
#skip images we have
next if -e $author_image_file;
#try and fetch image
#try and fetch image
my $grav_url =
"https://www.gravatar.com/avatar/"
. md5_hex( lc $email )
. "?d=404&size="
. $size;
my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&size=".$size;
warn "fetching image for '$author' $email ($grav_url)...\n";
warn "fetching image for '$author' $email ($grav_url)...\n";
my $rc = getstore( $grav_url, $author_image_file );
my $rc = getstore($grav_url, $author_image_file);
sleep(1);
sleep(1);
if ( $rc != 200 ) {
unlink($author_image_file);
next;
}
if($rc != 200) {
unlink($author_image_file);
next;
}
}
close $GITLOG;
close GITLOG;

File diff suppressed because it is too large Load Diff

View File

@@ -5,288 +5,223 @@
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
#----------------------------------------------------------------------------
## no critic (InputOutput::ProhibitExplicitStdin,InputOutput::RequireBriefOpen)
use strict;
use warnings;
use Cwd;
use Term::ANSIColor;
$OWNER = "ldestailleur";
$GROUP = "ldestailleur";
$OWNER="ldestailleur";
$GROUP="ldestailleur";
@LISTETARGET = ("ZIP"); # Possible packages
%REQUIREMENTTARGET = ( # Tool requirement for each package
"TGZ" => "tar",
"ZIP" => "7z"
@LISTETARGET=("ZIP"); # Possible packages
%REQUIREMENTTARGET=( # Tool requirement for each package
"TGZ"=>"tar",
"ZIP"=>"7z"
);
%ALTERNATEPATH = ();
%ALTERNATEPATH=(
);
use vars qw/ $REVISION $VERSION /;
$REVISION = '1.0';
$VERSION = "3.5 (build $REVISION)";
$REVISION='1.0';
$VERSION="3.5 (build $REVISION)";
#------------------------------------------------------------------------------
# MAIN
#------------------------------------------------------------------------------
( $DIR = $0 ) =~ s/([^\/\\]+)$//;
( $PROG = $1 ) =~ s/\.([^\.]*)$//;
$Extension = $1;
$DIR ||= '.';
$DIR =~ s/([^\/\\])[\\\/]+$/$1/;
($DIR=$0) =~ s/([^\/\\]+)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1;
$DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
# Detect OS type
# --------------
if ( "$^O" =~ /linux/i || ( -d "/etc" && -d "/var" && "$^O" !~ /cygwin/i ) ) {
$OS = 'linux';
$CR = '';
}
elsif ( -d "/etc" && -d "/Users" ) { $OS = 'macosx'; $CR = ''; }
elsif ( "$^O" =~ /cygwin/i || "$^O" =~ /win32/i ) {
$OS = 'windows';
$CR = "\r";
}
if ( !$OS ) {
print "$PROG.$Extension was not able to detect your OS.\n";
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
if (! $OS) {
print "$PROG.$Extension was not able to detect your OS.\n";
print "Can't continue.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
sleep 2;
exit 1;
}
# Define buildroot
# ----------------
if ( $OS =~ /linux/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp";
if ($OS =~ /linux/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
}
if ( $OS =~ /macos/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp";
if ($OS =~ /macos/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
}
if ( $OS =~ /windows/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "c:/temp";
$PROGPATH = $ENV{"ProgramFiles"};
if ($OS =~ /windows/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp";
$PROGPATH=$ENV{"ProgramFiles"};
}
if ( !$TEMP || !-d $TEMP ) {
print "Error: A temporary directory can not be find.\n";
print "Check that TEMP or TMP environment variable is set correctly.\n";
if (! $TEMP || ! -d $TEMP) {
print "Error: A temporary directory can not be find.\n";
print "Check that TEMP or TMP environment variable is set correctly.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 2;
sleep 2;
exit 2;
}
$BUILDROOT = "$TEMP/dolibarr-buildroot";
$BUILDROOT="$TEMP/dolibarr-buildroot";
my $copyalreadydone = 0;
my $batch = 0;
for ( 0 .. @ARGV - 1 ) {
if ( $ARGV[$_] =~ /^-*target=(\w+)/i ) { $target = $1; $batch = 1; }
if ( $ARGV[$_] =~ /^-*desti=(.+)/i ) { $DESTI = $1; }
if ( $ARGV[$_] =~ /^-*prefix=(.+)/i ) {
$PREFIX = $1;
$FILENAMESNAPSHOT .= "-" . $PREFIX;
}
my $copyalreadydone=0;
my $batch=0;
for (0..@ARGV-1) {
if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; }
if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; }
if ($ARGV[$_] =~ /^-*prefix=(.+)/i) {
$PREFIX=$1;
$FILENAMESNAPSHOT.="-".$PREFIX;
}
}
$SOURCE = "$DIR/../..";
$DESTI = "$SOURCE/dev/build";
if ( $ENV{"DESTIMODULES"} ) {
$DESTI = $ENV{"DESTIMODULES"};
} # Force output dir if env DESTIMODULES is defined
$NEWDESTI = $DESTI;
$SOURCE="$DIR/../..";
$DESTI="$SOURCE/dev/build";
if ($ENV{"DESTIMODULES"}) { $DESTI = $ENV{"DESTIMODULES"}; } # Force output dir if env DESTIMODULES is defined
$NEWDESTI=$DESTI;
print "Makepack for modules version $VERSION\n";
print "Source directory: $SOURCE\n";
print "Target directory: $NEWDESTI\n";
# Ask module
print
"Enter name for your module (mymodule, mywonderfullmodule, ... or 'all') : ";
my $PROJECTINPUT = <STDIN>;
print "Enter name for your module (mymodule, mywonderfulmondule, ... or 'all') : ";
$PROJECTINPUT=<STDIN>;
chomp($PROJECTINPUT);
print "Move to " . $DIR . " directory.\n";
print "Move to ".$DIR." directory.\n";
chdir($DIR);
my @PROJECTLIST = ();
if ( $PROJECTINPUT eq "all" ) {
opendir( my $DIR, $DIR ) or return;
local @rv = grep { /^makepack\-(.*)\.conf$/ } sort readdir($DIR);
closedir($DIR);
foreach my $xxx ( 0 .. @rv - 1 ) {
if ( $rv[$xxx] =~ /^makepack\-(.*)\.conf$/ ) {
@PROJECTLIST[$xxx] = $1;
}
}
my @PROJECTLIST=();
if ($PROJECTINPUT eq "all")
{
opendir(DIR, $DIR) || return;
local @rv = grep { /^makepack\-(.*)\.conf$/ } sort readdir(DIR);
closedir(DIR);
foreach my $xxx (0..@rv-1) {
if ($rv[$xxx] =~ /^makepack\-(.*)\.conf$/)
{
@PROJECTLIST[$xxx]=$1;
}
}
}
else {
@PROJECTLIST = ($PROJECTINPUT);
else
{
@PROJECTLIST=($PROJECTINPUT);
}
# Loop on each projects
foreach my $PROJECT (@PROJECTLIST) {
$PROJECTLC = lc($PROJECT);
$PROJECTLC=lc($PROJECT);
if ( !-f "makepack-" . $PROJECT . ".conf" ) {
print "Error: can't open conf file makepack-" . $PROJECT . ".conf\n";
if (! -f "makepack-".$PROJECT.".conf")
{
print "Error: can't open conf file makepack-".$PROJECT.".conf\n";
print "\n";
print "For help on building a module package, see web page\n";
print
"http://wiki.dolibarr.org/index.php/Module_development#Create_a_package_to_distribute_and_install_your_module\n";
print "http://wiki.dolibarr.org/index.php/Module_development#Create_a_package_to_distribute_and_install_your_module\n";
print "makepack-dolibarrmodule.pl aborted.\n";
sleep 2;
exit 2;
sleep 2;
exit 2;
}
# Get version $MAJOR, $MINOR and $BUILD
print "Version detected for module "
. $PROJECT
. " in file "
. $SOURCE
. "/htdocs/"
. $PROJECTLC
. "/core/modules/mod"
. ucfirst($PROJECT)
. ".class.php";
$result = open(
my $IN,
"<",
$SOURCE
. "/htdocs/"
. $PROJECTLC
. "/core/modules/mod"
. ucfirst($PROJECT)
. ".class.php"
);
$custom = false;
if ( !$result ) {
$result = open(
my $IN,
"<",
$SOURCE
. "/htdocs/custom/"
. $PROJECTLC
. "/core/modules/mod"
. ucfirst($PROJECT)
. ".class.php"
);
if ( !$result ) {
die "Error: Can't open descriptor file "
. $SOURCE
. "/htdocs/(or /htdocs/custom/)"
. $PROJECTLC
. "/core/modules/mod"
. ucfirst($PROJECT)
. ".class.php for reading.\n";
}
}
else {
$custom = true;
}
while (<$IN>) {
if ( $_ =~ /this->version\s*=\s*'([\d\.]+)'/ ) {
$PROJVERSION = $1;
break;
}
}
close $IN;
print $PROJVERSION. "\n";
print "Version detected for module ".$PROJECT." in file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".ucfirst($PROJECT).".class.php";
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".ucfirst($PROJECT).".class.php");
$custom=false;
if (! $result) {
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".ucfirst($PROJECT).".class.php");
if (! $result) {
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".ucfirst($PROJECT).".class.php for reading.\n";
}else{
$custom = true;
}
}
while(<IN>)
{
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
}
close IN;
print $PROJVERSION."\n";
( $MAJOR, $MINOR, $BUILD ) = split( /\./, $PROJVERSION, 3 );
if ( $MINOR eq '' ) {
print "Enter value for minor version for module " . $PROJECT . ": ";
$MINOR = <STDIN>;
chomp($MINOR);
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
if ($MINOR eq '')
{
print "Enter value for minor version for module ".$PROJECT.": ";
$MINOR=<STDIN>;
chomp($MINOR);
}
$FILENAME = "$PROJECTLC";
$FILENAMETGZ =
"module_$PROJECTLC-$MAJOR.$MINOR" . ( $BUILD ne '' ? ".$BUILD" : "" );
$FILENAMEZIP =
"module_$PROJECTLC-$MAJOR.$MINOR" . ( $BUILD ne '' ? ".$BUILD" : "" );
if ( -d "/usr/src/redhat" ) {
# redhat
$RPMDIR = "/usr/src/redhat";
$FILENAME="$PROJECTLC";
$FILENAMETGZ="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
$FILENAMEZIP="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
if (-d "/usr/src/redhat") {
# redhat
$RPMDIR="/usr/src/redhat";
}
if ( -d "/usr/src/RPM" ) {
# mandrake
$RPMDIR = "/usr/src/RPM";
if (-d "/usr/src/RPM") {
# mandrake
$RPMDIR="/usr/src/RPM";
}
# Choose package targets
#-----------------------
$target = "ZIP"; # Dolibarr modules are this format
$CHOOSEDTARGET{ uc($target) } = 1;
$target="ZIP"; # Dolibarr modules are this format
$CHOOSEDTARGET{uc($target)}=1;
# Test if requirement is ok
#--------------------------
foreach my $target ( keys %CHOOSEDTARGET ) {
foreach my $req ( split( /[,\s]/, $REQUIREMENTTARGET{$target} ) ) {
foreach my $target (keys %CHOOSEDTARGET) {
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) {
# Test
print "Test requirement for target $target: Search '$req'... ";
$ret=`"$req" 2>&1`;
$coderetour=$?; $coderetour2=$coderetour>>8;
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
# Not found error, we try in PROGPATH
$ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
$coderetour=$?; $coderetour2=$coderetour>>8;
$REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
}
# Test
print "Test requirement for target $target: Search '$req'... ";
$ret = `"$req" 2>&1`;
$coderetour = $?;
$coderetour2 = $coderetour >> 8;
if (
$coderetour != 0
&& (
(
$coderetour2 == 1
&& $OS =~ /windows/
&& $ret !~ /Usage/i
)
|| ( $coderetour2 == 127 && $OS !~ /windows/ )
)
&& $PROGPATH
)
{
# Not found error, we try in PROGPATH
$ret = `"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
$coderetour = $?;
$coderetour2 = $coderetour >> 8;
$REQUIREMENTTARGET{$target} =
"$PROGPATH/$ALTERNATEPATH{$req}/$req";
}
if (
$coderetour != 0
&& (
(
$coderetour2 == 1
&& $OS =~ /windows/
&& $ret !~ /Usage/i
)
|| ( $coderetour2 == 127 && $OS !~ /windows/ )
)
)
{
# Not found error
print
"Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
$CHOOSEDTARGET{$target} = -1;
last;
}
else {
# Pas erreur ou erreur autre que programme absent
print " Found " . $REQUIREMENTTARGET{$target} . "\n";
}
}
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
# Not found error
print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
$CHOOSEDTARGET{$target}=-1;
last;
} else {
# Pas erreur ou erreur autre que programme absent
print " Found ".$REQUIREMENTTARGET{$target}."\n";
}
}
}
print "\n";
# Check if there is at least one target to build
# Check if there is at least on target to build
#----------------------------------------------
$nboftargetok = 0;
$nboftargetneedbuildroot = 0;
$nboftargetneedcvs = 0;
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) { next; }
if ( $target ne 'EXE' && $target ne 'EXEDOLIWAMP' ) {
$nboftargetok=0;
$nboftargetneedbuildroot=0;
$nboftargetneedcvs=0;
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) { next; }
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP')
{
$nboftargetneedbuildroot++;
}
if ( $target eq 'SNAPSHOT' ) {
if ($target eq 'SNAPSHOT')
{
$nboftargetneedcvs++;
}
$nboftargetok++;
@@ -294,211 +229,178 @@ foreach my $PROJECT (@PROJECTLIST) {
if ($nboftargetok) {
# Update CVS if required
#-----------------------
if ($nboftargetneedcvs) {
print "Go to directory $SOURCE\n";
$olddir = getcwd();
chdir("$SOURCE");
print "Run cvs update -P -d\n";
$ret = `cvs update -P -d 2>&1`;
chdir("$olddir");
# Update CVS if required
#-----------------------
if ($nboftargetneedcvs)
{
print "Go to directory $SOURCE\n";
$olddir=getcwd();
chdir("$SOURCE");
print "Run cvs update -P -d\n";
$ret=`cvs update -P -d 2>&1`;
chdir("$olddir");
}
# Update buildroot if required
#-----------------------------
if ($nboftargetneedbuildroot) {
if ( !$copyalreadydone ) {
print "Delete directory $BUILDROOT\n";
$ret = `rm -fr "$BUILDROOT"`;
# Update buildroot if required
#-----------------------------
if ($nboftargetneedbuildroot)
{
if (! $copyalreadydone) {
print "Delete directory $BUILDROOT\n";
$ret=`rm -fr "$BUILDROOT"`;
mkdir "$BUILDROOT";
mkdir "$BUILDROOT/$PROJECTLC";
mkdir "$BUILDROOT";
mkdir "$BUILDROOT/$PROJECTLC";
print "Now, we will copy all files declared in the makepack-"
. $PROJECT
. ".conf into the directory $BUILDROOT\n";
print "Now, we will copy all files declared in the makepack-".$PROJECT.".conf into the directory $BUILDROOT\n";
open( my $IN2, "<", "makepack-" . $PROJECT . ".conf" )
or die "Error: Can't open conf file makepack-"
. $PROJECT
. ".conf for reading.\n";
while (<$IN2>) {
$entry = $_;
$result=open(IN,"<makepack-".$PROJECT.".conf");
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
while(<IN>)
{
$entry=$_;
if ( $entry =~ /^#/ ) { next; } # Do not process comments
if ($entry =~ /^#/) { next; } # Do not process comments
$entry =~ s/\n//;
if ( $entry =~ /^!(.*)$/ ) # Exclude so remove file/dir
{
print "Remove $BUILDROOT/$PROJECTLC/$1\n";
$ret = `rm -fr "$BUILDROOT/$PROJECTLC/"$1`;
if ( $? != 0 ) {
die
"Failed to delete a file to exclude declared into makepack-"
. $PROJECT
. ".conf file (Failed on the line "
. $entry . ")\n";
}
next;
}
if ($entry =~ /^!(.*)$/) # Exclude so remove file/dir
{
print "Remove $BUILDROOT/$PROJECTLC/$1\n";
$ret=`rm -fr "$BUILDROOT/$PROJECTLC/"$1`;
if ($? != 0) { die "Failed to delete a file to exclude declared into makepack-".$PROJECT.".conf file (Failed on the line ".$entry.")\n"; }
next;
}
$entry =~ /^(.*)\/[^\/]+/;
print "Create directory $BUILDROOT/$PROJECTLC/$1\n";
$ret = `mkdir -p "$BUILDROOT/$PROJECTLC/$1"`;
if ( $entry !~ /version\-/ ) {
print
"Copy $SOURCE/$entry into $BUILDROOT/$PROJECTLC/$entry\n";
$ret =
`cp -pr "$SOURCE/$entry" "$BUILDROOT/$PROJECTLC/$entry"`;
if ( $? != 0 ) {
die
"Failed to make copy of a file declared into makepack-"
. $PROJECT
. ".conf file (Failed on the line '"
. $entry . "')\n";
}
}
print "Create directory $BUILDROOT/$PROJECTLC/$1\n";
$ret=`mkdir -p "$BUILDROOT/$PROJECTLC/$1"`;
if ($entry !~ /version\-/)
{
print "Copy $SOURCE/$entry into $BUILDROOT/$PROJECTLC/$entry\n";
$ret=`cp -pr "$SOURCE/$entry" "$BUILDROOT/$PROJECTLC/$entry"`;
if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Failed on the line '".$entry."')\n"; }
}
}
close $IN2;
close IN;
@timearray = localtime( time() );
$fulldate =
( $timearray[5] + 1900 ) . '-'
. ( $timearray[4] + 1 ) . '-'
. $timearray[3] . ' '
. $timearray[2] . ':'
. $timearray[1];
#open(VF,">$BUILDROOT/$PROJECTLC/dev/build/version-".$PROJECTLC.".txt");
#print "Create version file $BUILDROOT/$PROJECTLC/dev/build/version-".$PROJECTLC.".txt with date ".$fulldate."\n";
#$ret=`mkdir -p "$BUILDROOT/$PROJECTLC/dev/build"`;
#print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n";
#print VF "Build : ".$fulldate."\n";
#close VF;
}
print "Clean $BUILDROOT\n";
$ret = `rm -fr $BUILDROOT/$PROJECTLC/.cache`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/.git`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/.project`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/.settings`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/index.php`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/dev/build/html`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/documents`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/document`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.mysql`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
if ($custom) {
$ret =
`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
}
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret = `rm -fr $BUILDROOT/$PROJECTLC/test`;
$ret =
`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`;
$ret =
`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`;
@timearray=localtime(time());
$fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1];
#open(VF,">$BUILDROOT/$PROJECTLC/dev/build/version-".$PROJECTLC.".txt");
#print "Create version file $BUILDROOT/$PROJECTLC/dev/build/version-".$PROJECTLC.".txt with date ".$fulldate."\n";
#$ret=`mkdir -p "$BUILDROOT/$PROJECTLC/dev/build"`;
#print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n";
#print VF "Build : ".$fulldate."\n";
#close VF;
}
print "Clean $BUILDROOT\n";
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.git`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/dev/build/html`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/document`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.mysql`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
if ($custom) {
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
}
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`;
}
# Build package for each target
#------------------------------
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) { next; }
# Build package for each target
#------------------------------
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) { next; }
print "\nBuild package for target $target\n";
print "\nBuild package for target $target\n";
if ( $target eq 'TGZ' ) {
$NEWDESTI = $DESTI;
if ( -d $DESTI . '/../modules' ) {
$NEWDESTI = $DESTI . '/../modules';
}
if ($target eq 'TGZ') {
$NEWDESTI=$DESTI;
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
print "Remove target $FILENAMETGZ.tgz...\n";
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
print "Compress $BUILDROOT/* into $FILENAMETGZ.tgz...\n";
$cmd =
"tar --exclude-vcs --exclude *.tgz --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" .";
$ret = `$cmd`;
if ( $OS =~ /windows/i ) {
print
"Move $FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n";
$ret = `mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
}
else {
$ret = `mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
}
next;
}
print "Remove target $FILENAMETGZ.tgz...\n";
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
print "Compress $BUILDROOT/* into $FILENAMETGZ.tgz...\n";
$cmd="tar --exclude-vcs --exclude *.tgz --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" .";
$ret=`$cmd`;
if ($OS =~ /windows/i) {
print "Move $FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n";
$ret=`mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
}
else
{
$ret=`mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
}
next;
}
if ( $target eq 'ZIP' ) {
$NEWDESTI = $DESTI;
if ( -d $DESTI . '/../modules' ) {
$NEWDESTI = $DESTI . '/../modules';
}
if ($target eq 'ZIP') {
$NEWDESTI=$DESTI;
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
print "Remove target $FILENAMEZIP.zip...\n";
unlink "$NEWDESTI/$FILENAMEZIP.zip";
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
print "Remove target $FILENAMEZIP.zip...\n";
unlink "$NEWDESTI/$FILENAMEZIP.zip";
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
print "Go to directory $BUILDROOT/$PROJECTLC\n";
$olddir = getcwd();
chdir("$BUILDROOT/$PROJECTLC");
$cmd = "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *";
print $cmd. "\n";
$ret = `$cmd`;
chdir("$olddir");
print "Go to directory $BUILDROOT/$PROJECTLC\n";
$olddir=getcwd();
chdir("$BUILDROOT/$PROJECTLC");
$cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *";
print $cmd."\n";
$ret= `$cmd`;
chdir("$olddir");
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
$ret =
`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
$ret = `chown $OWNER:$GROUP "$NEWDESTI/$FILENAMEZIP.zip"`;
next;
}
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
$ret=`chown $OWNER:$GROUP "$NEWDESTI/$FILENAMEZIP.zip"`;
next;
}
if ( $target eq 'EXE' ) {
$NEWDESTI = $DESTI;
if ( -d $DESTI . '/../modules' ) {
$NEWDESTI = $DESTI . '/../modules';
}
if ($target eq 'EXE') {
$NEWDESTI=$DESTI;
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
print "Remove target $FILENAMEEXE.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXE.exe";
print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n";
$command =
"\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\dev\\build\\exe\\$FILENAME.nsi\"";
print "$command\n";
$ret = `$command`;
print "Move $FILENAMEEXE.exe to $NEWDESTI\n";
rename( "$SOURCE\\dev\\build\\exe\\$FILENAMEEXE.exe",
"$NEWDESTI/$FILENAMEEXE.exe" );
next;
}
print "Remove target $FILENAMEEXE.exe...\n";
unlink "$NEWDESTI/$FILENAMEEXE.exe";
print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n";
$command="\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\dev\\build\\exe\\$FILENAME.nsi\"";
print "$command\n";
$ret=`$command`;
print "Move $FILENAMEEXE.exe to $NEWDESTI\n";
rename("$SOURCE\\dev\\build\\exe\\$FILENAMEEXE.exe","$NEWDESTI/$FILENAMEEXE.exe");
next;
}
}
}
}
print "\n----- Summary -----\n";
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) {
print "Package $target not built (bad requirement).\n";
}
else {
print "Package $target built successfully in $NEWDESTI\n";
}
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) {
print "Package $target not built (bad requirement).\n";
} else {
print "Package $target built successfully in $NEWDESTI\n";
}
}
}
if ( !$batch ) {
print "\nPress key to finish...";
my $WAITKEY = <STDIN>;
if (! $batch) {
print "\nPress key to finish...";
my $WAITKEY=<STDIN>;
}
0;

View File

@@ -4,294 +4,268 @@
# \brief Script to build a theme Package for Dolibarr
# \author (c)2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
#-----------------------------------------------------------------------------
## no critic (InputOutput::ProhibitExplicitStdin)
use strict;
use warnings;
use Cwd;
use Term::ANSIColor;
$PROJECT = "dolibarr";
$PROJECT="dolibarr";
@LISTETARGET = ("TGZ"); # Possible packages
%REQUIREMENTTARGET = ( # Tool requirement for each package
"TGZ" => "tar",
"ZIP" => "7z",
"RPM" => "rpmbuild",
"DEB" => "dpkg-buildpackage",
"EXE" => "makensis.exe"
@LISTETARGET=("TGZ"); # Possible packages
%REQUIREMENTTARGET=( # Tool requirement for each package
"TGZ"=>"tar",
"ZIP"=>"7z",
"RPM"=>"rpmbuild",
"DEB"=>"dpkg-buildpackage",
"EXE"=>"makensis.exe"
);
%ALTERNATEPATH = (
"7z" => "7-ZIP",
"makensis.exe" => "NSIS"
%ALTERNATEPATH=(
"7z"=>"7-ZIP",
"makensis.exe"=>"NSIS"
);
use vars qw/ $REVISION $VERSION /;
$REVISION = '1.11';
$VERSION = "1.0 (build $REVISION)";
$REVISION='1.11';
$VERSION="1.0 (build $REVISION)";
#------------------------------------------------------------------------------
# MAIN
#------------------------------------------------------------------------------
( $DIR = $0 ) =~ s/([^\/\\]+)$//;
( $PROG = $1 ) =~ s/\.([^\.]*)$//;
$Extension = $1;
$DIR ||= '.';
$DIR =~ s/([^\/\\])[\\\/]+$/$1/;
($DIR=$0) =~ s/([^\/\\]+)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1;
$DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
# Detect OS type
# --------------
if ( "$^O" =~ /linux/i || ( -d "/etc" && -d "/var" && "$^O" !~ /cygwin/i ) ) {
$OS = 'linux';
$CR = '';
}
elsif ( -d "/etc" && -d "/Users" ) { $OS = 'macosx'; $CR = ''; }
elsif ( "$^O" =~ /cygwin/i || "$^O" =~ /win32/i ) {
$OS = 'windows';
$CR = "\r";
}
if ( !$OS ) {
print "$PROG.$Extension was not able to detect your OS.\n";
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
if (! $OS) {
print "$PROG.$Extension was not able to detect your OS.\n";
print "Can't continue.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
sleep 2;
exit 1;
}
# Define buildroot
# ----------------
if ( $OS =~ /linux/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp";
if ($OS =~ /linux/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
}
if ( $OS =~ /macos/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "/tmp";
if ($OS =~ /macos/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
}
if ( $OS =~ /windows/ ) {
$TEMP = $ENV{"TEMP"} || $ENV{"TMP"} || "c:/temp";
$PROGPATH = $ENV{"ProgramFiles"};
if ($OS =~ /windows/) {
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp";
$PROGPATH=$ENV{"ProgramFiles"};
}
if ( !$TEMP || !-d $TEMP ) {
print "Error: A temporary directory can not be find.\n";
print "Check that TEMP or TMP environment variable is set correctly.\n";
if (! $TEMP || ! -d $TEMP) {
print "Error: A temporary directory can not be find.\n";
print "Check that TEMP or TMP environment variable is set correctly.\n";
print "makepack-dolibarrtheme.pl aborted.\n";
sleep 2;
exit 2;
sleep 2;
exit 2;
}
$BUILDROOT = "$TEMP/dolibarr-buildroot";
$BUILDROOT="$TEMP/dolibarr-buildroot";
my $copyalreadydone = 0;
my $batch = 0;
my $copyalreadydone=0;
my $batch=0;
print "Makepack theme version $VERSION\n";
print "Enter name of theme(s) to package (separated with space): ";
$PROJECT = <STDIN>;
$PROJECT=<STDIN>;
chomp($PROJECT);
@PROJECTLIST = split( / /, $PROJECT );
$PROJECT = join( '', @PROJECTLIST );
@PROJECTLIST=split(/ /,$PROJECT);
$PROJECT=join('',@PROJECTLIST);
# Ask and set version $MAJOR and $MINOR
print "Enter value for version: ";
$PROJVERSION = <STDIN>;
$PROJVERSION=<STDIN>;
chomp($PROJVERSION);
( $MAJOR, $MINOR ) = split( /\./, $PROJVERSION, 2 );
if ( $MINOR eq '' ) {
($MAJOR,$MINOR)=split(/\./,$PROJVERSION,2);
if ($MINOR eq '')
{
print "Enter value for minor version: ";
$MINOR = <STDIN>;
$MINOR=<STDIN>;
chomp($MINOR);
}
$FILENAME = "$PROJECT";
$FILENAMETGZ = "theme_$PROJECT-$MAJOR.$MINOR";
$FILENAMEZIP = "theme_$PROJECT-$MAJOR.$MINOR";
if ( -d "/usr/src/redhat" ) {
$FILENAME="$PROJECT";
$FILENAMETGZ="theme_$PROJECT-$MAJOR.$MINOR";
$FILENAMEZIP="theme_$PROJECT-$MAJOR.$MINOR";
# redhat
$RPMDIR = "/usr/src/redhat";
if (-d "/usr/src/redhat") {
# redhat
$RPMDIR="/usr/src/redhat";
}
if ( -d "/usr/src/RPM" ) {
# mandrake
$RPMDIR = "/usr/src/RPM";
if (-d "/usr/src/RPM") {
# mandrake
$RPMDIR="/usr/src/RPM";
}
$SOURCE = "$DIR/../..";
$DESTI = "$SOURCE/build";
$SOURCE="$DIR/../..";
$DESTI="$SOURCE/build";
# Choose package targets
#-----------------------
$target = "ZIP"; # Packages uses this format
$target="ZIP"; # Packages uses this format
if ($target) {
$CHOOSEDTARGET{ uc($target) } = 1;
$CHOOSEDTARGET{uc($target)}=1;
}
else {
my $found = 0;
my $NUM_SCRIPT;
while ( !$found ) {
my $cpt = 0;
printf( " %d - %3s (%s)\n",
$cpt, "All", "Need " . join( ",", values %REQUIREMENTTARGET ) );
foreach my $target (@LISTETARGET) {
$cpt++;
printf( " %d - %3s (%s)\n",
$cpt, $target, "Need " . $REQUIREMENTTARGET{$target} );
}
my $found=0;
my $NUM_SCRIPT;
while (! $found) {
my $cpt=0;
printf(" %d - %3s (%s)\n",$cpt,"All","Need ".join(",",values %REQUIREMENTTARGET));
foreach my $target (@LISTETARGET) {
$cpt++;
printf(" %d - %3s (%s)\n",$cpt,$target,"Need ".$REQUIREMENTTARGET{$target});
}
# Are asked to select the file to move
print "Choose one package number or several separated with space: ";
$NUM_SCRIPT = <STDIN>;
chomp($NUM_SCRIPT);
if ( $NUM_SCRIPT =~ s/-//g ) {
# Do not do copy
$copyalreadydone = 1;
}
if ( $NUM_SCRIPT !~ /^[0-$cpt\s]+$/ ) {
print "This is not a valid package number list.\n";
$found = 0;
}
else {
$found = 1;
}
}
print "\n";
if ($NUM_SCRIPT) {
foreach my $num ( split( /\s+/, $NUM_SCRIPT ) ) {
$CHOOSEDTARGET{ $LISTETARGET[ $num - 1 ] } = 1;
}
}
else {
foreach my $key (@LISTETARGET) {
$CHOOSEDTARGET{$key} = 1;
}
}
# Are asked to select the file to move
print "Choose one package number or several separated with space: ";
$NUM_SCRIPT=<STDIN>;
chomp($NUM_SCRIPT);
if ($NUM_SCRIPT =~ s/-//g) {
# Do not do copy
$copyalreadydone=1;
}
if ($NUM_SCRIPT !~ /^[0-$cpt\s]+$/)
{
print "This is not a valid package number list.\n";
$found = 0;
}
else
{
$found = 1;
}
}
print "\n";
if ($NUM_SCRIPT) {
foreach my $num (split(/\s+/,$NUM_SCRIPT)) {
$CHOOSEDTARGET{$LISTETARGET[$num-1]}=1;
}
}
else {
foreach my $key (@LISTETARGET) {
$CHOOSEDTARGET{$key}=1;
}
}
}
# Test if requirement is ok
#--------------------------
foreach my $target ( keys %CHOOSEDTARGET ) {
foreach my $req ( split( /[,\s]/, $REQUIREMENTTARGET{$target} ) ) {
foreach my $target (keys %CHOOSEDTARGET) {
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) {
# Test
print "Test requirement for target $target: Search '$req'... ";
$ret=`"$req" 2>&1`;
$coderetour=$?; $coderetour2=$coderetour>>8;
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
# Not found error, we try in PROGPATH
$ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
$coderetour=$?; $coderetour2=$coderetour>>8;
$REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
}
# Test
print "Test requirement for target $target: Search '$req'... ";
$ret = `"$req" 2>&1`;
$coderetour = $?;
$coderetour2 = $coderetour >> 8;
if (
$coderetour != 0
&& ( ( $coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i )
|| ( $coderetour2 == 127 && $OS !~ /windows/ ) )
&& $PROGPATH
)
{
# Not found error, we try in PROGPATH
$ret = `"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
$coderetour = $?;
$coderetour2 = $coderetour >> 8;
$REQUIREMENTTARGET{$target} = "$PROGPATH/$ALTERNATEPATH{$req}/$req";
}
if (
$coderetour != 0
&& ( ( $coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i )
|| ( $coderetour2 == 127 && $OS !~ /windows/ ) )
)
{
# Not found error
print
"Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
$CHOOSEDTARGET{$target} = -1;
last;
}
else {
# Pas erreur ou erreur autre que programme absent
print " Found " . $REQUIREMENTTARGET{$target} . "\n";
}
}
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
# Not found error
print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
$CHOOSEDTARGET{$target}=-1;
last;
} else {
# Pas erreur ou erreur autre que programme absent
print " Found ".$REQUIREMENTTARGET{$target}."\n";
}
}
}
print "\n";
# Check if there is at least on target to build
#----------------------------------------------
$nboftargetok = 0;
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) { next; }
$nboftargetok++;
$nboftargetok=0;
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) { next; }
$nboftargetok++;
}
if ($nboftargetok) {
# Update buildroot
#-----------------
if ( !$copyalreadydone ) {
print "Delete directory $BUILDROOT\n";
$ret = `rm -fr "$BUILDROOT"`;
mkdir "$BUILDROOT";
mkdir "$BUILDROOT/htdocs";
mkdir "$BUILDROOT/htdocs/theme";
# Update buildroot
#-----------------
if (! $copyalreadydone) {
print "Delete directory $BUILDROOT\n";
$ret=`rm -fr "$BUILDROOT"`;
mkdir "$BUILDROOT";
mkdir "$BUILDROOT/htdocs";
mkdir "$BUILDROOT/htdocs/theme";
print "Copy $SOURCE into $BUILDROOT\n";
mkdir "$BUILDROOT";
foreach my $tmp (@PROJECTLIST) {
$ret =
`cp -pr "$SOURCE/htdocs/theme/$tmp" "$BUILDROOT/htdocs/theme"`;
print "Copy $SOURCE into $BUILDROOT\n";
mkdir "$BUILDROOT";
foreach my $tmp (@PROJECTLIST)
{
$ret=`cp -pr "$SOURCE/htdocs/theme/$tmp" "$BUILDROOT/htdocs/theme"`;
}
}
print "Clean $BUILDROOT\n";
$ret =
`rm -fr $BUILDROOT/htdocs/theme/$PROJECT/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/Thumbs.db`;
$ret =
`rm -fr $BUILDROOT/htdocs/theme/$PROJECT/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/*/*/CVS*`;
}
print "Clean $BUILDROOT\n";
$ret=`rm -fr $BUILDROOT/htdocs/theme/$PROJECT/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/Thumbs.db $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/htdocs/theme/$PROJECT/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/*/CVS* $BUILDROOT/htdocs/theme/$PROJECT/*/*/*/*/*/CVS*`;
# Build package for each target
#------------------------------
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) { next; }
print "\nBuild package for target $target\n";
# Build package for each target
#------------------------------
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) { next; }
if ( $target eq 'TGZ' ) {
unlink $FILENAMETGZ . tgz;
print "Compress $BUILDROOT/htdocs into $FILENAMETGZ.tgz...\n";
$cmd =
"tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" htdocs";
$ret = `$cmd`;
if ( $OS =~ /windows/i ) {
print "Move $FILENAMETGZ.tgz to $DESTI/$FILENAMETGZ.tgz\n";
$ret = `mv "$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`;
}
next;
}
print "\nBuild package for target $target\n";
if ( $target eq 'ZIP' ) {
unlink $FILENAMEZIP . zip;
print "Compress $FILENAMETGZ into $FILENAMEZIP.zip...\n";
chdir("$BUILDROOT");
$ret = `7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip htdocs`;
if ($target eq 'TGZ') {
unlink $FILENAMETGZ.tgz;
print "Compress $BUILDROOT/htdocs into $FILENAMETGZ.tgz...\n";
$cmd="tar --exclude-vcs --exclude-from \"$DESTI/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" htdocs";
$ret=`$cmd`;
if ($OS =~ /windows/i) {
print "Move $FILENAMETGZ.tgz to $DESTI/$FILENAMETGZ.tgz\n";
$ret=`mv "$FILENAMETGZ.tgz" "$DESTI/$FILENAMETGZ.tgz"`;
}
next;
}
if ($target eq 'ZIP') {
unlink $FILENAMEZIP.zip;
print "Compress $FILENAMETGZ into $FILENAMEZIP.zip...\n";
chdir("$BUILDROOT");
$ret=`7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip htdocs`;
print "Move $FILENAMEZIP.zip to $DESTI\n";
$ret = `mv "$FILENAMEZIP.zip" "$DESTI/$FILENAMEZIP.zip"`;
next;
}
$ret=`mv "$FILENAMEZIP.zip" "$DESTI/$FILENAMEZIP.zip"`;
next;
}
}
}
}
print "\n----- Summary -----\n";
foreach my $target ( keys %CHOOSEDTARGET ) {
if ( $CHOOSEDTARGET{$target} < 0 ) {
print "Package $target not built (bad requirement).\n";
}
else {
print "Package $target built successfully in $DESTI\n";
}
foreach my $target (keys %CHOOSEDTARGET) {
if ($CHOOSEDTARGET{$target} < 0) {
print "Package $target not built (bad requirement).\n";
} else {
print "Package $target built successfully in $DESTI\n";
}
}
if ( !$btach ) {
print "\nPress key to finish...";
my $WAITKEY = <STDIN>;
if (! $btach) {
print "\nPress key to finish...";
my $WAITKEY=<STDIN>;
}
0;

View File

@@ -24,9 +24,10 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
- Add path to ISCC.exe into the PATH windows var (You can do this by launching wine cmd, then regedit and add entry int `HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH`)
- To manually build the .exe from Windows (Note: running from makepack-dolibarr.pl script is however recommended):
- To manually build the .exe from Windows :
Open the file dev/build/exe/doliwamp.iss and click on button "Compile".
Note: running from makepack-dolibarr.pl script is however recommended
open file dev/build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
@@ -57,8 +58,7 @@ Prerequisites to build autoexe DoliWamp package from Windows:
This section describes steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step.
- Check that all files on local working repository are committed.
- Check all files are committed.
- Update version/info in ChangeLog, for this you can:
To generate a changelog of a **major new version** x.y.0 (from a repo on branch develop), you can do
@@ -92,7 +92,7 @@ git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //
- Run `makepack-dolibarr.pl` to check the generation of all packages. No need to publish them.
- Post a news message on dolibarr.org about the freeze by cloning a past news + relay the news url on social networks. Include the content of the previously generated ChangeLog file into the news.
- Post a news message on dolibarr.org about the freeze by cloning a past news + relay the news url on social networks
- Create a branch x.y (but only when version seems stable enough).
@@ -108,18 +108,18 @@ We suppose the branch x.y has already been created during the beta (see previous
- Check there is no pending open security issue: List can be found here: https://github.com/Dolibarr/dolibarr/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22Priority%20-%20Critical%20or%20Security%22
- Check that all files on local working repository are committed.
- Check all files are committed.
- Update version/info in ChangeLog, for this:
To generate a changelog of a **major new version** x.0.0 (from a repo on branch develop or x.y):
To generate a changelog of a **major new version** x.0.0 (from a repo on branch develop), you can do
```
cd ~/git/dolibarr
git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy
```
To generate a changelog of a **intermediate new version** x.y.0 (from a repo on branch x.y);
To generate a changelog of a **intermediate new version** x.y.0 (from a repo on branch x.y), you can do
```
cd ~/git/dolibarr_x.y

View File

@@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2025 Regis Houssin <regis.houssin@inodbox.com>
# \author (c)2009-2020 Regis Houssin <regis.houssin@inodbox.com>
#----------------------------------------------------------------------------
@@ -30,15 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "22.0.3", "21.0.4", "20.0.4", "19.0.4", "18.0.8", "17.0.4", "16.0.5" );
}
sub script_dolibarr_version_desc
{
local ($ver) = @_;
my ($major_ver) = $ver =~ /^(\d+)\..*/;
return $major_ver == 22 ? "$ver (Latest)" :
$major_ver == 18 ? "$ver (LTS)" : "$ver";
return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
}
sub script_dolibarr_release
@@ -46,11 +38,6 @@ sub script_dolibarr_release
return 2; # for mysqli fix
}
sub script_dolibarr_testable
{
return 1;
}
sub script_dolibarr_category
{
return "Commerce";
@@ -58,23 +45,14 @@ return "Commerce";
sub script_dolibarr_php_vers
{
return ( 7 );
return ( 5 );
}
sub script_dolibarr_php_vars
{
return ( [ 'memory_limit', '128M', '+' ] );
}
sub script_dolibarr_php_modules
{
local ($d, $ver, $phpver, $opts) = @_;
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local @modules = ("xml", "mbstring", "gd", "iconv",
"curl", "intl", "zip");
push(@modules, ($dbtype eq "mysql" ? "mysql" : "pgsql"));
return @modules;
return $dbtype eq "mysql" ? ("mysql") : ("pgsql");
}
sub script_dolibarr_dbs
@@ -83,10 +61,34 @@ local ($d, $ver) = @_;
return ("mysql", "postgres");
}
sub script_dolibarr_php_fullver
# script_dolibarr_depends(&domain, version)
sub script_dolibarr_depends
{
local ($d, $ver, $sinfo) = @_;
return "7.1";
local ($d, $ver, $sinfo, $phpver) = @_;
local @rv;
if ($ver >= 3.6) {
# Check for PHP 5.3+
local $phpv = &get_php_version($phpver || 5, $d);
if (!$phpv) {
push(@rv, "Could not work out exact PHP version");
}
elsif ($phpv < 5.3) {
push(@rv, "Dolibarr requires PHP version 5.3 or later");
}
}
if ($ver >= 12.0) {
# Check for PHP 5.6+
local $phpv = &get_php_version($phpver || 5, $d);
if (!$phpv) {
push(@rv, "Could not work out exact PHP version");
}
elsif ($phpv < 5.6) {
push(@rv, "Dolibarr requires PHP version 5.6 or later");
}
}
return @rv;
}
# script_dolibarr_params(&domain, version, &upgrade-info)
@@ -193,7 +195,7 @@ local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" :
$dbtype eq "mysql" ? "mysqli" : "pgsql";
local $dbhost = &get_database_host($dbtype, $d);
local $dberr = &check_script_db_connection($d, $dbtype, $dbname, $dbuser, $dbpass);
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);
# Extract tar file to temp dir and copy to target
@@ -250,7 +252,7 @@ if ($upgrade) {
&copy_source_dest_as_domain_user($d, $oldcfile, $cfile);
&copy_source_dest_as_domain_user($d, $olddocdir, $docdir);
&copy_source_dest_as_domain_user($d, $oldaltdir, $altdir);
# First page (Update database schema)
local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ],
@@ -258,7 +260,7 @@ if ($upgrade) {
);
local $err = &call_dolibarr_wizard_page(\@params, "upgrade", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Migrate some data)
local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ],
@@ -266,7 +268,7 @@ if ($upgrade) {
);
local $err = &call_dolibarr_wizard_page(\@params, "upgrade2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Update version number)
local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ],
@@ -276,12 +278,12 @@ if ($upgrade) {
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory. (deprecated)
# local $dinstall = "$opts->{'dir'}/install";
# $dinstall =~ s/\/$//;
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
}
else {
# First page (Db connection and config file creation)
@@ -293,9 +295,6 @@ else {
[ "db_name", $dbname ],
[ "db_user", $dbuser ],
[ "db_pass", $dbpass ],
[ "db_prefix", 'llx_' ],
[ "db_port", '3306' ],
[ "selectlang", 'en_US' ],
[ "action", "set" ],
[ "main_force_https", $opts->{'forcehttps'} ],
[ "dolibarr_main_db_character_set", $charset ],
@@ -306,13 +305,13 @@ else {
local $p = $ver >= 3.8 ? "step1" : "etape1";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $p = $ver >= 3.8 ? "step2" : "etape2";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
local @params = ( [ "action", "set" ],
[ "login", "admin" ],
@@ -323,17 +322,17 @@ else {
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory (deprecated)
# local $dinstall = "$opts->{'dir'}/install";
# $dinstall =~ s/\/$//;
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Protect config file
&set_permissions_as_domain_user($d, 0644, $cfile);
&set_permissions_as_domain_user($d, 0755, $cfiledir);
}
# Return a URL for the user
local $rp = $opts->{'dir'};
$rp =~ s/^$d->{'home'}\///;
@@ -401,32 +400,24 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 22.0 ? "dolibarr\\-(22\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 21.0 ? "dolibarr\\-(21\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 20.0 ? "dolibarr\\-(20\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 19.0 ? "dolibarr\\-(19\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 18.0 ? "dolibarr\\-(18\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 17.0 ? "dolibarr\\-(17\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 16.0 ? "dolibarr\\-(16\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 15.0 ? "dolibarr\\-(15\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 14.0 ? "dolibarr\\-(14\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 13.0 ? "dolibarr\\-(13\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
$ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
return "Failed to find versions" if (!@vers);
return $ver eq $vers[0] ? undef : $vers[0];
}
@@ -441,26 +432,4 @@ sub script_dolibarr_passmode
return 2;
}
sub script_dolibarr_db_conn_desc
{
my $db_conn_desc =
{ 'conf/conf.php' =>
{
'dbpass' =>
{
'func' => 'php_quotemeta',
'func_params' => 1,
'replace' => [ '\$dolibarr_main_db_pass\s*=' =>
'$dolibarr_main_db_pass=\'$$sdbpass\';' ],
},
'dbuser' =>
{
'replace' => [ '\$dolibarr_main_db_user\s*=' =>
'$dolibarr_main_db_user=\'$$sdbuser\';' ],
},
}
};
return $db_conn_desc;
}
1;

File diff suppressed because it is too large Load Diff

View File

@@ -30,17 +30,27 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
ErrorDocument 404 /public/error-404.php
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
# Note that you must also enable the module mod_expires.
#ExpiresActive On
#ExpiresByType image/x-icon A2592000
#ExpiresByType image/gif A2592000
#ExpiresByType image/png A2592000
#ExpiresByType image/jpeg A2592000
#ExpiresByType text/css A2592000
#ExpiresByType text/javascript A2592000
#ExpiresByType application/x-javascript A2592000
#ExpiresByType application/javascript A2592000
# OPTIMIZE: To use gzip compressed files (for Dolibarr already compressed files).
# Note that constant MAIN_OPTIMIZE_SPEED must have a value with bit 0 set.
#AddType text/javascript .jgz
#AddEncoding gzip .jgz
# OPTIMIZE: To use gzip compression (on the fly).
# Note that you must also enable the module mod_deflate.
# You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set.
#TODO
# OPTIMIZE: To use cache on static pages (A259200 = 1 month).
# Note that you must also enable the module mod_expires.
#ExpiresActive On
#ExpiresByType image/x-icon A2592000
#ExpiresByType image/gif A2592000
#ExpiresByType image/png A2592000
#ExpiresByType image/jpeg A2592000
#ExpiresByType text/css A2592000
#ExpiresByType text/javascript A2592000
#ExpiresByType application/x-javascript A2592000
#ExpiresByType application/javascript A2592000
</DirectoryMatch>

View File

@@ -1,6 +1,6 @@
This file describes the changes made on external libraries to fix some bugs, after they were included
in Dolibarr external vendor dir (htdocs/includes).
This file describes changes made on external libraries after being included
in Dolibarr root.
@@ -234,7 +234,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
PHP TCPDI:
----------
Add file fpdf_tpl.php 1.2.3
Add file fpdf_tpl.php 1.2
Add file tcpdi.php

View File

@@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "17.5.0"
"zapier-platform-core": "15.0.1"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@@ -26,7 +26,7 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__).'/';
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
@@ -41,26 +41,12 @@ require __DIR__. '/../../htdocs/master.inc.php';
require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
// Global variables
$version = DOL_VERSION;
/*
* Main
* Parameters
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".implode(',', $argv));
if (empty($argv[1])) {
print "Usage: $script_file nbofrecord\n";
print "Usage: $script_file 100\n";
print "\n";
exit(1);
}
define('GEN_NUMBER_FACTURE', ((int) $argv[1]) ?? 1);
define('GEN_NUMBER_FACTURE', $argv[1] ?? 1);
$year = 2016;
$dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
@@ -114,7 +100,7 @@ $dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -27,7 +27,7 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__).'/';
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
@@ -47,28 +47,12 @@ include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
// Global variables
$version = DOL_VERSION;
/*
* Main
* Parameter
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".implode(',', $argv));
if (empty($argv[1])) {
print "Usage: $script_file nbofrecord\n";
print "Usage: $script_file 100\n";
print "\n";
exit(1);
}
define('GEN_NUMBER_COMMANDE', ((int) $argv[1]) ?? 10);
define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10);
$year = 2016;
$dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
@@ -122,7 +106,7 @@ $dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if ($ret <= 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -27,7 +27,7 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__).'/';
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
@@ -46,28 +46,15 @@ include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
// Global variables
$version = DOL_VERSION;
/*
* Main
* Parameters
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".implode(',', $argv));
define('GEN_NUMBER_PRODUIT', $argv[1] ?? 100);
if (empty($argv[1])) {
print "Usage: $script_file nbofrecord\n";
print "Usage: $script_file 100\n";
print "\n";
exit(1);
}
define('GEN_NUMBER_PRODUIT', ((int) $argv[1]) ?? 100);
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
@@ -119,22 +106,15 @@ if ($resql) {
print "Generates ".GEN_NUMBER_PRODUIT." products\n";
for ($s = 0; $s < GEN_NUMBER_PRODUIT; $s++) {
print "Product ".$s;
$produit = new Product($db);
$produit->type = mt_rand(0, 1);
$produit->status = mt_rand(0, 1);
$produit->status_buy = mt_rand(0, 1);
$produit->finished = mt_rand(0, 1);
$produit->stockable_product = mt_rand(0, 1);
$produit->status = 1;
$produit->ref = ($produit->type ? 'S' : 'P').time().$s;
$produit->label = 'Label '.time().$s;
$produit->description = 'This is a long description of '.$produit->ref;
$produit->description = 'Description '.time().$s;
$produit->price = mt_rand(1, 999.99);
$produit->tva_tx = "20.0";
$ret = $produit->create($user);
$ret=$produit->create($user);
if ($ret < 0) {
print "Error $ret - ".$produit->error."\n";
} else {

View File

@@ -27,7 +27,7 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__).'/';
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
@@ -44,27 +44,11 @@ require_once DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php";
require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
// Global variables
$version = DOL_VERSION;
/*
* Main
* Parameters
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".implode(',', $argv));
if (empty($argv[1])) {
print "Usage: $script_file nbofrecord\n";
print "Usage: $script_file 100\n";
print "\n";
exit(1);
}
define('GEN_NUMBER_PROPAL', ((int) $argv[1]) ?? 10);
define('GEN_NUMBER_PROPAL', $argv[1] ?? 10);
$year = 2016;
$dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
@@ -118,7 +102,7 @@ $dates = array(mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -49,29 +49,15 @@ include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$listoftown = array("Auray","Baden","Vannes","Pirouville","Haguenau","Souffelweiersheim","Illkirch-Graffenstaden","Lauterbourg","Picauville","Sainte-Mère Eglise","Le Bono");
$listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Dorothee","Saby","Brigitte","Karine","Jose-Anne","Celine","Virginie");
// Global variables
$version = DOL_VERSION;
/*
* Main
* Parameter
*/
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".implode(',', $argv));
if (empty($argv[1])) {
print "Usage: $script_file nbofrecord\n";
print "Usage: $script_file 100\n";
print "\n";
exit(1);
}
define('GEN_NUMBER_SOCIETE', ((int) $argv[1]) ?? 10);
define('GEN_NUMBER_SOCIETE', $argv[1] ?? 10);
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -41,15 +41,15 @@ require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$delimiter = ',';
$enclosure = '"';
$linelength = 10000;
$escape = '/';
$delimiter=',';
$enclosure='"';
$linelength=10000;
$escape='/';
// Global variables
$version = DOL_VERSION;
$confirmed = 1;
$error = 0;
$version=DOL_VERSION;
$confirmed=1;
$error=0;
/*
@@ -71,15 +71,15 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) |
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n";
print "\n";
exit(1);
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(1);
exit(-1);
}
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -41,15 +41,15 @@ require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$delimiter = ',';
$enclosure = '"';
$linelength = 10000;
$escape = '/';
$delimiter=',';
$enclosure='"';
$linelength=10000;
$escape='/';
// Global variables
$version = DOL_VERSION;
$confirmed = 1;
$error = 0;
$version=DOL_VERSION;
$confirmed=1;
$error=0;
/*
@@ -71,15 +71,15 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) |
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(1);
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(1);
exit(-1);
}
$ret = $user->fetch('', 'admin');
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;

View File

@@ -41,15 +41,15 @@ require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$delimiter = ',';
$enclosure = '"';
$linelength = 10000;
$escape = '/';
$delimiter=',';
$enclosure='"';
$linelength=10000;
$escape='/';
// Global variables
$version = DOL_VERSION;
$confirmed = 1;
$error = 0;
$version=DOL_VERSION;
$confirmed=1;
$error=0;
/*
@@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) |
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(1);
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(1);
exit(-1);
}
$ret=$user->fetch('', 'admin');

View File

@@ -32,7 +32,7 @@ $path=__DIR__.'/';
// Test si mode batch
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit(1);
exit(-1);
}
// Recupere root dolibarr
@@ -187,13 +187,13 @@ if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(1);
exit(-1);
}
if (empty($option)) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n";
exit(1);
exit(-1);
}
if ($option != 'all') {
$listofoptions=explode(',', $option);
@@ -202,7 +202,7 @@ if ($option != 'all') {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n";
exit(1);
exit(-1);
}
}
}
@@ -211,7 +211,7 @@ if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date !=
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
exit(1);
exit(-1);
}
if ($date == 'all') {

View File

@@ -84,7 +84,7 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
print "Return code: 0 if success, <>0 if error\n";
print "Warning, this script may take a long time.\n";
exit(1);
exit(-1);
}
@@ -106,7 +106,7 @@ $connection = ssh2_connect($server, 22);
if ($connection) {
if (!@ssh2_auth_password($connection, $login, $password)) {
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
exit(5);
exit(-5);
} else {
//$stream = ssh2_exec($connection, '/usr/bin/php -i');
/*
@@ -143,7 +143,7 @@ if ($connection) {
}
} else {
print 'Failed to connect to ssh2 to '.$server;
exit(6);
exit(-6);
}

View File

@@ -72,7 +72,7 @@ print "Update dates to current year for database name = ".$db->database_name."\n
if (empty($confirm)) {
print "Usage: $script_file confirm\n";
print "Return code: 0 if success, <>0 if error\n";
exit(1);
exit(-1);
}

View File

@@ -1,7 +0,0 @@
---- Locked files -----
This file is the list of the signatures of some set of files locked to block a commit if files are tried to be modified for a given version.
It is used by the CI or the script to check and guarantee that no change is done on a given scope of files.
Version Scope Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope
x.0.0 unalterable_files 123456

View File

@@ -1,3 +0,0 @@
/dolibarr_schema.mwb.bak
/dolibarr_schema.mwb.sav.mwb
/dolibarr_schema.mwb.sav.mwb.bak

View File

@@ -2,33 +2,33 @@
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
# Add this to use a custom apparmor profile when using apache php handler
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
# The URLs of the web site
ServerName myvirtualalias
ServerAlias myvirtualalias
UseCanonicalName On
KeepAlive On
KeepAliveTimeout 5
MaxKeepAliveRequests 20
AddDefaultCharset UTF-8
# Detect if we are using DoliDroid
#SetEnvIf User-Agent DoliDroid dolidroid
# The directory and permissions for the web site
DocumentRoot "/home/.../htdocs"
<Directory /home/.../htdocs/>
@@ -36,19 +36,24 @@
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
Require all granted
# To restrict access by a HTTP basic auth
# To restrict access by a HTTP basic auth
#AuthType Basic
#AuthName "Authenticate to backoffice"
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory>
# Leaving /public, /dav and /.well_known directory accessible to everyone
# Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
AuthType None
Satisfy any
Require all granted
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
AuthType None
Satisfy any
Require all granted
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
AuthType None
Satisfy any
@@ -59,14 +64,6 @@
Satisfy any
Require all granted
</Directory>
# You may also want to allow access to everyone to wrappers for api, document, viewimage, manifest and public json/img
# but if you can avoid it, it is better.
<Files /home/admin/wwwroot/dolibarr/htdocs/api/index.php>
AuthType None
Satisfy any
Require all granted
</Files>
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
AuthType None
Satisfy any
@@ -74,11 +71,11 @@
</Files>
# Log directives
# Log directives
ErrorLog /var/log/apache2/myvirtualalias_error_log
TransferLog /var/log/apache2/myvirtualalias_access_log
# Compress is done on resources of type php pages, text file export, css and javascript
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
AddType text/javascript .jgz
@@ -95,21 +92,21 @@
ExpiresByType text/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
# To enable the SSL if the certificate file exists
<IfFile "/etc/letsencrypt/live/www.mydomain.com/cert.pem">
SSLEngine On
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</IfFile>
</VirtualHost>

View File

@@ -28,15 +28,8 @@
<rule ref="Internal.NoCodeFound" />
<!-- Rules from Generic Standard -->
<!--
<rule ref="PSR12.Files.OpenTag">
<properties>
<property name="ignoreIndent" value="true"/>
</properties>
</rule>
<exclude name="PSR12.WhiteSpace.ScopeIndent"/>
-->
<!-- We want to allow empty statement: It allows to put some code comments into the else for examples -->
<rule ref="Generic.CodeAnalysis.EmptyStatement">

View File

@@ -1,5 +0,0 @@
To enable a default git commit template:
git config --local commit.template gitmessage
To enable the git hook pre-commit, to make CI validation at commit:
See the file pre-commit/README.md

View File

@@ -1,12 +0,0 @@
#!/bin/sh
# Hook to force a prefix on commits
commit_msg_file=$1
first_line=$(head -n1 "$commit_msg_file")
if echo "$first_line" | grep -Eqi '^(QUAL|SEC|PERF|FIX|CLOSE|NEW|Clean code|Debug[CSS)'; then
exit 0
else
echo "The commit message must start with QUAL, SEC, PERF, FIX, CLOSE, NEW, Clean code, Debug, CSS ..."
exit 1
fi

View File

@@ -12,10 +12,10 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")
if [ -x "$INSTALL_PYTHON" ]; then
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" 1>&2
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" 1>&2
elif command -v pre-commit > /dev/null; then
exec pre-commit "${ARGS[@]}" 1>&2
exec pre-commit "${ARGS[@]}" 1>&2
else
echo 'pre-commit not found. Did you forget to activate your virtualenv?' 1>&2
exit 1
echo 'pre-commit not found. Did you forget to activate your virtualenv?' 1>&2
exit 1
fi

View File

@@ -33,7 +33,7 @@ do
result1=$?
if [ "$result1" != "0" ]
if [ "x$result1" != "x0" ]
then
echo "Fix the error before commit." 1>&2
exit 1
@@ -56,10 +56,10 @@ then
result2=$?
if [ "$result2" != "0" ]
if [ "x$result2" != "x0" ]
then
# Fix standard errors
if [ "$AUTOFIX" != "0" ]
if [ "x$AUTOFIX" != "x0" ]
then
# shellcheck disable=2086,2090
"${DIRPHPCS}phpcbf" -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES

View File

@@ -1,12 +0,0 @@
# Example of logrotate file to put into /etc/logrotate.d to make the rotation of
# the dolibarr log files.
/home/admin/wwwroot/dolibarr_documents/*.log {
su admin www-data
daily
rotate 7
compress
delaycompress
missingok
notifempty
create 660 admin www-data
}

View File

@@ -44,10 +44,10 @@ function save_db_cache() (
# DETERMINE VERSION
cd "${TRAVIS_BUILD_DIR}/htdocs/install" || exit 1
# Get the target version from the version.inc.php file
target_version=$(sed -n "s/.*define('DOL_\\(MAJOR_\\)\\?VERSION',[[:space:]]*'\\([0-9.]*\\).*/\\2/p" ../version.inc.php) ; echo $target_version
# Get the target version from the filefunc.inc.php file
target_version=$(sed -n "s/.*define('DOL_VERSION',[[:space:]]*'\\([0-9.]*\\).*/\\1/p" ../filefunc.inc.php) ; echo $target_version
# Default in case that failed
target_version=${target_version:=22.0.0}
target_version=${target_version:=20.0.0}
# Sequence of versions for upgrade process (to be completed)
VERSIONS=("3.5.0" "3.6.0" "3.7.0" "3.8.0" "3.9.0")

View File

@@ -1,33 +0,0 @@
README (English)
--------------------------------
##############
RapidAPI
##############
RapidAPI for Mac is a full-featured HTTP client that let's you test and describe the APIs you build or consume.
It has a beautiful native macOS interface to compose requests, inspect server responses, generate client code and export API definitions.
https://paw.cloud/
@@@
(@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@%
@@@@@@, @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@,
@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
(@@@@@@( @@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@* @@@@@@@@@@@. /@@@@@@@@@@@@@@@@@(
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* @@@@@@@@@@@. @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ /@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@# @@@@@@@@@@@ @@@@@@@@@@@@&
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ @@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ &@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@ &@@@@@@@@@@@@@@@@@@@@/
@@@@@@@@@@@@@@@@@@@@@@@@@@& .@@@@@@@@@@@ &@@@@@@@@@@@@@@@@@@/
(@@@@@@@@@@@@@@@@@@@@@@@ .@@@@@@@@@@@ &@@@@@@@@@@@@@@@(
@@@@@ @@@@@ .@@@@@@@@@@@ @@@@@@@@@@@*

View File

@@ -124,28 +124,28 @@ $urlgit = 'https://github.com/Dolibarr/dolibarr/blob/develop/';
$output_arrproj = array();
$output_arrdep = array();
if ($dirscc != 'disabled') {
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=htdocs/custom,htdocs/includes,htdocs/public/includes,htdocs/theme/common/fontawesome-5,htdocs/public/theme/common/fontawesome-5 --cocomo-project-type semi-detached';
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc . --exclude-dir=htdocs/includes,htdocs/custom,htdocs/theme/common/fontawesome-5,htdocs/theme/common/octicons';
print 'Execute SCC to count lines of code in project: '.$commandcheck."\n";
$resexecproj = 0;
exec($commandcheck, $output_arrproj, $resexecproj);
// Count lines of code of dependencies
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes htdocs/public/includes htdocs/theme/common/fontawesome-5 htdocs/public/theme/common/fontawesome-5 --cocomo-project-type semi-detached';
$commandcheck = ($dirscc ? $dirscc.'/' : '').'scc htdocs/includes htdocs/theme/common/fontawesome-5 htdocs/theme/common/octicons';
print 'Execute SCC to count lines of code in dependencies: '.$commandcheck."\n";
$resexecdep = 0;
exec($commandcheck, $output_arrdep, $resexecdep);
}
// Get technical debt with PHPStan
$output_arrver = array();
$output_arrtd = array();
if ($dirphpstan != 'disabled') {
$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --version';
print 'Execute PHPStan to get the version: '.$commandcheck."\n";
$resexecver = 0;
exec($commandcheck, $output_arrver, $resexecver);
$resexectd = 0;
exec($commandcheck, $output_arrtd, $resexectd);
}
$phpstanversion = $output_arrver[0];
$phpstanversion = $output_arrtd[0];
$output_arrtd = array();
if ($dirphpstan != 'disabled') {
@@ -156,15 +156,6 @@ if ($dirphpstan != 'disabled') {
}
// Get technical debt with Phan
$output_arrverphan = array();
if ($dirphpstan != 'disabled') {
$commandcheck = ($dir_phan ? $dir_phan.DIRECTORY_SEPARATOR : '') .'phan --version';
print 'Execute Phan to get the version: '.$commandcheck."\n";
$resexecverphan = 0;
exec($commandcheck, $output_arrverphan, $resexecverphan);
}
$phpphanversion = $output_arrverphan[0];
$output_phan_json = array();
$res_exec_phan = 0;
if ($dir_phan != 'disabled') {
@@ -221,13 +212,13 @@ foreach (array('proj', 'dep') as $source) {
$arrayofmetrics[$source]['Bytes'] = $reg[1];
}
if (preg_match('/^(.*)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)\s+([\d,]+)$/', $line, $reg)) {
$arrayoflineofcode[$source][$reg[1]]['Files'] = str_replace(array(',', ' '), array('', ''), $reg[2]);
$arrayoflineofcode[$source][$reg[1]]['Lines'] = str_replace(array(',', ' '), array('', ''), $reg[3]);
$arrayoflineofcode[$source][$reg[1]]['Blanks'] = str_replace(array(',', ' '), array('', ''), $reg[4]);
$arrayoflineofcode[$source][$reg[1]]['Comments'] = str_replace(array(',', ' '), array('', ''), $reg[5]);
$arrayoflineofcode[$source][$reg[1]]['Code'] = str_replace(array(',', ' '), array('', ''), $reg[6]);
$arrayoflineofcode[$source][$reg[1]]['Complexity'] = str_replace(array(',', ' '), array('', ''), $reg[7]);
if (preg_match('/^(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/', $line, $reg)) {
$arrayoflineofcode[$source][$reg[1]]['Files'] = $reg[2];
$arrayoflineofcode[$source][$reg[1]]['Lines'] = $reg[3];
$arrayoflineofcode[$source][$reg[1]]['Blanks'] = $reg[4];
$arrayoflineofcode[$source][$reg[1]]['Comments'] = $reg[5];
$arrayoflineofcode[$source][$reg[1]]['Code'] = $reg[6];
$arrayoflineofcode[$source][$reg[1]]['Complexity'] = $reg[7];
}
}
@@ -254,20 +245,19 @@ foreach (array('proj', 'dep') as $source) {
}
// Get stats on nb of commits
/*
$nbofmonth = 2;
$delay = (3600 * 24 * 30 * $nbofmonth);
// Get stats on nb of commits
$commandcheck = "git log --all --shortstat --no-renames --no-merges --use-mailmap --pretty=".escapeshellarg('format:%cI;%H;%aN;%aE;%ce;%s')." --since=".dol_print_date(dol_now() - $delay, '%Y-%m-%d'); // --since= --until=...
print 'Execute git log to get list of commits: '.$commandcheck."\n";
$output_arrglpu = array();
$resexecglpu = 0;
//exec($commandcheck, $output_arrglpu, $resexecglpu);
*/
// Get git information for security alerts
$nbofmonth = 6;
$nbofmonth = 3;
$delay = (3600 * 24 * 30 * $nbofmonth);
$arrayofalerts = array();
@@ -276,14 +266,14 @@ print 'Execute git log to get commits related to security: '.$commandcheck."\n";
$output_arrglpu = array();
$resexecglpu = 0;
exec($commandcheck, $output_arrglpu, $resexecglpu);
foreach ($output_arrglpu as $valgitlog) { // The most recent lines are first.
foreach ($output_arrglpu as $val) {
// Parse the line to split interesting data
$tmpval = cleanVal2($valgitlog);
$tmpval = cleanVal2($val);
if (preg_match('/(#yogosha|CVE[\s\-]*\d|Sec:|Sec\s|Sec$)/i', $tmpval['title'])) { // Recommended git comment: "Sec: Fix #..."
if (preg_match('/(#yogosha|CVE|Sec:|Sec\s|Sec$)/i', $tmpval['title'])) { // Recommended git comment: "Sec: Fix #..."
$alreadyfound = '';
$alreadyfoundcommitid = '';
foreach ($arrayofalerts as $val) { // Loop on already found alerts
foreach ($arrayofalerts as $val) {
if ($val['issueidyogosha'] && $val['issueidyogosha'] == $tmpval['issueidyogosha']) { // Already in list
$alreadyfound = 'yogosha';
$alreadyfoundcommitid = $val['commitid'];
@@ -299,9 +289,7 @@ foreach ($output_arrglpu as $valgitlog) { // The most recent lines are first.
$alreadyfoundcommitid = $val['commitid'];
break;
}
if ($val['title'] && $tmpval['title'] &&
(strpos($val['title'], $tmpval['title']) === 0 || strpos($val['title'], $tmpval['title']) > 0
|| strpos($tmpval['title'], $val['title']) === 0 || strpos($tmpval['title'], $val['title']) > 0)) { // Already in list
if ($val['title'] && $val['title'] == $tmpval['title']) { // Already in list
$alreadyfound = 'title';
$alreadyfoundcommitid = $val['commitid'];
break;
@@ -349,22 +337,70 @@ foreach ($output_arrglpu as $valgitlog) { // The most recent lines are first.
/*var_dump($tmpval['commitid'].' '.$alreadyfoundcommitid);
var_dump($arrayofalerts[$alreadyfoundcommitid]['branch']);
var_dump($tmpval);*/
$arrayofalerts[$alreadyfoundcommitid]['commitidbis'][] = $tmpval['commitid']; // Concat the new commitid to the list of commitidbis array of the already found case.
if (empty($arrayofalerts[$alreadyfoundcommitid]['issueid']) && !empty($tmpval['issueid'])) { // If not Github was defined, we set it.
$arrayofalerts[$alreadyfoundcommitid]['issueid'] = $tmpval['issueid'];
}
if ($arrayofalerts[$alreadyfoundcommitid]['title'] != $tmpval['title']) { // Concat label of the new line to the already found one (if it differs)
$arrayofalerts[$alreadyfoundcommitid]['title'] .= ', '.preg_replace('/\.$/', '', $tmpval['title']);
}
$arrayofalerts[$alreadyfoundcommitid]['branch'] = array_merge($arrayofalerts[$alreadyfoundcommitid]['branch'], $tmpval['branch']);
$arrayofalerts[$alreadyfoundcommitid]['commitidbis'][] = $tmpval['commitid'];
}
}
}
/*
//$urlgit = 'https://api.github.com/search/issues?q=is:pr+repo:Dolibarr/dolibarr+created:>'.dol_print_date(dol_now() - $delay, "%Y-%m");
$urlgit = 'https://api.github.com/search/commits?q=repo:Dolibarr/dolibarr+yogosha+created:>'.dol_print_date(dol_now() - $delay, "%Y-%m");
// Count lines of code of application
$newurl = $urlgit.'+CVE';
$result = getURLContent($newurl);
print 'Execute GET on github for '.$newurl."\n";
if ($result && $result['http_code'] == 200) {
$arrayofalerts1 = json_decode($result['content']);
foreach ($arrayofalerts1->items as $val) {
$tmpval = cleanVal($val);
if (preg_match('/CVE/i', $tmpval['title'])) {
$arrayofalerts[$tmpval['number']] = $tmpval;
}
}
} else {
print 'Error: failed to get github response';
exit(-1);
}
$newurl = $urlgit.'+yogosha';
$result = getURLContent($newurl);
print 'Execute GET on github for '.$newurl."\n";
if ($result && $result['http_code'] == 200) {
$arrayofalerts2 = json_decode($result['content']);
foreach ($arrayofalerts2->items as $val) {
$tmpval = cleanVal($val);
if (preg_match('/yogosha:/i', $tmpval['title'])) {
$arrayofalerts[$tmpval['number']] = $tmpval;
}
}
} else {
print 'Error: failed to get github response';
exit(-1);
}
$newurl = $urlgit.'+Sec:';
$result = getURLContent($newurl);
print 'Execute GET on github for '.$newurl."\n";
if ($result && $result['http_code'] == 200) {
$arrayofalerts3 = json_decode($result['content']);
foreach ($arrayofalerts3->items as $val) {
$tmpval = cleanVal($val);
if (preg_match('/Sec:/i', $tmpval['title'])) {
$arrayofalerts[$tmpval['number']] = $tmpval;
}
}
} else {
print 'Error: failed to get github response';
exit(-1);
}
*/
$timeend = time();
@@ -688,6 +724,12 @@ $html .= <<<END
END;
$html .= '<!-- ';
foreach ($output_arrglpu as $line) {
$html .= $line."\n";
}
$html .= ' -->';
$html .= '</div>';
$html .= '</section>'."\n";
@@ -742,19 +784,19 @@ $html .= '</div>';
$html .= '</section>'."\n";
// Project value (COCOMO Model, use Basic / Semi-detached
// Project value
$html .= '<section class="chapter" id="projectvalue">'."\n";
$html .= '<h2><span class="fas fa-dollar-sign pictofixedwidth"></span>Project value</h2>'."\n";
$html .= '<div class="boxallwidth">'."\n";
$html .= '<div class="box inline-box back1">';
$html .= 'COCOMO value<br><span class="small opacitymedium">(Basic/Semi-detached model)</span><br>';
$html .= 'COCOMO value<br><span class="small opacitymedium">(Basic organic model)</span><br>';
$html .= '<b>$'.formatNumber((empty($arraycocomo['proj']['currency']) ? 0 : $arraycocomo['proj']['currency']) + (empty($arraycocomo['dep']['currency']) ? 0 : $arraycocomo['dep']['currency']), 2).'</b>';
$html .= '</div>';
if (array_key_exists('proj', $arraycocomo)) {
$html .= '<div class="box inline-box back2">';
$html .= 'COCOMO effort<br><span class="small opacitymedium">(Basic/Semi-detached model)</span><br>';
$html .= 'COCOMO effort<br><span class="small opacitymedium">(Basic organic model)</span><br>';
$html .= '<b>'.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj']['effort'] + $arraycocomo['dep']['people'] * $arraycocomo['dep']['effort']);
$html .= ' months people</b>';
$html .= '</div>';
@@ -835,7 +877,7 @@ if (count($output_phan_json) != 0) {
$title_security_short = "Last security issues";
$title_security = ($project ? "[".$project."] " : "").$title_security_short;
$html .= '<section class="chapter" id="securityalerts">'."\n";
$html .= '<section class="chapter" id="linesofcode">'."\n";
$html .= '<h2><span class="fas fa-code pictofixedwidth"></span>'.$title_security_short.' <span class="opacitymedium">(last '.($nbofmonth != 1 ? $nbofmonth.' months' : 'month').')</span></h2>'."\n";
$html .= '<div class="boxallwidth">'."\n";
@@ -911,7 +953,7 @@ foreach ($arrayofalerts as $key => $alert) {
}
$html .= '</td>';
// Title - Description
// Description
$html .= '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($alert['title']).'">'.dol_escape_htmltag($alert['title']).'</td>';
// Branches
@@ -932,7 +974,7 @@ $html .= '</div>';
$html .= '</div>';
$html .= '<br>';
$html .= 'Note:Search is done in git repository on regex string "#yogosha|CVE[\s\-]*\d|Sec:|Sec\s" (not case sensitive)<br>';
$html .= 'Note:Search is done in git repository on regexstring #yogosha|CVE|Sec:|Sec\s<br>';
$html .= 'You can use this URL for RSS notifications: <a href="/'.$outputfilerss.'">'.$outputfilerss.'</a><br><br>';
$html .= '</section>';
@@ -1040,7 +1082,7 @@ if ($dir_phan != 'disabled') {
]});
';
$html .= '<section class="chapter" id="technicaldebtphan">'."\n";
$html .= '<h2><span class="fas fa-book-dead pictofixedwidth"></span>Technical debt <span class="opacitymedium">('.$phpphanversion.' -> '.$phan_nblines.' warnings)</span></h2>'."\n";
$html .= '<h2><span class="fas fa-book-dead pictofixedwidth"></span>Technical debt <span class="opacitymedium">(PHAN '.$phan_nblines.' warnings)</span></h2>'."\n";
$html .= '<div class="boxallwidth">'."\n";
$html .= '<div class="div-table-responsive">'."\n";
@@ -1137,7 +1179,7 @@ function cleanVal2($val)
$tmpval['issueid'] = '';
$tmpval['issueidyogosha'] = '';
$tmpval['issueidcve'] = '';
$tmpval['title'] = array_key_exists(5, $tmp) ? preg_replace('/\.$/', '', $tmp[5]) : '';
$tmpval['title'] = array_key_exists(5, $tmp) ? $tmp[5] : '';
$tmpval['created_at'] = array_key_exists(0, $tmp) ? $tmp[0] : '';
$tmpval['updated_at'] = '';
@@ -1146,7 +1188,7 @@ function cleanVal2($val)
$tmpval['issueid'] = $reg[1];
}
if (preg_match('/CVE([0-9\-\s]+)/', $tmpval['title'], $reg)) {
$tmpval['issueidcve'] = preg_replace('/^\-/', '', preg_replace('/\s+/', '-', trim($reg[1])));
$tmpval['issueidcve'] = preg_replace('/^\-/', '', trim($reg[1]));
}
if (preg_match('/#yogosha(\d+)/i', $tmpval['title'], $reg)) {
$tmpval['issueidyogosha'] = $reg[1];

View File

@@ -13,7 +13,7 @@ zar
# Need as part of some PHP keys for some array variables
referer
# Name of contributors
# Name of contributores
noe
udo
tim
@@ -90,7 +90,7 @@ espace
methode
datee
# Some string found because it is part of text that is html entities escaped into files
# Some string found because it is part text that is html entities escaped into files
tre
activ

View File

@@ -11,386 +11,351 @@
# Pour les cles autoincrement: rowid integer AUTO_INCREMENT PRIMARY KEY,
# Mettre les index dans fichier.key.sql
#------------------------------------------------------------------------------
## no critic (InputOutput::ProhibitExplicitStdin,InputOutput::RequireBriefOpen)
use Data::Dumper;
use Getopt::Long;
use strict;
use warnings;
use vars qw/ $DIR $PROG $Extension $SOURCE $DESTI %filelist $stop /;
# command line options
my ( $opt_debug, $opt_help );
my( $opt_debug, $opt_help);
# general values
my ( $out, $size );
my ($out, $size);
# variables for constructing pre-create-table entities
my $create_sql = ''; # if empty we are not making a create statement
my $create_index = ''; # if empty we are not making a create statement
my %enum_datafield = (); # holds enumeration choices
my ( @column_values, $enum_column, $seq );
my $table = "";
my $create_sql=''; # if empty we are not making a create statement
my $create_index=''; # if empty we are not making a create statement
my %enum_datafield=(); # holds enumeration choices
my (@column_values,$enum_column, $seq);
my $table="";
#------------------------------------------------------------------------------
# MAIN
#------------------------------------------------------------------------------
( $DIR = $0 ) =~ s/([^\/\\]+)$//;
( $PROG = $1 ) =~ s/\.([^\.]*)$//;
$Extension = $1;
$DIR ||= '.';
$DIR =~ s/([^\/\\])[\\\/]+$/$1/;
($DIR=$0) =~ s/([^\/\\]+)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1;
$DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE = "$DIR/install/mysql/tables";
$DESTI = "$DIR/install/pgsql/tables";
$SOURCE="$DIR/install/mysql/tables";
$DESTI="$DIR/install/pgsql/tables";
# Recherche tous les fichiers .sql
opendir( my $dir, $SOURCE );
foreach my $file ( readdir($dir) ) {
if ( $file =~ /\.sql$/ && -f "$SOURCE/$file" ) {
print "Found file $file\n";
$filelist{$file} = 1;
}
}
closedir($dir);
opendir(DIR, $SOURCE);
foreach my $file (readdir(DIR)) {
if ($file =~ /\.sql$/ && -f "$SOURCE/$file") {
print "Found file $file\n";
$filelist{$file}=1;
}
}
closedir(DIR);
# Boucle sur tous les fichiers de SOURCE
#---------------------------------------
foreach my $file ( keys %filelist ) {
foreach my $file (keys %filelist) {
local $ARGV[0] = "$SOURCE/$file";
local $ARGV[1] = "$DESTI/$file";
$ARGV[0]="$SOURCE/$file";
$ARGV[1]="$DESTI/$file";
print "Convert file $ARGV[0] into $ARGV[1]\n";
print "Convert file $ARGV[0] into $ARGV[1]\n";
# MySQL to PostgreSQL dump file converter
#
# For usage: perl mysql2pgsql.perl --help
#
# homepage: http://www.rot13.org/~dpavlin/projects.html
# 1999-12-15 DbP -- Dobrica Pavlinusic <dpavlin@rot13.org>
# 1999-12-26 DbP don't make serial from auto_increment, create all manually
# (to set start value right)
# 2000-01-11 DbP now creates sequences with correct value
# 2000-04-25 DbP import into CVS (at cvs.linux.hr)
# 2001-01-29 tpo -- Tomas Pospisek <tpo@sourcepole.ch>:
# 1) make script comply to usage:
# 2) make script output to STDOUT instead of STERR
# 3) change verbosity behaveour
# 4) add debug option
# see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql
# 2003-12-16 jsp -- Joe Speigle <joe.speigle@jklh.us>:
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
# auto_increment->sequences
# 2004-01-13 jsp -- moved project to gborg; both the above declined ownership
# 2004-06-29 converts: year(4), year(2)
# homepage: gborg.postgresql.org
# MySQL to PostgreSQL dump file converter
#
# For usage: perl mysql2pgsql.perl --help
#
# homepage: http://www.rot13.org/~dpavlin/projects.html
# 1999-12-15 DbP -- Dobrica Pavlinusic <dpavlin@rot13.org>
# 1999-12-26 DbP don't make serial from auto_increment, create all manually
# (to set start value right)
# 2000-01-11 DbP now creates sequences with correct value
# 2000-04-25 DbP import into CVS (at cvs.linux.hr)
# 2001-01-29 tpo -- Tomas Pospisek <tpo@sourcepole.ch>:
# 1) make script comply to usage:
# 2) make script output to STDOUT instead of STERR
# 3) change verbosity behaveour
# 4) add debug option
# see rest of changelog at http://cvs.linux.hr/cvsweb.cgi/sql/mysql2pgsql
# 2003-12-16 jsp -- Joe Speigle <joe.speigle@jklh.us>:
# converts: s/\) *Type=MyISAM;/);/i, enum data type -> references,
# auto_increment->sequences
# 2004-01-13 jsp -- moved project to gborg; both the above declined ownership
# 2004-06-29 converts: year(4), year(2)
# homepage: gborg.postgresql.org
GetOptions( "debug", "help" );
GetOptions("debug", "help");
my $DEBUG = $opt_debug || 0;
my $HELP = $opt_help || 0;
my $DEBUG = $opt_debug || 0;
my $HELP = $opt_help || 0;
if ( ($HELP) || !defined( $ARGV[0] ) || !defined( $ARGV[1] ) ) {
print
"Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n";
print "\t* OPTIONS\n";
print
"\t--verbose tees to pg_dump_file.sql and STDOUT during conversion\n";
print "\t--debug does ?? \n";
print "\t--help prints this message \n";
print "\t* REQUIRED ARGUMENTS\n";
if ( defined( $ARGV[0] ) ) {
print "\tmysql_dump_file.sql ($ARGV[0])\n";
}
else {
print "\tmysql_dump_file.sql (undefined)\n";
}
if ( defined( $ARGV[1] ) ) {
print "\tpg_dump_file.sql ($ARGV[1])\n";
}
else {
print "\tpg_dump_file.sql (undefined)\n";
}
exit 1;
}
open( my $in, "<", "$ARGV[0]" )
|| die "can't open mysql dump file $ARGV[0]";
open( my $out, ">", "$ARGV[1]" ) || die "can't open pg dump file $ARGV[1]";
print $out "-- Generated by $PROG\n";
print $out "-- (c) 2004, PostgreSQL Inc.\n";
print $out "-- (c) 2005, Laurent Destailleur.\n";
print $out "\n";
if (($HELP) || ! defined($ARGV[0]) || ! defined($ARGV[1])) {
print "Usage: perl $0 {--verbose|--help|--debug} mysql_dump_file.sql pg_dump_file.sql\n";
print "\t* OPTIONS\n";
print "\t--verbose tees to pg_dump_file.sql and STDOUT during conversion\n";
print "\t--debug does ?? \n";
print "\t--help prints this message \n";
print "\t* REQUIRED ARGUMENTS\n";
if (defined ($ARGV[0])) {
print "\tmysql_dump_file.sql ($ARGV[0])\n";
} else {
print "\tmysql_dump_file.sql (undefined)\n";
}
if (defined ($ARGV[1])) {
print "\tpg_dump_file.sql ($ARGV[1])\n";
} else {
print "\tpg_dump_file.sql (undefined)\n";
}
exit 1;
}
# Output for create table and create index
sub output_create {
open(IN,"<$ARGV[0]") || die "can't open mysql dump file $ARGV[0]";
open(OUT,">$ARGV[1]") || die "can't open pg dump file $ARGV[1]";
print OUT "-- Generated by $PROG\n";
print OUT "-- (c) 2004, PostgreSQL Inc.\n";
print OUT "-- (c) 2005, Laurent Destailleur.\n";
print OUT "\n";
# If command ends with "xxx,);", we change to "xxx);"
$create_sql =~ s/,(\s*)\);/$1\);/m;
# Output for create table and create index
sub output_create {
# If command ends with "xxx,);", we change to "xxx);"
$create_sql =~ s/,(\s*)\);/$1\);/m;
# If command ends with "xxx, -- yyy );", we change to "xxx -- yyy);"
$create_sql =~ s/,(\s*\-\-[^\)\n]*)(\s*)\);/$1\n\);/m;
# If command ends with "xxx, -- yyy );", we change to "xxx -- yyy);"
$create_sql =~ s/,(\s*\-\-[^\)\n]*)(\s*)\);/$1\n\);/m;
print OUT $create_sql;
if ($create_index) {
print OUT "\n";
print OUT $create_index;
}
}
print $out $create_sql;
if ($create_index) {
print $out "\n";
print $out $create_index;
}
return;
}
# Reset when moving from each "create table" to "insert" part of dump
sub reset_vars() {
$create_sql="";
$create_index="";
%enum_datafield=();
$enum_column='';
}
# Reset when moving from each "create table" to "insert" part of dump
sub reset_vars() {
$create_sql = "";
$create_index = "";
%enum_datafield = ();
$enum_column = '';
return;
}
# Boucle sur contenu fichier source
#----------------------------------
while (<$in>) {
# Boucle sur contenu fichier source
#----------------------------------
while(<IN>) {
# comments or empty lines
if (/^-- \$Id/) {
$_ =~ s/\$//g;
print $out $_;
if (/^-- \$Id/) {
$_ =~ s/\$//g;
print OUT $_;
next;
}
# comments or empty lines
if ( /^#/ || /^$/ || /^--/ ) {
print $out $_;
next;
}
if (/^USE\s*([^;]*);/) {
print $out "\\c " . $1;
next;
}
if ( $create_sql ne "" )
{ # we are inside create table statement so let's process datatypes
if (/^#/ || /^$/ || /^--/) {
print OUT $_;
next;
}
if (/^USE\s*([^;]*);/) {
print OUT "\\c ". $1;
next;
}
if ($create_sql ne "") { # we are inside create table statement so let's process datatypes
if (/\);/i) { # end of create table sequence
$create_sql =~ s/,$//g; # strip last , inside create table
&output_create;
&reset_vars();
next;
if (/\);/i) { # end of create table sequence
$create_sql =~ s/,$//g; # strip last , inside create table
&output_create;
&reset_vars();
next;
# LDR Added "innodb" and "engine"
}
elsif (/(ISAM|innodb)/i) { # end of create table sequence
s/\) *type=(MyISAM|innodb);/);/i;
s/\) *engine=(MyISAM|innodb);/);/i;
$create_sql =~ s/,$//g; # strip last , inside create table
$create_sql .= $_;
&output_create;
&reset_vars();
next;
}
# LDR Added "innodb" and "engine"
}
elsif (/(ISAM|innodb)/i) { # end of create table sequence
s/\) *type=(MyISAM|innodb);/);/i;
s/\) *engine=(MyISAM|innodb);/);/i;
$create_sql =~ s/,$//g; # strip last , inside create table
$create_sql .= $_;
&output_create;
&reset_vars();
next;
}
# enum -> check
if (/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i) {
$enum_column=$1;
$enum_datafield{$enum_column}=$2; # 'abc','def', ...
my $suite=$3;
my $maxlength=0;
foreach my $enum (split(',',$enum_datafield{$enum_column})) {
$enum =~ s/[\"\']//g;
if ($maxlength<length($enum)) { $maxlength=length($enum); }
}
$enum_datafield{$enum_column} =~ s/\"/\'/g;
$_ = qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~;
# int, auto_increment -> serial
} elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
$seq = qq~${table}_${1}_seq~;
s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
$create_sql.=$_;
next;
# int type conversion
} elsif (/(\w*)int\(\d+\)/i) {
$size=$1;
$size =~ tr [A-Z] [a-z];
if ($size eq "tiny" || $size eq "small") {
$out = "int2";
} elsif ($size eq "big") {
$out = "int8";
} else {
$out = "int4";
}
s/\w*int\(\d+\)/$out/g;
}
# tinyint -> smallint
elsif (/tinyint/i) {
s/tinyint/smallint/g;
}
# enum -> check
if (
/([\w\"]*)\s+enum\s*\(((?:['"][\?\w]+['"]\s*,)+['"][\?\w]+['"])\)(.*)$/i
)
{
$enum_column = $1;
$enum_datafield{$enum_column} = $2; # 'abc','def', ...
my $suite = $3;
my $maxlength = 0;
foreach my $enum ( split( ',', $enum_datafield{$enum_column} ) )
{
$enum =~ s/[\"\']//g;
if ( $maxlength < length($enum) ) {
$maxlength = length($enum);
}
}
$enum_datafield{$enum_column} =~ s/\"/\'/g;
$_ =
qq~ $enum_column CHAR($maxlength) CHECK ($enum_column IN ($enum_datafield{$enum_column})) $suite\n~;
# nuke unsigned
s/(int\w+|smallint)\s+unsigned/$1/gi;
# int, auto_increment -> serial
}
elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
$seq = qq~${table}_${1}_seq~;
s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
$create_sql .= $_;
next;
# int type conversion
}
elsif (/(\w*)int\(\d+\)/i) {
$size = $1;
$size =~ tr [A-Z] [a-z];
if ( $size eq "tiny" || $size eq "small" ) {
$out = "int2";
}
elsif ( $size eq "big" ) {
$out = "int8";
}
else {
$out = "int4";
}
s/\w*int\(\d+\)/$out/g;
}
# blob -> text
s/\w*blob/text/gi;
# tinyint -> smallint
elsif (/tinyint/i) {
s/tinyint/smallint/g;
}
# tinytext/mediumtext -> text
s/tinytext/text/gi;
s/mediumtext/text/gi;
# nuke unsigned
s/(int\w+|smallint)\s+unsigned/$1/gi;
# char -> varchar
# PostgreSQL would otherwise pad with spaces as opposed
# to MySQL! Your user interface may depend on this!
s/(\s+)char/${1}varchar/gi;
# blob -> text
s/\w*blob/text/gi;
# nuke date representation (not supported in PostgreSQL)
s/datetime default '[^']+'/datetime/i;
s/date default '[^']+'/datetime/i;
s/time default '[^']+'/datetime/i;
# tinytext/mediumtext -> text
s/tinytext/text/gi;
s/mediumtext/text/gi;
# change not null datetime field to null valid ones
# (to support remapping of "zero time" to null
s/datetime not null/datetime/i;
s/datetime/timestamp/i;
# char -> varchar
# PostgreSQL would otherwise pad with spaces as opposed
# to MySQL! Your user interface may depend on this!
s/(\s+)char/${1}varchar/gi;
# nuke size of timestamp
s/timestamp\([^)]*\)/timestamp/i;
# nuke date representation (not supported in PostgreSQL)
s/datetime default '[^']+'/datetime/i;
s/date default '[^']+'/datetime/i;
s/time default '[^']+'/datetime/i;
# double -> numeric
s/^double/numeric/i;
s/(\s*)double/${1}numeric/i;
# change not null datetime field to null valid ones
# (to support remapping of "zero time" to null
s/datetime not null/datetime/i;
s/datetime/timestamp/i;
# float -> numeric
s/^float/numeric/i;
s/(\s*)float/${1}numeric/i;
# nuke size of timestamp
s/timestamp\([^)]*\)/timestamp/i;
# unique key(field1,field2)
if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
$create_sql.=$_;
next;
}
# unique index(field1,field2)
if (/unique index\s*\((\w+\s*,\s*\w+)\)/i) {
s/unique index\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
$create_sql.=$_;
next;
}
# double -> numeric
s/^double/numeric/i;
s/(\s*)double/${1}numeric/i;
# unique key [name] (field)
if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
my $idxname=($1?"$1":"idx_${table}_$2");
$create_sql.=$_;
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# unique index [name] (field)
if (/unique index\s*(\w*)\s*\((\w+)\)/i) {
s/unique index\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
my $idxname=($1?"$1":"idx_${table}_$2");
$create_sql.=$_;
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# unique (field) et unique (field1, field2 ...)
if (/unique\s*\(([\w,\s]+)\)/i) {
s/unique\s*\(([\w,\s]+)\)/UNIQUE\($1\)/i;
my $fieldlist="$1";
my $idxname="idx_${table}_${fieldlist}";
$idxname =~ s/\W/_/g; $idxname =~ tr/_/_/s;
$create_sql.=$_;
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
next;
}
# float -> numeric
s/^float/numeric/i;
s/(\s*)float/${1}numeric/i;
# index(field)
if (/index\s*(\w*)\s*\((\w+)\)/i) {
my $idxname=($1?"$1":"idx_${table}_$2");
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# unique key(field1,field2)
if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
$create_sql .= $_;
next;
}
# primary key
if (/\bkey\b/i && !/^\s+primary key\s+/i) {
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
}
# unique index(field1,field2)
if (/unique index\s*\((\w+\s*,\s*\w+)\)/i) {
s/unique index\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
$create_sql .= $_;
next;
}
# key(xxx)
if (/key\s*\((\w+)\)/i) {
my $idxname="idx_${table}_$1";
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
next;
}
# unique key [name] (field)
if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
my $idxname = ( $1 ? "$1" : "idx_${table}_$2" );
$create_sql .= $_;
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# Quote column names
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
# unique index [name] (field)
if (/unique index\s*(\w*)\s*\((\w+)\)/i) {
s/unique index\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
my $idxname = ( $1 ? "$1" : "idx_${table}_$2" );
$create_sql .= $_;
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
# Remap columns with names of existing system attribute
if (/"oid"/i) {
s/"oid"/"_oid"/g;
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
my $wait=<STDIN>;
}
s/oid/_oid/i if (/key/i && /oid/i); # fix oid in key
$create_sql.=$_;
} # END of if ($create_sql ne "") i.e. were inside create table statement so processed datatypes
else { # not inside create table
#---- fix data in inserted data: (from MS world)
# FIX: disabled for now
if (00 && /insert into/i) {
s!\x96!-!g; # --
s!\x93!"!g; # ``
s!\x94!"!g; # ''
s!\x85!... !g; # \ldots
s!\x92!`!g;
}
# unique (field) et unique (field1, field2 ...)
if (/unique\s*\(([\w,\s]+)\)/i) {
s/unique\s*\(([\w,\s]+)\)/UNIQUE\($1\)/i;
my $fieldlist = "$1";
my $idxname = "idx_${table}_${fieldlist}";
$idxname =~ s/\W/_/g;
$idxname =~ tr/_/_/s;
$create_sql .= $_;
$create_index .=
"CREATE INDEX $idxname ON $table ($fieldlist);\n";
next;
}
# fix dates '0000-00-00 00:00:00' (should be null)
s/'0000-00-00 00:00:00'/null/gi;
s/'0000-00-00'/null/gi;
s/'00:00:00'/null/gi;
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
# index(field)
if (/index\s*(\w*)\s*\((\w+)\)/i) {
my $idxname = ( $1 ? "$1" : "idx_${table}_$2" );
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
next;
}
if (/create\s+table\s+(\w+)/i) {
$create_sql = $_;
/create\s*table\s*(\w+)/i;
$table=$1 if (defined($1));
} else {
print OUT $_;
}
} # end of if inside create_table
} # END while(<IN>)
# primary key
if ( /\bkey\b/i && !/^\s+primary key\s+/i ) {
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i
; # hack off name of the non-primary key
}
# key(xxx)
if (/key\s*\((\w+)\)/i) {
my $idxname = "idx_${table}_$1";
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
next;
}
# Quote column names
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if ( !/\bkey\b/i );
# Remap columns with names of existing system attribute
if (/"oid"/i) {
s/"oid"/"_oid"/g;
print STDERR
"WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
my $wait = <STDIN>;
}
s/oid/_oid/i if ( /key/i && /oid/i ); # fix oid in key
$create_sql .= $_;
} # END of if ($create_sql ne "") i.e. were inside create table statement so processed datatypes
else { # not inside create table
#---- fix data in inserted data: (from MS world)
# FIX: disabled for now
if ( 00 && /insert into/i ) {
s!\x96!-!g; # --
s!\x93!"!g; # ``
s!\x94!"!g; # ''
s!\x85!... !g; # \ldots
s!\x92!`!g;
}
# fix dates '0000-00-00 00:00:00' (should be null)
s/'0000-00-00 00:00:00'/null/gi;
s/'0000-00-00'/null/gi;
s/'00:00:00'/null/gi;
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
if (/create\s+table\s+(\w+)/i) {
$create_sql = $_;
/create\s*table\s*(\w+)/i;
$table = $1 if ( defined($1) );
}
else {
print $out $_;
}
} # end of if inside create_table
} # END while(<IN>)
close $in;
close $out;
close IN;
close OUT;
}
print "\n";
print "Build " . ( scalar keys %filelist ) . " file(s).\n";
print "Build ".(scalar keys %filelist)." file(s).\n";
print "\n";
print "Press a key to finish...\n";
$stop = <STDIN>;
$stop=<STDIN>;
0;

View File

@@ -12,24 +12,19 @@ cp "$0" /tmp/github_commits_perversion.sh
TEMP_DIR=/tmp/git
DOL_GIT="$TEMP_DIR/dolibarr"
if ! git rev-parse ; then
echo "/tmp/git/dolibarr is not a git repo. Delete $TEMP_DIR"
echo "Delete $TEMP_DIR"
rm -fr "$TEMP_DIR"
echo "Create '$TEMP_DIR' and cd to it"
mkdir -p "$TEMP_DIR"
mkdir "$TEMP_DIR"
cd "$TEMP_DIR" || exit
git clone https://github.com/Dolibarr/dolibarr.git
cd "${DOL_GIT}" || exit
else
echo "/tmp/git/dolibarr is a git repo."
mkdir -p ${DOL_GIT}
if [ -r "${DOL_GIT}" ] ; then
echo git worktree remove "${DOL_GIT}"
git worktree remove "${DOL_GIT}"
rm -rf "${DOL_GIT}" >& /dev/null
fi
echo git worktree add --force "${DOL_GIT}" develop
git worktree add --force "${DOL_GIT}" develop
cd "$DOL_GIT" || exit
git pull
@@ -37,14 +32,11 @@ fi
# Determine release to check
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "20.0" "21.0" "22.0")
target_version=$(sed -n "s/.*define('DOL_VERSION',[[:space:]]*'\\([0-9]*\\.[0-9]*\\).*/\\1/p" htdocs/version.inc.php)
Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "19.0" "20.0")
target_version=$(sed -n "s/.*define('DOL_VERSION',[[:space:]]*'\\([0-9]*\\.[0-9]*\\).*/\\1/p" htdocs/filefunc.inc.php)
# Default target version in case getting it from filefunc.inc failed
target_version=${target_version:=23}
echo "Last version to test target_version = $target_version";
target_version=${target_version:=20.0}
# Setup loop to append required versions
target_major=${target_version%%.*}
@@ -98,9 +90,8 @@ do
done
# Clean up git directory if it is a worktree
#if [ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ] ; then
# cd "$TEMP_DIR" || exit
# git -C "$DOL_GIT" worktree remove "$DOL_GIT"
#fi
if [ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ] ; then
cd "$TEMP_DIR" || exit
git -C "$DOL_GIT" worktree remove "$DOL_GIT"
fi
exit

View File

@@ -1,10 +1,8 @@
#!/bin/bash
# Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
# Borrowed from https://gist.github.com/lgiraudel/6065155
# Inplace mode added by Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
# shellcheck disable=2003,2006,2034,2046,2086,2166,2268,2327,2328
# shellcheck disable=2003,2006,2034,2046,2086,2166,2268
PROGNAME=${0##*/}
INPUT=''

View File

@@ -9,39 +9,66 @@
*/
return [
// # Issue statistics:
// PhanUndeclaredProperty : 420+ occurrences
// PhanTypeMismatchProperty : 95+ occurrences
// PhanTypeMismatchArgument : 65+ occurrences
// PhanUndeclaredGlobalVariable : 60+ occurrences
// PhanTypeMismatchArgumentNullable : 20+ occurrences
// PhanTypeInvalidDimOffset : 15+ occurrences
// PhanTypeMismatchDimFetch : 10+ occurrences
// PhanUndeclaredMethod : 6 occurrences
// PhanTypeArraySuspiciousNull : 5 occurrences
// PhanTypeExpectedObjectPropAccess : 5 occurrences
// PhanUndeclaredProperty : 440+ occurrences
// PhanTypeMismatchProperty : 100+ occurrences
// PhanUndeclaredGlobalVariable : 90+ occurrences
// PhanTypeMismatchArgument : 85+ occurrences
// PhanTypeMismatchArgumentNullable : 30+ occurrences
// PhanTypeExpectedObjectPropAccess : 20+ occurrences
// PhanTypeInvalidDimOffset : 20+ occurrences
// PhanTypeMismatchDimFetch : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 9 occurrences
// PhanUndeclaredMethod : 9 occurrences
// PhanPossiblyUndeclaredGlobalVariable : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanTypeComparisonFromArray : 6 occurrences
// PhanPluginUndeclaredVariableIsset : 5 occurrences
// PhanParamTooMany : 4 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanPluginUndeclaredVariableIsset : 2 occurrences
// PhanPossiblyUndeclaredGlobalVariable : 2 occurrences
// PhanTypeMismatchArgumentProbablyReal : 2 occurrences
// PhanParamTooMany : 1 occurrence
// PhanPluginDuplicateExpressionBinaryOp : 4 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeMismatchReturn : 2 occurrences
// PhanTypeSuspiciousStringExpression : 2 occurrences
// PhanPossiblyUndeclaredVariable : 1 occurrence
// PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence
// PhanTypeMismatchReturn : 1 occurrence
// PhanTypeMismatchArgumentNullableInternal : 1 occurrence
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'htdocs/accountancy/class/accountancyexport.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/api/class/api_setup.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'],
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'],
'htdocs/asset/tpl/depreciation_options_edit.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/asset/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/bom/bom_card.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/bom/tpl/objectline_create.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/bom/tpl/objectline_edit.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/bom/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/bookcal/availabilities_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/bookcal/calendar_card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/bookcal/class/availabilities.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'],
'htdocs/collab/index.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
'htdocs/comm/action/pertype.php' => ['PhanTypeExpectedObjectPropAccess'],
'htdocs/comm/action/peruser.php' => ['PhanTypeMismatchArgument'],
'htdocs/comm/action/pertype.php' => ['PhanTypeComparisonFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchDimFetch'],
'htdocs/comm/action/peruser.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchArgument'],
'htdocs/comm/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/mailing/targetemailing.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/class/api_orders.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/account_statement_document.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/class/paymentvarious.class.php' => ['PhanTypeMismatchArgument'],
@@ -49,12 +76,16 @@ return [
'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'],
'htdocs/compta/clients.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/facture/card-rec.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/localtax/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/localtax/clients.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument'],
'htdocs/compta/localtax/index.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/localtax/list.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement/card.php' => ['PhanUndeclaredProperty'],
@@ -68,23 +99,26 @@ return [
'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/tva/clients.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'],
'htdocs/compta/tva/index.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument'],
'htdocs/contrat/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/ajax/selectobject.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/core/class/CMailFile.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/class/canvas.class.php' => ['PhanUndeclaredMethod'],
'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'],
'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/cgenericdic.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/conf.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/class/conf.class.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchProperty'],
'htdocs/core/class/ctyperesource.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/dolgraph.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/emailsenderprofile.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/extrafields.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/html.formfile.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/class/html.formmail.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/class/openid.class.php' => ['PhanTypeMismatchArgument'],
@@ -94,13 +128,16 @@ return [
'htdocs/core/lib/company.lib.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/functions2.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/pdf.lib.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/core/lib/pdf.lib.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/core/lib/product.lib.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/menus/standard/auguria.lib.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/modules/cheque/doc/pdf_blochet.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/modules/cheque/modules_chequereceipts.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
@@ -118,7 +155,7 @@ return [
'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty'],
'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'],
'htdocs/core/modules/member/modules_cards.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanUndeclaredProperty'],
@@ -137,6 +174,7 @@ return [
'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'],
'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/multicompany_page.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'],
@@ -145,8 +183,16 @@ return [
'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/resource_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanUndeclaredProperty'],
'htdocs/datapolicy/class/datapolicycron.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'],
'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/don/document.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/don/note.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgument'],
@@ -154,21 +200,27 @@ return [
'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/expensereport/card.php' => ['PhanUndeclaredProperty'],
'htdocs/expensereport/class/expensereport.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/expensereport/class/expensereport.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/expensereport/payment/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/card-rec.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/filefunc.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fourn/commande/card.php' => ['PhanUndeclaredProperty'],
'htdocs/fourn/commande/card.php' => ['PhanTypeMismatchDimAssignment', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
'htdocs/fourn/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fourn/facture/card.php' => ['PhanTypeMismatchArgument'],
'htdocs/fourn/facture/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'],
'htdocs/fourn/facture/rapport.php' => ['PhanTypeMismatchArgument'],
'htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/holiday/card_group.php' => ['PhanTypeMismatchArgument'],
'htdocs/holiday/list.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/hrm/class/evaluation.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/evaluationdet.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/job.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/position.class.php' => ['PhanUndeclaredProperty'],
'htdocs/hrm/class/skill.class.php' => ['PhanUndeclaredProperty'],
@@ -185,6 +237,7 @@ return [
'htdocs/loan/document.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanUndeclaredProperty'],
'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/multicurrency/class/multicurrency.class.php' => ['PhanTypeExpectedObjectPropAccess'],
@@ -201,7 +254,8 @@ return [
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
'htdocs/product/stock/info.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/list.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/movement_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/movement_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/stats/expedition.php' => ['PhanUndeclaredProperty'],
@@ -209,12 +263,16 @@ return [
'htdocs/product/stock/stats/reception.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/tpl/stockcorrection.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/product/stock/tpl/stocktransfer.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/projet/admin/project.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/projet/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/projet/tasks.php' => ['PhanTypeMismatchArgument'],
'htdocs/projet/tasks/time.php' => ['PhanTypeInvalidDimOffset', 'PhanUndeclaredProperty'],
'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/public/eventorganization/subscriptionok.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'],
'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/project/suggestbooth.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/suggestconference.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/public/project/viewandvote.php' => ['PhanUndeclaredGlobalVariable'],
@@ -222,7 +280,7 @@ return [
'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/reception/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'],
'htdocs/reception/list.php' => ['PhanUndeclaredProperty'],
'htdocs/reception/list.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanUndeclaredProperty'],
@@ -235,7 +293,7 @@ return [
'htdocs/recruitment/recruitmentjobposition_card.php' => ['PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/recruitment/recruitmentjobposition_note.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/salaries/payment_salary.php' => ['PhanUndeclaredProperty'],
'htdocs/salaries/paiement_salary.php' => ['PhanUndeclaredProperty'],
'htdocs/salaries/virement_request.php' => ['PhanUndeclaredProperty'],
'htdocs/societe/ajax/company.php' => ['PhanUndeclaredProperty'],
'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'],
@@ -243,6 +301,7 @@ return [
'htdocs/supplier_proposal/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanUndeclaredProperty'],
'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/takepos/invoice.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/ticket/card.php' => ['PhanUndeclaredProperty'],
@@ -253,12 +312,26 @@ return [
'htdocs/user/class/usergroup.class.php' => ['PhanUndeclaredProperty'],
'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/viewimage.php' => ['PhanUndeclaredMethod'],
'htdocs/webhook/class/target.class.php' => ['PhanUndeclaredMethod'],
'htdocs/webhook/target_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/webportal/admin/setup.php' => ['PhanTypeMismatchArgument'],
'htdocs/webportal/class/html.formcardwebportal.class.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webportal/class/webportalpropal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_actioncomm.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_category.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_contact.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_invoice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_order.php' => ['PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
'htdocs/webservices/server_payment.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_productorservice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_supplier_invoice.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_thirdparty.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_user.php' => ['PhanUndeclaredProperty'],
'htdocs/website/websiteaccount_card.php' => ['PhanUndeclaredProperty'],
'internal' => ['PhanUndeclaredConstant'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This is the phan config file used by .github/workflows/phan.yml
*/

View File

@@ -1,93 +1,53 @@
<?php
// These stubs were generated by the phan stub generator.
// @phan-stub-for-extension ftp@7.4.12
namespace {
const FTP_ASCII = 1;
const FTP_TEXT = 1;
const FTP_BINARY = 2;
const FTP_IMAGE = 2;
const FTP_AUTORESUME = -1;
const FTP_TIMEOUT_SEC = 0;
const FTP_AUTOSEEK = 1;
const FTP_USEPASVADDRESS = 2;
const FTP_FAILED = 0;
const FTP_FINISHED = 1;
const FTP_MOREDATA = 2;
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|false {}
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|false {}
function ftp_login(FTP\Connection $ftp, string $username, #[\SensitiveParameter] string $password): bool {}
function ftp_pwd(FTP\Connection $ftp): string|false {}
function ftp_cdup(FTP\Connection $ftp): bool {}
function ftp_chdir(FTP\Connection $ftp, string $directory): bool {}
function ftp_exec(FTP\Connection $ftp, string $command): bool {}
/**
* @return array<int, string>|null
*/
function ftp_raw(FTP\Connection $ftp, string $command): ?array {}
function ftp_mkdir(FTP\Connection $ftp, string $directory): string|false {}
function ftp_rmdir(FTP\Connection $ftp, string $directory): bool {}
function ftp_chmod(FTP\Connection $ftp, int $permissions, string $filename): int|false {}
/** @param string $response */
function ftp_alloc(FTP\Connection $ftp, int $size, &$response = null): bool {}
/**
* @return array<int, string>|false
*/
function ftp_nlist(FTP\Connection $ftp, string $directory): array|false {}
/**
* @return array<int, string>|false
*/
function ftp_rawlist(FTP\Connection $ftp, string $directory, bool $recursive = false): array|false {}
/**
* @return array<int, array>|false
*/
function ftp_mlsd(FTP\Connection $ftp, string $directory): array|false {}
function ftp_systype(FTP\Connection $ftp): string|false {}
/** @param resource $stream */
function ftp_fget(FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
/** @param resource $stream */
function ftp_nb_fget(FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_pasv(FTP\Connection $ftp, bool $enable): bool {}
function ftp_get(FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_nb_get(FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {}
function ftp_nb_continue(FTP\Connection $ftp): int {}
/** @param resource $stream */
function ftp_fput(FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {}
/** @param resource $stream */
function ftp_nb_fput(FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_put(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_append(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {}
function ftp_nb_put(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {}
function ftp_size(FTP\Connection $ftp, string $filename): int {}
function ftp_mdtm(FTP\Connection $ftp, string $filename): int {}
function ftp_rename(FTP\Connection $ftp, string $from, string $to): bool {}
function ftp_delete(FTP\Connection $ftp, string $filename): bool {}
function ftp_site(FTP\Connection $ftp, string $command): bool {}
function ftp_close(FTP\Connection $ftp): bool {}
function ftp_quit(FTP\Connection $ftp): bool {}
/** @param int|bool $value */
function ftp_set_option(FTP\Connection $ftp, int $option, $value): true {}
function ftp_get_option(FTP\Connection $ftp, int $option): int|bool {}
}
namespace FTP {
/**
* @strict-properties
* @not-serializable
*/
final class Connection
{
}
function ftp_alloc($ftp, $size, &$response = null) {}
function ftp_append($ftp, $remote_file, $local_file, $mode = null) {}
function ftp_cdup($ftp) {}
function ftp_chdir($ftp, $directory) {}
function ftp_chmod($ftp, $mode, $filename) {}
function ftp_close($ftp) {}
function ftp_connect($host, $port = null, $timeout = null) {}
function ftp_delete($ftp, $file) {}
function ftp_exec($ftp, $command) {}
function ftp_fget($ftp, $fp, $remote_file, $mode = null, $resumepos = null) {}
function ftp_fput($ftp, $remote_file, $fp, $mode = null, $startpos = null) {}
function ftp_get($ftp, $local_file, $remote_file, $mode = null, $resume_pos = null) {}
function ftp_get_option($ftp, $option) {}
function ftp_login($ftp, $username, $password) {}
function ftp_mdtm($ftp, $filename) {}
function ftp_mkdir($ftp, $directory) {}
function ftp_mlsd($ftp, $directory) {}
function ftp_nb_continue($ftp) {}
function ftp_nb_fget($ftp, $fp, $remote_file, $mode = null, $resumepos = null) {}
function ftp_nb_fput($ftp, $remote_file, $fp, $mode = null, $startpos = null) {}
function ftp_nb_get($ftp, $local_file, $remote_file, $mode = null, $resume_pos = null) {}
function ftp_nb_put($ftp, $remote_file, $local_file, $mode = null, $startpos = null) {}
function ftp_nlist($ftp, $directory) {}
function ftp_pasv($ftp, $pasv) {}
function ftp_put($ftp, $remote_file, $local_file, $mode = null, $startpos = null) {}
function ftp_pwd($ftp) {}
function ftp_quit($ftp) {}
function ftp_raw($ftp, $command) {}
function ftp_rawlist($ftp, $directory, $recursive = null) {}
function ftp_rename($ftp, $src, $dest) {}
function ftp_rmdir($ftp, $directory) {}
function ftp_set_option($ftp, $option, $value) {}
function ftp_site($ftp, $cmd) {}
function ftp_size($ftp, $filename) {}
function ftp_ssl_connect($host, $port = null, $timeout = null) {}
function ftp_systype($ftp) {}
const FTP_ASCII = 1;
const FTP_AUTORESUME = -1;
const FTP_AUTOSEEK = 1;
const FTP_BINARY = 2;
const FTP_FAILED = 0;
const FTP_FINISHED = 1;
const FTP_IMAGE = 2;
const FTP_MOREDATA = 2;
const FTP_TEXT = 1;
const FTP_TIMEOUT_SEC = 0;
const FTP_USEPASVADDRESS = 2;
}

View File

@@ -1,22 +1,20 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*/
/* PHP 7.0 */
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude([
'core/includes',
'custom',
'documents',
'doctemplates',
'vendor',
'install/doctemplates',
'htdocs/custom',
'htdocs/includes',
'htdocs/install/doctemplates',
])
->notPath('vendor');
->in(__DIR__)
->exclude([
'core/includes',
'custom',
'documents',
'doctemplates',
'vendor',
'install/doctemplates',
'htdocs/custom',
'htdocs/includes',
'htdocs/install/doctemplates',
])
->notPath('vendor');
/* PHP 7.4+ */
@@ -45,11 +43,8 @@ return (new PhpCsFixer\Config())
// So we use target PHP70 for the moment.
'@PHP70Migration' => true,
//'@PHP71Migration' => true,
// Avoid adding public to const (incompatible with PHP 7.0):
'visibility_required' => ['elements' => ['property', 'method']],
// Replace deprecated 'visibility_required'
'modifier_keywords' => ['elements' => ['property', 'method']],
// Avoid adding public to const (incompatible with PHP 7.0):
'visibility_required' => ['elements'=>['property', 'method']],
//'strict_param' => true,
//'array_syntax' => ['syntax' => 'short'],
@@ -64,4 +59,5 @@ return (new PhpCsFixer\Config())
->setIndent("\t")
// All files MUST use the Unix LF line ending only
// https://www.php-fig.org/psr/psr-12/#22-files
->setLineEnding("\n");
->setLineEnding("\n")
;

View File

@@ -66,14 +66,8 @@ parameters:
reportMagicMethods: false
reportMagicProperties: false
treatPhpDocTypesAsCertain: false
# if you want to exclude something, generate the baseline to do that, add here give only pattern that does not give the opportunity to introduce new errors
# or pattern to avoid false positive of some bugged or allowed phpstan checks
ignoreErrors:
- '#.*phan-var#'
- '#^Expression "''…" on a separate line does not do anything#'
- '#Empty array passed to foreach#'
- '#Unable to resolve the template type T#'
- '#in empty\(\) always exists and is always falsy#'
- '#is always#'
internalErrorsCountLimit: 50
cache:

View File

@@ -16,15 +16,15 @@ composer install
#### Usage
##### To make changes (remove --dry-run for real run)
##### To make changes (Add --dry-run for test mode only)
```shell
cd dev/tools/rector
./vendor/bin/rector process --debug --dry-run
./vendor/bin/rector process --dry-run
```
##### To make changes on a given directory
```shell
cd dev/tools/rector
./vendor/bin/rector process --debug [--dry-run] [--clear-cache] ../../../htdocs/core/
./vendor/bin/rector process [--dry-run] [--clear-cache] ../../../htdocs/core/
```

View File

@@ -18,7 +18,7 @@
/**
* \file dev/tools/rector/rector.php
* \ingroup core
* \brief Tool to run rector
* \brief Toolt to run rector
*
* cd dev/tools/rector
* ./vendor/bin/rector process [--dry-run] [--clear-cache] ../../../htdocs/core/
@@ -33,22 +33,17 @@ use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_71);
$rectorConfig->indent(' ', 4);
//$rectorConfig->indent(' ', 4);
// Traits seems not supported correctly by rector without declaring them as bootstrapFiles
$arrayoftraitfiles = array(
__DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php',
__DIR__ . '/../../../htdocs/core/class/commonpeople.class.php',
__DIR__ . '/../../../htdocs/core/class/commonsignedobject.class.php',
__DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php',
__DIR__ . '/../../../htdocs/core/class/commontrigger.class.php',
__DIR__ . '/../../../htdocs/core/class/doldeprecationhandler.class.php',
__DIR__ . '/../../../htdocs/subtotals/class/commonsubtotal.class.php',
__DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php'
);
$rectorConfig->bootstrapFiles($arrayoftraitfiles);
$rectorConfig->paths([
__DIR__ . '/../../../dev/',
__DIR__ . '/../../../htdocs/',
__DIR__ . '/../../../scripts/',
__DIR__ . '/../../../test/phpunit/',
@@ -59,8 +54,7 @@ return static function (RectorConfig $rectorConfig): void {
'**/custom/**',
'**/vendor/**',
'**/rector/**', // Disable this line to test the "test.php" file.
__DIR__ . '/../../../dev/tools/phan/stubs/*',
__DIR__ . '/../../../htdocs/custom/*',
__DIR__ . '/../../../htdocs/custom/',
__DIR__ . '/../../../htdocs/install/doctemplates/*'
//'test.php',
]);
@@ -88,18 +82,12 @@ return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyUserRightsToFunction::class);
$rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class);
$rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class);
$rectorConfig->rule(Dolibarr\Rector\Renaming\UsePositiveExit::class);
//$rectorConfig->rule(Dolibarr\Rector\Renaming\UsePositiveExit::class);
// This fix <> into != but it breaks other rules, so added at end.
//$rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class);
$rectorConfig->rule(Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector::class);
/*
$rectorConfig->skip([
Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser::class,
Dolibarr\Rector\Renaming\GlobalToFunction::class
]);
*/
// Add all predefined rules to migrate to up to php 71.
// Warning this break tab spacing of arrays on several lines

View File

@@ -63,7 +63,7 @@ class GlobalToFunction extends AbstractRector
'Change $conf->global to getDolGlobal in context (1) conf->global Operator Value or (2) function(conf->global...)',
[new CodeSample(
'$conf->global->CONSTANT',
'getDolGlobalString|Int(\'CONSTANT\')'
'getDolGlobalInt(\'CONSTANT\')'
)]
);
}
@@ -228,36 +228,14 @@ class GlobalToFunction extends AbstractRector
return new Concat($leftConcat, $rightConcat);
}
// If a && b and a or b is conf->global, we replace a or/and b
if ($node instanceof BooleanAnd) {
// Transformation sur le nœud gauche
$changedone = 0;
if ($this->isGlobalVar($node->left)) {
$constName = $this->getConstName($node->left);
if (empty($constName)) {
return;
}
$node->left = new FuncCall(
new Name('getDolGlobalString'),
[new Arg($constName)]
);
$changedone++;
}
if ($this->isGlobalVar($node->right)) {
$constName = $this->getConstName($node->right);
if (empty($constName)) {
return;
}
$node->right = new FuncCall(
new Name('getDolGlobalString'),
[new Arg($constName)]
);
$changedone++;
$nodes = $this->resolveTwoNodeMatch($node);
if (!isset($nodes)) {
return;
}
if ($changedone) {
return $node;
}
/** @var Equal $node */
$node = $nodes->getFirstExpr();
}
@@ -292,42 +270,9 @@ class GlobalToFunction extends AbstractRector
return;
}
// Now we process a comparison
$isconfglobal = $this->isGlobalVar($node->left);
if (!$isconfglobal) {
$isconfglobal = $this->isGlobalVar($node->right);
if (!$isconfglobal) {
// The left side and right side is not conf->global->xxx, so we leave
return;
}
// Right side is conf->global->xxx, but we can't know if we must use getDolGlobalInt or String,
// so we use getDolGlobalString if comparison is ==
if ($typeofcomparison == 'Equal') {
$constName = $this->getConstName($node->right);
if (empty($constName)) {
return;
}
// Test the type after the comparison conf->global->xxx to know the name of function
$typeleft = $node->left->getType();
switch ($typeleft) {
case 'Scalar_LNumber':
$funcName = 'getDolGlobalInt';
break;
case 'Scalar_String':
$funcName = 'getDolGlobalString';
break;
default: // Can be Expr_FuncCall
$funcName = 'getDolGlobalString';
break;
}
$node->right = new FuncCall(
new Name($funcName),
[new Arg($constName)]
);
return $node;
}
// The left side is not conf->global->xxx, so we leave
return;
}
@@ -415,6 +360,36 @@ class GlobalToFunction extends AbstractRector
}
}
/**
* Get nodes with check empty
*
* @param BooleanAnd $booleanAnd A BooleandAnd
* @return TwoNodeMatch|null
*/
private function resolveTwoNodeMatch(BooleanAnd $booleanAnd): ?TwoNodeMatch
{
return $this->binaryOpManipulator->matchFirstAndSecondConditionNode(
$booleanAnd,
// Function to check if we are in the case $conf->global->... == $value
function (Node $node): bool {
if (!$node instanceof Equal) {
return \false;
}
return $this->isGlobalVar($node->left);
},
// !empty(...) || isset(...)
function (Node $node): bool {
if ($node instanceof BooleanNot && $node->expr instanceof Empty_) {
return $this->isGlobalVar($node->expr->expr);
}
if (!$node instanceof Isset_) {
return $this->isGlobalVar($node);
}
return \true;
}
);
}
/**
* Check if node is a global access with format conf->global->XXX
*

View File

@@ -24,10 +24,6 @@ DATAPOLICY_TIERS_NIPROSPECT_NICLIENT
DATAPOLICY_TIERS_PROSPECT
DATAPOLICY_TIERS_PROSPECT_CLIENT
#
TOKEN_EXPIRE_AT
TOKEN_EXPIRED
# fournisseur
CodePaymentTerm
IdPaymentTerm
@@ -40,15 +36,6 @@ Reservation
CompletePage
PortionOfPage
#
AccountancyGroupCAPIT
AccountancyGroupEXPENSE
AccountancyGroupFINAN
AccountancyGroupIMMO
AccountancyGroupINCOME
AccountancyGroupSTOCK
AccountancyGroupTHIRDPARTY
# Others
ACCOUNTING_ACCOUNT_CUSTOMER
ACCOUNTING_ACCOUNT_CUSTOMER_Desc
@@ -108,24 +95,6 @@ ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT
ACCOUNTING_VAT_PAY_ACCOUNT
ACCOUNTING_VAT_SOLD_ACCOUNT
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT
ACCOUNTING_LT1_BUY_ACCOUNT
ACCOUNTING_LT2_BUY_ACCOUNT
ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT
ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT
ACCOUNTING_LT1_PAY_ACCOUNT
ACCOUNTING_LT2_PAY_ACCOUNT
ACCOUNTING_LT1_PAY_REVERSE_CHARGES_CREDIT
ACCOUNTING_LT2_PAY_REVERSE_CHARGES_CREDIT
ACCOUNTING_LT1_SOLD_ACCOUNT
ACCOUNTING_LT2_SOLD_ACCOUNT
AI_API_MODEL_AUDIO
AI_API_MODEL_IMAGE
AI_API_MODEL_TEXT
AI_API_MODEL_TRANSCRIPT
AI_API_MODEL_TRANSLATE
AI_API_MODEL_VIDEO
AGENDA_EVENT_CURRENT_COLOR
AGENDA_EVENT_FUTURE_COLOR
AGENDA_EVENT_PAST_COLOR

View File

@@ -96,6 +96,8 @@ AADE_WEBSERVICE_USER
API
Accept
AccountancyErrorMismatchLetteringCode
AccountingAccount
AccountingCode
AccountingJournalType
ActionAC_
ActionAC_ALL_
@@ -130,6 +132,7 @@ AvailabilityType
BAN
BI
BOMs
Back
Bad value for email, email was not verified by Google
Bad value for returned userinfo[aud]
Bad value for returned userinfo[exp]. Token expired.
@@ -144,12 +147,14 @@ Banque
Barcode
BarcodeDesc
BarcodeStickersMask
BatchInformationNotfound
BillOfMaterialsLine
BlockLogNeedAmountsValue
BlockLogNeedElement
BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote
BlockedLogAuthorityUrl
BlockedLogSetup
BookCalSystem
Bookings
BoxTitleLast
BoxTitleLatest
@@ -174,6 +179,7 @@ Child of
ClassNotFound
Clear
ClickToDial
Clients
Clone
CloneAffectation
CloneChanges
@@ -196,6 +202,8 @@ ConfirmActionMyObject
ConfirmActionTarget
ConfirmCloneMyObject
ConfirmCloneTask
ConfirmCreateAdherent
ConfirmDeleteAdherent
ConfirmDeleteIndividual
ConfirmDeleteReport
ConfirmDeleteWebsiteAccount
@@ -259,6 +267,7 @@ Dictionaries
DictionaryEmpty
DictionaryNameUpdated
Directory
DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND
Document
Documentation
Dolibarr
@@ -282,6 +291,7 @@ EmailcollectorFilter
EmailingTargetSelector
Empty
End
EnterAnIP
EnterNameOfDictionnaryToDeleteDesc
Entries
ErrSCAAuthentication
@@ -299,6 +309,7 @@ ErrorBadSocialNetworkValue
ErrorBadStatus
ErrorBadValue
ErrorBadValueForBatch
ErrorBadValueForDate
ErrorCanNotDeleteDir
ErrorCantSplitAUsedDiscount
ErrorChartOfAccountSystemNotSelected
@@ -323,6 +334,7 @@ ErrorFailedToGetListOfNotificationsToSend
ErrorFailedToLoadBankAccount
ErrorFailedToLoadDiscount
ErrorFailedToSetNewPassword
ErrorFaviconMustBeASquaredImage
ErrorFileNameInvalid
ErrorImportOfChartLimitedToCurrentChart
ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT
@@ -350,6 +362,7 @@ ErrorTechnicalError
ErrorThirdPartyIdIsMandatory
ErrorTicketIsNotValid
ErrorTitreAlreadyExists
ErrorUpdatingUsersCP
ErrorUserFetch
ErrorValueMustBeInteger
ErrorValueTooHigh
@@ -399,6 +412,7 @@ Filename
FilteredFrom
Flashy
ForcedByGlobalSetup
Form for public lead registration has not been enabled
Free
FreeLegalTextOnReceptions
FrequencyPer_
@@ -605,6 +619,7 @@ PaymentCondition
PaymentConditionShort
PaymentDonation
PaymentHigherThanReminderToPaySupplier
PaymentSalary
PaymentSendToStripeTerminal
PaymentType
PaymentTypeShort
@@ -621,13 +636,17 @@ Poll
Posts
PredefinedInterventional
PrevRangeToThisRange
PreviousFingerprint
Print
PrintDriver
PrintModule
PrintUserConfDesc
PrinterId
PrinterIdEmpty
PrinterLocation
PrinterNameEmpty
PrinterParameterEmpty
Printers
Printing
ProductCodeDesc
ProductFournisseurPrice
@@ -791,6 +810,7 @@ Templates
TestPrinterTemplate
TestTemplateToPrinter
Theme
ThirdpartyHasNoDefaultBanAccount
ThisIsInformationOnDocumentToSign
ThisScreenAllowsYouToSignDocFrom
TicketCategoryShort
@@ -800,6 +820,7 @@ TicketTypeShort
TimeOnly
Timezone
ToGetBack
ToPay
Token
Tooltip
TooltipEditAndRevertStockMovement
@@ -826,6 +847,8 @@ UpdateUser
UpgradeHasBeenUnlocked
Url
Use of API for currency update is disabled by option MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER
UserRemovedFromGroup
UserSetInGroup
VCard
Vacant
ValidateAndSign
@@ -851,6 +874,7 @@ Widgets
Windows
WorkingBoard
Workload
WrongAmount
XDebug
XmlCorrupted
Y
@@ -1007,6 +1031,10 @@ PDF/A-3b
PartnershipSentByEMail
PdfTitle
ProcessingError
PurchaseOrder
PurchaseOrders
ReceptionSentByEMail
ReceptionValidated
Recruited
Ref. Product
RefNewContract
@@ -1014,6 +1042,7 @@ Stable
Suggested
TicketMessageMailSignatureText
TicketSetupPage
Tiers
Timeline
Transfer
TryAnotherConnectionMode

View File

@@ -1,7 +1,6 @@
#!/bin/bash
#
# Find unused translations pretty fast...
# Go into the root of the git directory, then launch the shell.
#
# Principle:
#
@@ -36,7 +35,7 @@ DYNAMIC_KEYS_FILE=${TMP}/dynamic_keys
MISSING_AND_UNUSED_FILE=${TMP}/missing_and_unused
MISSING_FILE=${TMP}/missing
UNUSED_FILE=${TMP}/unused
EXPECTED_REGEX='(Country..|ExportDataset_.*|Language_.._..|MonthVeryShort\d\d|PaperFormat.*||Permission.*|ProfId\d(..)?|TypeContact_shipping_external_.*|unit.*)'
EXPECTED_REGEX='(Country..|ExportDataset_.*|Language_.._..|MonthVeryShort\d\d|PaperFormat.*||Permission.*|ProfId\d(..)?|unit.*)'
DYNAMIC_KEYS_SRC_FILE=${MYDIR}/dynamic_translation_keys.lst
EXCLUDE_KEYS_SRC_FILE=${MYDIR}/ignore_translation_keys.lst
DUPLICATE_KEYS_SRC_FILE=${MYDIR}/duplicate_translation_keys.lst

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ $search_import_key = GETPOST('search_import_key', 'alpha');
$search_reconcilable = GETPOST("search_reconcilable", 'int');
$search_centralized = GETPOST("search_centralized", 'int');
$search_active = GETPOST("search_active", 'int');
$toselect = GETPOST('toselect', 'array:int');
$toselect = GETPOST('toselect', 'array');
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$confirm = GETPOST('confirm', 'alpha');
@@ -98,22 +98,20 @@ if (!$sortorder) {
$sortorder = "ASC";
}
$object = new AccountingAccount($db);
$arrayfields = array(
'aa.account_number' => array('label' => "AccountNumber", 'checked' => '1'),
'aa.label' => array('label' => "Label", 'checked' => '1'),
'aa.labelshort' => array('label' => "ShortLabel", 'checked' => '1'),
'aa.labelshort' => array('label' => "LabelToShow", 'checked' => '1'),
'aa.account_parent' => array('label' => "Accountparent", 'checked' => '1'),
'aa.pcg_type' => array('label' => "Pcgtype", 'checked' => '1', 'help' => 'PcgtypeDesc'),
'categories' => array('label' => "AccountingCategories", 'checked' => '-1', 'help' => 'AccountingCategoriesDesc'),
'aa.reconcilable' => array('label' => "Reconcilable", 'checked' => '1'),
'aa.centralized' => array('label' => "Centralized", 'checked' => '1', 'help' => 'CentralizedAccountHelp'),
'aa.centralized' => array('label' => "Centralized", 'checked' => '1'),
'aa.import_key' => array('label' => "ImportId", 'checked' => '-1', 'help' => ''),
'aa.active' => array('label' => "Activated", 'checked' => '1')
);
if (!getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
unset($arrayfields['categories']);
unset($arrayfields['aa.reconcilable']);
}
@@ -352,7 +350,7 @@ $nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -431,7 +429,7 @@ if ($resql) {
$newcardbutton = dolGetButtonTitle($langs->trans('Addanaccount'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/accountancy/admin/card.php?action=create', '', $permissiontoadd);
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
@@ -559,10 +557,12 @@ if ($resql) {
}
// Reconcilable
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="liste_titre center">';
print $form->selectyesno('search_reconcilable', $search_reconcilable, 1, false, 1, 1, 'search_status onrightofpage width75');
print '</td>';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="liste_titre center">';
print $form->selectyesno('search_reconcilable', $search_reconcilable, 1, false, 1, 1, 'search_status onrightofpage width75');
print '</td>';
}
}
// Centralized
@@ -574,11 +574,10 @@ if ($resql) {
// Active
if (!empty($arrayfields['aa.active']['checked'])) {
print '<td class="liste_titre center parentonrightofpage">';
print '<td class="liste_titre center">';
print $form->selectyesno('search_active', $search_active, 1, false, 1, 1, 'search_status onrightofpage width75');
print '</td>';
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center maxwidthsearch">';
@@ -615,14 +614,12 @@ if ($resql) {
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
$totalarray['nbfield']++;
}
// Main group
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, 'right ', $arrayfields['aa.pcg_type']['help'].'::-1', 1);
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
$totalarray['nbfield']++;
}
// Number of custom groups
if (!empty($arrayfields['categories']['checked'])) {
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'].'::-1', 1);
print_liste_field_titre($arrayfields['categories']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, '', $arrayfields['categories']['help'], 1);
$totalarray['nbfield']++;
}
@@ -632,19 +629,21 @@ if ($resql) {
print $hookmanager->resPrint;
if (!empty($arrayfields['aa.import_key']['checked'])) {
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'].'::-1', 1);
print_liste_field_titre($arrayfields['aa.import_key']['label'], $_SERVER["PHP_SELF"], 'aa.import_key', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.import_key']['help'], 1);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['aa.centralized']['checked'])) {
print_liste_field_titre($arrayfields['aa.centralized']['label'], $_SERVER["PHP_SELF"], 'aa.centralized', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.centralized']['help'].'::-1', 1);
print_liste_field_titre($arrayfields['aa.centralized']['label'], $_SERVER["PHP_SELF"], 'aa.centralized', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.active']['checked'])) {
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
// Action column
@@ -760,7 +759,7 @@ if ($resql) {
}
// Custom accounts
if (!empty($arrayfields['categories']['checked'])) {
print '<td class="right">';
print "<td>";
// TODO Get all custom groups labels the account is in
print dol_escape_htmltag($obj->fk_accounting_category);
print "</td>\n";
@@ -784,21 +783,23 @@ if ($resql) {
}
}
// Activated or not reconciliation on an accounting account
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
// Activated or not reconciliation on a general accounting account
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}

View File

@@ -12,7 +12,7 @@
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -92,8 +92,6 @@ $search_country_id = GETPOST('search_country_id', 'int');
if ($user->socid > 0) {
accessforbidden();
}
$permissiontoeditchart = $user->hasRight('accounting', 'chartofaccount');
if (!$user->hasRight('accounting', 'chartofaccount')) {
accessforbidden();
}
@@ -144,6 +142,8 @@ $tabrowid[31] = "";
$tabhelp = array();
$tabhelp[31] = array('pcg_version' => $langs->trans("EnterAnyCode"));
$permissiontoeditchart = $user->hasRight('accounting', 'chartofaccount');
/*
* Actions
@@ -199,15 +199,32 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd', 'alpha')) {
$newid = 0;
if ($tabrowid[$id]) {
// Get free id for insert
$sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") as newid FROM ".$db->sanitize($tabname[$id]);
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
$newid = ($obj->newid + 1);
} else {
dol_print_error($db);
}
}
// Add new entry
$sql = "INSERT INTO ".$db->sanitize($tabname[$id])." (";
// List of fields
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
$sql .= $db->sanitize($tabrowid[$id]).",";
}
$sql .= $db->sanitize($tabfieldinsert[$id]);
$sql .= ",active)";
$sql .= " VALUES(";
// List of values
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
$sql .= $newid.",";
}
$i = 0;
foreach ($listfieldinsert as $f => $value) {
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
@@ -243,10 +260,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify', 'alpha')) {
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
// Modify entry
$sql = "UPDATE ".$db->sanitize($tabname[$id])." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
$sql .= $db->sanitize($tabrowid[$id])." = ";
$sql .= "'".$db->escape($rowid)."', ";
}
$i = 0;
foreach ($listfieldmodify as $field) {
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
@@ -265,7 +291,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
}
$i++;
}
$sql .= " WHERE rowid = ".((int) $rowid);
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
@@ -276,9 +302,14 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
}
}
// delete
if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart) {
$sql = "DELETE from ".$db->sanitize($tabname[$id])." WHERE rowid = ".((int) $rowid);
if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart) { // @phpstan-ignore-line
if ($tabrowid[$id]) {
$rowidcol = $tabrowid[$id];
} else {
$rowidcol = "rowid";
}
$sql = "DELETE from ".$db->sanitize($tabname[$id])." WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid);
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
@@ -292,7 +323,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontoeditchart)
}
// activate
if ($action == 'activate' && $permissiontoeditchart) {
if ($action == 'activate' && $permissiontoeditchart) { // @phpstan-ignore-line
$sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@@ -301,7 +332,7 @@ if ($action == 'activate' && $permissiontoeditchart) {
}
// disable
if ($action == $acts[1] && $permissiontoeditchart) {
if ($action == $acts[1] && $permissiontoeditchart) { // @phpstan-ignore-line
$sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql);
if (!$result) {
@@ -329,7 +360,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy');
// Confirmation de la suppression de la ligne
if ($action == 'delete') {
print $form->formconfirm(dolBuildUrl($_SERVER["PHP_SELF"], ['page'=> $page, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'rowid' => $rowid, 'code' => $code, 'id' => $id]), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode((string) ($page)).'&' : '').'sortfield='.urlencode((string) ($sortfield)).'&sortorder='.urlencode((string) ($sortorder)).'&rowid='.urlencode((string) ($rowid)).'&code='.urlencode((string) ($code)).'&id='.urlencode((string) ($id)), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
@@ -577,34 +608,36 @@ if ($resql) {
}
}
// $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
// $url .= '&'.$param.'&';
// Can an entry be erased or disabled ?
$iserasable = 1;
$canbedisabled = 1;
$canbemodified = 1; // true by default
$query = [];
// decode and add param to query
parse_str($param, $query);
$query = array_merge($query, [
'action' => '',
'page' => $page,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'rowid' => (!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')),
'code' => $obj->code,
]);
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
$url .= '&'.$param.'&';
// Active
print '<td class="center nowrap">';
$query['action'] = $acts[$obj->active];
print '<a href="'.dolBuildUrl($_SERVER["PHP_SELF"], $query, true).'">'.$actl[$obj->active].'</a>';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
$query['action'] = 'edit';
print '<td class="center"><a class="reposition editfielda" href="'.dolBuildUrl($_SERVER["PHP_SELF"], $query, true).'">'.img_edit().'</a></td>';
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
$query['action'] = 'delete';
print '<td class="center"><a href="'.dolBuildUrl($_SERVER["PHP_SELF"], $query, true).'">'.img_delete().'</a></td>';
if ($iserasable) {
print '<td class="center"><a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
print "</tr>\n";
}
@@ -668,8 +701,16 @@ function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context
print '</td>';
}
} elseif ($fieldlist[$field] == 'type_cdr') {
print '<td class="center">';
print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
if ($fieldlist[$field] == 'type_cdr') {
print '<td class="center">';
} else {
print '<td>';
}
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
} else {
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1);
}
print '</td>';
} elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="10" name="'.$fieldlist[$field].'"></td>';

View File

@@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ if (GETPOST('cancel', 'alpha')) {
exit;
}
if ($action == 'add' /* && $user->hasRight('accounting', 'chartofaccount') // already checked */) {
if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) {
if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@@ -132,7 +132,7 @@ if ($action == 'add' /* && $user->hasRight('accounting', 'chartofaccount') // al
}
}
}
} elseif ($action == 'edit' /* && $user->hasRight('accounting', 'chartofaccount') // already checked */) {
} elseif ($action == 'edit' && $user->hasRight('accounting', 'chartofaccount')) {
if (!$cancel) {
if (!$account_number) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors');
@@ -245,7 +245,7 @@ if ($action == 'create') {
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
// Label short
print '<tr><td>'.$langs->trans("ShortLabel").'</td>';
print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';
// Account parent
@@ -314,15 +314,15 @@ if ($action == 'create') {
// Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("AccountNumber").'</span></td>';
print '<td><input class="minwidth300" name="account_number" value="'.$object->account_number.'"></td></tr>';
print '<td><input name="account_number" size="30" value="'.$object->account_number.'"></td></tr>';
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
print '<td><input class="minwidth500" name="label" value="'.$object->label.'"></td></tr>';
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
// Label short
print '<tr><td>'.$langs->trans("ShortLabel").'</td>';
print '<td><input class="minwidth300" name="labelshort" value="'.$object->labelshort.'"></td></tr>';
print '<tr><td>'.$langs->trans("LabelToShow").'</td>';
print '<td><input name="labelshort" size="70" value="'.$object->labelshort.'"></td></tr>';
// Account parent
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
@@ -386,7 +386,7 @@ if ($action == 'create') {
print '<td colspan="2">'.$object->label.'</td></tr>';
// Label to show
print '<tr><td class="titlefield">'.$langs->trans("ShortLabel").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("LabelToShow").'</td>';
print '<td colspan="2">'.$object->labelshort.'</td></tr>';
// Account parent
@@ -419,11 +419,11 @@ if ($action == 'create') {
*/
print '<div class="tabsAction">';
// if ($user->hasRight('accounting', 'chartofaccount')) { // already checked
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
// } else {
// print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
// }
if ($user->hasRight('accounting', 'chartofaccount')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
// Delete
$permissiontodelete = $user->hasRight('accounting', 'chartofaccount');

View File

@@ -7,7 +7,6 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Vincent de Grandporé <vincent@de-grandpre.quebec>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -103,20 +102,9 @@ $list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT1_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT1_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT1_PAY_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT2_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT2_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_LT2_PAY_ACCOUNT';
if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
$list_account[] = 'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT';
$list_account[] = 'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT';
}
if (isModEnabled('bank')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
@@ -136,11 +124,6 @@ if (isModEnabled('loan')) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if (isModEnabled('invoice') || isModEnabled('supplier_invoice')) {
$list_account[] = '---Discounts---';
$list_account[] = 'ACCOUNTING_ACCOUNT_DISCOUNT_GRANTED';
$list_account[] = 'ACCOUNTING_ACCOUNT_DISCOUNT_RECEIVED';
}
if (isModEnabled('societe')) {
$list_account[] = '---Deposits---';
}
@@ -297,14 +280,8 @@ foreach ($list_account as $key) {
print img_picto('', 'service', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
print img_picto('', 'vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_LT/', $key)) {
print img_picto('', 'vat', 'class="pictofixedwidth"');
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
print img_picto('', 'bill', 'class="pictofixedwidth"');
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {

View File

@@ -131,7 +131,7 @@ $nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -202,7 +202,7 @@ if ($result) {
if (getDolGlobalString('ACCOUNTANCY_FISCALYEAR_DEFAULT') == (int) $fiscalyearstatic->ref) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'setdefault', 'value' => $fiscalyearstatic->ref, 'label'=>$fiscalyearstatic->label], true).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdefault&token='.newToken().'&value='.urlencode($fiscalyearstatic->ref).'&label='.urlencode($fiscalyearstatic->label).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
}
print '</td>';

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
@@ -82,7 +82,7 @@ $permissiontoadd = $user->hasRight('accounting', 'fiscalyear', 'write');
if ($user->socid > 0) {
accessforbidden();
}
if (!$permissiontoadd) { // after this test $permissiontoadd is always true
if (!$permissiontoadd) {
accessforbidden();
}
@@ -97,7 +97,7 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($action == 'confirm_delete' && $confirm == "yes" /* && $permissiontoadd // always true */) {
if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontoadd) {
$result = $object->delete($user);
if ($result >= 0) {
header("Location: fiscalyear.php");
@@ -105,7 +105,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" /* && $permissiontoadd // a
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'add' /* && $permissiontoadd // always true */) {
} elseif ($action == 'add' && $permissiontoadd) {
if (!GETPOST('cancel', 'alpha')) {
$error = 0;
@@ -147,7 +147,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" /* && $permissiontoadd // a
header("Location: ./fiscalyear.php");
exit();
}
} elseif ($action == 'update' /* && $permissiontoadd // always true */) {
} elseif ($action == 'update' && $permissiontoadd) {
// Update record
if (!GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
@@ -169,7 +169,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" /* && $permissiontoadd // a
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
}
} elseif ($action == 'reopen' /* && $permissiontoadd // always true */ && getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD')) {
} elseif ($action == 'reopen' && $permissiontoadd && getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD')) {
$result = $object->fetch($id);
$object->status = GETPOSTINT('status');
@@ -202,7 +202,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-fis
if ($action == 'create') {
print load_fiche_titre($title, '', 'object_'.$object->picto);
print '<form method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
@@ -334,7 +334,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/fiscalyear.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'label', $linkback, 1, 'label', 'label', $morehtmlref);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
@@ -342,12 +342,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Id
print "<tr>";
print '<td class="titlefield">'.$langs->trans("Id").'</td><td>';
print $object->id;
print '</td></tr>';
// Label
print '<tr><td class="tdtop">';
print $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'alpha:32');

View File

@@ -238,9 +238,11 @@ if ($action == 'update_export') {
// Export options
$modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV');
// reload
$configuration = $accountancyexport->getTypeConfig();
$listparam = $configuration['param'];
if (!$error) {
// reload
$configuration = $accountancyexport->getTypeConfig();
$listparam = $configuration['param'];
}
if (!empty($modelcsv)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
@@ -335,34 +337,6 @@ if ($action == 'setdisablebindingonexpensereports') {
}
}
if ($action == 'setdisabletransferonassets') {
$setdisabletransferonassets = GETPOSTINT('value');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS", $setdisabletransferonassets, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setdisabletransferondiscounts') {
$setdisabletransferondiscounts = GETPOSTINT('value');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS", $setdisabletransferondiscounts, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setenablelettering') {
$setenablelettering = GETPOSTINT('value');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
@@ -548,7 +522,7 @@ foreach ($list_binding as $key) {
1=>$langs->trans("ThirdPartyName") . ' - ' . $langs->trans("NumPiece"),
2=>$langs->trans("ThirdPartyName")
);
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width300');
print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage width200');
} else {
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
}
@@ -596,32 +570,6 @@ if (getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS").'</td>';
if (getDolGlobalString('ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS')) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisabletransferonassets&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisabletransferonassets&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS").'</td>';
if (getDolGlobalString('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisabletransferondiscounts&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', 0, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisabletransferondiscounts&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
if (!getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").'</td>';
@@ -818,7 +766,7 @@ if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
print '<input class="flat right" name="ACCOUNTING_LETTERING_NBLETTERS" id="ACCOUNTING_LETTERING_NBLETTERS" value="' . $nbletter . '" type="number" step="1" min="2" max="3" >' . "\n";
print '</tr>';
// Auto matching when transfer in accountancy is realized
// Auto Lettering when transfer in accountancy is realized
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
@@ -869,7 +817,6 @@ print '</div>';
print '<div class="center"><input type="submit" class="button button-edit reposition" name="button" value="'.$langs->trans('Save').'"></div>';
print '</form>';
print '<br><br>';

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -366,9 +366,12 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-adm
$titre = $langs->trans("DictionarySetup");
$linkback = '';
$titre .= ' - '.$langs->trans($tablib[$id]);
$titlepicto = 'title_accountancy';
if ($id) {
$titre .= ' - '.$langs->trans($tablib[$id]);
$titlepicto = 'title_accountancy';
} else {
$titlepicto = '';
}
print load_fiche_titre($titre, $linkback, $titlepicto);
@@ -381,297 +384,309 @@ if ($action == 'delete') {
/*
* Show a dictionary
*/
if ($id) {
// Complete requete recherche valeurs avec critere de tri
$sql = $tabsql[$id];
$sql .= " WHERE a.entity = ".((int) $conf->entity);
// Complete requete recherche valeurs avec critere de tri
$sql = $tabsql[$id];
$sql .= " WHERE a.entity = ".((int) $conf->entity);
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') {
$sortfield = 'country_code';
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') {
$sortfield = 'country_code';
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
$fieldlist = explode(',', $tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Form to add a new line
if ($tabname[$id]) {
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Form to add a new line
if ($tabname[$id]) {
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
print '</td>';
}
}
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
// Line to enter new values
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd', 'alpha')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
if (empty($reshook)) {
fieldListJournal($fieldlist, $obj, $tabname[$id], 'add');
}
print '<td colspan="4" class="right">';
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";
print '<tr><td colspan="7">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.((int) $id);
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode((string) ($search_country_id));
}
$paramwithsearch = $param;
$paramwithsearch .= '&sortorder='.$sortorder;
$paramwithsearch .= '&sortfield='.$sortfield;
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages
if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// Title line with search boxes
/*print '<tr class="liste_titre_filter liste_titre_add">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
*/
// Title of lines
print '<tr class="liste_titre liste_titre_add">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$class = "left";
$sortable = 1;
$valuetoshow = '';
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align'];
$sortable=$tmp['sortable'];
*/
$valuetoshow = ucfirst($fieldlist[$field]); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
// Affiche nom du champ
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
if ($num) {
// Lines with values
while ($i < $num) {
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$tmpaction = 'edit';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
// Show fields
if (empty($reshook)) {
fieldListJournal($fieldlist, $obj, $tabname[$id], 'edit');
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '<td class="center" colspan="4">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '</td>';
} else {
$tmpaction = 'view';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
}
}
$error = $hookmanager->error;
$errors = $hookmanager->errors;
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
if (empty($reshook)) {
$langs->load("accountancy");
foreach ($fieldlist as $field => $value) {
$class = "left";
$tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
if ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$key = $langs->trans("AccountingJournalType".strtoupper($obj->nature));
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow = $langs->trans($obj->label);
}
// Line to enter new values
print '<tr class="oddeven nodrag nodrop nohover">';
$class = 'tddict';
// Show value for field
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.dol_escape_htmltag($valuetoshow).'</td>';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd', 'alpha')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
if (empty($reshook)) {
fieldListJournal($fieldlist, $obj, $tabname[$id], 'add');
}
print '<td colspan="4" class="right">';
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";
print '<tr><td colspan="7">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.((int) $id);
if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode((string) ($search_country_id));
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.$sortorder;
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.$sortfield;
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages
if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit ? 1 : 0), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// Title line with search boxes
/*print '<tr class="liste_titre_filter liste_titre_add">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
*/
// Title of lines
print '<tr class="liste_titre liste_titre_add">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield = 1; // By default
$class = "left";
$sortable = 1;
$valuetoshow = '';
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield'];
$valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align'];
$sortable=$tmp['sortable'];
*/
$valuetoshow = ucfirst($fieldlist[$field]); // By default
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal");
}
// Affiche nom du champ
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
if ($num) {
// Lines with values
while ($i < $num) {
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$tmpaction = 'edit';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
// Show fields
if (empty($reshook)) {
fieldListJournal($fieldlist, $obj, $tabname[$id], 'edit');
}
}
// Can an entry be erased or disabled ?
$iserasable = 1;
$canbedisabled = 1;
$canbemodified = 1; // true by default
if (isset($obj->code) && $id != 10) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0;
$canbedisabled = 0;
}
}
$canbemodified = $iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
$url .= '&'.$param;
$url .= '&';
// Active
print '<td class="nowrap center">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '<td class="center" colspan="4">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '</td>';
} else {
print '<td>&nbsp;</td>';
$tmpaction = 'view';
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
if (empty($reshook)) {
$langs->load("accountancy");
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$class = "left";
$tmpvar = $fieldlist[$field];
$valuetoshow = $obj->$tmpvar;
if ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$key = $langs->trans("AccountingJournalType".strtoupper($obj->nature));
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow = $langs->trans($obj->label);
}
$class = 'tddict';
// Show value for field
if ($showfield) {
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.dol_escape_htmltag($valuetoshow).'</td>';
}
}
}
// Can an entry be erased or disabled ?
$iserasable = 1;
$canbedisabled = 1;
$canbemodified = 1; // true by default
if (isset($obj->code) && $id != 10) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0;
$canbedisabled = 0;
}
}
$canbemodified = $iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&';
// Active
print '<td class="nowrap center">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
print '<td></td>';
print '</td>';
}
print '<td></td>';
print '</td>';
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
} else {
dol_print_error($db);
}
} else {
dol_print_error($db);
print '</table>';
print '</div>';
print '</form>';
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
// End of page

View File

@@ -28,14 +28,6 @@
* \brief To define accounting account on product / service
*/
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -47,6 +39,15 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array("companies", "compta", "accountancy", "products"));
@@ -198,13 +199,15 @@ if ($action == 'update' && $permissiontobind) {
}
if (!empty($toselect) && $massaction === 'changeaccount') {
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
$ok = 0;
$ko = 0;
$msg = '';
$sql = '';
if (!empty($toselect) && in_array($accounting_product_mode, $accounting_product_modes)) { // @phpstan-ignore-line Bug phpstan thinking that empty(array()) is always true
if (!empty($toselect) && in_array($accounting_product_mode, $accounting_product_modes)) {
$accounting = new AccountingAccount($db);
//$msg .= '<div><span class="accountingprocessing">' . count($toselect) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
$arrayofdifferentselectedvalues = array();
$cpt = 0;
@@ -421,7 +424,7 @@ $nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -41,16 +41,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("accountancy", "admin", "bills", "compta", "errors", "hrm", "salaries"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$id = GETPOSTINT('id');
$rowid = GETPOSTINT('rowid');
$massaction = GETPOST('massaction', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
$id = GETPOSTINT('id');
$rowid = GETPOSTINT('rowid');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
$search_subaccount = GETPOST('search_subaccount', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@@ -299,7 +298,7 @@ $nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -336,7 +335,7 @@ if ($resql) {
// List of mass actions available
$arrayofmassactions = array();
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -318,7 +318,7 @@ if ($action != 'export') {
setEventMessages($object->error, $object->errors, 'errors');
}
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" id="action" value="list">';
print '<input type="hidden" name="export_type" id="export_type" value="">';

View File

@@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
$langs->loadLangs(array("accountancy", "bills", "compta"));
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel');
$confirm = GETPOST('confirm', 'alpha');
$type = GETPOST('type', 'alpha');
@@ -198,11 +198,6 @@ if (empty($reshook)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("AccountAccountingShort")), null, 'errors');
$action = '';
}
$subledger_account_str = is_array($subledger_account) ? reset($subledger_account) : (string) $subledger_account;
if (!checkGeneralAccountAllowsAuxiliary($db, $accountingaccount_number, $subledger_account_str)) {
$error++;
setEventMessages($langs->trans("ErrorAccountNotCentralized"). ". " . $langs->trans("RemoveSubsidiaryAccountOrAdjustTheGeneralAccount"), null, 'errors');
}
if (!$error) {
if (GETPOSTINT('doc_datemonth') && GETPOSTINT('doc_dateday') && GETPOSTINT('doc_dateyear')) {
@@ -495,29 +490,6 @@ if ($action == 'delete') {
print $formconfirm;
}
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax)) {
print "\n" . '<script type="text/javascript">';
print '$(document).ready(function () {
function toggleSubledger() {
var isCentral = $("#accountingaccount_number option:selected").data("centralized");
console.log("the selected general ledger account is centralised?", isCentral);
if (isCentral) {
$("#subledger_account, #subledger_label").prop("disabled", false);
} else {
$("#subledger_account, #subledger_label").prop("disabled", true);
}
}
toggleSubledger();
$("#accountingaccount_number").on("change", toggleSubledger);
$("#accountingaccount_number").on("select2:select", toggleSubledger);
';
print ' });' . "\n";
print ' </script>' . "\n";
}
if ($action == 'create') {
print load_fiche_titre($title);
@@ -604,25 +576,6 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
}*/
$head = accounting_transaction_prepare_head($object, $mode, $type, $backtopage);
print dol_get_fiche_head($head, 'transaction', '', -1);
//$object->label = $object->doc_ref;
if ($mode == '_tmp') {
$object->context['mode'] = $mode;
$object->next_prev_filter = '1=0'; // Add a test always false to disable navigation into the dol_banner_tab. In tmp mode, we just want to create/edit lines of bank transaction.
}
$object->label = $object->ref;
$morehtmlref = '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $object->label;
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $backlink, 1, 'piece_num', 'piece_num', $morehtmlref);
if ($action == 'clonebookkeepingwriting' && $confirm != 'yes' && $permissiontoadd) {
$piece_num = GETPOST('piece_num', 'alpha');
$formaccounting = new FormAccounting($db);
@@ -661,6 +614,28 @@ if ($action == 'create') {
);
}
$head = array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/accountancy/bookkeeping/card.php".'?piece_num='.((int) $object->piece_num).($mode ? '&mode='.$mode : '').($type ? '&type='.$type : '').'&backtopage='.urlencode($backtopage);
$head[$h][1] = $langs->trans("Transaction");
$head[$h][2] = 'transaction';
$h++;
print dol_get_fiche_head($head, 'transaction', '', -1);
//$object->label = $object->doc_ref;
if ($mode == '_tmp') {
$object->context['mode'] = $mode;
$object->next_prev_filter = '1=0'; // Add a test always false to disable navigation into the dol_banner_tab. In tmp mode, we just want to create/edit lines of bank transaction.
}
$object->label = $object->ref;
$morehtmlref = '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $object->label;
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $backlink, 1, 'piece_num', 'piece_num', $morehtmlref);
print '<div class="fichecenter">';
@@ -682,7 +657,7 @@ if ($action == 'create') {
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Ref');
print '</td>';
if ($action != 'editref' && empty($object->date_validation)) {
if ($action != 'editref') {
print '<td class="right">';
if ($permissiontoadd && $numRefModel === 'mod_bookkeeping_neon') {
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editref&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
@@ -691,7 +666,7 @@ if ($action == 'create') {
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editref' && empty($object->date_validation)) {
if ($action == 'editref') {
print '<form name="setref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -717,14 +692,14 @@ if ($action == 'create') {
print '</td>';
if ($action != 'editdocref') {
print '<td class="right">';
if ($permissiontoadd && empty($object->date_validation)) {
if ($permissiontoadd) {
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
}
print '</td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editdocref' && empty($object->date_validation)) {
if ($action == 'editdocref') {
print '<form name="setdocref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -750,14 +725,14 @@ if ($action == 'create') {
print '</td>';
if ($action != 'editdate') {
print '<td class="right">';
if ($permissiontoadd && empty($object->date_validation)) {
if ($permissiontoadd) {
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a>';
}
print '</td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdate' && empty($object->date_validation)) {
if ($action == 'editdate') {
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -783,14 +758,14 @@ if ($action == 'create') {
print '</td>';
if ($action != 'editjournal') {
print '<td class="right">';
if ($permissiontoadd && empty($object->date_validation)) {
if ($permissiontoadd) {
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
}
print '</td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editjournal' && empty($object->date_validation)) {
if ($action == 'editjournal') {
print '<form name="setjournal" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -851,7 +826,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>';
print '<td>';
print $object->date_export ? img_picto($langs->trans("TransactionExportDesc"), 'fa-file-export', 'class="pictofixedwidth opacitymedium"').dol_print_date($object->date_export, 'dayhour') : '&nbsp;';
print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : '&nbsp;';
print '</td>';
print '</tr>';
@@ -859,7 +834,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>';
print '<td>';
print $object->date_validation ? img_picto($langs->trans("TransactionBlockedLockedDesc"), 'fa-lock', 'class="pictofixedwidth opacitymedium"').dol_print_date($object->date_validation, 'dayhour') : '&nbsp;';
print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;';
print '</td>';
print '</tr>';
@@ -966,23 +941,21 @@ if ($action == 'create') {
// List of movements
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
if (empty($object->date_validation)) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . ((int) $object->piece_num) . '" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
}
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";
print '<input type="hidden" name="ref" value="' . $object->ref . '">' . "\n";
print '<input type="hidden" name="code_journal" value="' . $object->code_journal . '">' . "\n";
print '<input type="hidden" name="fk_doc" value="' . $object->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $object->fk_docdet . '">' . "\n";
print '<input type="hidden" name="mode" value="' . $mode . '">' . "\n";
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
print '<input type="hidden" name="type" value="' . $type . '">';
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="doc_date" value="'.$object->doc_date.'">'."\n";
print '<input type="hidden" name="doc_type" value="'.$object->doc_type.'">'."\n";
print '<input type="hidden" name="doc_ref" value="'.$object->doc_ref.'">'."\n";
print '<input type="hidden" name="ref" value="'.$object->ref.'">'."\n";
print '<input type="hidden" name="code_journal" value="'.$object->code_journal.'">'."\n";
print '<input type="hidden" name="fk_doc" value="'.$object->fk_doc.'">'."\n";
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if (count($object->linesmvt) > 0) {
print '<div class="div-table-responsive-no-min">';
@@ -1007,7 +980,7 @@ if ($action == 'create') {
print "</tr>\n";
// Add an empty line if there is not yet
if (!empty($object->linesmvt[0]) && empty($object->date_validation)) {
if (!empty($object->linesmvt[0])) {
$tmpline = $object->linesmvt[0];
if (!empty($tmpline->numero_compte)) {
$line = new BookKeepingLine($db);
@@ -1019,7 +992,7 @@ if ($action == 'create') {
$total_debit += $line->debit;
$total_credit += $line->credit;
if ($action == 'update' && $line->id == $id && empty($object->date_validation)) {
if ($action == 'update' && $line->id == $id) {
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
print '<!-- td columns in edit mode -->';
print '<td>';
@@ -1036,7 +1009,7 @@ if ($action == 'create') {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
}
// Add also input for subledger label
print '<br><input type="text" class="maxwidth150" name="subledger_label" id="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>';
print '<td class="right"><input type="text" class="right width50" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>';
@@ -1046,7 +1019,7 @@ if ($action == 'create') {
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
print '</td>';
print "</tr>\n";
} elseif ((empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) && empty($object->date_validation)) {
} elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) {
if (($action == "" || $action == 'add') && $permissiontoadd) {
print '<tr class="oddeven" data-lineid="'.((int) $line->id).'">';
print '<!-- td columns in add mode -->';
@@ -1063,7 +1036,7 @@ if ($action == 'create') {
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">';
}
print '<br><input type="text" class="maxwidth150" name="subledger_label" id="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . dol_escape_htmltag($label_operation) . '"/></td>';
print '<td class="right"><input type="text" class="right width50" name="debit" value=""/></td>';

View File

@@ -55,7 +55,7 @@ $langs->loadLangs(array("accountancy", "compta"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array:int');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist';
$socid = GETPOSTINT('socid');
@@ -764,7 +764,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
dol_print_error($db);
}
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -877,7 +877,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
$arrayofmassactions = array();
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') {
@@ -1046,7 +1046,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>';
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).'"/>';
@@ -1399,7 +1399,7 @@ while ($i < min($num, $limit)) {
$totalarray['val']['totalcredit'] += $line->credit;
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) {

View File

@@ -63,8 +63,8 @@ $massdate = dol_mktime(0, 0, 0, GETPOSTINT('massdatemonth'), GETPOSTINT('massdat
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array:int');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php'));
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist';
// Search Parameters
$search_mvt_num = GETPOST('search_mvt_num', 'alpha');
@@ -785,7 +785,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
dol_print_error($db);
}
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -853,7 +853,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringaut
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') {
@@ -1055,7 +1055,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>';
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).'"/>';
@@ -1272,12 +1272,6 @@ while ($i < min($num, $limit)) {
$object->piece_num = $line->piece_num;
$object->ref = $line->ref;
print $object->getNomUrl(1, '', 0, '', 1);
if (!empty($line->date_export)) {
print img_picto($langs->trans("DateExport").": ".dol_print_date($line->date_export, 'dayhour')." (".$langs->trans("TransactionExportDesc").")", 'fa-file-export', 'class="paddingleft pictofixedwidth opacitymedium"');
}
if (!empty($line->date_validation)) {
print img_picto($langs->trans("DateValidation").": ".dol_print_date($line->date_validation, 'dayhour')." (".$langs->trans("TransactionBlockedLockedDesc").")", 'fa-lock', 'class="paddingleft pictofixedwidth opacitymedium"');
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@@ -1312,7 +1306,6 @@ while ($i < min($num, $limit)) {
// Document ref
$modulepart = ''; // may be used by include*.tpl.php
if (!empty($arrayfields['t.doc_ref']['checked'])) {
$documentlink = '';
$objectstatic = null;
if ($line->doc_type === 'customer_invoice') {
@@ -1324,7 +1317,7 @@ while ($i < min($num, $limit)) {
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->invoice->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type === 'supplier_invoice') {
@@ -1443,7 +1436,7 @@ while ($i < min($num, $limit)) {
$totalarray['val']['totalcredit'] += $line->credit;
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.$line->lettering_code.'</td>';
if (!$i) {

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Nicolas Barrouillet <nicolas@pragma-tech.fr>
*
@@ -60,7 +60,7 @@ $socid = GETPOSTINT('socid');
$mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'customer'); // Only for tab view
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array:int');
$toselect = GETPOST('toselect', 'array');
$type = GETPOST('type', 'alpha');
if ($type == 'sub') {
$context_default = 'bookkeepingbysubaccountlist';
@@ -866,7 +866,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringaut
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') {
@@ -908,7 +908,7 @@ if (empty($reshook)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'.(!empty($type) ? '&type=sub' : '').'&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
}
if ($contextpage != $_SERVER["PHP_SELF"]) {
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
@@ -1010,8 +1010,16 @@ if ($type == 'sub') {
}
if (empty($socid)) {
$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $conf->browser->stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $conf->browser->stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
$stringforfirstkey = $langs->trans("KeyboardShortcut");
if ($conf->browser->name == 'chrome') {
$stringforfirstkey .= ' ALT +';
} elseif ($conf->browser->name == 'firefox') {
$stringforfirstkey .= ' ALT + SHIFT +';
} else {
$stringforfirstkey .= ' CTL +';
}
$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
$moreforfilter .= <<<SCRIPT
<script type="text/javascript">
jQuery(document).ready(function() {
@@ -1102,7 +1110,7 @@ if (!empty($arrayfields['t.doc_ref']['checked'])) {
if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
@@ -1420,12 +1428,6 @@ while ($i < min($num, $limit)) {
$object->piece_num = $line->piece_num;
$object->ref = $line->ref;
print $object->getNomUrl(1, '', 0, '', 1);
if (!empty($line->date_export)) {
print img_picto($langs->trans("DateExport").": ".dol_print_date($line->date_export, 'dayhour')." (".$langs->trans("TransactionExportDesc").")", 'fa-file-export', 'class="paddingleft pictofixedwidth opacitymedium"');
}
if (!empty($line->date_validation)) {
print img_picto($langs->trans("DateValidation").": ".dol_print_date($line->date_validation, 'dayhour')." (".$langs->trans("TransactionBlockedLockedDesc").")", 'fa-lock', 'class="paddingleft pictofixedwidth opacitymedium"');
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@@ -1532,7 +1534,7 @@ while ($i < min($num, $limit)) {
}
}
// Matching code
// Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.dol_escape_htmltag((string) $line->lettering_code).'</td>';
if (!$i) {

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -69,47 +69,47 @@ class AccountancyCategory // extends CommonObject
public $id;
/**
* @var ?string Accountancy code
* @var string Accountancy code
*/
public $code;
/**
* @var ?string Accountancy Category label
* @var string Accountancy Category label
*/
public $label;
/**
* @var ?string Accountancy range account
* @var string Accountancy range account
*/
public $range_account;
/**
* @var ?int Sens of the account: 0: credit - debit, 1: debit - credit
* @var int Sens of the account: 0: credit - debit, 1: debit - credit
*/
public $sens;
/**
* @var ?int Category type of accountancy
* @var int Category type of accountancy
*/
public $category_type;
/**
* @var ?string Formula
* @var string Formula
*/
public $formula;
/**
* @var ?int Position
* @var int Position
*/
public $position;
/**
* @var ?int country id
* @var int country id
*/
public $fk_country;
/**
* @var ?int Is active
* @var int Is active
*/
public $active;
@@ -399,6 +399,7 @@ class AccountancyCategory // extends CommonObject
*/
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
@@ -437,7 +438,6 @@ class AccountancyCategory // extends CommonObject
public function display($id)
{
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM ".$this->db->prefix()."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id);

View File

@@ -85,8 +85,6 @@ class AccountancyExport
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
/** @var int */
public static $EXPORT_TYPE_ISUITEEXPERT = 200;
/** @var int */
public static $EXPORT_TYPE_ISTEA = 205;
// Generic FEC after that
/** @var int */
public static $EXPORT_TYPE_FEC = 1000;
@@ -163,7 +161,6 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'),
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'),
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
self::$EXPORT_TYPE_ISTEA => $langs->trans('Modelcsv_ISTEA'),
);
$listofgenericformatexport = array(
@@ -226,7 +223,6 @@ class AccountancyExport
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
self::$EXPORT_TYPE_ISTEA => 'istea',
);
global $hookmanager;
@@ -321,10 +317,6 @@ class AccountancyExport
'label' => 'iSuite Expert',
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
self::$EXPORT_TYPE_ISTEA => array(
'label' => 'ISTEA',
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr' => array(
'1' => $langs->trans("Unix"),
@@ -547,9 +539,6 @@ class AccountancyExport
case self::$EXPORT_TYPE_ISUITEEXPERT:
$this->exportiSuiteExpert($TData, $exportFile);
break;
case self::$EXPORT_TYPE_ISTEA:
$this->exportISTEA($TData, $exportFile);
break;
default:
global $hookmanager;
$parameters = array('format' => $formatexportset, 'exportFile' => $exportFile);
@@ -1016,7 +1005,7 @@ class AccountancyExport
$tab['affaire'] = str_repeat(' ', 10);
$tab['quantity1'] = str_repeat(' ', 10);
$tab['num_piece2'] = str_pad(self::trunc((string) $line->piece_num, 8), 8);
$tab['devis'] = str_pad(getDolCurrency(), 3);
$tab['devis'] = str_pad($conf->currency, 3);
$tab['code_journal2'] = str_pad(self::trunc($line->code_journal, 3), 3);
$tab['filler3'] = str_repeat(' ', 3);
@@ -1356,63 +1345,6 @@ class AccountancyExport
}
}
/**
* Export format : ISTEA
*
* @param BookKeepingLine[] $objectLines data
* @param ?resource $exportFile [=null] File resource to export or print if null
* @return void
*/
public function exportISTEA($objectLines, $exportFile = null)
{
global $conf;
$separator = ';';
$end_line = "\n";
// parcours du tableau pour recuperation des numero de compte des tiers pour pouvoir les fournir dans la bonne ligne pour istea
$tiers = [];
foreach ($objectLines as $line) {
if ($line->subledger_account && substr($line->subledger_account, 0, 1) == '4') {
$tiers[$line->piece_num] = $line->subledger_label;
}
}
foreach ($objectLines as $line) {
$date_document = dol_print_date($line->doc_date, '%d/%m/%Y');
/*** preparation du champ label operation pour istea ***/
// retrecissement du champs car ISTEA n'affiche pas bcp de caract<63>re.
$search = array('Paiement fournisseur ', 'Virement ', 'Paiement ');
$replace = array('Paiemt fourn ','Virt ','Paiemt ');
$label_operation = str_replace($search, $replace, $line->label_operation);
// encadrement par des ' si le champs contient le separateur
$label_operation = preg_match('/'.$separator.'/', $label_operation) ? "'".$label_operation."'" : $label_operation;
$tab = array();
// export configurable
$tab[] = $line->piece_num; // colonne 1 : numero de piece ISTEA
$tab[] = $date_document; // colonne 2 : date ISTEA
$tab[] = $line->doc_ref; // colonne 3 : reference piece ISTEA
$tab[] = array_key_exists($line->piece_num, $tiers) ? $tiers[$line->piece_num] : ''; // colonne 4 : nom tiers ISTEA
$tab[] = length_accountg(($line->subledger_account && (substr($line->subledger_account, 0, 2) == substr($line->numero_compte, 0, 2))) ? $line->subledger_account : $line->numero_compte); // colonne 5 : numero de compte ISTEA
$tab[] = length_accountg($line->subledger_account ? $line->subledger_account : $line->numero_compte); // colonne 6 : numero de compte
$tab[] = length_accountg($line->subledger_account ? $line->numero_compte : ''); // G // colonne 7 : numero de compte principal (divers paiement ou 40100000 ou 41100000)
$tab[] = ($line->doc_type == 'bank') ? $label_operation : ($line->subledger_account ? $line->subledger_label : $line->label_compte); // colonne 8 : label de l'operation ISTEA
$tab[] = $label_operation; // colonne 9 : label de l'operation (semble non prise en compte par ISTEA)
$tab[] = price2num($line->debit); // colonne 10 : debit ISTEA
$tab[] = price2num($line->credit); // colonne 11 : credit ISTEA
$tab[] = $line->code_journal; // colonne 12 : journal ISTEA
$output = mb_convert_encoding('"'.implode('"'.$separator.'"', $tab).'"'.$this->end_line, 'ISO-8859-1');
if ($exportFile) {
fwrite($exportFile, $output);
} else {
print $output;
}
}
}
/**
* Export format : FEC
* Last review for this format : 2023/10/12 Alexandre Spangaro (aspangaro@open-dsi.fr)
@@ -1474,21 +1406,20 @@ class AccountancyExport
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
$refInvoice = '';
$invoice = null;
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = (string) $invoice->ref;
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = (string) $invoice->ref_supplier;
$refInvoice = $invoice->ref_supplier;
}
$tab = array();
@@ -1577,9 +1508,10 @@ class AccountancyExport
if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output;
}
} elseif ($line->doc_type == 'supplier_invoice' && $invoice instanceof FactureFournisseur) {
} elseif ($line->doc_type == 'supplier_invoice') {
if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
'@phan-var-force FactureFournisseur $invoice';
/** @var FactureFournisseur $invoice */
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
$objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
}
@@ -1694,21 +1626,20 @@ class AccountancyExport
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
$refInvoice = '';
$invoice = null;
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = (string) $invoice->ref;
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = (string) $invoice->ref_supplier;
$refInvoice = $invoice->ref_supplier;
}
$tab = array();
@@ -1797,9 +1728,10 @@ class AccountancyExport
if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
$objectDirPath = !empty($conf->expensereport->multidir_output[$conf->entity]) ? $conf->expensereport->multidir_output[$conf->entity] : $conf->expensereport->dir_output;
}
} elseif ($line->doc_type == 'supplier_invoice' && $invoice instanceof FactureFournisseur) {
} elseif ($line->doc_type == 'supplier_invoice') {
if (!getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
'@phan-var-force FactureFournisseur $invoice';
/** @var FactureFournisseur $invoice */
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
$objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
}

View File

@@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
/* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -67,22 +66,22 @@ class AccountancyReport // extends CommonObject
public $id;
/**
* @var ?string Accountancy code
* @var string Accountancy code
*/
public $code;
/**
* @var ?string Accountancy Category label
* @var string Accountancy Category label
*/
public $label;
/**
* @var ?int country id
* @var int country id
*/
public $fk_country;
/**
* @var ?int Is active
* @var int Is active
*/
public $active;
@@ -230,6 +229,7 @@ class AccountancyReport // extends CommonObject
*/
public function update($user = null, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
// Clean parameters

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