mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Compare commits
524 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0db33caf2 | ||
|
|
8159249209 | ||
|
|
9f76298e58 | ||
|
|
f1ecb023ff | ||
|
|
ce1243140f | ||
|
|
52c827c2bb | ||
|
|
c263fccb5f | ||
|
|
719de0aef3 | ||
|
|
4cc3be24d3 | ||
|
|
b1109f6803 | ||
|
|
fda1499eee | ||
|
|
4bb42de5d6 | ||
|
|
f31270df2a | ||
|
|
d50a938d12 | ||
|
|
478a8a4d52 | ||
|
|
fa135a216b | ||
|
|
79779b1d2f | ||
|
|
456adc1e95 | ||
|
|
06dc4f5426 | ||
|
|
467c772504 | ||
|
|
1bd6757e62 | ||
|
|
1c52426b90 | ||
|
|
bc18656fd5 | ||
|
|
c77c4efcb8 | ||
|
|
cada04442b | ||
|
|
4bd11f64d7 | ||
|
|
9c45f42e4f | ||
|
|
c9f743983a | ||
|
|
1497541129 | ||
|
|
878474f1d1 | ||
|
|
0afd5cc7e3 | ||
|
|
1aaa29ad9e | ||
|
|
4096b00bd5 | ||
|
|
dcc4334768 | ||
|
|
f137074a98 | ||
|
|
f8f31daa16 | ||
|
|
35528a5885 | ||
|
|
8853bfd51a | ||
|
|
ce0f46a483 | ||
|
|
9a8a07e85a | ||
|
|
26bcc944cf | ||
|
|
d2d9590019 | ||
|
|
fe4b1ff34d | ||
|
|
4e95aab6b5 | ||
|
|
4fb79ba8a1 | ||
|
|
a42593db0d | ||
|
|
cfc766ebbe | ||
|
|
51e4ce05c9 | ||
|
|
819c3fd08a | ||
|
|
4c6955017f | ||
|
|
de40214a09 | ||
|
|
491ecaccfe | ||
|
|
3b3f3fa29b | ||
|
|
efb9327896 | ||
|
|
223f0c2763 | ||
|
|
b85bfc40f4 | ||
|
|
cc78023a44 | ||
|
|
9b74628e29 | ||
|
|
0ef0d339b5 | ||
|
|
5bf5d23495 | ||
|
|
02588036c2 | ||
|
|
8e0d3911e6 | ||
|
|
3929ef0bfa | ||
|
|
c3b35d4da5 | ||
|
|
5e887e8850 | ||
|
|
61df34acd6 | ||
|
|
f5b11b78da | ||
|
|
d7758f9ae6 | ||
|
|
8434e6567f | ||
|
|
2c38bea2b0 | ||
|
|
096b59913d | ||
|
|
d38b9e6248 | ||
|
|
f256deb54b | ||
|
|
7fa3474ecd | ||
|
|
363b05d314 | ||
|
|
3fe6132c94 | ||
|
|
238f684576 | ||
|
|
e6ebf315ed | ||
|
|
70e4d1ccd0 | ||
|
|
a8a95cba75 | ||
|
|
1a015cd91e | ||
|
|
9b36b6e965 | ||
|
|
cbb9f5aa0c | ||
|
|
ef159f919e | ||
|
|
3e8c5651cd | ||
|
|
0a4f1ffc06 | ||
|
|
42a1cde41a | ||
|
|
324f9631d7 | ||
|
|
8073c0e1be | ||
|
|
b256c9aaba | ||
|
|
4897c9de7f | ||
|
|
2058d572d9 | ||
|
|
089fab828b | ||
|
|
fa05dc44ce | ||
|
|
5b9453e302 | ||
|
|
d81a2d060e | ||
|
|
8d9dc8c87d | ||
|
|
97aaff7395 | ||
|
|
7a1fa20959 | ||
|
|
2f36edef3b | ||
|
|
f7fe6c4f1a | ||
|
|
b9f4ddb021 | ||
|
|
6f4b2a8905 | ||
|
|
0e95f70b8d | ||
|
|
dd7189b1d0 | ||
|
|
cd21d385d6 | ||
|
|
86442aa7f0 | ||
|
|
39cd4fcb9e | ||
|
|
4272cfa7e4 | ||
|
|
db56e5c8ea | ||
|
|
0c573812e9 | ||
|
|
4cf6394f01 | ||
|
|
00ccb45bc4 | ||
|
|
8aa1d1165f | ||
|
|
5911d7d0c0 | ||
|
|
41e54529b0 | ||
|
|
f89aff96f7 | ||
|
|
54df3c2991 | ||
|
|
85bce8b71f | ||
|
|
9d9d890c97 | ||
|
|
f511e2e523 | ||
|
|
bd9bf8b5a8 | ||
|
|
5fd5eae3b1 | ||
|
|
6aa4d6a940 | ||
|
|
7997e927a0 | ||
|
|
9516f9bbd2 | ||
|
|
f7bd03fb75 | ||
|
|
ea60024712 | ||
|
|
edea44bccb | ||
|
|
09df62600e | ||
|
|
94eaf5d089 | ||
|
|
d04ac67ecd | ||
|
|
81b9286ea4 | ||
|
|
c648bd8c90 | ||
|
|
99a291f878 | ||
|
|
47f10cdc29 | ||
|
|
7eba8832e6 | ||
|
|
03340d6016 | ||
|
|
d288fe74a2 | ||
|
|
28d588fd40 | ||
|
|
9fc78cd1b6 | ||
|
|
34298f6c8c | ||
|
|
bbbba45fc1 | ||
|
|
bfb97edccf | ||
|
|
989c9b9548 | ||
|
|
82b7326c99 | ||
|
|
d2e6335e95 | ||
|
|
711f21e8a0 | ||
|
|
e1c343cedd | ||
|
|
51def8d31d | ||
|
|
bbb8b0f01f | ||
|
|
c115a76d4e | ||
|
|
63ab8d9f75 | ||
|
|
7848d77830 | ||
|
|
737a807456 | ||
|
|
e6a6426b5b | ||
|
|
f3dc94d334 | ||
|
|
e4f0c1a42b | ||
|
|
44d6803d12 | ||
|
|
f80e83b846 | ||
|
|
bdcd7b5ef3 | ||
|
|
17d1c279ab | ||
|
|
dd40aea380 | ||
|
|
f9ec70f1db | ||
|
|
83bc7b70a0 | ||
|
|
2cbede2ef8 | ||
|
|
729e6c4aba | ||
|
|
a2e865587f | ||
|
|
c6ab6cd57e | ||
|
|
837b2ff060 | ||
|
|
c7ee83b3b9 | ||
|
|
a404b80988 | ||
|
|
cbe15c7c71 | ||
|
|
278b07099c | ||
|
|
576e70c3ce | ||
|
|
5433aa8d2e | ||
|
|
b67fdb3e51 | ||
|
|
7f2a253625 | ||
|
|
ad60a50d4d | ||
|
|
08a976fd85 | ||
|
|
426f4305b0 | ||
|
|
db47ce3bb1 | ||
|
|
1b42078d1e | ||
|
|
736890b244 | ||
|
|
2664518bd3 | ||
|
|
c6f90d8361 | ||
|
|
cc732621ab | ||
|
|
04fed9526a | ||
|
|
9f4692e1c9 | ||
|
|
1fa3b63fdc | ||
|
|
af2889e982 | ||
|
|
4d925db3cd | ||
|
|
36d91f1c07 | ||
|
|
bcc260dc08 | ||
|
|
9507b89fec | ||
|
|
a52a218ae4 | ||
|
|
0409b8b9c5 | ||
|
|
f68cf0034a | ||
|
|
ba4e97f07b | ||
|
|
c2c3879032 | ||
|
|
c4529ed986 | ||
|
|
8b7eaf360e | ||
|
|
2f317f0f52 | ||
|
|
bd35af1360 | ||
|
|
351a7bd6bb | ||
|
|
fe6d59c090 | ||
|
|
d4e66426e7 | ||
|
|
88d81aa943 | ||
|
|
f24f4e012d | ||
|
|
60ea952b78 | ||
|
|
5354b54ec0 | ||
|
|
49feeee85e | ||
|
|
42d8591758 | ||
|
|
cf156e024d | ||
|
|
6b0c8f39d5 | ||
|
|
2c2e01d14c | ||
|
|
abc1d1dcb3 | ||
|
|
628189f57f | ||
|
|
748dcd0881 | ||
|
|
2d1d6f13c9 | ||
|
|
4f98ca37e2 | ||
|
|
a34eaa07ed | ||
|
|
20f2293c01 | ||
|
|
7869e45954 | ||
|
|
9af7eaf08c | ||
|
|
79ed9c7e37 | ||
|
|
eb8167bc57 | ||
|
|
df992477be | ||
|
|
79c55149b2 | ||
|
|
ac1077bfe3 | ||
|
|
a46c47c134 | ||
|
|
762e4ec8d1 | ||
|
|
77f982d1a8 | ||
|
|
7a7146c03d | ||
|
|
a34d760a88 | ||
|
|
e9eb22f8f0 | ||
|
|
e1a47ed0fb | ||
|
|
6388f6e62a | ||
|
|
e2605fbf64 | ||
|
|
90c24b3d95 | ||
|
|
0912b3b04f | ||
|
|
7e82f70c77 | ||
|
|
2dd81deb13 | ||
|
|
273ec857a3 | ||
|
|
ef564caf28 | ||
|
|
3ef6299c83 | ||
|
|
ec58ee940a | ||
|
|
2519278269 | ||
|
|
74881ae251 | ||
|
|
c218eaa6ed | ||
|
|
b7cb799af0 | ||
|
|
78bf506790 | ||
|
|
61b03b0c05 | ||
|
|
b31962f7e2 | ||
|
|
112220da86 | ||
|
|
1fafc1b6ad | ||
|
|
eb4e059683 | ||
|
|
b5ff688841 | ||
|
|
8805b8cac4 | ||
|
|
d01a99cd79 | ||
|
|
1866713082 | ||
|
|
9ecc88230f | ||
|
|
8ddd050a34 | ||
|
|
4c4b773de5 | ||
|
|
37a815af53 | ||
|
|
f60f34cdf8 | ||
|
|
4267f5f010 | ||
|
|
f08c9605db | ||
|
|
e41dfcbbb3 | ||
|
|
a0b6aa28a7 | ||
|
|
c273495261 | ||
|
|
220090813d | ||
|
|
e65ee097a5 | ||
|
|
92963af09f | ||
|
|
8ccdbf374b | ||
|
|
0300209b3d | ||
|
|
a5f51dc969 | ||
|
|
04b7fdd4c4 | ||
|
|
e3c44568a0 | ||
|
|
37f3fccc35 | ||
|
|
fedcec58a6 | ||
|
|
be95c92c45 | ||
|
|
810fd7e744 | ||
|
|
c6afa1a6cb | ||
|
|
29eedd2ac4 | ||
|
|
ead519811c | ||
|
|
5203652796 | ||
|
|
750ed5e91c | ||
|
|
425c23d28c | ||
|
|
900a91a0a2 | ||
|
|
ce06c12da6 | ||
|
|
b73bcd68a9 | ||
|
|
86833633ef | ||
|
|
21ac3b28ef | ||
|
|
6aee2db1d4 | ||
|
|
a6da3b189a | ||
|
|
65d6403fa3 | ||
|
|
62c1d500e8 | ||
|
|
ef090aa895 | ||
|
|
d9be3efa90 | ||
|
|
a4785adb3d | ||
|
|
3c22179183 | ||
|
|
a96d13d5aa | ||
|
|
f1868ee162 | ||
|
|
cfd4919829 | ||
|
|
30893bf676 | ||
|
|
28213b3129 | ||
|
|
c3ede4413d | ||
|
|
21eca275e9 | ||
|
|
127b9701ff | ||
|
|
ee7201fc61 | ||
|
|
c075e078e9 | ||
|
|
f9eb6b69f5 | ||
|
|
3d9b7ed7d3 | ||
|
|
6920b72cf4 | ||
|
|
9a9602f418 | ||
|
|
0960fcba2a | ||
|
|
9b46ed9c2d | ||
|
|
d055b1fb29 | ||
|
|
9411ac2144 | ||
|
|
eb2b35e3b1 | ||
|
|
ab5f9a0884 | ||
|
|
b4ece8d154 | ||
|
|
75e504ffbc | ||
|
|
3877f257b4 | ||
|
|
6f2d8b23b4 | ||
|
|
80326acb71 | ||
|
|
d9035eecda | ||
|
|
da6f1fbc9a | ||
|
|
4bb2b9f971 | ||
|
|
a0864dfb3f | ||
|
|
d3d534efee | ||
|
|
2e94f7dbd4 | ||
|
|
2c4b3bf6ad | ||
|
|
e8aaa51edc | ||
|
|
e48e1e27d5 | ||
|
|
c86b50e3fc | ||
|
|
42368b37e9 | ||
|
|
addefdf0cf | ||
|
|
59642d8d93 | ||
|
|
a26eecf0fd | ||
|
|
69449668a8 | ||
|
|
084d99f670 | ||
|
|
15c19b99c9 | ||
|
|
c418a6ff57 | ||
|
|
3aad5fd283 | ||
|
|
d04b1e57d2 | ||
|
|
f5c715c6a7 | ||
|
|
d8fecc1522 | ||
|
|
30a9da8fbf | ||
|
|
e6712300d5 | ||
|
|
c547362ae9 | ||
|
|
9ec4575c43 | ||
|
|
4962dd1a81 | ||
|
|
6337a987d8 | ||
|
|
7a500976d2 | ||
|
|
0e1744a6ec | ||
|
|
29a7a410c8 | ||
|
|
e9009ede87 | ||
|
|
7b16039084 | ||
|
|
acdab170a7 | ||
|
|
32b18d6bfd | ||
|
|
9cd7d381a6 | ||
|
|
e35b534ee2 | ||
|
|
682544ad45 | ||
|
|
53ffe42f92 | ||
|
|
c2a037842d | ||
|
|
552bebf564 | ||
|
|
ec93f50863 | ||
|
|
240c5bb311 | ||
|
|
c12a7e144a | ||
|
|
991f53db9e | ||
|
|
877fd00353 | ||
|
|
d420d035de | ||
|
|
115323dec8 | ||
|
|
ac6c57e90e | ||
|
|
9c4bb84460 | ||
|
|
5a58b8e721 | ||
|
|
b068fdc9b3 | ||
|
|
b8533e1853 | ||
|
|
753e5e535d | ||
|
|
99774022a5 | ||
|
|
c5ebc9b7bd | ||
|
|
f2f3e478d1 | ||
|
|
f10d9464a1 | ||
|
|
580d789a00 | ||
|
|
98d106e6b5 | ||
|
|
bca77bddb8 | ||
|
|
7ca9f0022a | ||
|
|
a602309e04 | ||
|
|
f51935a258 | ||
|
|
976399c2d9 | ||
|
|
cd6ed63768 | ||
|
|
348981a419 | ||
|
|
adf59f2599 | ||
|
|
d0323fa27d | ||
|
|
038f8d5dff | ||
|
|
bab49d66c5 | ||
|
|
230eee4ead | ||
|
|
ce9a1b3661 | ||
|
|
4feb9def4e | ||
|
|
dccde49388 | ||
|
|
a039a00277 | ||
|
|
d30a0ea066 | ||
|
|
ab6c74ae88 | ||
|
|
fbca98ec2a | ||
|
|
93f23fe452 | ||
|
|
67c2a48fc9 | ||
|
|
792ff4044e | ||
|
|
29ef86a245 | ||
|
|
d5add8aa49 | ||
|
|
d3b9a83055 | ||
|
|
f4b2269e2e | ||
|
|
0eee1ad18b | ||
|
|
d5e2f89edc | ||
|
|
67bcc242db | ||
|
|
8a55e2f6a4 | ||
|
|
5eb5033aba | ||
|
|
723c8278ce | ||
|
|
bbf83c7053 | ||
|
|
b8286ab8f3 | ||
|
|
7133c6529b | ||
|
|
e0a3756c6e | ||
|
|
c396a08cb2 | ||
|
|
0981c69515 | ||
|
|
1987ea2eb7 | ||
|
|
6a4ee18380 | ||
|
|
b3a2908b48 | ||
|
|
910f7e8564 | ||
|
|
7cf1a97673 | ||
|
|
cf57e7e88b | ||
|
|
8b4dcb1194 | ||
|
|
a186e16568 | ||
|
|
eaa31ed4a3 | ||
|
|
0e62008db6 | ||
|
|
aa096448be | ||
|
|
d9d0618eec | ||
|
|
39afafc585 | ||
|
|
b37b2ba76f | ||
|
|
c48b035a15 | ||
|
|
1d197e42bb | ||
|
|
b0c7b8750a | ||
|
|
a0b791a4a6 | ||
|
|
abefce7ae2 | ||
|
|
352bdaf9c4 | ||
|
|
87c16498ca | ||
|
|
35f3a4f441 | ||
|
|
111e3fcd32 | ||
|
|
d819d88718 | ||
|
|
278eea6fae | ||
|
|
fa22ebd893 | ||
|
|
793e77bc5f | ||
|
|
70a453a5c2 | ||
|
|
33c6d95b1c | ||
|
|
1e64870a9e | ||
|
|
94ed718782 | ||
|
|
40965b63b5 | ||
|
|
3391d3db05 | ||
|
|
9509929f5d | ||
|
|
63d4b5e3d8 | ||
|
|
f287d100a3 | ||
|
|
336d3ad8e5 | ||
|
|
9af212a542 | ||
|
|
e71631abe0 | ||
|
|
5d58a33f37 | ||
|
|
25ea797aed | ||
|
|
97eacefa6b | ||
|
|
f5fbbcfcb8 | ||
|
|
2c67c8b6ff | ||
|
|
d0fb08adf4 | ||
|
|
624493fb26 | ||
|
|
6eddee9a78 | ||
|
|
52138372ce | ||
|
|
a27538f582 | ||
|
|
385927fe06 | ||
|
|
a621032643 | ||
|
|
32646cb7f4 | ||
|
|
74b67eb6c6 | ||
|
|
231fc6ce70 | ||
|
|
1dfc091c9b | ||
|
|
df7fffcab3 | ||
|
|
b517e068ed | ||
|
|
8a330ecaa9 | ||
|
|
eef0d0bddb | ||
|
|
c1889afd7b | ||
|
|
644f365455 | ||
|
|
667890247c | ||
|
|
c727bbb530 | ||
|
|
79edf0fb15 | ||
|
|
c0f5e314e1 | ||
|
|
e125ab4783 | ||
|
|
a8cb076bbd | ||
|
|
691f76d1e0 | ||
|
|
4ea503f366 | ||
|
|
65c9bd7dcf | ||
|
|
16a0d1d7d5 | ||
|
|
bb40a43c5f | ||
|
|
e4a93da82e | ||
|
|
6de574bf5c | ||
|
|
2f773e9326 | ||
|
|
1594afdef7 | ||
|
|
ad154a368f | ||
|
|
171494ddfc | ||
|
|
21d8c40fc0 | ||
|
|
fd0338cb1c | ||
|
|
61c5a61623 | ||
|
|
bad8ee865d | ||
|
|
dcba3347d8 | ||
|
|
126dc77ef3 | ||
|
|
f64a07861d | ||
|
|
1ee3c5e5a0 | ||
|
|
1a81d7fc16 | ||
|
|
4cd82df73c | ||
|
|
0be0c1a1c1 | ||
|
|
9f5ef68123 | ||
|
|
66a175e48d | ||
|
|
e24da32424 | ||
|
|
a13b720598 | ||
|
|
86971c7b86 | ||
|
|
daccab5a07 | ||
|
|
4d32d93ee2 | ||
|
|
abc9eb7bdc | ||
|
|
ec19dcc8f8 | ||
|
|
9051e411d0 |
3
.github/changed-lines-count-labeler.yml
vendored
Normal file
3
.github/changed-lines-count-labeler.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Add this tag for any changes for more than 1 line
|
||||
"Pending analysis of PR (maintenance team)":
|
||||
min: 1
|
||||
86
.github/scripts/get_changed_php.sh
vendored
Executable file
86
.github/scripts/get_changed_php.sh
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# This script retrieves the list of changed PHP files for a pull request
|
||||
# using the GitHub API and sets two outputs:
|
||||
# - any_changed: "true" if at least one PHP file changed, "false" otherwise
|
||||
# - all_changed_files: space-separated list of changed PHP file paths
|
||||
#
|
||||
# Required environment variables:
|
||||
# GITHUB_TOKEN - GitHub token with repo access
|
||||
# GITHUB_REPOSITORY - "owner/repo"
|
||||
# GITHUB_EVENT_PATH - Path to the event JSON payload
|
||||
|
||||
# Verify required environment variables are set
|
||||
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
|
||||
echo "GITHUB_TOKEN is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
|
||||
echo "GITHUB_REPOSITORY is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${GITHUB_EVENT_PATH:-}" ]]; then
|
||||
echo "GITHUB_EVENT_PATH is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the pull request number from the event payload
|
||||
pr_number=$(jq --raw-output '.pull_request.number' "$GITHUB_EVENT_PATH")
|
||||
if [[ "$pr_number" == "null" ]]; then
|
||||
echo "Not a pull request event"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Split repository into owner and repo name
|
||||
# Split repository into owner and repo name using Bash parameter expansion
|
||||
owner="${GITHUB_REPOSITORY%%/*}" # Extract text before the first '/'
|
||||
repo="${GITHUB_REPOSITORY##*/}" # Extract text after the last '/'
|
||||
|
||||
page=1
|
||||
per_page=100
|
||||
changed_php_files=()
|
||||
|
||||
# Loop through all pages to gather changed files
|
||||
while true; do
|
||||
response=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
"https://api.github.com/repos/${owner}/${repo}/pulls/${pr_number}/files?per_page=${per_page}&page=${page}")
|
||||
|
||||
# Filter for files ending with .php and add them to the list
|
||||
mapfile -t files < <(echo "$response" | jq -r '.[] | select(.filename | test("\\.php$")) | .filename')
|
||||
changed_php_files+=("${files[@]}")
|
||||
|
||||
# Check if we have reached the last page (less than per_page results)
|
||||
count=$(echo "$response" | jq 'length')
|
||||
if (( count < per_page )); then
|
||||
break
|
||||
fi
|
||||
((page++))
|
||||
done
|
||||
|
||||
|
||||
# Build a space-separated string of changed PHP files
|
||||
# This does not cope with files that have spaces.
|
||||
# But such files do not exist in the project (at least not for the
|
||||
# files we are filtering).
|
||||
all_changed_files=$(IFS=" " ; echo "${changed_php_files[*]}")
|
||||
|
||||
|
||||
# Determine changed files flag
|
||||
if [ -z "$all_changed_files" ]; then
|
||||
any_changed="false"
|
||||
else
|
||||
any_changed="true"
|
||||
fi
|
||||
|
||||
# Set outputs for GitHub Actions if GITHUB_OUTPUT is available
|
||||
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||
echo "any_changed=${any_changed}" >> "$GITHUB_OUTPUT"
|
||||
echo "all_changed_files=${all_changed_files}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Otherwise, print the outputs
|
||||
echo "any_changed=${any_changed}"
|
||||
echo "all_changed_files=${all_changed_files}"
|
||||
fi
|
||||
21
.github/workflows/pr-18-autolabel.yaml.disabled
vendored
Normal file
21
.github/workflows/pr-18-autolabel.yaml.disabled
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: "Set label for v18"
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- "18.0"
|
||||
push:
|
||||
branches:
|
||||
- "18.0"
|
||||
|
||||
jobs:
|
||||
changed-lines-count-labeler:
|
||||
runs-on: ubuntu-latest
|
||||
name: An action for automatically labelling pull requests based on the changed lines count
|
||||
steps:
|
||||
- name: Set a label
|
||||
uses: vkirilichev/changed-lines-count-labeler@v0.2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
configuration-path: .github/changed-lines-count-labeler.yml
|
||||
continue-on-error: true
|
||||
45
.github/workflows/pr-18.yaml.disabled
vendored
Normal file
45
.github/workflows/pr-18.yaml.disabled
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# Action to prepare the github action
|
||||
# Go on Dolibarr - Settings - Developer settings - Enter a name + webhook to disable + Permissions (see app test) + Can install by any account
|
||||
# Click on generate the private keys
|
||||
# Click on Install application - choose user of the Organization
|
||||
# Go on Organisation - Secret and variables and create a secret PR18_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 PR18_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr".
|
||||
#
|
||||
|
||||
name: Set reviewer for v18
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- "18.0"
|
||||
push:
|
||||
branches:
|
||||
- "18.0"
|
||||
|
||||
jobs:
|
||||
pr18:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
#env:
|
||||
# GH_TOKEN: ${{ github.token }}
|
||||
# GH_TOKENS: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
steps:
|
||||
- name: Generate a token
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@v2
|
||||
with:
|
||||
app-id: ${{ vars.PR18_APP_ID }}
|
||||
private-key: ${{ secrets.PR18_SECRET_KEY }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Assign reviewer
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
|
||||
url: ${{ github.event.pull_request.html_url }}
|
||||
run: |
|
||||
gh pr edit "$url" --add-reviewer rycks
|
||||
gh pr edit "$url" --add-reviewer lvessiller-opendsi
|
||||
|
||||
47
.github/workflows/pre-commit.yml
vendored
47
.github/workflows/pre-commit.yml
vendored
@@ -14,18 +14,18 @@ jobs:
|
||||
run: sudo apt-get update && sudo apt-get install cppcheck
|
||||
if: false
|
||||
|
||||
# Checkout git sources to analyze
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The next uses the git API because there is no clone yet.
|
||||
# This is faster for a big repo.
|
||||
- name: Get all changed php files (if PR)
|
||||
id: changed-php
|
||||
uses: tj-actions/changed-files@v42
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
files: |
|
||||
**.php
|
||||
if: env.gh_event == 'pull_request'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./.github/scripts/get_changed_php.sh
|
||||
|
||||
# Checkout git sources to analyze
|
||||
- uses: actions/checkout@v4
|
||||
# Action setup-python needs a requirements.txt or pyproject.toml
|
||||
# This ensures one of them exists.
|
||||
- name: Create requirements.txt if no requirements.txt or pyproject.toml
|
||||
@@ -42,6 +42,21 @@ jobs:
|
||||
with:
|
||||
path: ~/.cache/pre-commit/
|
||||
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- name: Extract PHP version
|
||||
id: extract-php-version
|
||||
run: |
|
||||
PHP_VERSION=$(sed -n 's/.*\$arrayphpmaxversionwarning\s*=\s*array\s*(\s*\([0-9]\+\)\s*,\s*\([0-9]\+\).*/\1.\2/p' htdocs/install/check.php)
|
||||
echo "PHP_VERSION=$PHP_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup PHPCS
|
||||
uses: shivammathur/setup-php@v2
|
||||
# Install proper php version, and also install phpcs which may be needed
|
||||
with:
|
||||
php-version: ${{ env.PHP_VERSION }} # Version from check.php
|
||||
coverage: none # disable xdebug, pcov
|
||||
tools: phpcs
|
||||
|
||||
# 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
|
||||
@@ -62,24 +77,6 @@ jobs:
|
||||
# files: |
|
||||
# **.php
|
||||
|
||||
- name: Setup PHPCS
|
||||
uses: shivammathur/setup-php@v2
|
||||
# Install when we're going to run phpcs
|
||||
if: |
|
||||
steps.changed-php.outputs.any_changed == 'true'
|
||||
||
|
||||
(
|
||||
github.event_name == 'push'
|
||||
&& (
|
||||
github.event.ref == 'refs/heads/develop'
|
||||
|| endsWith(github.event.ref, '.0')
|
||||
)
|
||||
)
|
||||
with:
|
||||
php-version: 8.1
|
||||
coverage: none # disable xdebug, pcov
|
||||
tools: phpcs
|
||||
|
||||
- name: Run some pre-commit hooks on selected changed files only
|
||||
if: steps.changed-php.outputs.any_changed == 'true'
|
||||
env:
|
||||
|
||||
2
.github/workflows/stale-issues-safe.yml
vendored
2
.github/workflows/stale-issues-safe.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {} # none
|
||||
permissions: {} # no restriction by default
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
28
.github/workflows/test.yaml
vendored
Normal file
28
.github/workflows/test.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Test github actions
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
push:
|
||||
|
||||
env:
|
||||
ENVGHT: ${{ secrets.GITHUB_TOKEN }}
|
||||
ENVGHU: ${{ github.token }}
|
||||
TEST_ACCESS_KEY: ${{ secrets.TEST_ACCESS_KEY }}
|
||||
TEST_VAR_REPO: ${{ vars.TEST_VAR_REPO }}
|
||||
ENVLOCAL: "varenvlocal"
|
||||
|
||||
jobs:
|
||||
testjob:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Log
|
||||
run: |
|
||||
echo "Run action by ${{ github.actor }}"
|
||||
echo "github.token=${{ github.token }}"
|
||||
echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}"
|
||||
echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH"
|
||||
echo "repo-token: ${{secrets.GITHUB_TOKEN}}"
|
||||
echo "secret repository TEST_ACCESS_KEY: ${{secrets.TEST_ACCESS_KEY}}"
|
||||
echo "variable repository : ${{vars.TEST_VAR_REPO}}"
|
||||
echo "ENVLOCAL: ${{env.ENVLOCAL}}"
|
||||
@@ -6,7 +6,7 @@ repos:
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: no-commit-to-branch
|
||||
args: [--branch, develop, --pattern, \d+.0]
|
||||
args: [--branch, develop, --pattern, \d+.0$]
|
||||
- id: check-yaml
|
||||
args: [--unsafe]
|
||||
- id: check-json
|
||||
@@ -81,6 +81,8 @@ repos:
|
||||
]
|
||||
pass_filenames: false # Run on all files
|
||||
- id: php-lint
|
||||
exclude:
|
||||
(?x)^(htdocs/includes/symfony/var-dumper/Tests/.*)$
|
||||
- id: php-stan
|
||||
stages: [manual]
|
||||
files: \.(php)$
|
||||
|
||||
13
.travis.yml
13
.travis.yml
@@ -2,9 +2,9 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see https://docs.travis-ci.com/user/languages/php/
|
||||
|
||||
# We use dist: bionic = 18.04, focal = 20.04
|
||||
# We use dist: focal = 20.04, jammy = 22.04
|
||||
os: linux
|
||||
dist: focal
|
||||
dist: jammy
|
||||
|
||||
language: generic
|
||||
|
||||
@@ -21,7 +21,7 @@ services:
|
||||
|
||||
|
||||
addons:
|
||||
mariadb: '10.5'
|
||||
mariadb: '10.6'
|
||||
|
||||
|
||||
env:
|
||||
@@ -123,7 +123,8 @@ install:
|
||||
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
sudo chmod -R a+rwx /usr/local/bin/composer
|
||||
composer -V
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
sudo composer -n config -g vendor-dir htdocs/includes
|
||||
sudo chmod -R a+rwx /home/travis/.config/composer
|
||||
echo
|
||||
|
||||
- |
|
||||
@@ -193,8 +194,8 @@ before_script:
|
||||
phpcs -i | head -
|
||||
# Check PHP Vardump check version
|
||||
echo "PHP Vardump check version"
|
||||
which var_dump_check
|
||||
var_dump_check --version
|
||||
which var-dump-check
|
||||
var-dump-check --version
|
||||
# Check PHPUnit version
|
||||
echo "PHPUnit version"
|
||||
which phpunit
|
||||
|
||||
209
ChangeLog
209
ChangeLog
@@ -2,6 +2,205 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 18.0.7 compared to 18.0.6 *****
|
||||
138 files changed, 1622 insertions(+), 530 deletions(-)
|
||||
|
||||
FIX: 17.0 API endpoints "PUT": prevent overwriting all extrafields if only some are supplied in the request cf. PR #29237
|
||||
FIX: 17.0 - collisions in cache for dol_getIdFromCode
|
||||
FIX: 17.0 - missing error handling for FactureRec::fetch in card-rec.php
|
||||
FIX: 17.0: warnings due to uninitialized variables + delete code that doesn't apply to recurring invoices (AFAIK, there is no recurring credit note feature)
|
||||
FIX: #21294 Stock import sql query
|
||||
FIX: #26250 fatal error on kit
|
||||
FIX: #32339 Delete a loan settlement is partial
|
||||
FIX: #33038 drag and drop files are not prefixed with object reference
|
||||
FIX: #33117 accountancy export Quadratus when doc ref is less than 10 char
|
||||
FIX: #33145 wrong label status buy on product tooltip
|
||||
FIX: accountancy export Quadratus when doc ref is less than 10 char
|
||||
FIX: bad dispatched quantities for batches on shipment card
|
||||
FIX: bank payment rejection on SEPA (backport commit 100a657) (#33838)
|
||||
FIX: calculate start date of cloned task from cloned project (#31799)
|
||||
FIX: can not delete files in task card
|
||||
FIX: close all services on contract will close all lines (#33466)
|
||||
FIX: compatibility with multicompany
|
||||
FIX: constant PAYMENTBYBANKTRANSFER_ADDDAYS was never saved (#33799)
|
||||
FIX: Count on supplier invoice list does not match count in DB (#33351)
|
||||
FIX: #CVE-2024-34051
|
||||
FIX: delete supplier order line when linked to customer order line
|
||||
FIX: delete supplier order when at least one line linked to customer order line
|
||||
FIX: display error when loan can't be deleted
|
||||
FIX: display full tree on shipment card when a kit contains a same component in other sub-kit
|
||||
FIX: Fix case when the value of a extrafields of the type 'boolean', 'select' or other have an option with a value equal to '0'.
|
||||
FIX: Fix return value of hook sendMail when hook return -1 who must be return false in sendfile() function
|
||||
FIX: GETPOST('private_message')
|
||||
FIX: in projet/element.php total_time is always back to 0
|
||||
FIX: invoice creation : use dol_include_once instead of require_once to allow external modules
|
||||
FIX: invoice creation : use dol_include_once instead of require_once to allow external modules.
|
||||
FIX: issue #28222 Edit date extrafield displayed on all on lines (#31914)
|
||||
FIX: Many status on invoice linked object block
|
||||
FIX: Multilangs : PDF lines description
|
||||
FIX: ODT substitution when many HTML tags in string
|
||||
FIX: old copy not needed in supplier order create method (#31733)
|
||||
FIX: PAIEMENT Wrong field displayed for DateChequeReceived (#33390)
|
||||
FIX: phpcs
|
||||
FIX: product variants copy: also copy multiprice variations
|
||||
FIX: qual
|
||||
FIX: removes traces of <<<HEAD conflicts following the postponement of branch 13 modifications (#32014)
|
||||
FIX: Replace compromised tj-actions/changed-files (#33481)
|
||||
FIX: selectcontact is loading all contacts if socid is empty and MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is not set
|
||||
FIX: selectcontact is loading all contacts when update event
|
||||
FIX: select group and severity search fields on ticket list
|
||||
FIX: send email to assigned user on ticket create
|
||||
FIX: send mail to BCC when email formatted as Fullname <email> (#31983)
|
||||
FIX: Show true error when send notify email at validate expense report
|
||||
FIX: status ticket update for new message
|
||||
FIX: swiftmailer: correctly set errors-to header (#31826)
|
||||
FIX: TakePos barcode rule (#31857)
|
||||
FIX: There were many status indicator in the invoice linked object block (propal card)
|
||||
FIX(ticket): Notification email without public interface
|
||||
FIX: Update on a sold line of bank entries set the type to empty, now it's fixed #22539 (#31888)
|
||||
FIX: update status on create supplier order for trigger (#31642)
|
||||
FIX: use tax with code on supplier order line give tax code missing in supplier invoice (#32018)
|
||||
FIX: use vat with code on supplier order result code missing in supplier invoice
|
||||
FIX: warehouse list: broken status filter (#33667)
|
||||
FIX: warnings (#33423)
|
||||
FIX: wrong left margin (v18 to develop ?)
|
||||
FIX: wrong message on update shipment
|
||||
FIX: wrong update function parameter
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.6 compared to 18.0.5 *****
|
||||
FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269)
|
||||
FIX: 16.0 - the e-mail templates configured in the notification module are not used if the recipient is a fixed e-mail address (#29407)
|
||||
FIX: 17.0: $num doesn't take trigger-modified newref into account, leading to inconsistencies if BILL_SUPPLIER_VALIDATE changes the invoice's ref (#28684)
|
||||
FIX: 17.0: fatal when updating recurring supplier invoice line with php8 ($remise_percent is '' instead of 0) (#31713)
|
||||
FIX: 17.0: supplier invoice template card: buyer and seller swapped in VAT-related function calls (probably a copy-paste from customer invoice templates) (#31446)
|
||||
FIX: #24265 regression cannot see all product on takepos (#28753)
|
||||
FIX: #25853 Thirdparty Massaction (#25868)
|
||||
FIX: #28205
|
||||
FIX: #28251 Fixing subpermission name on api_multicurrencies.class.php (#28252)
|
||||
FIX: #28369
|
||||
FIX: #28518 (#28520)
|
||||
FIX: #28978 FIX: #28976
|
||||
FIX: #29029 Impossible to delete an order line
|
||||
FIX: #29114 Missing contact term in intervention
|
||||
FIX: #29114 Translate contact term in intervention
|
||||
FIX: #29439 incomplete API return (#29796)
|
||||
FIX: #29496 filtering a record should not hide its child not filtered
|
||||
FIX: #30010 Use conf TICKET_MESSAGE_MAIL_INTRO instead of translation key (#30081)
|
||||
FIX: #30274 Add the include before executing dolibarr_set_const (#30320)
|
||||
FIX: #30467
|
||||
FIX: #30768 allocate the correct invoice_line_id to the element timespent (#30769)
|
||||
FIX: Accountancy export with file or not
|
||||
FIX: Accountancy - Generate entries of expense report with localtax (#30411)
|
||||
FIX: Accountancy - Not trunc id_import
|
||||
FIX: accounting FEC import (Issue #28306) (#29414)
|
||||
FIX: Add new hidden conf "DISABLE_QTY_OVERWRITTEN" (#28523)
|
||||
FIX: Add same security test when uploading files from API than from GUI (#31114)
|
||||
FIX: Amount of localtaxes in foreign currency was wrong on screen and PDF
|
||||
FIX: an error in a complex else condition
|
||||
FIX: ASSET: annual depreciation starting year (Again ;-)) #26084 (#30040)
|
||||
FIX: avoid error "Column 'entity' in where clause is ambiguous" (#28270)
|
||||
FIX: avoid from re-initializing array result on nested hook getEntity (#30626)
|
||||
FIX: avoid php warnings (#29247)
|
||||
FIX: avoid to delete "lock" and "unlock" files
|
||||
FIX: avoid Unknown column 'pfp.ref_fourn' (#28145)
|
||||
FIX: background color for enabled modules (#29378)
|
||||
FIX: Backport fix fatal error on price with some truncating setup
|
||||
FIX: Backport page inventory.php from v18 to fix pagination bugs causing data loss (#29688)
|
||||
FIX: back to page on error in contact card (#29627)
|
||||
FIX: Bad calculation of $nbtotalofrecord (#30183)
|
||||
FIX: box_actions.php still uses fk_user_done which no longer exists (#31190)
|
||||
FIX: can validate shipment without stock movement (#31780)
|
||||
FIX: Condition on newDateLimReglement
|
||||
FIX: Conflict with autoload (#30399)
|
||||
FIX: const WORKFLOW_RECEPTION_CLASSIFY_NEWD_INVOICE (#31601)
|
||||
FIX: contact/address title is always "New Contact/Address" even if the contact/address already exists (#29581)
|
||||
FIX: Display the date according to user language on substitutions (#29510)
|
||||
FIX: Display the real_PMP on inventory when its value is equal to 0 (#22291)
|
||||
FIX: Don't display column when it's out of date (#28271)
|
||||
FIX: email templates for expense report not visible
|
||||
FIX: Error mesg show untranslated extrafield name (#30227)
|
||||
FIX: Error message overwrote when a error occurs during update of product multilangs (#30841)
|
||||
FIX: Error When cloning fourn price no default value for tva_tx (#28368)
|
||||
FIX: executeHooks $object default value (#29647)
|
||||
FIX: expedition PDF models using units labels (#30358)
|
||||
FIX: Extrafield following between rec invoice and classic invoice (#31445)
|
||||
FIX: fatal error on loading pictures in attached documents of an event (#30553)
|
||||
FIX: fatal error Unsupported operand types when recording load payment
|
||||
FIX: Fix bug select columns and access to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000)
|
||||
FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfer is allowed (#26217)
|
||||
FIX: Fix save directory for invoice ODT and multientities
|
||||
FIX: group by qty in product margin tab (#29853)
|
||||
FIX: Hierarchy Employee view do not filter on employee = 1 (#29496)
|
||||
FIX: if you call fetchLines several times, your $object->lines contains duplicates (#31167)
|
||||
FIX: If you have no stock of your product, an error is displayed when you delete the reception. (#31504)
|
||||
FIX: incorrect page numbering in PDF #29458 (#29476)
|
||||
FIX: inventoryDeletePermission id define twice
|
||||
FIX: issue on action set condition in particular when you set a deposi… (#31518)
|
||||
FIX: issue to get the right files exported in Quadratrus export.php (#30004)
|
||||
FIX: lang output for sales representative on PDF (#30469)
|
||||
FIX: late order search option (#30692) and propal (#30687)
|
||||
FIX: lettering (auto) for invoice deposit with company discount (#29633)
|
||||
FIX: made invalid code shape error more user friendly (#29498)
|
||||
FIX: Merge of thirdparties must also move uploaded files
|
||||
FIX: missing entity parameter for ajax_constantonoff
|
||||
FIX: missing hide "new" button where "product" or "service" module are disable
|
||||
FIX: mo cloning (#29686)
|
||||
FIX: modification date from label in accounting bookkeeping list (#30038)
|
||||
FIX: Move the trigger for delete order line before the SQL request
|
||||
FIX: multiple problems with multicompany
|
||||
FIX: mysql error during dump for enable sandbox M999999 (#31116)
|
||||
FIX: notification: error 500 in fixed emails due to a bad copy/paste (#29580)
|
||||
FIX: notification module: for supplier orders (any of the 3 triggers), user can choose an e-mail template in conf, but the conf is not used when sending the notification (#28216)
|
||||
FIX: Not qualified lines for reception (#29473)
|
||||
FIX: not redirect when error occurs on updating card (#29388)
|
||||
FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211)
|
||||
FIX: on change ref for bank account attachment are lost (#30529)
|
||||
FIX: Option MAIN_DOC_USE_TIMING can be a string with date format
|
||||
FIX: orders to bill menu (#30179)
|
||||
FIX: Payment on customer invoice - Remove accountid in url if empty for apply default value (#28156)
|
||||
FIX: PDF Fatal error : Backport fix from #23972
|
||||
FIX: PDF Translations Extrafields
|
||||
FIX: permission on payment file of a tax
|
||||
FIX: php8: Fatal when empty $tmpvat is an empty string (no silent conversion to '0' when used in arithmetic operations) (#29451)
|
||||
FIX: PHP 8 warning on output of successful cronjob (#29922)
|
||||
FIX: PHP exception on getSpecialCode (#29646)
|
||||
FIX: php warning global conf (#29478)
|
||||
FIX: pos: invoice date incorrectly set because of timezome mismatches (reverts #36e91da) (#30184)
|
||||
FIX: public project form return an error if SOCIETE_EMAIL_UNIQUE (#29942)
|
||||
FIX: purge files cron: php warnings when rest module enabled (#30919)
|
||||
FIX: PUT /thirdparties/{id} and PUT /contacts/{id} should throw exception if update returns < 0 (#29596)
|
||||
FIX: Regression #29340
|
||||
FIX: Repair the replenishment list (#29336)
|
||||
FIX: REPLENISH MANY FOURN WHEN ORDER ALREADY CREATE (#29710)
|
||||
FIX: round capital societe (#29211)
|
||||
FIX: search and add extrafields to tasks when conf disabled (#29542)
|
||||
FIX: show preview pdf list expensereport (#31694)
|
||||
FIX: sometimes a string type instead integer is return, why ?
|
||||
FIX: Special code is now transmitted by args only in order supplier (#28546) (#28619)
|
||||
FIX: SQL syntax error in DDLUpdateField
|
||||
FIX: subscription must be editable when accounting isn't reconciled (#28469)
|
||||
FIX: substitutions THIRDPARTY_XXX are not available for actioncomm reminders (#31385)
|
||||
FIX: Supplier Order search on date valid (#30448)
|
||||
FIX: supplier price duplicate entry on update supplier product ref (#29290)
|
||||
FIX: syntax error
|
||||
FIX: TakePOS | Add product / Delete line of existing invoice
|
||||
FIX: Ticket new message notification sent twice
|
||||
FIX: transfer in accountancy for expense reports.
|
||||
FIX: Unsigned propal having signing date (#29825)
|
||||
FIX: Update asset.class.php
|
||||
FIX: update date_echeance of supplier invoices when we update invoice date in the past (#29886)
|
||||
FIX: use $conf->browser->os instead
|
||||
FIX: use price() to display qty on a product's stats tab to avoid showing too many decimals when rounding errors are possible (#31165)
|
||||
FIX: User List - Function is show in wrong column when module HRM enabled (#30186)
|
||||
fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_NEW, the invoice must have the default bank account of the thirdparty is it's empty on order (#29462)
|
||||
FIX: when qty is not an integer, apply price() (#31138)
|
||||
FIX: Wrong currency shown in TakePOS payment page
|
||||
FIX: wrong shortcut key for macintosh
|
||||
FIX: wrong sql request with product category filter
|
||||
FIX: wrong stock permission number
|
||||
|
||||
|
||||
***** ChangeLog for 18.0.5 compared to 18.0.4 *****
|
||||
FIX: 17.0: deprecated field should only be a fallback
|
||||
FIX: 17.0 - php8 warnings: test for $field existence before checking if it is null or empty
|
||||
@@ -366,7 +565,7 @@ NEW: No overwrite of optionals during put() contact
|
||||
NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification
|
||||
NEW: Notifications: for Sign or Refused Propal from Online Page
|
||||
NEW: Now we can edit amount on VAT and salaries clone action
|
||||
NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver
|
||||
NEW: only get open contact from liste_contact function, to not have access to closed contact as mail receiver
|
||||
NEW: Option to manage deposit slips for more payment modes (not only
|
||||
NEW: Option to show column for field and line selection on the left
|
||||
NEW: Orders: add sub total in order list det
|
||||
@@ -2611,7 +2810,7 @@ NEW: add quick dropdown menu in top right menu (experimental with MAIN_USE_TOP_M
|
||||
NEW: add region in export companies and contacts
|
||||
NEW: add rights on margin info on invoice list
|
||||
NEW: add search param for close date on order list
|
||||
NEW: add show preview for mail attachement on form mail
|
||||
NEW: add show preview for mail attachment on form mail
|
||||
NEW: add State/Province origin for products
|
||||
NEW: add the workflow interaction close intervention on closing ticket
|
||||
NEW: add tracking number in list and search_all items
|
||||
@@ -3996,7 +4195,7 @@ FIX: access to public interface when origin email has an alias.
|
||||
FIX: Alias name is not into the email recipient label.
|
||||
FIX: allow standalone credit note even if no invoice
|
||||
FIX: an admin can not access his own permissions after enabling advanced permissions
|
||||
FIX: Attachement of linked files on ticket when sending a message
|
||||
FIX: Attachment of linked files on ticket when sending a message
|
||||
FIX: avoid non numeric warning
|
||||
FIX: Bad currency var used in stripe for connect
|
||||
FIX: Bad list of ticket on public interface for ticket emailcollector
|
||||
@@ -4792,7 +4991,7 @@ NEW: hidden option to define an invoice template for each invoice type
|
||||
NEW: Highlight lines on lists when they are checked
|
||||
NEW: Notification module support expense report+holiday validation and approval
|
||||
NEW: On customer/supplier card, add simple tooltip to amount boxes
|
||||
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements
|
||||
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachments
|
||||
NEW: possibility to add all rights of all modules in one time
|
||||
NEW: redirect if only one result on global search on card
|
||||
NEW: Permission to ignore price min
|
||||
@@ -6236,7 +6435,7 @@ NEW: No external check of version without explicit click in about page.
|
||||
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
|
||||
NEW: odt usergroup
|
||||
NEW: On invoices generated by template, we save if invoice come from a source template.
|
||||
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
|
||||
NEW: option to copy into attachment files of events, files send by mail (with auto event creation)
|
||||
NEW: PDF with numbertoword
|
||||
NEW: Permit multiple file upload in linked documents
|
||||
NEW: PHP 7.1 compatibility
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
|
||||
# \author (c)2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
#
|
||||
# This is list of constant you can set to have generated packages moved into a specific dir:
|
||||
# This is list of constant you can set to have generated packages moved into a specific dir:
|
||||
#DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'
|
||||
#DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'
|
||||
#DESTIMODULES='/media/HDDATA1_LD/Mes Sites/Web/Admin1/wwwroot/files/modules'
|
||||
@@ -18,10 +18,12 @@ use Term::ANSIColor;
|
||||
|
||||
# Change this to defined target for option 98 and 99
|
||||
$PROJECT="dolibarr";
|
||||
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
||||
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
|
||||
|
||||
$PUBLISHBETARC="$ENV{'DESTIASSOLOGIN'}\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files";
|
||||
$PUBLISHSTABLE="$ENV{'DESTISFLOGIN'}\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
||||
|
||||
# due to implicit origin on git commands, example
|
||||
# implicit origin, lionel upstream, eric dolibarr
|
||||
$GITREMOTENAME="$ENV{'GITREMOTENAME'}";
|
||||
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
%REQUIREMENTPUBLISH=(
|
||||
@@ -36,7 +38,7 @@ $PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/
|
||||
"RPM_FEDORA"=>"rpmbuild",
|
||||
"RPM_MANDRIVA"=>"rpmbuild",
|
||||
"RPM_OPENSUSE"=>"rpmbuild",
|
||||
"DEB"=>"dpkg dpatch",
|
||||
"DEB"=>"dpkg",
|
||||
"FLATPACK"=>"flatpack",
|
||||
"EXEDOLIWAMP"=>"ISCC.exe",
|
||||
"SNAPSHOT"=>"tar"
|
||||
@@ -98,6 +100,13 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"})
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (! $ENV{"GITREMOTENAME"})
|
||||
{
|
||||
print "Error: environment variable GITREMOTENAME does not exist. You can set it to 'origin' or any other git remote name.\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
sleep 2;
|
||||
exit 1;
|
||||
}
|
||||
# Detect OS type
|
||||
# --------------
|
||||
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
|
||||
@@ -129,7 +138,7 @@ if (! $TEMP || ! -d $TEMP) {
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
sleep 2;
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
$BUILDROOT="$TEMP/buildroot";
|
||||
|
||||
|
||||
@@ -172,7 +181,7 @@ $newbuild = $BUILD;
|
||||
$newbuild =~ s/(dev|alpha)/1/gi; # dev
|
||||
$newbuild =~ s/beta(.?)/2/gi; # beta (we want beta1, beta2, betax to be same package name)
|
||||
$newbuild =~ s/rc(.?)/3/gi; # rc (we want rc1, rc2, rcx to be same package name)
|
||||
if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc.
|
||||
if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc.
|
||||
# now newbuild is 0-1 or 0-4 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management
|
||||
$build = $newbuild;
|
||||
$build =~ s/-.*$//g;
|
||||
@@ -190,8 +199,8 @@ 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;
|
||||
$PREFIX=$1;
|
||||
$FILENAMESNAPSHOT.="-".$PREFIX;
|
||||
}
|
||||
}
|
||||
if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined
|
||||
@@ -210,7 +219,7 @@ print "Target directory (DESTI) : $DESTI\n";
|
||||
# Choose package targets
|
||||
#-----------------------
|
||||
if ($target) {
|
||||
if ($target eq "ALL") {
|
||||
if ($target eq "ALL") {
|
||||
foreach my $key (@LISTETARGET) {
|
||||
if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; }
|
||||
}
|
||||
@@ -236,10 +245,10 @@ else {
|
||||
printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".$REQUIREMENTPUBLISH{"ASSO"});
|
||||
$cpt=99;
|
||||
printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".$REQUIREMENTPUBLISH{"SF"});
|
||||
|
||||
|
||||
# Ask which target to build
|
||||
print "Choose one target number or several separated with space (0 - ".$cpt."): ";
|
||||
$NUM_SCRIPT=<STDIN>;
|
||||
$NUM_SCRIPT=<STDIN>;
|
||||
chomp($NUM_SCRIPT);
|
||||
if ($NUM_SCRIPT !~ /^[0-9\s]+$/)
|
||||
{
|
||||
@@ -286,11 +295,11 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
print "Error: You asked creation of several rpms. Because all rpm have same name, you must defined an environment variable DESTI to tell packager where it can create subdirs for each generated package.\n";
|
||||
exit;
|
||||
}
|
||||
$atleastonerpm=1;
|
||||
}
|
||||
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target}))
|
||||
$atleastonerpm=1;
|
||||
}
|
||||
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target}))
|
||||
{
|
||||
# Test
|
||||
# Test
|
||||
print "Test requirement for target $target: Search '$req'... ";
|
||||
$newreq=$req; $newparam='';
|
||||
if ($newreq eq 'zip') { $newparam.='-h'; }
|
||||
@@ -299,12 +308,12 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
print "Test command ".$cmd."... ";
|
||||
$ret=`$cmd`;
|
||||
$coderetour=$?; $coderetour2=$coderetour>>8;
|
||||
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
|
||||
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
|
||||
@@ -333,7 +342,7 @@ $nbofpublishneedchangelog=0;
|
||||
foreach my $target (sort keys %CHOOSEDTARGET) {
|
||||
if ($target eq '-CHKSUM') { $nbofpublishneedchangelog++; }
|
||||
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
|
||||
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM')
|
||||
{
|
||||
$nboftargetneedbuildroot++;
|
||||
}
|
||||
@@ -397,10 +406,10 @@ if ($nboftargetok) {
|
||||
print "Go to directory $SOURCE\n";
|
||||
$olddir=getcwd();
|
||||
chdir("$SOURCE");
|
||||
|
||||
|
||||
print "Clean $SOURCE/htdocs/includes/autoload.php\n";
|
||||
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
|
||||
|
||||
|
||||
$ret=`git ls-files . --exclude-standard --others`;
|
||||
if ($ret)
|
||||
{
|
||||
@@ -409,12 +418,16 @@ if ($nboftargetok) {
|
||||
print "Canceled.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
|
||||
$ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`;
|
||||
print $ret."\n";
|
||||
# Copy to final dir
|
||||
$NEWDESTI=$DESTI;
|
||||
if ( !-d "$NEWDESTI/signatures" ) {
|
||||
use File::Path qw( make_path );
|
||||
make_path "$NEWDESTI/signatures" or die "Failed to create path: $NEWDESTI/signatures";
|
||||
}
|
||||
print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n";
|
||||
use File::Copy qw(copy);
|
||||
copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml";
|
||||
@@ -427,32 +440,32 @@ if ($nboftargetok) {
|
||||
print "Go to directory $SOURCE\n";
|
||||
$olddir=getcwd();
|
||||
chdir("$SOURCE");
|
||||
|
||||
|
||||
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
|
||||
if ($ret =~ /(already exists|existe déjà)/)
|
||||
{
|
||||
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
|
||||
$QUESTIONOVERWRITETAG=<STDIN>;
|
||||
$QUESTIONOVERWRITETAG=<STDIN>;
|
||||
chomp($QUESTIONOVERWRITETAG);
|
||||
if ($QUESTIONOVERWRITETAG =~ /(o|y)/)
|
||||
{
|
||||
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
|
||||
print 'Run git push -f --tags'."\n";
|
||||
$ret=`git push -f --tags`;
|
||||
print 'Run git push $GITREMOTENAME -f --tags'."\n";
|
||||
$ret=`git push $GITREMOTENAME -f --tags`;
|
||||
#$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'Run git push --tags'."\n";
|
||||
$ret=`git push --tags`;
|
||||
print 'Run git push $GITREMOTENAME --tags'."\n";
|
||||
$ret=`git push $GITREMOTENAME --tags`;
|
||||
#$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`;
|
||||
}
|
||||
chdir("$olddir");
|
||||
}
|
||||
|
||||
|
||||
# Update buildroot if required
|
||||
#-----------------------------
|
||||
if ($nboftargetneedbuildroot)
|
||||
@@ -462,7 +475,7 @@ if ($nboftargetok) {
|
||||
|
||||
print "Delete directory $BUILDROOT\n";
|
||||
$ret=`rm -fr "$BUILDROOT"`;
|
||||
|
||||
|
||||
mkdir "$BUILDROOT";
|
||||
mkdir "$BUILDROOT/$PROJECT";
|
||||
print "Copy $SOURCE into $BUILDROOT/$PROJECT\n";
|
||||
@@ -488,7 +501,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`;
|
||||
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
|
||||
@@ -555,20 +568,20 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`;
|
||||
|
||||
# Security to avoid to package data files
|
||||
# Security to avoid to package data files
|
||||
print "Remove documents dir\n";
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
||||
|
||||
|
||||
print "Remove subdir of custom dir\n";
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
|
||||
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
|
||||
|
||||
# Removed known external modules to avoid any error when packaging from env where external modules are tested
|
||||
# Removed known external modules to avoid any error when packaging from env where external modules are tested
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
|
||||
@@ -593,15 +606,15 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/common/fontawesome-5/svgs`;
|
||||
|
||||
|
||||
# Removed other test files
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
|
||||
|
||||
# Removed files installed by the awful composer
|
||||
|
||||
# Removed files installed by the awful composer
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||
@@ -640,14 +653,14 @@ if ($nboftargetok) {
|
||||
|
||||
# Build package for each target
|
||||
#------------------------------
|
||||
foreach my $target (sort keys %CHOOSEDTARGET)
|
||||
foreach my $target (sort keys %CHOOSEDTARGET)
|
||||
{
|
||||
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||
if ($target eq '-CHKSUM') { next; }
|
||||
|
||||
|
||||
print "\nBuild package for target $target\n";
|
||||
|
||||
if ($target eq 'SNAPSHOT')
|
||||
if ($target eq 'SNAPSHOT')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
|
||||
@@ -671,13 +684,13 @@ if ($nboftargetok) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target eq 'TGZ')
|
||||
if ($target eq 'TGZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMETGZ.tgz...\n";
|
||||
@@ -691,7 +704,7 @@ if ($nboftargetok) {
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`;
|
||||
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
|
||||
|
||||
|
||||
print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n";
|
||||
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ";
|
||||
print "$cmd\n";
|
||||
@@ -703,14 +716,14 @@ if ($nboftargetok) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target eq 'XZ')
|
||||
if ($target eq 'XZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMEXZ.xz...\n";
|
||||
unlink("$NEWDESTI/$FILENAMEXZ.xz");
|
||||
@@ -723,7 +736,7 @@ if ($nboftargetok) {
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`;
|
||||
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages
|
||||
|
||||
|
||||
print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
|
||||
|
||||
print "Go to directory $BUILDROOT\n";
|
||||
@@ -739,15 +752,15 @@ if ($nboftargetok) {
|
||||
$ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target eq 'ZIP')
|
||||
|
||||
if ($target eq 'ZIP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
}
|
||||
}
|
||||
|
||||
print "Remove target $FILENAMEZIP.zip...\n";
|
||||
unlink("$NEWDESTI/$FILENAMEZIP.zip");
|
||||
@@ -770,14 +783,14 @@ if ($nboftargetok) {
|
||||
print $cmd."\n";
|
||||
$ret= `$cmd`;
|
||||
chdir("$olddir");
|
||||
|
||||
|
||||
# Move to final dir
|
||||
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
|
||||
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target =~ /RPM/) # Linux only
|
||||
|
||||
if ($target =~ /RPM/) # Linux only
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
$subdir="package_rpm_generic";
|
||||
@@ -788,7 +801,7 @@ if ($nboftargetok) {
|
||||
{
|
||||
mkdir($DESTI.'/'.$subdir);
|
||||
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
|
||||
}
|
||||
}
|
||||
|
||||
if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; }
|
||||
|
||||
@@ -801,7 +814,7 @@ if ($nboftargetok) {
|
||||
|
||||
print "Create directory $BUILDROOT/$FILENAMETGZ2\n";
|
||||
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`;
|
||||
|
||||
|
||||
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n";
|
||||
$cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'";
|
||||
$ret=`$cmd`;
|
||||
@@ -827,7 +840,7 @@ if ($nboftargetok) {
|
||||
if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; }
|
||||
if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; }
|
||||
if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; }
|
||||
|
||||
|
||||
use Date::Language;
|
||||
$lang=Date::Language->new('English');
|
||||
$datestring = $lang->time2str("%a %b %e %Y", time);
|
||||
@@ -845,7 +858,7 @@ if ($nboftargetok) {
|
||||
}
|
||||
close SPECFROM;
|
||||
close SPECTO;
|
||||
|
||||
|
||||
print "Copy patch file to $RPMDIR/SOURCES\n";
|
||||
$ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`;
|
||||
$ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`;
|
||||
@@ -867,14 +880,14 @@ if ($nboftargetok) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($target eq 'DEB')
|
||||
if ($target eq 'DEB')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_debian-ubuntu');
|
||||
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
|
||||
}
|
||||
}
|
||||
|
||||
$olddir=getcwd();
|
||||
|
||||
@@ -955,13 +968,18 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/select2/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`;
|
||||
|
||||
|
||||
# Removed files we don't need (already removed)
|
||||
#$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`;
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.codeclimate.yml`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.pre-commit-config.yaml`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/.vscode`;
|
||||
$ret=`find $BUILDROOT/$PROJECT.tmp/ -type f -name '.editorconfig' -exec rm {} \\;`;
|
||||
$ret=`find $BUILDROOT/$PROJECT.tmp/ -type f -name '.travis.yml' -exec rm {} \\;`;
|
||||
|
||||
# Rename upstream changelog to match debian rules
|
||||
$ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`;
|
||||
|
||||
|
||||
# Prepare source package (init debian dir)
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
@@ -999,7 +1017,7 @@ if ($nboftargetok) {
|
||||
$ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
|
||||
|
||||
# Set owners and permissions
|
||||
#print "Set owners on files/dir\n";
|
||||
#$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`;
|
||||
@@ -1030,8 +1048,8 @@ if ($nboftargetok) {
|
||||
$ret=`$cmd`;
|
||||
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";
|
||||
$ret=`$cmd`;
|
||||
|
||||
|
||||
|
||||
|
||||
print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
$cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
|
||||
$ret=`$cmd`;
|
||||
@@ -1039,14 +1057,14 @@ if ($nboftargetok) {
|
||||
|
||||
print "Go into directory $BUILDROOT\n";
|
||||
chdir("$BUILDROOT");
|
||||
|
||||
|
||||
# We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native)
|
||||
print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n";
|
||||
$cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build";
|
||||
print $cmd."\n";
|
||||
$ret=`$cmd`;
|
||||
|
||||
# Creation of source package
|
||||
# Creation of source package
|
||||
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
|
||||
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
|
||||
@@ -1065,12 +1083,12 @@ if ($nboftargetok) {
|
||||
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
|
||||
#$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option
|
||||
#$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option
|
||||
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
if ($target eq 'EXEDOLIWAMP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
@@ -1078,22 +1096,22 @@ if ($nboftargetok) {
|
||||
{
|
||||
mkdir($DESTI.'/package_windows');
|
||||
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
|
||||
}
|
||||
}
|
||||
|
||||
print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n";
|
||||
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
|
||||
|
||||
|
||||
if ($OS eq 'windows') {
|
||||
print "Check that ISCC.exe is in your PATH.\n";
|
||||
} else {
|
||||
print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n";
|
||||
}
|
||||
|
||||
|
||||
$SOURCEBACK=$SOURCE;
|
||||
$SOURCEBACK =~ s/\//\\/g;
|
||||
|
||||
print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n";
|
||||
|
||||
|
||||
#$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
open(IN, '<' . $SOURCE."/build/exe/doliwamp/doliwamp.iss") or die $!;
|
||||
open(OUT, '>' . "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss") or die $!;
|
||||
@@ -1106,7 +1124,7 @@ if ($nboftargetok) {
|
||||
close(OUT);
|
||||
|
||||
print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" on OS $OS\n";
|
||||
|
||||
|
||||
if ($OS eq 'windows') {
|
||||
$cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\"";
|
||||
} else {
|
||||
@@ -1120,26 +1138,26 @@ if ($nboftargetok) {
|
||||
print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
|
||||
rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
|
||||
print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n";
|
||||
|
||||
|
||||
use File::Copy;
|
||||
|
||||
#$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`;
|
||||
$ret=move("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe", "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe");
|
||||
|
||||
|
||||
print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n";
|
||||
#$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`;
|
||||
$ret=unlink("$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss");
|
||||
|
||||
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# Publish package for each target
|
||||
#--------------------------------
|
||||
foreach my $target (sort keys %CHOOSEDPUBLISH)
|
||||
foreach my $target (sort keys %CHOOSEDPUBLISH)
|
||||
{
|
||||
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
|
||||
|
||||
|
||||
print "\nList of files to publish (BUILD=$BUILD)\n";
|
||||
%filestoscansf=(
|
||||
"$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'none', # none means it won't be published on SF
|
||||
@@ -1162,7 +1180,8 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
|
||||
#"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
@@ -1197,26 +1216,26 @@ if ($nboftargetok) {
|
||||
print "\n";
|
||||
}
|
||||
|
||||
if ($target eq 'SF' || $target eq 'ASSO')
|
||||
if ($target eq 'SF' || $target eq 'ASSO')
|
||||
{
|
||||
print "\n";
|
||||
|
||||
|
||||
if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; }
|
||||
if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; }
|
||||
if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; }
|
||||
|
||||
|
||||
$NEWPUBLISH=$PUBLISH;
|
||||
print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n";
|
||||
|
||||
# Ask which target to build
|
||||
$NUM_SCRIPT=<STDIN>;
|
||||
$NUM_SCRIPT=<STDIN>;
|
||||
chomp($NUM_SCRIPT);
|
||||
|
||||
print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n";
|
||||
$ret=`mkdir -p "/tmp/emptydir/"`;
|
||||
|
||||
|
||||
%filestoscan=%filestoscansf;
|
||||
|
||||
|
||||
foreach my $file (sort keys %filestoscan)
|
||||
{
|
||||
$found=0;
|
||||
@@ -1226,30 +1245,30 @@ if ($nboftargetok) {
|
||||
if ($target eq 'SF') {
|
||||
if ($filestoscan{$file} eq 'none') {
|
||||
next;
|
||||
}
|
||||
}
|
||||
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
|
||||
}
|
||||
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {
|
||||
$destFolder="$NEWPUBLISH/$filestoscanstableasso{$file}";
|
||||
}
|
||||
}
|
||||
elsif ($target eq 'ASSO' and $NEWPUBLISH !~ /stable/) {
|
||||
$destFolder="$NEWPUBLISH";
|
||||
}
|
||||
}
|
||||
else # No more used
|
||||
{
|
||||
$dirnameonly=$file;
|
||||
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
|
||||
$dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/;
|
||||
$filenameonly=$file;
|
||||
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
|
||||
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
|
||||
$destFolder="$NEWPUBLISH/$dirnameonly";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print "Publish file ".$file." to ".$destFolder."\n";
|
||||
|
||||
# mkdir
|
||||
# mkdir
|
||||
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");
|
||||
#$ssh->login("$user","$pass");
|
||||
#$ssh->login("$user","$pass");
|
||||
#use String::ShellQuote qw( shell_quote );
|
||||
#$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit');
|
||||
|
||||
@@ -1258,20 +1277,20 @@ if ($nboftargetok) {
|
||||
#$sftp->mkdir($destFolder)
|
||||
|
||||
#$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\"";
|
||||
#print "$command\n";
|
||||
#print "$command\n";
|
||||
#my $ret=`$command 2>&1`;
|
||||
|
||||
$command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\"";
|
||||
print "$command\n";
|
||||
print "$command\n";
|
||||
my $ret=`$command 2>&1`;
|
||||
|
||||
$command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\"";
|
||||
print "$command\n";
|
||||
print "$command\n";
|
||||
my $ret2=`$command 2>&1`;
|
||||
print "$ret2\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "\n----- Summary -----\n";
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
.git
|
||||
.gitignore
|
||||
.scrutinizer.yml
|
||||
.travis.yml
|
||||
.vscode
|
||||
.idea
|
||||
.editorconfig
|
||||
.codeclimate.yml
|
||||
.pre-commit-config.yaml
|
||||
.mailmap
|
||||
Thumbs.db
|
||||
build/exe
|
||||
build/html
|
||||
|
||||
@@ -22,3 +22,9 @@ dolibarr*.deb
|
||||
dolibarr*.zip
|
||||
cvschangelogbuilder_dolibarr*
|
||||
dolibarr_install.log
|
||||
.travis.yml
|
||||
.vscode
|
||||
.idea
|
||||
.editorconfig
|
||||
.codeclimate.yml
|
||||
.pre-commit-config.yaml
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"npm": ">=5.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"zapier-platform-core": "11.3.1"
|
||||
"zapier-platform-core": "15.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
|
||||
@@ -87,7 +87,7 @@ $tablib[32] = "DictionaryAccountancyCategory";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql = array();
|
||||
$tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[32] = "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid AND c.active=1 AND a.entity IN (".getEntity('c_accounting_category').")";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort = array();
|
||||
@@ -99,11 +99,11 @@ $tabfield[32] = "code,label,range_account,category_type,formula,position,country
|
||||
|
||||
// Name of editing fields for record modification
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id";
|
||||
$tabfieldvalue[32] = "code,label,range_account,category_type,formula,position,country_id,entity";
|
||||
|
||||
// Name of the fields in the table for inserting a record
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[32] = "code,label,range_account,category_type,formula,position,fk_country,entity";
|
||||
|
||||
// Name of the rowid if the field is not of type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
|
||||
@@ -197,6 +197,9 @@ if (empty($reshook)) {
|
||||
$filter['t.reconciled_option'] = $search_not_reconciled;
|
||||
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
|
||||
}
|
||||
if (!empty($show_subgroup)) {
|
||||
$param .= '&show_subgroup='.urlencode($show_subgroup);
|
||||
}
|
||||
|
||||
// param with type of list
|
||||
$url_param = substr($param, 1); // remove first "&"
|
||||
|
||||
@@ -348,7 +348,7 @@ if (empty($reshook)) {
|
||||
$listofaccountsforgroup2 = array();
|
||||
if (is_array($listofaccountsforgroup)) {
|
||||
foreach ($listofaccountsforgroup as $tmpval) {
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
|
||||
}
|
||||
}
|
||||
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
|
||||
|
||||
@@ -332,7 +332,7 @@ if (empty($reshook)) {
|
||||
$listofaccountsforgroup2 = array();
|
||||
if (is_array($listofaccountsforgroup)) {
|
||||
foreach ($listofaccountsforgroup as $tmpval) {
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
|
||||
}
|
||||
}
|
||||
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
|
||||
|
||||
@@ -291,7 +291,7 @@ if (empty($reshook)) {
|
||||
$listofaccountsforgroup2 = array();
|
||||
if (is_array($listofaccountsforgroup)) {
|
||||
foreach ($listofaccountsforgroup as $tmpval) {
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
|
||||
$listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
|
||||
}
|
||||
}
|
||||
$filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
|
||||
@@ -932,6 +932,21 @@ $sous_total_credit = 0;
|
||||
$totalarray['val']['totaldebit'] = 0;
|
||||
$totalarray['val']['totalcredit'] = 0;
|
||||
|
||||
$colspan = 0; // colspan before field 'label of operation'
|
||||
$colspanend = 3; // colspan after debit/credit
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
$colspanend--;
|
||||
}
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$line = $object->lines[$i];
|
||||
|
||||
@@ -945,21 +960,6 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
//if (empty($accountg)) $accountg = '-';
|
||||
|
||||
$colspan = 0; // colspan before field 'label of operation'
|
||||
$colspanend = 3; // colspan after debit/credit
|
||||
if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
|
||||
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
|
||||
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
$colspan++;
|
||||
$colspanend--;
|
||||
}
|
||||
|
||||
// Is it a break ?
|
||||
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
|
||||
// Show a subtotal by accounting account
|
||||
@@ -1027,8 +1027,6 @@ while ($i < min($num, $limit)) {
|
||||
//if (empty($displayed_account_number)) $displayed_account_number='-';
|
||||
$sous_total_debit = 0;
|
||||
$sous_total_credit = 0;
|
||||
|
||||
$colspan = 0;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@@ -966,7 +966,7 @@ class AccountancyExport
|
||||
|
||||
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part
|
||||
// $tab['num_piece3'] = str_pad(self::trunc($line->piece_num, 10), 10);
|
||||
$tab['num_piece3'] = substr(self::trunc($line->doc_ref, 20), -10);
|
||||
$tab['num_piece3'] = str_pad(substr(self::trunc($line->doc_ref, 20), -10), 10);
|
||||
$tab['reserved'] = str_repeat(' ', 10); // position 159
|
||||
$tab['currency_amount'] = str_repeat(' ', 13); // position 169
|
||||
// get document file
|
||||
|
||||
@@ -967,7 +967,7 @@ class BookKeeping extends CommonObject
|
||||
$line->multicurrency_amount = $obj->multicurrency_amount;
|
||||
$line->multicurrency_code = $obj->multicurrency_code;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->date_lettering = $this->db->jdate($obj->date_lettering);
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
@@ -1068,7 +1068,7 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
if (is_array($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
$sqlwhere[] = natural_search("t.code_journal", (string) join(',', $value), 3, 1);
|
||||
} else {
|
||||
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
|
||||
}
|
||||
@@ -1119,7 +1119,7 @@ class BookKeeping extends CommonObject
|
||||
$line->amount = $obj->amount;
|
||||
$line->sens = $obj->sens;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->date_lettering = $this->db->jdate($obj->date_lettering);
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
@@ -1399,6 +1399,7 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
@@ -1406,6 +1407,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
|
||||
$sql .= " SET ".$field." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'");
|
||||
$sql .= " WHERE piece_num = ".((int) $piece_num);
|
||||
$sql .= " AND entity = " . ((int) $conf->entity);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -2147,7 +2149,7 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = '';
|
||||
$obj = (object) array('label' => '');
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ class Lettering extends BookKeeping
|
||||
|
||||
$grouped_lines = array();
|
||||
foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
|
||||
if (!is_array($bookkeeping_lines_by_type[$doc_type])) {
|
||||
if (empty($bookkeeping_lines_by_type[$doc_type]) || !is_array($bookkeeping_lines_by_type[$doc_type])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ if ($action == 'writebookkeeping' && !$error) {
|
||||
$db->begin();
|
||||
|
||||
// Error if some lines are not binded/ready to be journalized
|
||||
if ($errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
if (!empty($errorforinvoice[$key]) && $errorforinvoice[$key] == 'somelinesarenotbound') {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($langs->trans('ErrorInvoiceContainsLinesNotYetBounded', $val['ref']), null, 'errors');
|
||||
|
||||
@@ -348,6 +348,12 @@ class Members extends DolibarrApi
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$member->array_options[$index] = $this->_checkValForAPI($field, $val, $member);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$member->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +193,12 @@ class MembersTypes extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$membertype->array_options[$index] = $this->_checkValForAPI($field, $val, $membertype);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// Process the status separately because it must be updated using
|
||||
// the validate(), resiliate() and exclude() methods of the class AdherentType.
|
||||
$membertype->$field = $value;
|
||||
|
||||
@@ -186,6 +186,12 @@ class Subscriptions extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$subscription->array_options[$index] = $this->_checkValForAPI($field, $val, $subscription);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$subscription->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -2004,6 +2004,11 @@ if ($id > 0) {
|
||||
$canbemodified = 1;
|
||||
}
|
||||
|
||||
if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) {
|
||||
$canbedisabled = 0;
|
||||
$canbemodified = 0;
|
||||
$iserasable = 0;
|
||||
}
|
||||
// Build Url. The table is id=, the id of line is rowid=
|
||||
$rowidcol = $tabrowid[$id];
|
||||
// If rowidcol not defined
|
||||
|
||||
@@ -43,7 +43,7 @@ if (!$user->admin) {
|
||||
|
||||
$usersignature = $user->signature;
|
||||
// For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html.
|
||||
if ($action == 'test' || ($action == 'send' && $trackid = 'test')) {
|
||||
if ($action == 'test' || ($action == 'send' && $trackid == 'test')) {
|
||||
$usersignature = dol_string_nohtmltag($usersignature, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,9 @@ if ($action == "set") {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif (!$error) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
|
||||
@@ -161,7 +161,7 @@ $workflowcodes = array(
|
||||
),
|
||||
|
||||
// Automatic classification reception
|
||||
'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array(
|
||||
'WORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE'=>array(
|
||||
'family'=>'classify_reception',
|
||||
'position'=>95,
|
||||
'enabled'=>(isModEnabled("reception") && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2025 William Mead <william@m34d.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
|
||||
@@ -174,14 +175,6 @@ class DolibarrApi
|
||||
unset($object->stats_mrptoconsume);
|
||||
unset($object->stats_mrptoproduce);
|
||||
|
||||
unset($object->element);
|
||||
unset($object->element_for_permission);
|
||||
unset($object->fk_element);
|
||||
unset($object->table_element);
|
||||
unset($object->table_element_line);
|
||||
unset($object->class_element_line);
|
||||
unset($object->picto);
|
||||
|
||||
unset($object->fieldsforcombobox);
|
||||
unset($object->regeximgext);
|
||||
|
||||
@@ -202,10 +195,18 @@ class DolibarrApi
|
||||
|
||||
unset($object->prefix_comm);
|
||||
|
||||
if (!isset($object->table_element) || $object->table_element != 'ticket') {
|
||||
if (!isset($object->table_element) || ! in_array($object->table_element, array('expensereport_det', 'ticket'))) {
|
||||
unset($object->comments);
|
||||
}
|
||||
|
||||
unset($object->element);
|
||||
unset($object->element_for_permission);
|
||||
unset($object->fk_element);
|
||||
unset($object->table_element);
|
||||
unset($object->table_element_line);
|
||||
unset($object->class_element_line);
|
||||
unset($object->picto);
|
||||
|
||||
// Remove the $oldcopy property because it is not supported by the JSON
|
||||
// encoder. The following error is generated when trying to serialize
|
||||
// it: "Error encoding/decoding JSON: Type is not supported"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2023 Romain Neil <contact@romain-neil.fr>
|
||||
* Copyright (C) 2025 William Mead <william@m34d.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
|
||||
@@ -481,7 +482,7 @@ class Documents extends DolibarrApi
|
||||
} elseif ($modulepart == 'expensereport') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) {
|
||||
if (!DolibarrApiAccess::$user->rights->expensereport->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
@@ -890,7 +891,7 @@ class Documents extends DolibarrApi
|
||||
// Move the temporary file at its final emplacement
|
||||
$result = dol_move($destfiletmp, $dest_file, 0, $overwriteifexists, 1, 1, $moreinfo);
|
||||
if (!$result) {
|
||||
throw new RestException(500, "Failed to move file into '".$destfile."'");
|
||||
throw new RestException(500, "Failed to move file into '".$dest_file."'");
|
||||
}
|
||||
|
||||
return dol_basename($destfile);
|
||||
|
||||
@@ -999,7 +999,7 @@ class Asset extends CommonObject
|
||||
//-----------------------------------------------------
|
||||
$nb_days_in_year = !empty($conf->global->ASSET_DEPRECIATION_DURATION_PER_YEAR) ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_YEAR : 365;
|
||||
$nb_days_in_month = !empty($conf->global->ASSET_DEPRECIATION_DURATION_PER_MONTH) ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_MONTH : 30;
|
||||
$period_amount = (double) price2num($depreciation_period_amount / $fields['duration'], 'MT');
|
||||
$period_amount = (float) ($fields['duration'] > 0 ? price2num($depreciation_period_amount / $fields['duration'], 'MT') : 0);
|
||||
$first_period_found = false;
|
||||
$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class AssetDepreciationOptions extends CommonObject
|
||||
// Unset required option (notnull) if field disabled
|
||||
if (!empty($field_info['enabled_field'])) {
|
||||
$info = explode(':', $field_info['enabled_field']);
|
||||
if ($this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) {
|
||||
if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) {
|
||||
unset($this->fields[$field_key]['notnull']);
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ class AssetDepreciationOptions extends CommonObject
|
||||
foreach ($this->deprecation_options_fields as $mode_key => $mode_info) {
|
||||
if (!empty($mode_info['enabled_field'])) {
|
||||
$info = explode(':', $mode_info['enabled_field']);
|
||||
if ($deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
unset($deprecation_options[$info[0]][$info[1]]);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ class AssetDepreciationOptions extends CommonObject
|
||||
foreach ($this->deprecation_options_fields as $mode_key => $mode_info) {
|
||||
if (!empty($mode_info['enabled_field'])) {
|
||||
$info = explode(':', $mode_info['enabled_field']);
|
||||
if ($deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
unset($deprecation_options[$info[0]][$info[1]]);
|
||||
}
|
||||
}
|
||||
@@ -469,7 +469,7 @@ class AssetDepreciationOptions extends CommonObject
|
||||
if (!$error && !empty($this->deprecation_options[$mode_key])) {
|
||||
if (!empty($mode_info['enabled_field'])) {
|
||||
$info = explode(':', $mode_info['enabled_field']);
|
||||
if ($this->deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $this->deprecation_options[$info[0]][$info[1]] != $info[2]) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,6 +240,12 @@ class Boms extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->bom->array_options[$index] = $this->_checkValForAPI($field, $val, $this->bom);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->bom->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,6 +237,12 @@ class Categories extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->category->array_options[$index] = $this->_checkValForAPI($field, $val, $this->category);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
|
||||
@@ -267,8 +273,8 @@ class Categories extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$this->category->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(401, 'error when delete category');
|
||||
if ($this->category->delete(DolibarrApiAccess::$user) <= 0) {
|
||||
throw new RestException(500, 'Error when delete category : ' . $this->category->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
@@ -1960,7 +1960,12 @@ if ($id > 0) {
|
||||
// related contact
|
||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
if (getDolGlobalInt('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT')) {
|
||||
$select_contact_default = 0; // select "all" contacts by default : avoid to use it if there is a lot of contacts
|
||||
} else {
|
||||
$select_contact_default = -1; // select "none" by default
|
||||
}
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!empty($object->socid) ? $object->socid : $select_contact_default, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -619,7 +619,7 @@ class ActionComm extends CommonObject
|
||||
foreach ($this->userassigned as $key => $val) {
|
||||
// Common value with new behavior is to have $val = array('id'=>iduser, 'transparency'=>0|1) and $this->userassigned is an array of iduser => $val.
|
||||
if (!is_array($val)) { // For backward compatibility when $val='id'.
|
||||
$val = array('id'=>$val);
|
||||
$val = array('id' => $val);
|
||||
}
|
||||
|
||||
if ($val['id'] > 0) {
|
||||
@@ -1258,9 +1258,11 @@ class ActionComm extends CommonObject
|
||||
$already_inserted = array();
|
||||
foreach (array_keys($this->socpeopleassigned) as $key => $val) {
|
||||
if (!is_array($val)) { // For backward compatibility when val=id
|
||||
$val = array('id'=>$val);
|
||||
$val = array('id' => $val);
|
||||
}
|
||||
if (!empty($already_inserted[$val['id']])) {
|
||||
continue;
|
||||
}
|
||||
if (!empty($already_inserted[$val['id']])) continue;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
|
||||
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
|
||||
@@ -2518,80 +2520,86 @@ class ActionComm extends CommonObject
|
||||
// Load event
|
||||
$res = $this->fetch($actionCommReminder->fk_actioncomm);
|
||||
if ($res > 0) {
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
$res2 = $this->fetch_thirdparty();
|
||||
if ($res2 >= 0) {
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, '', $this);
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this);
|
||||
|
||||
complete_substitutions_array($substitutionarray, $langs, $this);
|
||||
complete_substitutions_array($substitutionarray, $langs, $this);
|
||||
|
||||
// Content
|
||||
$sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray);
|
||||
// Content
|
||||
$sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray);
|
||||
|
||||
//Topic
|
||||
$sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder'));
|
||||
//Topic
|
||||
$sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder'));
|
||||
|
||||
// Recipient
|
||||
$recipient = new User($this->db);
|
||||
$res = $recipient->fetch($actionCommReminder->fk_user);
|
||||
if ($res > 0) {
|
||||
if (!empty($recipient->email)) {
|
||||
$to = $recipient->email;
|
||||
// Recipient
|
||||
$recipient = new User($this->db);
|
||||
$res = $recipient->fetch($actionCommReminder->fk_user);
|
||||
if ($res > 0) {
|
||||
if (!empty($recipient->email)) {
|
||||
$to = $recipient->email;
|
||||
} else {
|
||||
$errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user.";
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user.";
|
||||
$errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Errors Recipient
|
||||
$errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO');
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
} else {
|
||||
$errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$actionCommReminder->status = $actionCommReminder::STATUS_DONE;
|
||||
|
||||
$res = $actionCommReminder->update($user);
|
||||
if ($res < 0) {
|
||||
$errorsMsg[] = "Failed to update status to done of ActionComm Reminder";
|
||||
$error++;
|
||||
break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first.
|
||||
}
|
||||
} else {
|
||||
$actionCommReminder->status = $actionCommReminder::STATUS_ERROR;
|
||||
$actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1);
|
||||
|
||||
$res = $actionCommReminder->update($user);
|
||||
if ($res < 0) {
|
||||
$errorsMsg[] = "Failed to update status to error of ActionComm Reminder";
|
||||
$error++;
|
||||
break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first.
|
||||
} else {
|
||||
$errorsMsg[] = $errormesg;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user;
|
||||
$errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Errors Recipient
|
||||
$errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO');
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
} else {
|
||||
$errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.join(',', $cMailFile->errors);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$actionCommReminder->status = $actionCommReminder::STATUS_DONE;
|
||||
|
||||
$res = $actionCommReminder->update($user);
|
||||
if ($res < 0) {
|
||||
$errorsMsg[] = "Failed to update status to done of ActionComm Reminder";
|
||||
$error++;
|
||||
break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first.
|
||||
}
|
||||
} else {
|
||||
$actionCommReminder->status = $actionCommReminder::STATUS_ERROR;
|
||||
$actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1);
|
||||
|
||||
$res = $actionCommReminder->update($user);
|
||||
if ($res < 0) {
|
||||
$errorsMsg[] = "Failed to update status to error of ActionComm Reminder";
|
||||
$error++;
|
||||
break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first.
|
||||
} else {
|
||||
$errorsMsg[] = $errormesg;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm;
|
||||
$error++;
|
||||
|
||||
@@ -270,6 +270,12 @@ class AgendaEvents extends DolibarrApi
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->actioncomm->array_options[$index] = $this->_checkValForAPI($field, $val, $this->actioncomm);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,9 @@ if ($user->socid && $socid) {
|
||||
$result = restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
|
||||
$object = new ActionComm($db);
|
||||
$object->fetch($id);
|
||||
|
||||
$usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create'));
|
||||
|
||||
|
||||
@@ -65,8 +68,6 @@ $form = new Form($db);
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
$object = new ActionComm($db);
|
||||
$object->fetch($id);
|
||||
$object->info($object->id);
|
||||
|
||||
$head = actions_prepare_head($object);
|
||||
|
||||
@@ -442,20 +442,25 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id";
|
||||
}
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
}
|
||||
$sql .= " WHERE c.id = a.fk_action";
|
||||
$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
|
||||
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
|
||||
@@ -486,7 +491,7 @@ if (!empty($actioncode)) {
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) {
|
||||
$sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
|
||||
$sql .= " AND r.resource_id = ".((int) $resourceid);
|
||||
}
|
||||
if ($pid) {
|
||||
$sql .= " AND a.fk_project=".((int) $pid);
|
||||
@@ -497,10 +502,6 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
}
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = ".((int) $type);
|
||||
}
|
||||
|
||||
@@ -868,9 +868,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
@@ -980,9 +980,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
@@ -1074,9 +1074,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
@@ -1180,9 +1180,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
@@ -1271,9 +1271,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
@@ -1471,9 +1471,9 @@ if ($object->id > 0) {
|
||||
$filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
if (is_array($file_list) && !empty($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
|
||||
@@ -37,7 +37,7 @@ if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "p.name";
|
||||
$sortfield = "p.lastname";
|
||||
}
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
@@ -81,7 +81,7 @@ if ($type == "f") {
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, st.libelle as stcomm";
|
||||
$sql .= ", p.rowid as cidp, p.name, p.firstname, p.email, p.phone";
|
||||
$sql .= ", p.rowid as cidp, p.lastname, p.firstname, p.email, p.phone";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
@@ -106,7 +106,7 @@ if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
}
|
||||
if (!empty($search_lastname)) {
|
||||
$sql .= " AND p.name LIKE '%".$db->escape($search_lastname)."%'";
|
||||
$sql .= " AND p.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||
}
|
||||
if (!empty($search_firstname)) {
|
||||
$sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||
@@ -115,8 +115,8 @@ if (!empty($search_company)) {
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
}
|
||||
if (!empty($contactname)) { // acces a partir du module de recherche
|
||||
$sql .= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
|
||||
$sortfield = "p.name";
|
||||
$sql .= " AND (p.lastname LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') ";
|
||||
$sortfield = "p.lastname";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ if ($resql) {
|
||||
|
||||
print '<table class="liste centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "p.name", $begin, $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "p.lastname", $begin, $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "p.firstname", $begin, $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", $begin, $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Email");
|
||||
|
||||
@@ -146,7 +146,6 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
$backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php';
|
||||
|
||||
@@ -1614,7 +1613,20 @@ if (empty($reshook)) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int'));
|
||||
} elseif ($action == 'setconditions' && $usercancreate) {
|
||||
// Terms of payment
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
$sql = "SELECT code ";
|
||||
$sql .= "FROM " . $db->prefix() . "c_payment_term";
|
||||
$sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int'));
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object($result);
|
||||
if ($obj->code == 'DEP30PCTDEL') {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
} else {
|
||||
$object->deposit_percent = 0;
|
||||
$object->update($user);
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), $object->deposit_percent);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
@@ -3125,7 +3137,7 @@ if ($action == 'create') {
|
||||
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
|
||||
print '<br><!-- Link to sign -->';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
|
||||
print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
|
||||
print showOnlineSignatureUrl('proposal', $object->ref, $object).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
@@ -695,6 +695,12 @@ class Proposals extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->propal->array_options[$index] = $this->_checkValForAPI($field, $val, $this->propal);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -3517,7 +3517,7 @@ class Propal extends CommonObject
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->img = img_object('', "propal");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
@@ -4443,8 +4443,17 @@ class PropaleLigne extends CommonObjectLine
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
$this->db->rollback();
|
||||
@@ -4650,8 +4659,17 @@ class PropaleLigne extends CommonObjectLine
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
|
||||
@@ -67,11 +67,11 @@ $socid = '';
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$hookmanager->initHooks(array('proposalcontactcard', 'globalcard'));
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
$usercancreate = $user->hasRight("propal", "creer");
|
||||
|
||||
|
||||
/*
|
||||
* Add a new contact
|
||||
*/
|
||||
|
||||
@@ -81,6 +81,7 @@ $socid = '';
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$hookmanager->initHooks(array('propaldocument', 'globalcard'));
|
||||
restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
$usercancreate = $user->hasRight("propal", "creer");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.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
|
||||
@@ -146,6 +147,12 @@ $search_status = GETPOST('search_status', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$object_statut = GETPOST('search_statut', 'alpha');
|
||||
|
||||
$search_option = GETPOST('search_option', 'alpha');
|
||||
if ($search_option == 'late') {
|
||||
$search_status = '1';
|
||||
$object_statut = '1';
|
||||
}
|
||||
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
|
||||
@@ -389,6 +396,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_date_signature_endyear = '';
|
||||
$search_date_signature_start = '';
|
||||
$search_date_signature_end = '';
|
||||
$search_option = '';
|
||||
}
|
||||
if ($object_statut != '') {
|
||||
$search_status = $object_statut;
|
||||
@@ -764,6 +772,9 @@ if ($search_date_signature_start) {
|
||||
if ($search_date_signature_end) {
|
||||
$sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
|
||||
}
|
||||
if ($search_option == 'late') {
|
||||
$sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'";
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
$searchCategoryProductList = array($search_product_category);
|
||||
@@ -1042,6 +1053,9 @@ if ($resql) {
|
||||
if ($search_date_signature_endyear) {
|
||||
$param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
|
||||
}
|
||||
if ($search_option) {
|
||||
$param .= "&search_option=".urlencode($search_option);
|
||||
}
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@@ -1166,6 +1180,7 @@ if ($resql) {
|
||||
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
|
||||
@@ -871,17 +871,17 @@ if (empty($reshook)) {
|
||||
|
||||
// Set unit price to use
|
||||
if (!empty($price_ht) || $price_ht === '0') {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
$pu_ht = (float) price2num($price_ht, 'MU');
|
||||
$pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif (!empty($price_ttc) || $price_ttc === '0') {
|
||||
$pu_ttc = price2num($price_ttc, 'MU');
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
$pu_ttc = (float) price2num($price_ttc, 'MU');
|
||||
$pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// Is this still used ?
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
$pu_ht = (float) price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
$pu_ttc = (float) price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -653,6 +653,12 @@ class Orders extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->commande->array_options[$index] = $this->_checkValForAPI($field, $val, $this->commande);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.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
|
||||
@@ -3280,7 +3281,7 @@ class Commande extends CommonOrder
|
||||
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
|
||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||
$this->line->remise_percent = $remise_percent;
|
||||
$this->line->subprice = $subprice;
|
||||
$this->line->subprice = (float) $pu_ht;
|
||||
$this->line->info_bits = $info_bits;
|
||||
$this->line->special_code = $special_code;
|
||||
$this->line->total_ht = $total_ht;
|
||||
@@ -3614,6 +3615,7 @@ class Commande extends CommonOrder
|
||||
$response->label = $langs->trans("OrdersToProcess");
|
||||
$response->labelShort = $langs->trans("Opened");
|
||||
$response->url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&mainmenu=commercial&leftmenu=orders';
|
||||
$response->url_late = DOL_URL_ROOT.'/commande/list.php?search_option=late&mainmenu=commercial&leftmenu=orders';
|
||||
$response->img = img_object('', "order");
|
||||
|
||||
$generic_commande = new Commande($this->db);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* Copyright (C) 2016-2023 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.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
|
||||
@@ -118,6 +119,10 @@ $search_fk_cond_reglement = GETPOST('search_fk_cond_reglement', 'int');
|
||||
$search_fk_shipping_method = GETPOST('search_fk_shipping_method', 'int');
|
||||
$search_fk_mode_reglement = GETPOST('search_fk_mode_reglement', 'int');
|
||||
$search_fk_input_reason = GETPOST('search_fk_input_reason', 'int');
|
||||
$search_option = GETPOST('search_option', 'alpha');
|
||||
if ($search_option == 'late') {
|
||||
$search_status = '-2';
|
||||
}
|
||||
|
||||
$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
|
||||
|
||||
@@ -293,6 +298,7 @@ if (empty($reshook)) {
|
||||
$search_fk_shipping_method = '';
|
||||
$search_fk_mode_reglement = '';
|
||||
$search_fk_input_reason = '';
|
||||
$search_option = '';
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
@@ -601,6 +607,9 @@ if (empty($reshook)) {
|
||||
if ($search_status != '') {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
if ($search_option) {
|
||||
$param .= "&search_option=".urlencode($search_option);
|
||||
}
|
||||
if ($search_orderday) {
|
||||
$param .= '&search_orderday='.urlencode($search_orderday);
|
||||
}
|
||||
@@ -915,7 +924,9 @@ if ($search_status <> '') {
|
||||
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_option == 'late') {
|
||||
$sql .= " AND c.date_commande < '".$db->idate(dol_now() - $conf->commande->client->warning_delay)."'";
|
||||
}
|
||||
if ($search_datecloture_start) {
|
||||
$sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'";
|
||||
}
|
||||
@@ -1169,6 +1180,9 @@ if ($socid > 0) {
|
||||
if ($search_status != '') {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
if ($search_option) {
|
||||
$param .= "&search_option=".urlencode($search_option);
|
||||
}
|
||||
if ($search_datecloture_start) {
|
||||
$param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y');
|
||||
}
|
||||
@@ -1466,6 +1480,7 @@ if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURIN
|
||||
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
@@ -1477,9 +1492,6 @@ if (empty($reshook)) {
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@@ -2620,7 +2632,7 @@ while ($i < $imaxinloop) {
|
||||
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
}
|
||||
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
|
||||
@@ -2016,7 +2016,7 @@ if ($resql) {
|
||||
$productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel'];
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'];
|
||||
}
|
||||
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
|
||||
@@ -332,6 +332,12 @@ class BankAccounts extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$account->array_options[$index] = $this->_checkValForAPI($field, $val, $account);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$account->$field = $this->_checkValForAPI($field, $value, $account);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,8 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$sql .= " SET ";
|
||||
// Always opened
|
||||
if (GETPOSTISSET('value')) {
|
||||
$sql .= " fk_type='".$db->escape(GETPOST('value'))."',";
|
||||
$type = GETPOST('value');
|
||||
$sql .= " fk_type='".$db->escape(empty($type) && $object->fk_type == 'SOLD' ? 'SOLD' : $type)."',";
|
||||
}
|
||||
if (GETPOSTISSET('num_chq')) {
|
||||
$sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',";
|
||||
|
||||
@@ -253,7 +253,7 @@ if ($resql) {
|
||||
|
||||
// Date ope
|
||||
print '<td class="nowrap left">';
|
||||
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
|
||||
print '<span id="dateoperation_'.$objp->facid.'">'.dol_print_date($db->jdate($objp->do), "day")."</span>";
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@@ -91,7 +91,10 @@ $pagenext = $page + 1;
|
||||
$object = new FactureRec($db);
|
||||
if (($id > 0 || $ref) && $action != 'create' && $action != 'add') {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if (!$ret) {
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
} elseif (! $ret) {
|
||||
setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
|
||||
}
|
||||
}
|
||||
@@ -1304,14 +1307,10 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
|
||||
}
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
print ' ';
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -1735,6 +1734,7 @@ if ($action == 'create') {
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$morehtmlcenter = '';
|
||||
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
|
||||
|
||||
print '</div>';
|
||||
|
||||
@@ -98,7 +98,7 @@ $origin = GETPOST('origin', 'alpha');
|
||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||
$fac_rec = GETPOST('fac_rec', 'int');
|
||||
$facid = GETPOST('facid', 'int');
|
||||
$ref_client = GETPOST('ref_client', 'int');
|
||||
$ref_client = GETPOST('ref_client', 'alpha');
|
||||
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0);
|
||||
|
||||
@@ -321,7 +321,7 @@ if (empty($reshook)) {
|
||||
$object->date = dol_now();
|
||||
}
|
||||
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
if (!empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $object->willBeLastOfSameType(true);
|
||||
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
||||
@@ -643,7 +643,7 @@ if (empty($reshook)) {
|
||||
$object->setValueFrom('ref', GETPOST('ref'), '', null, '', '', $user, 'BILL_MODIFY');
|
||||
} elseif ($action == 'setref_client' && $usercancreate) {
|
||||
$object->fetch($id);
|
||||
$object->set_ref_client(GETPOST('ref_client'));
|
||||
$object->set_ref_client(GETPOST('ref_client', 'alpha'));
|
||||
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
|
||||
// Classify to validated
|
||||
$idwarehouse = GETPOST('idwarehouse', 'int');
|
||||
@@ -4487,6 +4487,9 @@ if ($action == 'create') {
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalcreditnotes = $totalcreditnotes;
|
||||
$object->totaldeposits = $totaldeposits;
|
||||
$object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT');
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
@@ -5039,7 +5042,9 @@ if ($action == 'create') {
|
||||
|
||||
$current_situation_counter = array();
|
||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
|
||||
$tmptotalpaidforthisinvoice = $prev_invoice->getSommePaiement();
|
||||
$tmptotalallpayments = $prev_invoice->getSommePaiement(0);
|
||||
$tmptotalallpayments += $prev_invoice->getSumDepositsUsed(0);
|
||||
$tmptotalallpayments += $prev_invoice->getSumCreditNotesUsed(0);
|
||||
$total_prev_ht += $prev_invoice->total_ht;
|
||||
$total_prev_ttc += $prev_invoice->total_ttc;
|
||||
$current_situation_counter[] = (($prev_invoice->type == Facture::TYPE_CREDIT_NOTE) ?-1 : 1) * $prev_invoice->situation_counter;
|
||||
@@ -5052,11 +5057,14 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($prev_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$prev_invoice->getLibStatut(3, $tmptotalpaidforthisinvoice).'</td>';
|
||||
print '<td class="right">'.$prev_invoice->getLibStatut(3, $tmptotalallpayments).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$totalallpayments = $object->getSommePaiement(0);
|
||||
$totalallpayments += $object->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $object->getSumDepositsUsed(0);
|
||||
|
||||
$total_global_ht += $total_prev_ht;
|
||||
$total_global_ttc += $total_prev_ttc;
|
||||
@@ -5072,7 +5080,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($object->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($object->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$object->getLibStatut(3, $object->getSommePaiement()).'</td>';
|
||||
print '<td class="right">'.$object->getLibStatut(3, $totalallpayments).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -5114,7 +5122,9 @@ if ($action == 'create') {
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice) {
|
||||
$totalpaid = $next_invoice->getSommePaiement();
|
||||
$totalpaid = $next_invoice->getSommePaiement(0);
|
||||
$totalcreditnotes = $next_invoice->getSumCreditNotesUsed(0);
|
||||
$totaldeposits = $next_invoice->getSumDepositsUsed(0);
|
||||
$total_next_ht += $next_invoice->total_ht;
|
||||
$total_next_ttc += $next_invoice->total_ttc;
|
||||
|
||||
@@ -5127,7 +5137,7 @@ if ($action == 'create') {
|
||||
}
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
|
||||
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid).'</td>';
|
||||
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid + $totalcreditnotes + $totaldeposits).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +622,12 @@ class Invoices extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->invoice->$field = $value;
|
||||
}
|
||||
|
||||
@@ -632,11 +638,11 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->invoice->update(DolibarrApiAccess::$user)) {
|
||||
if ($this->invoice->update(DolibarrApiAccess::$user) > 0) {
|
||||
return $this->get($id);
|
||||
} else {
|
||||
throw new RestException(500, $this->invoice->error);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,6 +131,13 @@ class FactureRec extends CommonInvoice
|
||||
public $cond_reglement_code; // Code in llx_c_paiement
|
||||
public $mode_reglement_code; // Code in llx_c_paiement
|
||||
|
||||
public $fk_multicurrency;
|
||||
public $multicurrency_code;
|
||||
public $multicurrency_tx;
|
||||
public $multicurrency_total_ht;
|
||||
public $multicurrency_total_tva;
|
||||
public $multicurrency_total_ttc;
|
||||
|
||||
public $suspended; // status
|
||||
|
||||
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
|
||||
@@ -1340,6 +1347,14 @@ class FactureRec extends CommonInvoice
|
||||
$facture->multicurrency_tx = $facturerec->multicurrency_tx;
|
||||
}
|
||||
|
||||
if (isset($facture->array_options) && isset($facturerec->array_options)) {
|
||||
foreach ($facturerec->array_options as $key => $value) {
|
||||
if (isset($facture->array_options[$key])) {
|
||||
$facture->array_options[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$invoiceidgenerated = $facture->create($user);
|
||||
if ($invoiceidgenerated <= 0) {
|
||||
$this->errors = $facture->errors;
|
||||
@@ -1389,6 +1404,7 @@ class FactureRec extends CommonInvoice
|
||||
$nb_create++;
|
||||
$this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n";
|
||||
} else {
|
||||
$this->output .= $langs->trans("InvoiceGeneratedFromTemplateError", $facture->ref, $facturerec->ref, $this->error)."\n";
|
||||
$this->db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
|
||||
}
|
||||
|
||||
|
||||
@@ -503,8 +503,8 @@ class Facture extends CommonInvoice
|
||||
$this->ref_client = trim($this->ref_client);
|
||||
|
||||
$this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated
|
||||
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private));
|
||||
$this->note_public = trim($this->note_public);
|
||||
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : '');
|
||||
$this->note_public = (isset($this->note_public) ? trim($this->note_public) : '');
|
||||
if (!$this->cond_reglement_id) {
|
||||
$this->cond_reglement_id = 0;
|
||||
}
|
||||
@@ -1013,13 +1013,13 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
if (!$error && $this->fac_rec > 0) {
|
||||
foreach ($_facrec->lines as $i => $val) {
|
||||
// For line from template invoice, we use data from template invoice
|
||||
/*
|
||||
if ($_facrec->lines[$i]->fk_product) {
|
||||
$prod = new Product($this->db);
|
||||
$res = $prod->fetch($_facrec->lines[$i]->fk_product);
|
||||
}
|
||||
|
||||
// For line from template invoice, we use data from template invoice
|
||||
/*
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$soc,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
@@ -1294,6 +1294,7 @@ class Facture extends CommonInvoice
|
||||
$object->date_modification = '';
|
||||
$object->date_validation = '';
|
||||
$object->ref_client = '';
|
||||
$object->ref_customer = '';
|
||||
$object->close_code = '';
|
||||
$object->close_note = '';
|
||||
if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) {
|
||||
@@ -2522,6 +2523,9 @@ class Facture extends CommonInvoice
|
||||
if (isset($this->retained_warranty)) {
|
||||
$this->retained_warranty = floatval($this->retained_warranty);
|
||||
}
|
||||
if (!isset($this->fk_user_author) && isset($this->user_author) ) {
|
||||
$this->fk_user_author = $this->user_author;
|
||||
}
|
||||
|
||||
|
||||
// Check parameters
|
||||
@@ -2551,7 +2555,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
|
||||
$sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? $this->db->escape($this->revenuestamp) : "null").",";
|
||||
$sql .= " fk_statut=".(isset($this->statut) ? $this->db->escape($this->statut) : "null").",";
|
||||
$sql .= " fk_user_author=".(isset($this->user_author) ? $this->db->escape($this->user_author) : "null").",";
|
||||
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->db->escape($this->fk_user_author) : "null").",";
|
||||
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->db->escape($this->fk_user_valid) : "null").",";
|
||||
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->db->escape($this->fk_facture_source) : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->db->escape($this->fk_project) : "null").",";
|
||||
@@ -4231,6 +4235,11 @@ class Facture extends CommonInvoice
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$this->line->rang = $rangmax + 1;
|
||||
}
|
||||
$apply_abs_price_on_credit_note=false;
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE && !getDolGlobalInt('FACTURE_ENABLE_NEGATIVE_LINES') && !getDolGlobalInt('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
|
||||
$apply_abs_price_on_credit_note = true;
|
||||
}
|
||||
|
||||
|
||||
$this->line->id = $rowid;
|
||||
$this->line->rowid = $rowid;
|
||||
@@ -4247,14 +4256,14 @@ class Facture extends CommonInvoice
|
||||
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
|
||||
|
||||
$this->line->remise_percent = $remise_percent;
|
||||
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->subprice = ($apply_abs_price_on_credit_note?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->date_start = $date_start;
|
||||
$this->line->date_end = $date_end;
|
||||
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
|
||||
$this->line->total_ht = (($apply_abs_price_on_credit_note || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
|
||||
$this->line->total_tva = (($apply_abs_price_on_credit_note || $qty < 0) ?-abs($total_tva) : $total_tva);
|
||||
$this->line->total_localtax1 = $total_localtax1;
|
||||
$this->line->total_localtax2 = $total_localtax2;
|
||||
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc);
|
||||
$this->line->total_ttc = (($apply_abs_price_on_credit_note || $qty < 0) ?-abs($total_ttc) : $total_ttc);
|
||||
$this->line->info_bits = $info_bits;
|
||||
$this->line->special_code = $special_code;
|
||||
$this->line->product_type = $type;
|
||||
@@ -5844,9 +5853,9 @@ class Facture extends CommonInvoice
|
||||
$joinFileName = [];
|
||||
$joinFileMime = [];
|
||||
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
|
||||
$joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc;
|
||||
$joinFile[] = DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc;
|
||||
$joinFileName[] = basename($tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc);
|
||||
}
|
||||
|
||||
// Mail Creation
|
||||
@@ -6401,7 +6410,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
// If fk_remise_except is defined, the discount is linked to the invoice
|
||||
// which flags it as "consumed".
|
||||
if ($this->fk_remise_except) {
|
||||
if ($this->fk_remise_except && empty($error)) {
|
||||
$discount = new DiscountAbsolute($this->db);
|
||||
$result = $discount->fetch($this->fk_remise_except);
|
||||
if ($result >= 0) {
|
||||
@@ -6438,7 +6447,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
}
|
||||
}
|
||||
|
||||
if (!$notrigger) {
|
||||
if (!$notrigger && empty($error)) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEBILL_INSERT', $user);
|
||||
if ($result < 0) {
|
||||
@@ -6448,8 +6457,17 @@ class FactureLigne extends CommonInvoiceLine
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
@@ -6620,8 +6638,18 @@ class FactureLigne extends CommonInvoiceLine
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
$this->db->rollback();
|
||||
|
||||
@@ -55,12 +55,11 @@ $object = new Facture($db);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('invoicecontactcard', 'globalcard'));
|
||||
$result = restrictedArea($user, 'facture', $object->id);
|
||||
|
||||
$usercancreate = $user->hasRight("facture", "creer");
|
||||
|
||||
|
||||
/*
|
||||
* Add a new contact
|
||||
*/
|
||||
|
||||
@@ -79,6 +79,7 @@ $permissiontoadd = $user->hasRight('facture', 'creer');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$hookmanager->initHooks(array('invoicedocument', 'globalcard'));
|
||||
$result = restrictedArea($user, 'facture', $object->id, '');
|
||||
|
||||
$usercancreate = $user->hasRight("facture", "creer");
|
||||
|
||||
@@ -422,8 +422,8 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
|
||||
$paiementAmount = $facture->getSommePaiement();
|
||||
$totalcreditnotes = $facture->getSumCreditNotesUsed();
|
||||
$totaldeposits = $facture->getSumDepositsUsed();
|
||||
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facture->total_ttc - $totalpay);
|
||||
$totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facture->total_ttc - $totalallpayments);
|
||||
if ($remaintopay != 0) {
|
||||
$resultBank = $facture->setBankAccount($bankid);
|
||||
if ($resultBank < 0) {
|
||||
@@ -1821,7 +1821,7 @@ if ($resql) {
|
||||
$totalarray['val']['f.total_tva'] = 0;
|
||||
$totalarray['val']['f.total_ht'] = 0;
|
||||
$totalarray['val']['f.total_ttc'] = 0;
|
||||
$totalarray['val']['totalam'] = 0;
|
||||
$totalarray['val']['dynamount_payed'] = 0;
|
||||
$totalarray['val']['rtp'] = 0;
|
||||
|
||||
|
||||
@@ -1910,8 +1910,8 @@ if ($resql) {
|
||||
$multicurrency_totalcreditnotes = $facturestatic->getSumCreditNotesUsed(1);
|
||||
$multicurrency_totaldeposits = $facturestatic->getSumDepositsUsed(1);
|
||||
|
||||
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = price2num($facturestatic->total_ttc - $totalpay);
|
||||
$totalallpayments = $paiement + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = $obj->total_ttc - $totalallpayments;
|
||||
|
||||
$multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
|
||||
$multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
|
||||
@@ -1923,13 +1923,16 @@ if ($resql) {
|
||||
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { // If credit note closed, we take into account the amount not yet consumed
|
||||
$remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id);
|
||||
$remaintopay = -$remaincreditnote;
|
||||
$totalpay = price2num($facturestatic->total_ttc - $remaintopay);
|
||||
$totalallpayments = price2num($facturestatic->total_ttc - $remaintopay);
|
||||
$multicurrency_remaincreditnote = $discount->getAvailableDiscounts($companystatic, '', 'rc.fk_facture_source='.$facturestatic->id, 0, 0, 1);
|
||||
$multicurrency_remaintopay = -$multicurrency_remaincreditnote;
|
||||
$multicurrency_totalpay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_remaintopay);
|
||||
}
|
||||
|
||||
$facturestatic->alreadypaid = $paiement;
|
||||
$facturestatic->totalpaid = $paiement;
|
||||
$facturestatic->totalcreditnotes = $totalcreditnotes;
|
||||
$facturestatic->totaldeposits = $totaldeposits;
|
||||
|
||||
$marginInfo = array();
|
||||
if ($with_margin_info === true) {
|
||||
@@ -2002,6 +2005,8 @@ if ($resql) {
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
$filepath = $conf->invoice->multidir_output[$obj->entity] ?? $conf->invoice->dir_output;
|
||||
$filedir = $filepath . '/' . $filename;
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->id;
|
||||
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
@@ -2382,14 +2387,14 @@ if ($resql) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['dynamount_payed']['checked'])) {
|
||||
print '<td class="right nowraponall amount">'.(!empty($totalpay) ? price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
print '<td class="right nowraponall amount">'.(!empty($totalallpayments) ? price($totalallpayments, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'totalam';
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'dynamount_payed';
|
||||
}
|
||||
$totalarray['val']['totalam'] += $totalpay;
|
||||
$totalarray['val']['dynamount_payed'] += $totalallpayments;
|
||||
}
|
||||
|
||||
// Pending amount
|
||||
@@ -2580,7 +2585,7 @@ if ($resql) {
|
||||
// Status
|
||||
if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
||||
print '<td class="nowrap right">';
|
||||
print $facturestatic->getLibStatut(5, $paiement);
|
||||
print $facturestatic->getLibStatut(5, $totalallpayments);
|
||||
print "</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@@ -86,11 +86,21 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-statut right">';
|
||||
$totalallpayments = 0;
|
||||
$totalcalculated = false;
|
||||
if (method_exists($objectlink, 'getSommePaiement')) {
|
||||
print $objectlink->getLibStatut(3, $objectlink->getSommePaiement());
|
||||
} else {
|
||||
print $objectlink->getLibStatut(3);
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSommePaiement();
|
||||
}
|
||||
if (method_exists($objectlink, 'getSumDepositsUsed')) {
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSumDepositsUsed();
|
||||
}
|
||||
if (method_exists($objectlink, 'getSumCreditNotesUsed')) {
|
||||
$totalcalculated = true;
|
||||
$totalallpayments += $objectlink->getSumCreditNotesUsed();
|
||||
}
|
||||
print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1));
|
||||
print '</td>';
|
||||
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -215,6 +215,9 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
||||
$thirdpartystatic->code_compta = $obj->code_compta;
|
||||
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$totalallpayments = $tmpinvoice->getSommePaiement(0);
|
||||
$totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $tmpinvoice->getSumDepositsUsed(0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
@@ -247,7 +250,7 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
||||
|
||||
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
|
||||
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
|
||||
print '<td>'.$tmpinvoice->getLibStatut(3, $totalallpayments).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@@ -377,6 +380,8 @@ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
|
||||
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
|
||||
print '<td class="right" title="'.dol_escape_htmltag($langs->trans("DateModificationShort").' : '.dol_print_date($db->jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').'</td>';
|
||||
$alreadypaid = $facstatic->getSommePaiement();
|
||||
$alreadypaid += $facstatic->getSumCreditNotesUsed();
|
||||
$alreadypaid += $facstatic->getSumDepositsUsed();
|
||||
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
|
||||
print '</tr>';
|
||||
$total_ht += $obj->total_ht;
|
||||
|
||||
@@ -544,7 +544,7 @@ if ($action == 'new') {
|
||||
if (count($lines[$bid])) {
|
||||
foreach ($lines[$bid] as $lid => $value) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_print_date($value["date"], 'day').'</td>';
|
||||
print '<td>'.dol_print_date($value["paymentdate"], 'day').'</td>';
|
||||
print '<td>'.$value["numero"]."</td>\n";
|
||||
print '<td>'.$value["emetteur"]."</td>\n";
|
||||
print '<td>'.$value["banque"]."</td>\n";
|
||||
|
||||
@@ -1269,7 +1269,7 @@ class Paiement extends CommonObject
|
||||
$facturestatic = new Facture($this->db);
|
||||
foreach ($arraybill as $billid) {
|
||||
$facturestatic->fetch($billid);
|
||||
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1);
|
||||
$label .= '<br> '.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ $charge = new ChargeSociales($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes')) {
|
||||
if ($action == 'add_payment') {
|
||||
$error = 0;
|
||||
|
||||
if ($cancel) {
|
||||
@@ -89,7 +89,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
}
|
||||
}
|
||||
|
||||
if (count($amounts) <= 0) {
|
||||
if (empty($amounts)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||
$action = 'create';
|
||||
@@ -119,9 +119,9 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
|
||||
|
||||
if (!$error) {
|
||||
$result = $paiement->addPaymentToBank($user, 'payment_sc', '(SocialContributionPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
if (!($result > 0)) {
|
||||
if ($result <= 0) {
|
||||
$error++;
|
||||
setEventMessages($paiement->error, null, 'errors');
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,27 +76,28 @@ class RejetPrelevement
|
||||
}
|
||||
|
||||
/**
|
||||
* Create
|
||||
* Create a reject
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $id Id
|
||||
* @param string $motif Motif
|
||||
* @param int $date_rejet Date rejet
|
||||
* @param int $date_rejet Date reject
|
||||
* @param int $bonid Bon id
|
||||
* @param int $facturation Facturation
|
||||
* @return void
|
||||
* @param int $facturation 1=Bill the reject
|
||||
* @return int Return >=0 if OK, <0 if KO
|
||||
*/
|
||||
public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs;
|
||||
|
||||
$error = 0;
|
||||
$this->id = $id;
|
||||
$this->bon_id = $bonid;
|
||||
$now = dol_now();
|
||||
|
||||
dol_syslog("RejetPrelevement::Create id $id");
|
||||
$bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT);
|
||||
dol_syslog("RejetPrelevement::Create id ".$id);
|
||||
|
||||
$bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalString('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalString('PRELEVEMENT_ID_BANKACCOUNT'));
|
||||
$facs = $this->getListInvoices(1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
|
||||
@@ -152,17 +153,16 @@ class RejetPrelevement
|
||||
|
||||
$fac->fetch($facs[$i][0]);
|
||||
|
||||
// Make a negative payment
|
||||
//$pai = new Paiement($this->db);
|
||||
$amountrejected = $facs[$i][1];
|
||||
|
||||
// Make a negative payment
|
||||
// Amount must be an array (id of invoice -> amount)
|
||||
$pai->amounts = array();
|
||||
|
||||
/*
|
||||
* We replace the comma with a point otherwise some
|
||||
* PHP installs sends only the part integer negative
|
||||
*/
|
||||
//var_dump($this->type);exit;
|
||||
|
||||
$pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund
|
||||
|
||||
$pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1 : -1));
|
||||
$pai->datepaye = $date_rejet;
|
||||
$pai->paiementid = 3; // type of payment: withdrawal
|
||||
$pai->num_paiement = $fac->ref;
|
||||
@@ -175,7 +175,13 @@ class RejetPrelevement
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
|
||||
} else {
|
||||
$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
|
||||
// We record entry into bank
|
||||
$mode = 'payment';
|
||||
if ($this->type == 'bank-transfer') {
|
||||
$mode = 'payment_supplier';
|
||||
}
|
||||
|
||||
$result = $pai->addPaymentToBank($user, $mode, '(InvoiceRefused)', $bankaccount, '', '');
|
||||
if ($result < 0) {
|
||||
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
|
||||
$error++;
|
||||
@@ -200,9 +206,13 @@ class RejetPrelevement
|
||||
if ($error == 0) {
|
||||
dol_syslog("RejetPrelevement::Create Commit");
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog("RejetPrelevement::Create Rollback");
|
||||
$this->db->rollback();
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ print '</span></td></tr></table></div><br>';
|
||||
/*
|
||||
* Invoices waiting for withdraw
|
||||
*/
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,";
|
||||
$sql .= " pfd.date_demande, pfd.amount,";
|
||||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
@@ -141,10 +141,13 @@ if ($resql) {
|
||||
|
||||
$invoicestatic->id = $obj->rowid;
|
||||
$invoicestatic->ref = $obj->ref;
|
||||
$invoicestatic->statut = $obj->fk_statut;
|
||||
$invoicestatic->statut = $obj->status;
|
||||
$invoicestatic->status = $obj->status;
|
||||
$invoicestatic->paye = $obj->paye;
|
||||
$invoicestatic->type = $obj->type;
|
||||
$alreadypayed = $invoicestatic->getSommePaiement();
|
||||
$totalallpayments = $invoicestatic->getSommePaiement(0);
|
||||
$totalallpayments += $invoicestatic->getSumCreditNotesUsed(0);
|
||||
$totalallpayments += $invoicestatic->getSumDepositsUsed(0);
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
@@ -177,7 +180,7 @@ if ($resql) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print $invoicestatic->getLibStatut(3, $alreadypayed);
|
||||
print $invoicestatic->getLibStatut(3, $totalallpayments);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -85,7 +85,7 @@ $error = 0;
|
||||
if ($action == 'confirm_rejet' && $permissiontoadd) {
|
||||
if (GETPOST("confirm") == 'yes') {
|
||||
if (GETPOST('remonth', 'int')) {
|
||||
$daterej = mktime(2, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$daterej = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
}
|
||||
|
||||
if (empty($daterej)) {
|
||||
@@ -166,7 +166,12 @@ if ($id) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $id.'</td></tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("BankTransfers").'</td><td>';
|
||||
} else {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("WithdrawalsReceipts").'</td><td>';
|
||||
}
|
||||
|
||||
print $bon->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
|
||||
|
||||
@@ -417,7 +417,7 @@ while ($i < $imaxinloop) {
|
||||
print '<td>';
|
||||
print $line->LibStatut($obj->statut_ligne, 2);
|
||||
print " ";
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.($type == 'bank-transfer' ? '&type=bank-transfer' : '').'">';
|
||||
print substr('000000'.$obj->rowid_ligne, -6);
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ if ($result) {
|
||||
|
||||
print '<td>';
|
||||
print $line->LibStatut($obj->statut, 2).' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.($type == 'bank-transfer' ? '&type=bank-transfer' : '').'">';
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->nom."</a></td>\n";
|
||||
|
||||
@@ -159,7 +159,9 @@ if ($id > 0) {
|
||||
print $fac->error."<br>";
|
||||
continue;
|
||||
}
|
||||
$totalpaid = $fac->getSommePaiement();
|
||||
$alreadypaid = $fac->getSommePaiement();
|
||||
$alreadypaid += $fac->getSumDepositsUsed();
|
||||
$alreadypaid += $fac->getSumCreditNotesUsed();
|
||||
|
||||
$userstatic->id = $objf->userid;
|
||||
$userstatic->login = $objf->login;
|
||||
@@ -169,7 +171,7 @@ if ($id > 0) {
|
||||
'date' => $fac->date,
|
||||
'datefieldforsort' => $fac->date.'-'.$fac->ref,
|
||||
'link' => $fac->getNomUrl(1),
|
||||
'status' => $fac->getLibStatut(2, $totalpaid),
|
||||
'status' => $fac->getLibStatut(2, $alreadypaid),
|
||||
'amount' => $fac->total_ttc,
|
||||
'author' => $userstatic->getLoginUrl(1)
|
||||
);
|
||||
|
||||
@@ -579,7 +579,6 @@ class PaymentSocialContribution extends CommonObject
|
||||
$result = $this->update_fk_bank($bank_line_id);
|
||||
if ($result <= 0) {
|
||||
$error++;
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction
|
||||
@@ -591,7 +590,7 @@ class PaymentSocialContribution extends CommonObject
|
||||
$result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode);
|
||||
if ($result <= 0) {
|
||||
$error++;
|
||||
dol_print_error($this->db);
|
||||
$this->setErrorsFromObject($acc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -603,7 +602,8 @@ class PaymentSocialContribution extends CommonObject
|
||||
$socialcontrib->fetch($key);
|
||||
$result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
|
||||
if ($result <= 0) {
|
||||
dol_print_error($this->db);
|
||||
$this->setErrorsFromObject($acc);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($socialcontrib->fk_user) {
|
||||
@@ -620,14 +620,14 @@ class PaymentSocialContribution extends CommonObject
|
||||
);
|
||||
|
||||
if ($result <= 0) {
|
||||
$this->error = $acc->error;
|
||||
$this->setErrorsFromObject($acc);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = $acc->error;
|
||||
$this->setErrorsFromObject($acc);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
// Quantity
|
||||
print '<td class="right">';
|
||||
print $qty[$key];
|
||||
print price($qty[$key], 1, $langs, 0, 0);
|
||||
print '</td>';
|
||||
|
||||
// Percent;
|
||||
|
||||
@@ -719,7 +719,8 @@ while ($i < $imaxinloop) {
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.status']['checked'])) {
|
||||
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $obj->alreadypayed) . '</td>';
|
||||
$totalallpayments = $obj->alreadypayed;
|
||||
print '<td class="nowrap right">' . $tva_static->getLibStatut(5, $totalallpayments) . '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -604,7 +604,7 @@ if (empty($reshook)) {
|
||||
$info_bits |= 0x01;
|
||||
}
|
||||
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('produit', 'ignore_price_min_advance'))
|
||||
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
||||
$result = -1;
|
||||
@@ -1713,7 +1713,7 @@ if ($action == 'create') {
|
||||
$line = new ContratLigne($db);
|
||||
$line->id = $objp->rowid;
|
||||
$line->fetch_optionals();
|
||||
print $line->showOptionals($extrafields, 'view', array('class'=>'oddeven', 'style'=>$moreparam, 'colspan'=>$colspan), '', '', 1);
|
||||
print $line->showOptionals($extrafields, 'view', array('class'=>'oddeven', 'style'=>$moreparam, 'colspan'=>$colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1);
|
||||
}
|
||||
} else {
|
||||
// Line in mode update
|
||||
@@ -1817,7 +1817,7 @@ if ($action == 'create') {
|
||||
$line = new ContratLigne($db);
|
||||
$line->id = $objp->rowid;
|
||||
$line->fetch_optionals();
|
||||
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
|
||||
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1836,7 +1836,7 @@ if ($action == 'create') {
|
||||
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
|
||||
$colspan++;
|
||||
}
|
||||
if (isModEnabled('margin') && !empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) {
|
||||
if (isModEnabled('margin') && getDolGlobalString('MARGIN_SHOW_ON_CONTRACT')) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
@@ -2063,7 +2063,7 @@ if ($action == 'create') {
|
||||
print '</div>';
|
||||
|
||||
// Form to add new line
|
||||
if ($user->rights->contrat->creer && ($object->statut == 0)) {
|
||||
if ($user->hasRight('contrat', 'creer') && ($object->statut == 0)) {
|
||||
$dateSelector = 1;
|
||||
|
||||
print "\n";
|
||||
@@ -2127,7 +2127,7 @@ if ($action == 'create') {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->statut == 1) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('contrat', 'creer'))) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
||||
@@ -2136,7 +2136,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
if ($object->statut == 0 && $nbofservices) {
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
||||
@@ -2144,7 +2144,7 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
if ($object->statut == 1) {
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
||||
@@ -2204,7 +2204,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
@@ -2240,7 +2240,7 @@ if ($action == 'create') {
|
||||
print '<br><!-- Link to sign -->';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
|
||||
|
||||
print showOnlineSignatureUrl('contract', $object->ref).'<br>';
|
||||
print showOnlineSignatureUrl('contract', $object->ref, $object).'<br>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
@@ -509,6 +509,12 @@ class Contracts extends DolibarrApi
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field == 'array_options' && is_array($value)) {
|
||||
foreach ($value as $index => $val) {
|
||||
$this->contract->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contract);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -3227,7 +3227,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql .= " t.label,"; // This field is not used. Only label of product
|
||||
$sql .= " p.ref as product_ref,";
|
||||
$sql .= " p.label as product_label,";
|
||||
$sql .= " p.description as product_desc,";
|
||||
$sql .= " p.description as product_description,";
|
||||
$sql .= " p.fk_product_type as product_type,";
|
||||
$sql .= " t.description,";
|
||||
$sql .= " t.date_commande,";
|
||||
@@ -3761,15 +3761,13 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$error = 0;
|
||||
|
||||
// statut actif : 4
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) ContratLigne::STATUS_CLOSED).",";
|
||||
$sql .= " date_cloture = '".$this->db->idate($date_end_real)."',";
|
||||
$sql .= " fk_user_cloture = ".((int) $user->id).",";
|
||||
$sql .= " commentaire = '".$this->db->escape($comment)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id)." AND statut = ".((int) ContratLigne::STATUS_OPEN);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id)." AND statut <> ".((int) ContratLigne::STATUS_CLOSED);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@@ -348,6 +348,11 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
//print $sql;
|
||||
@@ -452,6 +457,10 @@ if ($optioncss != '') {
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
|
||||
@@ -477,6 +477,11 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$substitutionarray['__EMAIL__'] = $thirdparty->email;
|
||||
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefined&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefined", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
|
||||
if ($oneemailperrecipient) {
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__'] = '';
|
||||
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '';
|
||||
}
|
||||
|
||||
$parameters = array('mode'=>'formemail');
|
||||
|
||||
if (!empty($listofobjectthirdparties)) {
|
||||
|
||||
@@ -310,7 +310,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
||||
// <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||
$message = preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
|
||||
|
||||
$sendtobcc = GETPOST('sendtoccc');
|
||||
$sendtobcc = GETPOST('sendtoccc', 'alphawithlgt');
|
||||
// Autocomplete the $sendtobcc
|
||||
// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
|
||||
if (!empty($autocopy)) {
|
||||
|
||||
@@ -106,7 +106,7 @@ class box_actions extends ModeleBoxes
|
||||
$sql .= " AND s.rowid = ".((int) $user->socid);
|
||||
}
|
||||
if (!$user->hasRight('agenda', 'allactions', 'read')) {
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id).")";
|
||||
}
|
||||
$sql .= " ORDER BY a.datep ASC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
@@ -111,7 +111,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$data = array();
|
||||
|
||||
$sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql = "SELECT p.fk_statut, SUM(p.total_ttc) as mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@@ -171,7 +171,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
@@ -200,7 +200,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$data = array();
|
||||
|
||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as mnttot, count(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@@ -257,7 +257,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
@@ -285,7 +285,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
// part 1
|
||||
$data = array();
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@@ -342,7 +342,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
);
|
||||
|
||||
// We add only for the current year
|
||||
@@ -366,7 +366,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
// part 2
|
||||
$data = array();
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
@@ -415,7 +415,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right amount"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
'text' => price($data[$j]->mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
|
||||
@@ -180,7 +180,7 @@ class box_validated_projects extends ModeleBoxes
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => $objp->startDate,
|
||||
'text' => $objp->startdate,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
|
||||
@@ -577,7 +577,7 @@ class CMailFile
|
||||
|
||||
if (!empty($this->errors_to)) {
|
||||
try {
|
||||
$headers->addTextHeader('Errors-To', $this->getArrayAddress($this->errors_to));
|
||||
$headers->addTextHeader('Errors-To', $this->getValidAddress($this->errors_to, 0));
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
@@ -644,7 +644,6 @@ class CMailFile
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
//if (!empty($this->errors_to)) $this->message->setErrorsTo($this->getArrayAddress($this->errors_to));
|
||||
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) {
|
||||
try {
|
||||
$this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from));
|
||||
@@ -687,7 +686,7 @@ class CMailFile
|
||||
$this->error = "Error in hook maildao sendMail ".$reshook;
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
|
||||
return $reshook;
|
||||
return false;
|
||||
}
|
||||
if ($reshook == 1) { // Hook replace standard code
|
||||
return true;
|
||||
@@ -894,7 +893,7 @@ class CMailFile
|
||||
}
|
||||
} elseif ($this->sendmode == 'smtps') {
|
||||
if (!is_object($this->smtps)) {
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."<br>Constructor of object CMailFile was not initialized without errors.";
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".ini_get('SMTP').", PORT=".$conf->global->$keyforsmtpport."<br>Constructor of object CMailFile was not initialized without errors.";
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
return false;
|
||||
}
|
||||
@@ -1190,9 +1189,10 @@ class CMailFile
|
||||
$res = true;
|
||||
if (!empty($this->error) || !empty($this->errors) || !$result) {
|
||||
if (!empty($failedRecipients)) {
|
||||
$this->errors[] = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
|
||||
$this->error = 'Transport failed for the following addresses: "' . join('", "', $failedRecipients) . '".';
|
||||
$this->errors[] = $this->error;
|
||||
}
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
dol_syslog("CMailFile::sendfile: mail end error=". join(' ', $this->errors), LOG_ERR);
|
||||
$res = false;
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
|
||||
@@ -2111,7 +2111,9 @@ abstract class CommonObject
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".$this->db->prefix()."usergroup_user as ug";
|
||||
if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user = te.rowid";
|
||||
}
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
@@ -2148,7 +2150,6 @@ abstract class CommonObject
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
@@ -2181,7 +2182,9 @@ abstract class CommonObject
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ",".$this->db->prefix()."usergroup_user as ug";
|
||||
if (empty($user->admin) || !empty($user->entity) || $conf->entity != 1) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON ug.fk_user = te.rowid";
|
||||
}
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
@@ -2218,7 +2221,6 @@ abstract class CommonObject
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql .= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql .= " AND ug.fk_user = te.rowid";
|
||||
$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
|
||||
}
|
||||
} else {
|
||||
@@ -4056,8 +4058,12 @@ abstract class CommonObject
|
||||
$classpath = 'adherents/class';
|
||||
$module = 'adherent';
|
||||
} elseif ($objecttype == 'contact') {
|
||||
$module = 'societe';
|
||||
$module = 'societe';
|
||||
} elseif ($objecttype == 'action') {
|
||||
$module = 'agenda';
|
||||
$subelement = 'actionComm';
|
||||
}
|
||||
|
||||
// Set classfile
|
||||
$classfile = strtolower($subelement);
|
||||
$classname = ucfirst($subelement);
|
||||
@@ -5207,16 +5213,12 @@ abstract class CommonObject
|
||||
$discount->fk_soc = $this->socid;
|
||||
$this->tpl['label'] .= $discount->getNomUrl(0, 'discount');
|
||||
} elseif (!empty($line->fk_product)) {
|
||||
$productstatic = new Product($this->db);
|
||||
$productstatic->id = $line->fk_product;
|
||||
$productstatic->ref = $line->ref;
|
||||
$productstatic->type = $line->fk_product_type;
|
||||
if (empty($productstatic->ref)) {
|
||||
if (empty($line->product)) {
|
||||
$line->fetch_product();
|
||||
$productstatic = $line->product;
|
||||
}
|
||||
$productstatic = $line->product;
|
||||
|
||||
$this->tpl['label'] .= $productstatic->getNomUrl(1);
|
||||
$this->tpl['label'] .= (is_object($productstatic) ? $productstatic->getNomUrl(1) : $line->ref);
|
||||
$this->tpl['label'] .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
|
||||
// Dates
|
||||
if ($line->product_type == 1 && ($date_start || $date_end)) {
|
||||
@@ -7042,7 +7044,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
|
||||
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) {
|
||||
if ((!isset($this->fields[$key]['default'])) || empty($this->fields[$key]['notnull']) || ($this->fields[$key]['notnull'] != 1)) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
foreach ($param['options'] as $keyb => $valb) {
|
||||
@@ -8208,6 +8210,10 @@ abstract class CommonObject
|
||||
if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) {
|
||||
continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
|
||||
} elseif (($mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3 && abs($visibility) != 4) {
|
||||
// We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost
|
||||
$ef_name = 'options_' . $key;
|
||||
$ef_value = $this->array_options[$ef_name];
|
||||
$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
|
||||
continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
|
||||
} elseif ($mode == 'view' && empty($visibility)) {
|
||||
continue;
|
||||
@@ -8329,7 +8335,7 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
$datekey = $keyprefix.'options_'.$key.$keysuffix;
|
||||
$value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring;
|
||||
$value = (GETPOSTISSET($datekey) && $this->id == GETPOST('elrowid', 'int')) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring;
|
||||
}
|
||||
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
|
||||
$datenotinstring = null;
|
||||
@@ -9517,6 +9523,7 @@ abstract class CommonObject
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
$this->lines = array();
|
||||
while ($i < $num_rows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
|
||||
@@ -58,6 +58,7 @@ class FileUpload
|
||||
$pathname = str_replace('/class', '', $element_prop['classpath']);
|
||||
$filename = $element_prop['classfile'];
|
||||
$dir_output = $element_prop['dir_output'];
|
||||
$savingDocMask = '';
|
||||
|
||||
//print 'fileupload.class.php: element='.$element.' pathname='.$pathname.' filename='.$filename.' dir_output='.$dir_output."\n";
|
||||
|
||||
@@ -73,6 +74,11 @@ class FileUpload
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
|
||||
// add object reference as file name prefix if const MAIN_DISABLE_SUGGEST_REF_AS_PREFIX is not enabled
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_SUGGEST_REF_AS_PREFIX')) {
|
||||
$savingDocMask = $object_ref.'-__file__';
|
||||
}
|
||||
|
||||
// Special cases to forge $object_ref used to forge $upload_dir
|
||||
if ($element == 'invoice_supplier') {
|
||||
$object_ref = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$object_ref;
|
||||
@@ -98,6 +104,7 @@ class FileUpload
|
||||
'script_url' => $_SERVER['PHP_SELF'],
|
||||
'upload_dir' => $dir_output.'/'.$object_ref.'/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/',
|
||||
'saving_doc_mask' => $savingDocMask,
|
||||
'param_name' => 'files',
|
||||
// Set the following option to 'POST', if your server does not support
|
||||
// DELETE requests. This is a parameter sent to the client:
|
||||
@@ -417,6 +424,14 @@ class FileUpload
|
||||
|
||||
if ($validate) {
|
||||
if (dol_mkdir($this->options['upload_dir']) >= 0) {
|
||||
// add object reference as file name prefix if const MAIN_DISABLE_SUGGEST_REF_AS_PREFIX is not enabled
|
||||
$fileNameWithoutExt = preg_replace('/\.[^\.]+$/', '', $file->name);
|
||||
$savingDocMask = $this->options['saving_doc_mask'];
|
||||
if ($savingDocMask && strpos($savingDocMask, $fileNameWithoutExt) !== 0) {
|
||||
$fileNameWithPrefix = preg_replace('/__file__/', $file->name, $savingDocMask);
|
||||
$file->name = $fileNameWithPrefix;
|
||||
}
|
||||
|
||||
$file_path = $this->options['upload_dir'].$file->name;
|
||||
$append_file = !$this->options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
|
||||
|
||||
|
||||
@@ -3381,9 +3381,10 @@ class Form
|
||||
}
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,";
|
||||
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,";
|
||||
$sql .= " pfp.supplier_reputation";
|
||||
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice";
|
||||
$sql .= ", pfp.multicurrency_code, pfp.multicurrency_unitprice";
|
||||
$sql .= ", pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name";
|
||||
$sql .= ", pfp.supplier_reputation";
|
||||
// if we use supplier description of the products
|
||||
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
|
||||
$sql .= ", pfp.desc_fourn as description";
|
||||
@@ -3689,6 +3690,10 @@ class Form
|
||||
$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
|
||||
$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
|
||||
$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
|
||||
if (isModEnabled('multicurrency')) {
|
||||
$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
|
||||
$optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
|
||||
}
|
||||
}
|
||||
$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
|
||||
|
||||
@@ -3710,6 +3715,10 @@ class Form
|
||||
'disabled' => (empty($objp->idprodfournprice) ? true : false),
|
||||
'description' => $objp->description
|
||||
);
|
||||
if (isModEnabled('multicurrency')) {
|
||||
$outarrayentry['multicurrency_code'] = $objp->multicurrency_code;
|
||||
$outarrayentry['multicurrency_unitprice'] = price2num($objp->multicurrency_unitprice, 'MU');
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'objp' => &$objp,
|
||||
@@ -3725,29 +3734,33 @@ class Form
|
||||
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
|
||||
array_push(
|
||||
$outarray,
|
||||
array('key' => $outkey,
|
||||
'value' => $outref,
|
||||
'label' => $outvallabel,
|
||||
'qty' => $outqty,
|
||||
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_qty_ht_locale' => price($objp->fprice),
|
||||
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_unit_ht_locale' => price($objp->unitprice),
|
||||
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx_formated' => price($objp->tva_tx),
|
||||
'tva_tx' => price2num($objp->tva_tx),
|
||||
'default_vat_code' => $objp->default_vat_code,
|
||||
'discount' => $outdiscount,
|
||||
'type' => $outtype,
|
||||
'duration_value' => $outdurationvalue,
|
||||
'duration_unit' => $outdurationunit,
|
||||
'disabled' => (empty($objp->idprodfournprice) ? true : false),
|
||||
'description' => $objp->description
|
||||
)
|
||||
$outarraypush = array(
|
||||
'key' => $outkey,
|
||||
'value' => $outref,
|
||||
'label' => $outvallabel,
|
||||
'qty' => $outqty,
|
||||
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_qty_ht_locale' => price($objp->fprice),
|
||||
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_unit_ht_locale' => price($objp->unitprice),
|
||||
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx_formated' => price($objp->tva_tx),
|
||||
'tva_tx' => price2num($objp->tva_tx),
|
||||
'default_vat_code' => $objp->default_vat_code,
|
||||
'discount' => $outdiscount,
|
||||
'type' => $outtype,
|
||||
'duration_value' => $outdurationvalue,
|
||||
'duration_unit' => $outdurationunit,
|
||||
'disabled' => (empty($objp->idprodfournprice) ? true : false),
|
||||
'description' => $objp->description
|
||||
);
|
||||
// Exemple of var_dump $outarray
|
||||
if (isModEnabled('multicurrency')) {
|
||||
$outarraypush['multicurrency_code'] = $objp->multicurrency_code;
|
||||
$outarraypush['multicurrency_unitprice'] = price2num($objp->multicurrency_unitprice, 'MU');
|
||||
}
|
||||
array_push($outarray, $outarraypush);
|
||||
|
||||
// Example of var_dump $outarray
|
||||
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
|
||||
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
|
||||
// ["qty"]=>string(1) "1" ["discount"]=>string(1) "0" ["disabled"]=>bool(false)
|
||||
@@ -4319,7 +4332,7 @@ class Form
|
||||
if (depositPercent.length > 0) {
|
||||
$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
|
||||
} else {
|
||||
$("#' . $htmlname . '_deposit_percent_container").hide();
|
||||
$("#' . $htmlname . '_deposit_percent_container").hide().find("#' . $htmlname . '_deposit_percent").val(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -6235,7 +6248,7 @@ class Form
|
||||
$TCurrency = array();
|
||||
|
||||
$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
|
||||
$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
|
||||
$sql .= " WHERE entity IN ('" . getEntity('multicurrency') . "')";
|
||||
if ($filter) {
|
||||
$sql .= " AND " . $filter;
|
||||
}
|
||||
@@ -8389,7 +8402,7 @@ class Form
|
||||
},
|
||||
cache: true
|
||||
},
|
||||
language: select2arrayoflanguage,
|
||||
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "' . dol_escape_js($placeholder) . '",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
@@ -8479,7 +8492,7 @@ class Form
|
||||
|
||||
$(".' . $htmlname . '").select2({
|
||||
data: data,
|
||||
language: select2arrayoflanguage,
|
||||
language: (typeof select2arrayoflanguage === \'undefined\') ? \'en\' : select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
placeholder: "' . dol_escape_js($placeholder) . '",
|
||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||
|
||||
@@ -502,8 +502,6 @@ class FormAccounting extends Form
|
||||
return -1;
|
||||
}
|
||||
|
||||
ksort($aux_account);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Auxiliary user account
|
||||
@@ -526,6 +524,8 @@ class FormAccounting extends Form
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
ksort($aux_account);
|
||||
|
||||
if ($usecache) {
|
||||
$this->options_cache[$usecache] = $aux_account;
|
||||
}
|
||||
|
||||
@@ -879,12 +879,12 @@ class FormMail extends Form
|
||||
|
||||
// Complete substitution array with the url to make online payment
|
||||
$paymenturl = '';
|
||||
$validpaymentmethod = array();
|
||||
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$validpaymentmethod = getValidOnlinePaymentMethods('');
|
||||
if (empty($this->substit['__REF__'])) {
|
||||
$paymenturl = '';
|
||||
} else {
|
||||
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$langs->loadLangs(array('paypal', 'other'));
|
||||
$typeforonlinepayment = 'free';
|
||||
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') {
|
||||
@@ -898,14 +898,15 @@ class FormMail extends Form
|
||||
}
|
||||
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
|
||||
$paymenturl = $url;
|
||||
|
||||
$validpaymentmethod = getValidOnlinePaymentMethods('');
|
||||
}
|
||||
|
||||
if (count($validpaymentmethod) > 0 && $paymenturl) {
|
||||
$langs->load('other');
|
||||
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
|
||||
$this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl;
|
||||
} elseif (count($validpaymentmethod) > 0) {
|
||||
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '__ONLINE_PAYMENT_TEXT_AND_URL__';
|
||||
$this->substit['__ONLINE_PAYMENT_URL__'] = '__ONLINE_PAYMENT_URL__';
|
||||
} else {
|
||||
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = '';
|
||||
$this->substit['__ONLINE_PAYMENT_URL__'] = '';
|
||||
|
||||
@@ -332,7 +332,7 @@ class FormTicket
|
||||
|
||||
// Type of Ticket
|
||||
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>';
|
||||
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 1, 0, 0, 'minwidth200');
|
||||
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 'ifone', 0, 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Group => Category
|
||||
@@ -342,12 +342,12 @@ class FormTicket
|
||||
$filter = 'public=1';
|
||||
}
|
||||
$selected = (GETPOST('category_code') ? GETPOST('category_code') : $this->category_code);
|
||||
$this->selectGroupTickets($selected, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200');
|
||||
$this->selectGroupTickets($selected, 'category_code', $filter, 2, 'ifone', 0, 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity => Priority
|
||||
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
|
||||
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 1);
|
||||
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 'ifone');
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->knowledgemanagement->enabled)) {
|
||||
@@ -690,8 +690,8 @@ class FormTicket
|
||||
* @param string|array $selected Id of preselected field or array of Ids
|
||||
* @param string $htmlname Nom de la zone select
|
||||
* @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz))
|
||||
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
|
||||
* @param int $empty 1=peut etre vide, 0 sinon
|
||||
* @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code
|
||||
* @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only
|
||||
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
@@ -715,9 +715,9 @@ class FormTicket
|
||||
|
||||
$ticketstat->loadCacheTypesTickets();
|
||||
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect?'[]':'').'"'.($multiselect?' multiple':'').'>';
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($multiselect ? ' multiple' : '').'>';
|
||||
if ($empty) {
|
||||
print '<option value=""> </option>';
|
||||
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? ' ' : $empty).'</option>';
|
||||
}
|
||||
|
||||
if (is_array($ticketstat->cache_types_tickets) && count($ticketstat->cache_types_tickets)) {
|
||||
@@ -753,7 +753,9 @@ class FormTicket
|
||||
print ' selected="selected"';
|
||||
} elseif (in_array($id, $selected)) {
|
||||
print ' selected="selected"';
|
||||
} elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) {
|
||||
} elseif ($arraytypes['use_default'] == "1" && empty($selected) && !$multiselect) {
|
||||
print ' selected="selected"';
|
||||
} elseif (count($ticketstat->cache_types_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
|
||||
print ' selected="selected"';
|
||||
}
|
||||
|
||||
@@ -813,10 +815,10 @@ class FormTicket
|
||||
$ticketstat = new Ticket($this->db);
|
||||
$ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups
|
||||
|
||||
if ($use_multilevel <= 0) {
|
||||
if ($use_multilevel <= 0) { // Only one combo list to select the group of ticket (default)
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
if ($empty) {
|
||||
print '<option value=""> </option>';
|
||||
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? ' ' : $empty).'</option>';
|
||||
}
|
||||
|
||||
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
|
||||
@@ -861,9 +863,9 @@ class FormTicket
|
||||
print ' selected="selected"';
|
||||
} elseif (isset($selected) && $selected == $id) {
|
||||
print ' selected="selected"';
|
||||
} elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) {
|
||||
} elseif ($arraycategories['use_default'] == "1" && !$selected && (!$empty || $empty == 'ifone')) {
|
||||
print ' selected="selected"';
|
||||
} elseif (count($ticketstat->cache_category_tickets) == 1) {
|
||||
} elseif (count($ticketstat->cache_category_tickets) == 1 && (!$empty || $empty == 'ifone')) {
|
||||
print ' selected="selected"';
|
||||
}
|
||||
|
||||
@@ -1135,14 +1137,14 @@ class FormTicket
|
||||
/**
|
||||
* Return html list of ticket severitys (priorities)
|
||||
*
|
||||
* @param string $selected Id severity pre-selected
|
||||
* @param string $htmlname Name of the select area
|
||||
* @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz))
|
||||
* @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code
|
||||
* @param int $empty 1 = can be empty, 0 = or not
|
||||
* @param int $noadmininfo 0 = add admin info, 1 = disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
* @param string $selected Id severity pre-selected
|
||||
* @param string $htmlname Name of the select area
|
||||
* @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz))
|
||||
* @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code
|
||||
* @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only
|
||||
* @param int $noadmininfo 0 = add admin info, 1 = disable admin info
|
||||
* @param int $maxlength Max length of label
|
||||
* @param string $morecss More CSS
|
||||
* @return void
|
||||
*/
|
||||
public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketseverity', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '')
|
||||
@@ -1163,7 +1165,7 @@ class FormTicket
|
||||
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
if ($empty) {
|
||||
print '<option value=""> </option>';
|
||||
print '<option value="">'.((is_numeric($empty) || $empty == 'ifone') ? ' ' : $empty).'</option>';
|
||||
}
|
||||
|
||||
if (is_array($ticketstat->cache_severity_tickets) && count($ticketstat->cache_severity_tickets)) {
|
||||
@@ -1199,7 +1201,9 @@ class FormTicket
|
||||
print ' selected="selected"';
|
||||
} elseif (isset($selected) && $selected == $id) {
|
||||
print ' selected="selected"';
|
||||
} elseif ($arrayseverities['use_default'] == "1" && !$selected && !$empty) {
|
||||
} elseif ($arrayseverities['use_default'] == "1" && empty($selected) && (!$empty || $empty == 'ifone')) {
|
||||
print ' selected="selected"';
|
||||
} elseif (count($ticketstat->cache_severity_tickets) == 1 && (!$empty || $empty == 'ifone')) { // If only 1 choice, we autoselect it
|
||||
print ' selected="selected"';
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ class Translate
|
||||
*/
|
||||
private function getTradFromKey($key)
|
||||
{
|
||||
global $conf, $db;
|
||||
global $db;
|
||||
|
||||
if (!is_string($key)) {
|
||||
//xdebug_print_function_stack('ErrorBadValueForParamNotAString');
|
||||
@@ -660,7 +660,7 @@ class Translate
|
||||
}
|
||||
}
|
||||
|
||||
// Crypt string into HTML
|
||||
// Encode string into HTML
|
||||
$str = htmlentities($str, ENT_COMPAT, $this->charset_output); // Do not convert simple quotes in translation (strings in html are embraced by "). Use dol_escape_htmltag around text in HTML content
|
||||
|
||||
// Restore reliable HTML tags into original translation string
|
||||
@@ -670,6 +670,10 @@ class Translate
|
||||
$str
|
||||
);
|
||||
|
||||
// Remove dangerous sequence we should never have. Not needed into a translated response.
|
||||
// %27 is entity code for ' and is replaced by browser automatically when translation is inside a javascript code called by a click like on a href link.
|
||||
$str = str_replace(array('%27', '''), '', $str);
|
||||
|
||||
if ($maxsize) {
|
||||
$str = dol_trunc($str, $maxsize);
|
||||
}
|
||||
@@ -739,6 +743,10 @@ class Translate
|
||||
$str = sprintf($str, $param1, $param2, $param3, $param4, $param5); // Replace %s and %d except for FormatXXX strings.
|
||||
}
|
||||
|
||||
// Remove dangerous sequence we should never have. Not needed into a translated response.
|
||||
// %27 is entity code for ' and is replaced by browser automatically when translation is inside a javascript code called by a click like on a href link.
|
||||
$str = str_replace(array('%27', '''), '', $str);
|
||||
|
||||
return $str;
|
||||
} else {
|
||||
/*if ($key[0] == '$') {
|
||||
|
||||
@@ -532,13 +532,13 @@ class Utils
|
||||
} elseif ($compression == 'zstd') {
|
||||
fclose($handle);
|
||||
}
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg)) { // No error
|
||||
if ($ok && preg_match('/^-- (MySql|MariaDB)/i', $errormsg) || preg_match('/^\/\*M?!999999/', $errormsg)) { // Start of file is ok, NOT an error
|
||||
$errormsg = '';
|
||||
} else {
|
||||
// Renommer fichier sortie en fichier erreur
|
||||
// Rename file out into a file error
|
||||
//print "$outputfile -> $outputerror";
|
||||
@dol_delete_file($outputerror, 1, 0, 0, null, false, 0);
|
||||
@rename($outputfile, $outputerror);
|
||||
@dol_move($outputfile, $outputerror, '0', 1, 0, 0);
|
||||
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
|
||||
if (!$errormsg) {
|
||||
$langs->load("errors");
|
||||
|
||||
@@ -158,12 +158,13 @@ abstract class DoliDB implements Database
|
||||
*
|
||||
* @param string $stringtosanitize String to escape
|
||||
* @param int $allowsimplequote 1=Allow simple quotes in string. When string is used as a list of SQL string ('aa', 'bb', ...)
|
||||
* @param string $allowsequals 1=Allow equals sign
|
||||
* @param int $allowsequals 1=Allow equals sign
|
||||
* @param int $allowsspace 1=Allow space char
|
||||
* @return string String escaped
|
||||
*/
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0)
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0, $allowsspace = 0)
|
||||
{
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').']/i', '', $stringtosanitize);
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').($allowsspace ? ' ' : '').']/i', '', $stringtosanitize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -718,7 +718,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
public function escape($stringtoencode)
|
||||
{
|
||||
return pg_escape_string($stringtoencode);
|
||||
return pg_escape_string($this->db, $stringtoencode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -252,7 +252,7 @@ if (!class_exists('MenuManager')) {
|
||||
$menufound = 0;
|
||||
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
|
||||
foreach ($dirmenus as $dirmenu) {
|
||||
$menufound = dol_include_once($dirmenu."standard/".$file_menu);
|
||||
$menufound = dol_include_once($dirmenu."standard/".dol_sanitizeFileName($file_menu));
|
||||
if ($menufound) {
|
||||
break;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ if (!class_exists('MenuManager')) {
|
||||
if (!$menufound) { // If failed to include, we try with standard
|
||||
dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
|
||||
$file_menu = 'eldy_menu.php';
|
||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
|
||||
include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".dol_sanitizeFileName($file_menu);
|
||||
}
|
||||
}
|
||||
$menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user