Compare commits

...

183 Commits

Author SHA1 Message Date
Laurent Destailleur
78ca968db6 Merge pull request #36517 from atm-florianm/SEC/commented-out-restrictedArea
SEC: FIX #36430 permissions not checked on other tabs of HRM evaluation card
2025-12-04 18:37:46 +01:00
atm-florian
a1476fd221 SEC: permissions not checked on other tabs of HRM evaluation card 2025-12-03 17:11:14 +01:00
Laurent Destailleur
908880c82c SEC: fix IDOR attack on employee evaluation. Missing permision test 7ed0af2a13
SEC: empty commit for CI automata
2025-11-26 15:41:53 +01:00
atm-florian
3608e9b102 SEC: 7ed0af2a13 2025-11-26 14:44:38 +01:00
Florian Mortgat
c2635f5242 FIX 17.0: perweek.php resets task progress to 0% when: (#36401)
* FIX 17.0: perweek.php resets task progress to 0% when:
1. the column "Declared real progress" is hidden (which means the corresponding form inputs won't be displayed)
2. and the user doesn't enter any time for that task (= leaves the input empty)

If the column is shown, the bug doesn't occur because the correct value is sent with $_POST.
If the user enters time, the bug doesn't occur because there is a GETPOSTISSET test for that case.

* Apply suggestion from @atm-florianm

variable name ($taskid vs $tmptaskid)
2025-11-24 16:32:27 +01:00
Laurent Destailleur
2935a245a3 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-11-24 16:07:46 +01:00
Laurent Destailleur
5589ed71b2 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-11-24 16:07:22 +01:00
Laurent Destailleur
32f160355b Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-11-24 16:03:52 +01:00
Florian Mortgat
5a61cc9393 FIX DA027383: permissions not checked on HRM evaluation card (#36328) (#36399)
Permissions involved:
- hrm->evaluation->readall: the user can view anyone's evaluations
- hrm->evaluation->read: the user can only view their or their subordinates' evaluations
2025-11-24 14:57:20 +01:00
Florian Mortgat
7ed0af2a13 FIX DA027383: permissions not checked on HRM evaluation card (#36328)
Permissions involved:
- hrm->evaluation->readall: the user can view anyone's evaluations
- hrm->evaluation->read: the user can only view their or their subordinates' evaluations
2025-11-24 12:21:51 +01:00
ldestailleur
9e8460c3dc Fix CI 2025-11-20 15:17:01 +01:00
ldestailleur
70f5e20572 Fix CI 2025-11-20 15:16:04 +01:00
lvessiller-opendsi
30ecf80732 FIX keep user who validate proposal on update (#36257) 2025-11-14 15:53:31 +01:00
Laurent Destailleur
99fe044868 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-11-12 21:44:49 +01:00
Laurent Destailleur
8ae27c3a5f Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-11-12 21:44:34 +01:00
Frédéric FRANCE
5fa475a074 fix directory was always overwritten (#36148) 2025-11-07 18:43:26 +01:00
Florian Mortgat
a16f3bdf31 FIX 16.0: extrafield of type link to category causes SQL error in selectForFormsList() (#36074)
* FIX 16.0 (up to 19.0): extrafield of type link to category causes SQL error in selectForFormsList

* Apply suggestion from @atm-florianm
2025-11-04 13:06:58 +01:00
atm-GregM
dc7932700b Fix TICKET_ENABLE_PUBLIC_INTERFACE (#36073) 2025-11-04 12:25:57 +01:00
Laurent Destailleur
534d4ed4bc Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-11-03 13:49:06 +01:00
Laurent Destailleur
50b90d795c Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-11-03 13:48:51 +01:00
Laurent Destailleur
3209eb4bd8 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-11-03 13:46:49 +01:00
Marc de Lima Lucio
1f65548836 FIX: notifications: correctly report email delivery errors (#35864) 2025-10-20 23:53:07 +02:00
lvessiller-opendsi
5de1fcca2f FIX extra-field list depend on parent extra-filed list on direct edit (#35803) 2025-10-17 15:48:40 +02:00
lvessiller-opendsi
50afc9682b FIX create invoice from order using API and multi-entity (#35654)
* FIX create invoice from order using API and multi-entity

* FIX API not allow to access order in other entity on creating invoice from order

* Update api_invoices.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-06 13:56:50 +02:00
Marc de Lima Lucio
a3969c1d2c FIX: php 8+ warnings when creating deposits (#35582) 2025-10-01 16:21:05 +02:00
ldestailleur
d87ebbf926 Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-09-25 11:55:28 +02:00
ldestailleur
08b105502e Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-09-25 11:55:21 +02:00
ldestailleur
bd2aba1a2f Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-09-25 11:54:59 +02:00
ldestailleur
a4601686a6 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-09-25 11:54:18 +02:00
lvessiller-opendsi
bcf6d6a7a2 FIX api orders : forward database error on failure (backpot commit d9e81cb) (#35478) 2025-09-25 11:47:51 +02:00
Dylan Bourdere
65a3b0893d fix undefined properties (#35435) 2025-09-22 20:31:50 +02:00
Dylan Bourdere
92454d671f rename tab name in comment of modulebuilder (#35431) 2025-09-22 12:11:32 +02:00
Frédéric FRANCE
f43f2909ff rule is deprecated (#35410) 2025-09-20 16:02:39 +02:00
Florian Mortgat
60f089c015 FIX 17.0: ContratLigne::fetch() returns 1 even if the line doesn't exist (#35324) 2025-09-12 15:19:20 +02:00
atm-lucas
7d898184b5 Modify condition display button (#35257) 2025-09-09 19:30:14 +02:00
lvessiller-opendsi
e818bf732d FIX extra field list depend on parent list when editing a card (#35165) 2025-09-01 19:55:00 +02:00
ldestailleur
347bf3e4d6 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-08-07 16:14:00 +02:00
Maxime Kohlhaas
b3a2257638 Fix : contract line activation error when duration not defined (#34813)
* Fix : contract line activation error when duration not defined

* Fix of fix

* Update card.php

---------

Co-authored-by: x <x@x.x>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-08-06 21:22:47 +02:00
Laurent Destailleur
3b0a4c9fa9 Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 2025-07-31 23:11:32 +02:00
VIAL-GOUTEYRON Quentin
154a25f8cb Enhance working days calculation to incorporate half-day adjustments and optimize public holiday checks (#34552)
* "Enhance working days calculation to incorporate half-day adjustments and optimize public holiday checks"

* "Add test cases for num_open_day() to validate half-day and weekend boundary scenarios"

* "Update DateLibTest to include Saturday and Sunday as non-working days in test setup"
2025-07-31 22:59:29 +02:00
Maxime Kohlhaas
6a88d31675 Fix : missing langs load on comm card file (#34812)
Co-authored-by: x <x@x.x>
2025-07-26 14:57:23 +02:00
Florian Mortgat
f4555c4413 FIX 17.0 SQL syntax error and/or constraint error when calling Facture::update() after a clone (e.g. in a trigger) (#34778)
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-07-23 11:26:49 +02:00
Florian Mortgat
bc33f7e1a7 FIX 17.0: when you clone an invoice that was created from a template invoice, the clone should not be linked to the template invoice (#34777) 2025-07-22 12:10:41 +02:00
ldestailleur
3c1b5846c9 Fix travis file 2025-07-22 12:08:51 +02:00
ldestailleur
3b5e07dca9 Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-07-09 15:27:37 +02:00
ldestailleur
8927d1260a Fix travis 2025-07-09 15:27:28 +02:00
Laurent Destailleur
53cf9f0bf1 Doc 2025-07-05 00:40:19 +02:00
ldestailleur
c0161ccead Fix CI 2025-06-28 18:54:53 +02:00
ldestailleur
a4b1700bae Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-06-28 18:53:25 +02:00
ldestailleur
f5cb64afaa Fix CI 2025-06-28 18:53:12 +02:00
ldestailleur
a5c51589d3 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-06-28 17:54:41 +02:00
ldestailleur
b4501511c8 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-06-28 17:54:22 +02:00
ldestailleur
e18c5b9d68 Fix CI 2025-06-28 17:40:01 +02:00
ldestailleur
d31bad82a1 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-06-28 17:14:50 +02:00
ldestailleur
bc0b0bebd3 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-06-28 17:09:51 +02:00
ldestailleur
031acacdab Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-06-28 17:04:21 +02:00
POTIER Mathieu
18725aec6b [FIX] loop interrupt if an error occurs in sendEmailsRemindersOnInvoiceDueDate (#34657) 2025-06-28 16:45:52 +02:00
atm-lucas
4c6955017f Adding mapping to module rights (#34212) 2025-05-20 21:47:08 +02:00
HENRY Florian
de40214a09 fix: multi filter journal in accountancy/bookkeeping/list.php and in export (#34217)
* fix: filter journal IN

* fix: filter journal IN
2025-05-20 20:33:31 +02:00
ldestailleur
096b59913d Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-04-10 14:16:34 +02:00
ldestailleur
d38b9e6248 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-04-10 14:16:11 +02:00
ldestailleur
f256deb54b Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-04-10 14:15:48 +02:00
ThomasNgr-OpenDSI
7fa3474ecd FIX : constant PAYMENTBYBANKTRANSFER_ADDDAYS was never saved (#33799) 2025-04-09 15:44:51 +02:00
ldestailleur
ef159f919e Backport fix in v20 #33536 2025-03-19 16:10:25 +01:00
atm-lucas
42a1cde41a useless product fetch on invoice create (#33505) 2025-03-19 14:00:03 +01:00
MDW
324f9631d7 FIX: Replace compromised tj-actions/changed-files (#33481)
# FIX: Replace compromised tj-actions/changed-files

See https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised .

(Backport from develop)
2025-03-15 16:38:56 +01:00
ldestailleur
2058d572d9 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-03-14 12:17:06 +01:00
ldestailleur
089fab828b Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-03-14 12:14:10 +01:00
ldestailleur
fa05dc44ce Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-03-14 11:29:14 +01:00
ldestailleur
5b9453e302 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-03-14 11:28:33 +01:00
ldestailleur
d81a2d060e Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0 2025-03-14 11:27:49 +01:00
Eric - CAP-REL
97aaff7395 13.0 fix migration missing tms auto update (#33443)
* tms field in llx_product is not updated to default timestamp

* but that's not the only one ...
2025-03-13 23:01:52 +01:00
Florian Mortgat
f7fe6c4f1a FIX warnings (#33423)
* FIX warnings

* fix: empty({function call})
2025-03-12 19:15:24 +01:00
Eric - CAP-REL
6f4b2a8905 allow spaces on natural search (#33324)
* allow spaces on natural search like documentation says

* clear comment

* sanitize backport from 19.0

* update sanitize call to be compatible with dolibarr 19.0 backported function
2025-03-11 02:13:06 +01:00
Laurent Destailleur (aka Eldy)
82b7326c99 Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-02-05 10:49:20 +01:00
Laurent Destailleur (aka Eldy)
d2e6335e95 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-02-05 10:49:14 +01:00
Laurent Destailleur (aka Eldy)
711f21e8a0 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-02-05 10:48:43 +01:00
Laurent Destailleur (aka Eldy)
e1c343cedd Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-02-05 10:48:16 +01:00
Laurent Destailleur
bbb8b0f01f Merge pull request #32830 from hregis/17.0
FIX compatibility with multicompany
2025-01-30 13:25:07 +01:00
Laurent Destailleur
63ab8d9f75 Merge pull request #32871 from atm-irvine/fix_undefined_properties
fix(contrat,facture-rec): undefined properties
2025-01-30 12:40:08 +01:00
Irvine Fleith
7848d77830 fix(contrat,facture-rec): undefined properties 2025-01-30 09:58:29 +01:00
Laurent Destailleur
e6a6426b5b Merge pull request #32850 from atm-irvine/fix_missing_hook_printFieldListSearchParam
fix(services-list): added missing hook printFieldListSearchParam in services list
2025-01-29 16:49:48 +01:00
Irvine Fleith
f3dc94d334 fix(services-list): added missing hook printFieldListSearchParam 2025-01-29 10:14:46 +01:00
Laurent Destailleur
44d6803d12 Merge pull request #32834 from atm-irvine/fix_missing_hook_printFieldListWhere
fix(services-list): added missing hook printFieldListWhere
2025-01-28 23:46:14 +01:00
Irvine Fleith
bdcd7b5ef3 fix(services-list): added missing hook printFieldListWhere 2025-01-28 14:47:10 +01:00
Regis Houssin
f9ec70f1db FIX compatibility with multicompany 2025-01-28 14:05:59 +01:00
Laurent Destailleur
b67fdb3e51 Merge pull request #32719 from Easya-Solutions/14.0_fix-supplier-order-linked-line-delete
FIX delete supplier order line when linked to customer order line
2025-01-20 15:13:22 +01:00
VESSILLER
ad60a50d4d Uniformize SQL concat char 2025-01-20 11:58:58 +01:00
VESSILLER
08a976fd85 FIX delete supplier order when at least one line linked to customer order line 2025-01-20 11:56:54 +01:00
VESSILLER
db47ce3bb1 FIX delete supplier order line when linked to customer order line 2025-01-20 11:33:24 +01:00
Laurent Destailleur (aka Eldy)
736890b244 Merge 2025-01-20 10:15:31 +01:00
Laurent Destailleur (aka Eldy)
2664518bd3 Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-01-20 10:14:52 +01:00
Laurent Destailleur (aka Eldy)
c6f90d8361 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-01-20 10:14:44 +01:00
Laurent Destailleur (aka Eldy)
cc732621ab Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-01-20 10:14:25 +01:00
Laurent Destailleur (aka Eldy)
04fed9526a Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-01-20 10:13:04 +01:00
Laurent Destailleur
f68cf0034a Merge pull request #32683 from ATM-Consulting/FIX/133/TK2501-3514/api-put
FIX 17.0 API endpoints "PUT": prevent overwriting all extrafields if only some are supplied in the request
2025-01-16 11:41:26 +01:00
atm-florian
ba4e97f07b FIX 17.0 API endpoints "PUT": prevent overwriting all extrafields if only some are supplied in the request cf. PR #29237
+ security for Tickets API: disable updating rowid
2025-01-16 10:37:29 +01:00
Laurent Destailleur (aka Eldy)
c2c3879032 Clean php file 2025-01-16 00:36:56 +01:00
Laurent Destailleur (aka Eldy)
c4529ed986 Clean file 2025-01-16 00:35:38 +01:00
Laurent Destailleur (aka Eldy)
8b7eaf360e Fix phpunit 2025-01-15 20:08:13 +01:00
Laurent Destailleur (aka Eldy)
2f317f0f52 Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-01-15 20:07:40 +01:00
Laurent Destailleur (aka Eldy)
bd35af1360 Fix phpunit 2025-01-15 20:07:31 +01:00
Laurent Destailleur
fe6d59c090 Merge pull request #32651 from ATM-Consulting/FIX/133/bug/pre-commit-debug-bar-fails
Apply suggestion by @mdeweerd to ensure pre-commit will pass.
2025-01-15 15:53:48 +01:00
Laurent Destailleur
d4e66426e7 Merge pull request #32621 from ATM-Consulting/FIX/132/bug/cache-collisions-dol-getIdFromCode
FIX 17.0 - collisions in cache for dol_getIdFromCode
2025-01-15 15:51:23 +01:00
Laurent Destailleur
88d81aa943 Merge pull request #27159 from atm-lena/17.0_FIX_MultilangsTranslationPDFLinesDescription
FIX Multilangs : PDF lines description
2025-01-15 15:38:48 +01:00
Laurent Destailleur
5354b54ec0 Merge pull request #32663 from Easya-Solutions/14_FIX_socpeopleassigned_update_event
Backport Fix bad management when inserting contacts of actioncomm
2025-01-15 14:40:07 +01:00
Laurent Destailleur
49feeee85e Merge pull request #32654 from atm-irvine/fix_search_thirdparty_by_name
fix(services-list): search thirdparty by name
2025-01-15 14:37:32 +01:00
Laurent Destailleur
42d8591758 Merge pull request #32660 from Easya-Solutions/14_FIX_selectcontacts_param_update_event
FIX selectcontact is loading all contacts when update event
2025-01-15 14:35:32 +01:00
Laurent Destailleur (aka Eldy)
6b0c8f39d5 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2025-01-15 12:15:28 +01:00
Laurent Destailleur (aka Eldy)
2c2e01d14c Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2025-01-15 12:14:06 +01:00
Laurent Destailleur (aka Eldy)
abc1d1dcb3 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2025-01-15 12:13:44 +01:00
Laurent Destailleur
628189f57f Backport of #00e65eb
Fix bad management when inserting contacts of actioncomm
2025-01-15 11:00:05 +01:00
uvaldenaire-opendsi
748dcd0881 FIX selectcontact is loading all contacts if socid is empty and MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is not set 2025-01-15 10:12:16 +01:00
Laurent Destailleur
4f98ca37e2 Merge pull request #32653 from mdeweerd/pr32651
Fix ci 17.0 and up - Install maximum php version found in check.php
2025-01-15 01:11:52 +01:00
Irvine Fleith
a34eaa07ed fix(services-list): search thirdparty by name 2025-01-14 16:19:52 +01:00
MDW
20f2293c01 Always install expected php version 2025-01-14 16:15:04 +01:00
MDW
7869e45954 Move installation of php before pre-commit run 2025-01-14 16:15:03 +01:00
MDW
9af7eaf08c Use PHP version from check.php 2025-01-14 16:15:01 +01:00
atm-florian
df992477be Apply suggestion by @mdeweerd to ensure pre-commit will pass. 2025-01-14 14:34:09 +01:00
Florian Mortgat
79c55149b2 Update htdocs/core/lib/functions.lib.php 2025-01-14 11:00:38 +01:00
atm-florian
762e4ec8d1 updated local pre-commit hook -> fix typo 2025-01-10 17:01:59 +01:00
atm-florian
77f982d1a8 FIX 17.0 - collisions in cache for dol_getIdFromCode 2025-01-10 16:25:27 +01:00
Laurent Destailleur
7a7146c03d Merge pull request #32600 from Easya-Solutions/14_fix_selectcontacts_socid_param
fix selectcontacts  param
2025-01-10 12:03:36 +01:00
Maxime Kohlhaas
6388f6e62a Merge branch '16.0' of github.com:Dolibarr/dolibarr into 17.0 2025-01-09 18:07:09 +01:00
Maxime Kohlhaas
e2605fbf64 Merge branch '15.0' of github.com:Dolibarr/dolibarr into 16.0 2025-01-09 18:05:33 +01:00
Maxime Kohlhaas
90c24b3d95 Merge branch '14.0' of https://github.com/Dolibarr/dolibarr into 15.0 2025-01-09 18:01:51 +01:00
uvaldenaire-opendsi
0912b3b04f fix selectcontacts param 2025-01-09 15:09:38 +01:00
Laurent Destailleur
2dd81deb13 Merge pull request #32568 from atm-maxime/14.0
Fix : cron job user rights force reload
2025-01-07 21:29:15 +01:00
Maxime Kohlhaas
273ec857a3 Fix : cron job user rights force reload 2025-01-07 18:39:19 +01:00
Laurent Destailleur
2519278269 Merge pull request #32558 from Easya-Solutions/14_fix_join_soc_commerciaux
fix join societe_commerciaux in societe list
2025-01-07 15:54:42 +01:00
uvaldenaire-opendsi
74881ae251 fix join societe_commerciaux in societe list 2025-01-07 13:51:34 +01:00
Laurent Destailleur (aka Eldy)
f08c9605db Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2024-12-31 17:17:45 +01:00
Laurent Destailleur (aka Eldy)
e41dfcbbb3 Fix phpcs 2024-12-31 17:17:00 +01:00
Laurent Destailleur
a5f51dc969 Merge pull request #32433 from frederic34/15.0-fix_ci
fix CI for branch 15.0
2024-12-19 18:58:29 +01:00
Frédéric France
04b7fdd4c4 fix CI 2024-12-19 18:32:16 +01:00
Laurent Destailleur
37f3fccc35 Merge pull request #32383 from atm-etienne/fix/130/remove_dol_syslog_throws
Fix/130/remove dol syslog throws
2024-12-19 18:10:38 +01:00
Laurent Destailleur
fedcec58a6 Update errors.lang 2024-12-19 18:09:50 +01:00
Laurent Destailleur
be95c92c45 Update functions.lib.php 2024-12-19 18:07:02 +01:00
Laurent Destailleur (aka Eldy)
c6afa1a6cb Merge branch '17.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2024-12-19 17:50:40 +01:00
Laurent Destailleur (aka Eldy)
29eedd2ac4 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2024-12-19 17:50:34 +01:00
Laurent Destailleur (aka Eldy)
ead519811c Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2024-12-19 17:50:09 +01:00
Laurent Destailleur
5203652796 Merge pull request #32430 from Benoit-PASCAL/fix-fetch-action-linked-object
fix: fetch action linked object
2024-12-19 17:49:50 +01:00
Laurent Destailleur
750ed5e91c Merge pull request #32412 from Easya-Solutions/17.0_fix_no_commit_to_branch
pre-commit : change regex for hook no-commit-to-branch to block only `18.0`, not `18.0_branch_description`
2024-12-19 17:38:15 +01:00
Benoît PASCAL
425c23d28c fix: fetch action linked object 2024-12-19 15:38:19 +01:00
tnegre
b73bcd68a9 pre-commit : change regex for hook no-commit-to-branch in order to allow branches BEGINNING by 18.0, such as 18.0_fix_foo 2024-12-18 10:47:46 +01:00
Etienne BENDER
6aee2db1d4 Remove use of getDolGlobalInt() 2024-12-17 09:01:04 +01:00
Etienne BENDER
a96d13d5aa Add translation for bad log level 2024-12-09 10:56:35 +01:00
Etienne BENDER
f1868ee162 Replace dol_syslog throws by default log level 2024-12-09 10:50:29 +01:00
Laurent Destailleur
42368b37e9 Merge pull request #32251 from ATM-Consulting/FIX/130/coeur/fetch-return-value-bad-test
Fix 17.0 missing test of return value
2024-12-05 19:28:42 +01:00
Laurent Destailleur
addefdf0cf Merge pull request #32247 from atm-irvine/fix_missing_error_cron_createrecurringinvoice
Added new error message for CRON createRecurringInvoice
2024-12-05 18:14:40 +01:00
atm-florian
15c19b99c9 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) 2024-12-05 12:15:20 +01:00
atm-florian
c418a6ff57 FIX 17.0 - missing error handling for FactureRec::fetch in card-rec.php 2024-12-05 12:14:13 +01:00
Irvine Fleith
3aad5fd283 Added new error message for CRON createRecurringInvoice 2024-12-05 09:02:51 +01:00
Laurent Destailleur (aka Eldy)
9ec4575c43 Merge branch '16.0' of git@github.com:/Dolibarr/dolibarr.git into 17.0 2024-12-02 01:38:41 +01:00
Mathieu Moulin
6337a987d8 Fix handling of boolean extrafields in list filters (#32109)
* Fix show payment URL in massaction context when not one email per recipient

* Debug v20 - fix param for filter on boolean

* 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'.
It's not reselected when the filter is set.

* Revert "Fix show payment URL in massaction context when not one email per recipient"

This reverts commit 0986d487f1.

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: kkhelifa <kkhelifa@open-dsi.fr>
2024-12-01 23:28:49 +01:00
Frédéric FRANCE
7b16039084 fix test (#32110) 2024-11-27 18:02:59 +01:00
alkaan
115323dec8 FIX : removes traces of <<<HEAD conflicts following the postponement of branch 13 modifications (#32014)
Co-authored-by: John Fleuret <john.fleuret@atgp.net>
2024-11-20 20:57:22 +01:00
Laurent Destailleur
9c4bb84460 Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 2024-11-19 12:57:19 +01:00
Laurent Destailleur
5a58b8e721 Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2024-11-19 12:56:37 +01:00
Laurent Destailleur
b068fdc9b3 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2024-11-19 12:56:19 +01:00
Laurent Destailleur
b8533e1853 Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 2024-11-19 12:49:19 +01:00
Laurent Destailleur
753e5e535d Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0 2024-11-19 12:47:14 +01:00
Laurent Destailleur
c5ebc9b7bd Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 2024-11-19 03:33:15 +01:00
Mathieu Moulin
a602309e04 Fix user::load_previous_next_ref() with MULTICOMPANY_TRANSVERSE_MODE bad sql query (cartesian product replaced by INNER JOIN) (#31946) 2024-11-16 18:19:59 +01:00
Mathieu Moulin
f51935a258 Fix slow user card when many users in same group, disable loading of all other users (#31947) 2024-11-16 18:10:08 +01:00
Mathieu Moulin
cd6ed63768 Fix Specimen warning in supplier admin when database has no products (#31867) 2024-11-16 10:45:01 +01:00
Mathieu Moulin
348981a419 Fix show payment URL in massaction context when not one email per recipient (#31927) 2024-11-16 00:06:15 +01:00
Mathieu Moulin
adf59f2599 Fix mod_facture_fournisseur_tulip::getExample & get_next_value if no object in parameter (#31878) 2024-11-16 00:00:05 +01:00
Laurent Destailleur
d30a0ea066 Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 2024-11-13 16:32:54 +01:00
Laurent Destailleur
ab6c74ae88 Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0 2024-11-13 16:29:18 +01:00
Laurent Destailleur
fbca98ec2a Merge 2024-11-13 16:25:00 +01:00
thomas-Ngr
93f23fe452 ODF : fix : escape specials chars in IF ELSE ENDIF $key (#31796)
* ODF : fix : escape specials chars in IF ELSE ENDIF $key

* fix missing brackets

* add delimiter to preg_quote

---------

Co-authored-by: Brice Werry <bwerry@open-dsi.fr>
2024-11-13 16:18:08 +01:00
lvessiller-opendsi
8a55e2f6a4 FIX old copy not needed in supplier order create method (#31733) 2024-11-08 17:51:44 +01:00
lvessiller-opendsi
e0a3756c6e FIX update status on create supplier order for trigger (#31642) 2024-10-30 23:35:39 +01:00
atm-lena
66a175e48d langs of recipient 2024-01-22 14:52:51 +01:00
atm-lena
e24da32424 Load multilangs in function pdf_getlinedesc() 2024-01-16 14:13:28 +01:00
atm-lena
a13b720598 Merge branch '17.0' of https://github.com/Dolibarr/dolibarr into 17.0_FIX_MultilangsTranslationPDFLinesDescription 2024-01-16 14:08:52 +01:00
atm-lena
86971c7b86 Clean Conditions 2023-12-22 09:30:35 +01:00
atm-lena
daccab5a07 Merge branch '17.0' of https://github.com/Dolibarr/dolibarr into 17.0_FIX_MultilangsTranslationPDFLinesDescription 2023-12-22 09:22:38 +01:00
atm-lena
4d32d93ee2 Clean Travis 2023-12-18 17:28:41 +01:00
atm-lena
abc9eb7bdc Clean Code 2023-12-18 13:44:19 +01:00
atm-lena
ec19dcc8f8 Invoice 2023-12-18 13:34:50 +01:00
atm-lena
9051e411d0 FIX Multilangs : PDF lines description 2023-12-18 12:00:41 +01:00
88 changed files with 1137 additions and 442 deletions

86
.github/scripts/get_changed_php.sh vendored Executable file
View 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

View File

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

View File

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

View File

@@ -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:
@@ -36,10 +36,10 @@ jobs:
include:
- stage: PHP 7.0-8.1
if: type = push
php: '7.0'
php: '7.1'
env:
- DB=postgresql
- TRAVIS_PHP_VERSION=7.0
- TRAVIS_PHP_VERSION=7.1
- stage: PHP 7.0-8.1
if: type = pull_request OR type = push
php: '8.1'
@@ -78,6 +78,9 @@ before_install:
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
sudo apt install unzip apache2 php7.0 php7.0-cli php7.0-curl php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imap php7.0-intl php7.0-ldap php7.0-xml php7.0-mbstring php7.0-xml php7.0-zip libapache2-mod-php7.0
fi
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
fi
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
fi
@@ -108,6 +111,9 @@ install:
- |
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
sudo update-alternatives --set php /usr/bin/php7.0
fi
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
sudo update-alternatives --set php /usr/bin/php7.1
fi
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
sudo update-alternatives --set php /usr/bin/php8.1
@@ -123,7 +129,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
- |
@@ -201,8 +208,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
@@ -253,8 +260,8 @@ before_script:
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
#echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
# Create pgsql compatibility functions
psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' < htdocs/install/pgsql/functions/functions.sql
@@ -472,11 +479,9 @@ script:
echo "Unit testing"
# Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
set -e
if [ "$TRAVIS_PHP_VERSION" != '7.0' ]; then
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
phpunitresult=$?
echo "Phpunit return code = $phpunitresult"
fi
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
phpunitresult=$?
echo "Phpunit return code = $phpunitresult"
set +e
after_script:

View File

@@ -4,7 +4,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 17.0.4 compared to 17.0.3 *****
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
FIX: $this->newref already exists and could have been modified by a trigger but we still use a local variable for the filesystem-based renaming
FIX: 16.0 only, backport fix for SQL error on global search product
FIX: 17.0: deprecated field should only be a fallback
FIX: 17.0 PHP8: supplier invoice class:

View File

@@ -133,7 +133,7 @@
<rule ref="Generic.Formatting.SpaceAfterCast" />
<rule ref="Generic.Functions.CallTimePassByReference" />
<!-- <rule ref="Generic.Functions.CallTimePassByReference" /> -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />

View File

@@ -86,7 +86,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();
@@ -98,11 +98,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

View File

@@ -676,7 +676,7 @@ if (count($filter) > 0) {
} elseif ($key == 't.reconciled_option') {
$sqlwhere[] = 't.lettering_code IS NULL';
} elseif ($key == 't.code_journal' && !empty($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1);
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}

View File

@@ -1053,7 +1053,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", join(',', $value), 4, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,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);
}

View File

@@ -104,7 +104,9 @@ if ($action == "set") {
if (!($res > 0)) {
$error++;
}
} elseif (!$error) {
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {

View File

@@ -237,6 +237,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;
}

View File

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

View File

@@ -1442,8 +1442,14 @@ if ($action == 'create') {
$preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
}
if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
// select "all" or "none" contact by default
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"');
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
print $form->selectcontacts(GETPOSTISSET('socid') ? GETPOSTINT('socid') : $select_contact_default, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
print '</td></tr>';
}
@@ -1946,7 +1952,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($object->socid, 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>';

View File

@@ -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) {
@@ -1263,9 +1263,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)";

View File

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

View File

@@ -65,7 +65,7 @@ if (isModEnabled('ficheinter')) {
}
// Load translation files required by the page
$langs->loadLangs(array('companies', 'banks'));
$langs->loadLangs(array('companies', 'banks', 'commercial'));
if (isModEnabled('contrat')) {
$langs->load("contracts");

View File

@@ -696,6 +696,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;
}

View File

@@ -191,7 +191,6 @@ class Propal extends CommonObject
public $fin_validite;
public $user_author_id;
public $user_valid_id;
public $user_close_id;
/**
@@ -1456,7 +1455,9 @@ class Propal extends CommonObject
// Clear fields
$object->user_author = $user->id;
$object->user_valid = 0;
$object->user_validation_id = 0;
$object->date = $now;
$object->datep = $now; // deprecated
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
@@ -1651,7 +1652,7 @@ class Propal extends CommonObject
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
$this->user_validation_id = $obj->fk_user_valid;
$this->user_close_id = $obj->fk_user_cloture;
//Incoterms
@@ -1753,7 +1754,7 @@ class Propal extends CommonObject
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
$sql .= " fk_user_valid = ".(!empty($this->user_validation_id) ? (int) $this->user_validation_id : "null").",";
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " deposit_percent=".(!empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").",";
@@ -2046,7 +2047,7 @@ class Propal extends CommonObject
$this->ref = $num;
$this->brouillon = 0;
$this->statut = self::STATUS_VALIDATED;
$this->user_valid_id = $user->id;
$this->user_validation_id = $user->id;
$this->datev = $now;
$this->db->commit();
@@ -3321,9 +3322,7 @@ class Propal extends CommonObject
$this->user_creation = $cuser;
if ($obj->fk_user_valid) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
$this->user_validation_id = $obj->fk_user_valid;
}
if ($obj->fk_user_signature) {

View File

@@ -2872,7 +2872,7 @@ if ($action == 'create' && $usercancreate) {
// Create a purchase order
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) {
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfProductsLines() > 0) {
if ($usercancreatepurchaseorder) {
print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id, '');
}

View File

@@ -652,6 +652,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;
}

View File

@@ -1174,7 +1174,7 @@ class Commande extends CommonOrder
}
}
} else {
dol_print_error($this->db);
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}

View File

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

View File

@@ -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');
}
}
@@ -1175,6 +1178,7 @@ if ($action == 'create') {
if ($object->id > 0) {
$object->fetch_thirdparty();
$formconfirm = '';
// Confirmation de la suppression d'une ligne produit
if ($action == 'ask_deleteline') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
@@ -1299,14 +1303,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 '&nbsp;';
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
}
print '</td></tr>';
@@ -1729,6 +1729,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>';

View File

@@ -1507,6 +1507,9 @@ if (empty($reshook)) {
}
foreach ($TTotalByTva as $tva => &$total) {
if (empty($amountdeposit[$tva])) {
$amountdeposit[$tva] = 0;
}
$coef = $total / $srcobject->total_ttc; // Calc coef
$am = $amount * $coef;
$amount_ttc_diff += $am;
@@ -1531,6 +1534,9 @@ if (empty($reshook)) {
if ($qualified) {
$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
$tva_tx = $lines[$i]->tva_tx;
if (empty($amountdeposit[$tva_tx])) {
$amountdeposit[$tva_tx] = 0;
}
$amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100;
}
}

View File

@@ -332,6 +332,7 @@ class Invoices extends DolibarrApi
* @return int
* @throws RestException 400
* @throws RestException 401
* @throws RestException 403 Access not allowed for login
* @throws RestException 404
* @throws RestException 405
*/
@@ -349,6 +350,9 @@ class Invoices extends DolibarrApi
if (empty($orderid)) {
throw new RestException(400, 'Order ID is mandatory');
}
if (!DolibarrApi::_checkAccessToResource('commande', $orderid)) {
throw new RestException(403, 'Access not allowed on order for login '.DolibarrApiAccess::$user->login);
}
$order = new Commande($this->db);
$result = $order->fetch($orderid);
@@ -627,6 +631,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;
}

View File

@@ -125,6 +125,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
@@ -1395,6 +1402,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);
}

View File

@@ -979,13 +979,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;
@@ -1238,7 +1238,7 @@ class Facture extends CommonInvoice
$object->socid = $objsoc->id;
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$object->fk_project = '';
$object->fk_project = null;
$object->fk_delivery_address = '';
}
@@ -1256,6 +1256,7 @@ class Facture extends CommonInvoice
$object->fk_user_author = $user->id;
$object->fk_user_valid = null;
$object->fk_facture_source = 0;
$object->fk_fac_rec_source = null;
$object->date_creation = '';
$object->date_modification = '';
$object->date_validation = '';
@@ -5496,220 +5497,223 @@ class Facture extends CommonInvoice
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!$error) {
// Load event
$res = $tmpinvoice->fetch($obj->id);
if ($res > 0) {
$tmpinvoice->fetch_thirdparty();
// Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop
$loopError = 0;
$outputlangs = new Translate('', $conf);
if ($tmpinvoice->thirdparty->default_lang) {
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "bills"));
} else {
$outputlangs = $langs;
}
// Load event
$res = $tmpinvoice->fetch($obj->id);
if ($res > 0) {
$tmpinvoice->fetch_thirdparty();
// Select email template
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
if (is_numeric($arraymessage) && $arraymessage <= 0) {
$langs->load("errors");
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
return 0;
}
$outputlangs = new Translate('', $conf);
if ($tmpinvoice->thirdparty->default_lang) {
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "bills"));
} else {
$outputlangs = $langs;
}
// PREPARE EMAIL
$errormesg = '';
// Select email template
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
if (is_numeric($arraymessage) && $arraymessage <= 0) {
$langs->load("errors");
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
return 0;
}
// Make substitution in email content
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
// PREPARE EMAIL
$errormesg = '';
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
// Make substitution in email content
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
// Topic
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
// Content
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
// Topic
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
// Content
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
// Recipient
$to = array();
if ($forcerecipient) { // If a recipient was forced
$to = array($forcerecipient);
} else {
$res = $tmpinvoice->fetch_thirdparty();
$recipient = $tmpinvoice->thirdparty;
if ($res > 0) {
$tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
foreach ($tmparraycontact as $data_email) {
if (!empty($data_email['email'])) {
$to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
}
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
// Recipient
$to = array();
if ($forcerecipient) { // If a recipient was forced
$to = array($forcerecipient);
} else {
$res = $tmpinvoice->fetch_thirdparty();
$recipient = $tmpinvoice->thirdparty;
if ($res > 0) {
$tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
foreach ($tmparraycontact as $data_email) {
if (!empty($data_email['email'])) {
$to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
}
}
if (empty($to) && !empty($recipient->email)) {
$to[] = $recipient->email;
}
if (empty($to)) {
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
$error++;
}
} else {
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
$error++;
}
if (empty($to) && !empty($recipient->email)) {
$to[] = $recipient->email;
}
if (empty($to)) {
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
$loopError++;
}
} else {
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
$loopError++;
}
// Sender
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority
$from = $arraymessage->email_from;
}
if (empty($from)) {
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
$error++;
}
if (!$error && !empty($to)) {
$this->db->begin();
$to = implode(',', $to);
if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it
$to = $to.','.$arraymessage->email_to;
}
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
$trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard';
$email_tocc = '';
if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it
$email_tocc = $arraymessage->email_tocc;
}
$email_tobcc = '';
if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it
$email_tobcc = $arraymessage->email_tobcc;
}
//join file is asked
$joinFile = [];
$joinFileName = [];
$joinFileMime = [];
if ($arraymessage->joinfiles == 1 && !empty($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);
}
// Mail Creation
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
// Sending Mail
if ($cMailFile->sendfile()) {
$nbMailSend++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
$actioncomm->note_private = $sendContent;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
$actioncomm->elementtype = 'invoice';
$actioncomm->fk_element = $tmpinvoice->id;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
} else {
$errormesg = $cMailFile->error.' : '.$to;
$error++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
$actioncomm->note_private = $errormesg;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
}
$this->db->commit(); // We always commit
}
if ($errormesg) {
$errorsMsg[] = $errormesg;
}
} else {
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
$error++;
}
// Sender
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority
$from = $arraymessage->email_from;
}
if (empty($from)) {
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
$loopError++;
}
if (!$loopError && !empty($to)) {
$this->db->begin();
$to = implode(',', $to);
if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it
$to = $to.','.$arraymessage->email_to;
}
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
$trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard';
$email_tocc = '';
if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it
$email_tocc = $arraymessage->email_tocc;
}
$email_tobcc = '';
if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it
$email_tobcc = $arraymessage->email_tobcc;
}
//join file is asked
$joinFile = [];
$joinFileName = [];
$joinFileMime = [];
if ($arraymessage->joinfiles == 1 && !empty($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);
}
// Mail Creation
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
// Sending Mail
if ($cMailFile->sendfile()) {
$nbMailSend++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
$actioncomm->note_private = $sendContent;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
$actioncomm->elementtype = 'invoice';
$actioncomm->fk_element = $tmpinvoice->id;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
} else {
$errormesg = $cMailFile->error.' : '.$to;
$loopError++;
// Add a line into event table
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
$actioncomm->contact_id = 0;
$actioncomm->code = 'AC_EMAIL';
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
$actioncomm->note_private = $errormesg;
$actioncomm->fk_project = $tmpinvoice->fk_project;
$actioncomm->datep = dol_now();
$actioncomm->datef = $actioncomm->datep;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields when action is an email (content should be added into note)
$actioncomm->email_msgid = $cMailFile->msgid;
$actioncomm->email_from = $from;
$actioncomm->email_sender = '';
$actioncomm->email_to = $to;
//$actioncomm->email_tocc = $sendtocc;
//$actioncomm->email_tobcc = $sendtobcc;
//$actioncomm->email_subject = $subject;
$actioncomm->errors_to = $errors_to;
//$actioncomm->extraparams = $extraparams;
$actioncomm->create($user);
}
$this->db->commit(); // We always commit
}
if ($errormesg) {
$errorsMsg[] = $errormesg;
}
} else {
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
$loopError++;
}
$error += $loopError;
}
} else {
$error++;
}
if (!$error) {
$this->output .= 'Nb of emails sent : '.$nbMailSend;
return 0;
} else {
if ($error > 0) { // If there is at least an error, early return with specific message
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
return $error;
}
$this->output .= 'Nb of emails sent : '.$nbMailSend;
return 0;
}
/**

View File

@@ -597,7 +597,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;
@@ -1815,7 +1815,7 @@ if ($action == 'create') {
$moreparam = 'style="display: none;"';
}
print '<tr class="oddeven" '.$moreparam.'>';
print '<td class="tdhrthin" colspan="'.($conf->margin->enabled ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
print '<td class="tdhrthin" colspan="'.(isModEnabled('margin') ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
print "</tr>\n";
}
@@ -1828,7 +1828,7 @@ if ($action == 'create') {
/*
* Confirmation to delete service line of contract
*/
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("DeleteContractLine"), $langs->trans("ConfirmDeleteContractLine"), "confirm_deleteline", '', 0, 1);
if ($ret == 'html') {
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
@@ -1838,7 +1838,7 @@ if ($action == 'create') {
/*
* Confirmation to move service toward another contract
*/
if ($action == 'move' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
if ($action == 'move' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
$arraycontractid = array();
foreach ($arrayothercontracts as $contractcursor) {
$arraycontractid[$contractcursor->id] = $contractcursor->ref;
@@ -1942,7 +1942,9 @@ if ($action == 'create') {
if ($objp->fk_product > 0) {
$product = new Product($db);
$product->fetch($objp->fk_product);
$dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
if (!empty($product->duration_value) && !empty($product->duration_unit)) {
$dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
}
}
}
@@ -2035,7 +2037,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";
@@ -2098,7 +2100,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);
@@ -2107,7 +2109,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");
@@ -2115,7 +2117,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");
@@ -2175,7 +2177,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);
}
@@ -2195,8 +2197,8 @@ if ($action == 'create') {
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->contrat->lire;
$delallowed = $user->rights->contrat->creer;
$genallowed = $user->hasRight('contrat', 'lire');
$delallowed = $user->hasRight('contrat', 'creer');
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);

View File

@@ -510,6 +510,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;
}

View File

@@ -3079,7 +3079,7 @@ class ContratLigne extends CommonObjectLine
*
* @param int $id Id object
* @param string $ref Ref of contract line
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK, 0 if not found
*/
public function fetch($id, $ref = '')
{
@@ -3097,7 +3097,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,";
@@ -3200,6 +3200,9 @@ class ContratLigne extends CommonObjectLine
$this->rang = $obj->rang;
$this->fetch_optionals();
} else {
$this->db->free($resql);
return 0;
}
$this->db->free($resql);

View File

@@ -281,7 +281,7 @@ if ($filter == "notexpired") {
$sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
}
if ($search_name) {
$sql .= natural_search("c.ref", $search_name);
$sql .= natural_search("s.nom", $search_name);
}
if ($search_contract) {
$sql .= natural_search("c.ref", $search_contract);
@@ -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;
@@ -437,6 +442,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(

View File

@@ -476,6 +476,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='.urlencode($thirdparty->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" 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)) {

View File

@@ -583,7 +583,6 @@ abstract class CommonObject
*/
public $fk_user_modif;
public $next_prev_filter;
/**
@@ -605,6 +604,10 @@ abstract class CommonObject
protected $labelStatus;
protected $labelStatusShort;
/**
* @var string output
*/
public $output;
/**
* @var array List of child tables. To test if we can delete object.
@@ -2192,7 +2195,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);
@@ -2229,7 +2234,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 {
@@ -2262,7 +2266,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);
@@ -2299,7 +2305,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 {
@@ -4085,8 +4090,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);
@@ -8446,7 +8455,7 @@ abstract class CommonObject
$("#"+child_list).hide();
//Show mother lists
} else if ($("#"+parent_list).val() != 0){
$("#"+parent_list).show();
showOptions'.$type.'(child_list, parent_list, orig_select[child_list]);
}
//Show the child list if the parent list value is selected
$("select[name=\""+parent_list+"\"]").click(function() {

View File

@@ -7821,6 +7821,8 @@ class Form
if ($tmpfieldstoshow) {
$fieldstoshow = $tmpfieldstoshow;
}
} else if ($objecttmp->element === 'category') {
$fieldstoshow = 't.label';
} else {
// For backward compatibility
$objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1);

View File

@@ -864,12 +864,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') {
@@ -883,14 +883,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__'] = '';

View File

@@ -669,6 +669,12 @@ class Notify
'notification'
);
if (! empty($mailfile->error) || ! empty($mailfile->errors)) {
$this->error = $mailfile->error;
$this->errors = $mailfile->errors;
return -1;
}
if ($mailfile->sendfile()) {
if ($obj->type_target == 'touserid') {
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
@@ -933,6 +939,12 @@ class Notify
'notification'
);
if (! empty($mailfile->error) || ! empty($mailfile->errors)) {
$this->error = $mailfile->error;
$this->errors = $mailfile->errors;
return -1;
}
if ($mailfile->sendfile()) {
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";

View File

@@ -155,12 +155,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);
}
/**

View File

@@ -718,7 +718,7 @@ class DoliDBPgsql extends DoliDB
*/
public function escape($stringtoencode)
{
return pg_escape_string($stringtoencode);
return pg_escape_string($this->db, $stringtoencode);
}
/**

View File

@@ -1292,6 +1292,40 @@ $(document).ready(function() {
});
// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php)
function showOptions(child_list, parent_list) {
var parentInput = $("select[name="+parent_list+"]");
if (parentInput.length === 0) { // when parent extra-field is in view mode and the child is edited directly on card (on line edit)
parentInput = $("input[name="+parent_list+"]");
}
if (parentInput.length > 0) {
var val = parentInput.val();
var parentVal = parent_list + ":" + val;
if (val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").prop("disabled", true).hide(); // hide not work with select2 element so disabled it
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").prop('disabled', false).show(); // show not work with select2 element so enabled it
} else {
$("select[name=\""+child_list+"\"] option").prop("disabled", false).show(); // show not work with select2 element so enabled it
}
}
}
function setListDependencies() {
console.log("setListDependencies");
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
showOptions(child_list, parent_list);
/* Activate the handler to call showOptions on each future change */
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
}
/*
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
* see: https://github.com/select2/select2/issues/5993
@@ -1315,4 +1349,5 @@ $(document).on('select2:open', (e) => {
}
?>
// End of lib_head.js.php

View File

@@ -1030,16 +1030,35 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0,
return 'ErrorBadParameter_num_open_day';
}
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
if ($timestampStart < $timestampEnd) {
$numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
// --- 1. Calculate Gross Working Days ---
// Gross working days = total days in range - non-working days (weekends & public holidays).
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
$nbOpenDay = ($numdays - $numholidays);
if ($inhour == 1 && $nbOpenDay <= 3) {
$nbOpenDay = ($nbOpenDay * 24);
// --- 2. Apply Contextual Half-Day Deductions ---
$halfday = (int) $halfday; // Ensure $halfday is an integer for reliable comparisons.
// Check if start/end days are working days just ONCE to optimize performance
// by avoiding redundant calls to the potentially slow num_public_holiday() function.
$isStartDayWorking = (num_public_holiday($timestampStart, $timestampStart, $country_code, 1) == 0);
$isEndDayWorking = (num_public_holiday($timestampEnd, $timestampEnd, $country_code, 1) == 0);
// Deduct 0.5 if the leave starts in the afternoon of a working day.
if (($halfday == -1 || $halfday == 2) && $isStartDayWorking) {
$nbOpenDay -= 0.5;
}
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
// Deduct 0.5 if the leave ends in the morning of a different, working day.
if (($halfday == 1 || $halfday == 2) && date('Y-m-d', $timestampStart) != date('Y-m-d', $timestampEnd) && $isEndDayWorking) {
$nbOpenDay -= 0.5;
}
// --- 3. Return Final Value ---
if ($inhour == 1) {
return $nbOpenDay * 24;
}
return $nbOpenDay;
} elseif ($timestampStart == $timestampEnd) {
$numholidays = 0;
if ($lastday) {

View File

@@ -1658,8 +1658,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
if (!empty($message)) {
// Test log level
$logLevels = array(LOG_EMERG=>'EMERG', LOG_ALERT=>'ALERT', LOG_CRIT=>'CRITICAL', LOG_ERR=>'ERR', LOG_WARNING=>'WARN', LOG_NOTICE=>'NOTICE', LOG_INFO=>'INFO', LOG_DEBUG=>'DEBUG');
if (!array_key_exists($level, $logLevels)) {
throw new Exception('Incorrect log level');
dol_syslog('Error Bad Log Level '.$level, LOG_ERR);
$level = $logLevels[LOG_ERR];
}
if ($level > $conf->global->SYSLOG_LEVEL) {
return;
@@ -8874,10 +8876,11 @@ function dol_osencode($str)
* @param string $fieldid Field to get
* @param int $entityfilter Filter by entity
* @param string $filters Filters to add. WARNING: string must be escaped for SQL and not coming from user input.
* @param bool $useCache If true (default), cache will be queried and updated.
* @return int <0 if KO, Id of code if OK
* @see $langs->getLabelFromKey
*/
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '')
function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '', $useCache = true)
{
global $cache_codes;
@@ -8887,8 +8890,8 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
}
// Check in cache
if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
return $cache_codes[$tablename][$key][$fieldid]; // Found in cache
if ($useCache && isset($cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key])) { // Can be defined to 0 or ''
return $cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key]; // Found in cache
}
dol_syslog('dol_getIdFromCode (value for field '.$fieldid.' from key '.$key.' not found into cache)', LOG_DEBUG);
@@ -8906,13 +8909,15 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$valuetoget = '';
if ($obj) {
$cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget;
} else {
$cache_codes[$tablename][$key][$fieldid] = '';
$valuetoget = $obj->valuetoget;
}
$db->free($resql);
return $cache_codes[$tablename][$key][$fieldid];
if ($useCache) {
$cache_codes[$tablename][$fieldkey][$fieldid][$entityfilter][$filters][$key] = $valuetoget;
}
return $valuetoget;
} else {
return -1;
}
@@ -9814,7 +9819,12 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$value = preg_replace('/\s*\|\s*/', '|', $value);
$crits = explode(' ', $value);
//natural mode search type 3 allow spaces into search ...
if ($mode == 3 || $mode == -3) {
$crits = explode(',', $value);
} else {
$crits = explode(' ', $value);
}
$res = '';
if (!is_array($fields)) {
$fields = array($fields);
@@ -9875,7 +9885,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$listofcodes .= "'".$db->escape($val)."'";
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1, 0, 1).")";
$i2++; // a criteria for 1 more field was added to string
}
if ($mode == -3) {
@@ -10837,21 +10847,21 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* @param int|boolean $userRight User action right
* // phpcs:disable
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
* 'attr' => [ // to add or override button attributes
* 'xxxxx' => '', // your xxxxx attribute you want
* 'class' => 'reposition', // to add more css class to the button class attribute
* 'classOverride' => '' // to replace class attribute of the button
* ],
* 'confirm' => [
* 'url' => 'http://', // Overide Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
* 'title' => '', // Overide title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
* 'action-btn-label' => '', // Overide label of action button, if empty default label use "Confirm" lang key
* 'cancel-btn-label' => '', // Overide label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Overide text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
* 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background)
* ],
* ]
* 'attr' => [ // to add or override button attributes
* 'xxxxx' => '', // your xxxxx attribute you want
* 'class' => 'reposition', // to add more css class to the button class attribute
* 'classOverride' => '' // to replace class attribute of the button
* ],
* 'confirm' => [
* 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm.
* 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key
* 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key
* 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key
* 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key
* 'modal' => true, // true|false to display dialog as a modal (with dark background)
* 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background)
* ],
* ]
* // phpcs:enable
* @return string html button
*/

View File

@@ -1410,12 +1410,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
{
global $db, $conf, $langs;
$idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
$label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : ''));
$desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : ''));
$ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
$note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
$dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
$multilangsactive = getDolGlobalInt('MAIN_MULTILANGS');
if ($issupplierline) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
@@ -1429,10 +1424,54 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
}
//id
$idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false);
if ($idprod) {
$prodser->fetch($idprod);
//load multilangs
if ($multilangsactive) {
$prodser->getMultiLangs();
$object->lines[$i]->multilangs = $prodser->multilangs;
}
}
//label
if (!empty($object->lines[$i]->label)) {
$label = $object->lines[$i]->label;
} else {
if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['label']) && $multilangsactive) {
$label = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['label'];
} else {
if (!empty($object->lines[$i]->product_label)) {
$label = $object->lines[$i]->product_label;
} else {
$label = '';
}
}
}
//description
if (!empty($object->lines[$i]->desc)) {
$desc = $object->lines[$i]->desc;
} else {
if (!empty($object->lines[$i]->multilangs[$outputlangs->defaultlang]['description']) && $multilangsactive) {
$desc = $object->lines[$i]->multilangs[$outputlangs->defaultlang]['description'];
} else {
if (!empty($object->lines[$i]->description)) {
$desc = $object->lines[$i]->description;
} else {
$desc = '';
}
}
}
//ref supplier
$ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders
//note
$note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : '');
//dbatch
$dbatch = (!empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false);
if ($idprod) {
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (getDolGlobalInt('MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
if ($multilangsactive && ($outputlangs->defaultlang != $langs->defaultlang)) {
$translatealsoifmodified = (!empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation

View File

@@ -401,6 +401,10 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$tableandshare = 'paiementcharge';
$parentfortableentity = 'fk_charge@chargesociales';
}
if ($features == 'evaluation') {
$features = 'hrm';
$feature2 = 'evaluation';
}
// Get more permissions checks from hooks
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
@@ -834,7 +838,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); // Test for task object
$checkhierarchy = array('expensereport', 'holiday'); // check permission among the hierarchy of user
$checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
$nocheck = array('barcode', 'stock'); // No test
@@ -1055,6 +1059,20 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
}
}
}
if ($feature == 'hrm' && in_array('evaluation', $feature2)) {
$useridtocheck = $object->fk_user;
if ($user->hasRight('hrm', 'evaluation', 'readall')) {
// the user can view evaluations for anyone
return true;
}
if (!$user->hasRight('hrm', 'evaluation', 'read')) {
// the user can't view any evaluations
return false;
}
// the user can only their own evaluations or their subordinates'
return in_array($useridtocheck, $childids);
}
}
// For some object, we also have to check it is public or owned by user

View File

@@ -176,7 +176,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
}
// Supplier invoices take invoice date instead of creation date for the mask
$numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date);
$numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, is_object($object) ?$object->date :'');
return $numFinal;
}

View File

@@ -47,7 +47,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) {
$morecss = 'maxwidth200';
}
echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
echo $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
}
print '</td>';
}

View File

@@ -31,8 +31,24 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr
$param .= '&'.$search_options_pattern.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
$val = '';
}
if ($val != '') {
$param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
if ($val !== '') {
if (is_array($val)) {
foreach ($val as $val2) {
$param .= '&'.$search_options_pattern.$tmpkey.'[]='.urlencode($val2);
}
} else {
// test if we have checkbox type, we add the _multiselect needed into param
$tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('checkbox', 'chkbxlst'))) {
$param .= '&'.$search_options_pattern.$tmpkey.'_multiselect='.urlencode($val);
}
// test if we have boolean type, we add the _booleand needed into param
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('boolean'))) {
$param .= '&'.$search_options_pattern.$tmpkey.'_boolean='.urlencode($val);
}
$param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
}
}
}
}

View File

@@ -253,6 +253,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
} else {
//var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element);
print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element);
print '<input type="hidden" value="' . $value . '" name="options_' . $tmpkeyextra . '" id="options_' . $tmpkeyextra . '"/>'; // it's needed when to get parent value when extra-field list depend on parent extra-field list
}
print '</td>';
@@ -267,31 +268,6 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
print '
<script>
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
var val = $("select[name="+parent_list+"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
} else {
$("select[name=\""+child_list+"\"] option").show();
}
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
showOptions(child_list, parent_list);
/* Activate the handler to call showOptions on each future change */
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
}
setListDependencies();
});
</script>'."\n";

View File

@@ -77,9 +77,13 @@ class InterfaceNotification extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
$notify = new Notify($this->db);
$notify->send($action, $object);
$result = $notify->send($action, $object);
return 1;
if ($result < 0) {
$this->errors = array_merge($this->errors, empty($notify->error) ? array() : array($notify->error), empty($notify->errors) ? array() : $notify->errors);
}
return $result;
}

View File

@@ -379,9 +379,11 @@ class InterfaceTicketEmail extends DolibarrTriggers
$message = dol_nl2br($message);
}
$message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
}
$from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';

View File

@@ -231,6 +231,12 @@ class Donations extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->don->array_options[$index] = $this->_checkValForAPI($field, $val, $this->don);
}
continue;
}
$this->don->$field = $value;
}

View File

@@ -86,6 +86,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->eventorganization->multidir_output[$object->entity ? $object->entity : $conf->entity]."/conferenceorbooth/".get_exdir(0, 0, 0, 1, $object);
}
@@ -96,7 +97,6 @@ $permissiontoadd = $user->rights->eventorganization->write; // Used by the inclu
$permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check
if ($user->socid > 0) {

View File

@@ -447,6 +447,12 @@ class Shipments extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment);
}
continue;
}
$this->shipment->$field = $value;
}

View File

@@ -420,6 +420,12 @@ class ExpenseReports extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->expensereport->array_options[$index] = $this->_checkValForAPI($field, $val, $this->expensereport);
}
continue;
}
$this->expensereport->$field = $value;
}

View File

@@ -263,6 +263,12 @@ class SupplierInvoices 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;
}

View File

@@ -277,6 +277,12 @@ class SupplierOrders extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->order->array_options[$index] = $this->_checkValForAPI($field, $val, $this->order);
}
continue;
}
$this->order->$field = $value;
}

View File

@@ -1372,6 +1372,8 @@ class CommandeFournisseur extends CommonOrder
// We set order into draft status
$this->brouillon = 1;
$this->statut = self::STATUS_DRAFT; // deprecated
$this->status = self::STATUS_DRAFT;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
$sql .= "ref";
@@ -2209,6 +2211,16 @@ class CommandeFournisseur extends CommonOrder
$error++;
}
if (!$error) {
$sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")";
dol_syslog(__METHOD__." linked order lines", LOG_DEBUG);
if (!$this->db->query($sql1)) {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
}
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql)) {
@@ -2945,7 +2957,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= $this->db->order("rowid", "ASC");
$sql .= $this->db->plimit(1);
$resql = $this->db->query($sql);
if ($resql) {
if ($resql && $this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$prodid = $obj->rowid;
}
@@ -3989,7 +4001,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
return -1;
}
$sql1 = 'UPDATE '.MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE rowid=".((int) $this->id);
$sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id);
$resql = $this->db->query($sql1);
if (!$resql) {
$this->db->rollback();

View File

@@ -96,8 +96,9 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (!isModEnabled('hrm')) {
accessforbidden();
}

View File

@@ -92,8 +92,8 @@ $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->enti
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
$isdraft = ($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0;
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (!isModEnabled("hrm")) {
accessforbidden();
}

View File

@@ -62,10 +62,8 @@ $permission = $user->rights->hrm->evaluation->write;
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->hrm->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);

View File

@@ -85,10 +85,10 @@ $permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the includ
$permissiontoread = $user->rights->hrm->evaluation->read;
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->hrm->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();

View File

@@ -66,10 +66,10 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the includ
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->hrm->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
$isdraft = (($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->hrm->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*

View File

@@ -23,13 +23,13 @@ class TraceablePDO extends PDO
$this->pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, [TraceablePDOStatement::class, [$this]]);
}
/**
* Initiates a transaction
*
* @link http://php.net/manual/en/pdo.begintransaction.php
* @return bool TRUE on success or FALSE on failure.
*/
public function beginTransaction()
/**
* Initiates a transaction
*
* @link http://php.net/manual/en/pdo.begintransaction.php
* @return bool TRUE on success or FALSE on failure.
*/
public function beginTransaction() : bool
{
return $this->pdo->beginTransaction();
}
@@ -40,7 +40,7 @@ class TraceablePDO extends PDO
* @link http://php.net/manual/en/pdo.commit.php
* @return bool TRUE on success or FALSE on failure.
*/
public function commit()
public function commit() : bool
{
return $this->pdo->commit();
}
@@ -51,6 +51,7 @@ class TraceablePDO extends PDO
* @link http://php.net/manual/en/pdo.errorinfo.php
* @return array PDO::errorInfo returns an array of error information
*/
#[\ReturnTypeWillChange]
public function errorCode()
{
return $this->pdo->errorCode();
@@ -62,7 +63,7 @@ class TraceablePDO extends PDO
* @link http://php.net/manual/en/pdo.errorinfo.php
* @return array PDO::errorInfo returns an array of error information
*/
public function errorInfo()
public function errorInfo() : array
{
return $this->pdo->errorInfo();
}
@@ -77,6 +78,7 @@ class TraceablePDO extends PDO
* return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE.
* Please read the section on Booleans for more information
*/
#[\ReturnTypeWillChange]
public function exec($statement)
{
return $this->profileCall('exec', $statement, func_get_args());
@@ -90,6 +92,7 @@ class TraceablePDO extends PDO
* @return mixed A successful call returns the value of the requested PDO attribute.
* An unsuccessful call returns null.
*/
#[\ReturnTypeWillChange]
public function getAttribute($attribute)
{
return $this->pdo->getAttribute($attribute);
@@ -101,7 +104,7 @@ class TraceablePDO extends PDO
* @link http://php.net/manual/en/pdo.intransaction.php
* @return bool TRUE if a transaction is currently active, and FALSE if not.
*/
public function inTransaction()
public function inTransaction() : bool
{
return $this->pdo->inTransaction();
}
@@ -114,36 +117,41 @@ class TraceablePDO extends PDO
* @return string If a sequence name was not specified for the name parameter, PDO::lastInsertId
* returns a string representing the row ID of the last row that was inserted into the database.
*/
#[\ReturnTypeWillChange]
public function lastInsertId($name = null)
{
return $this->pdo->lastInsertId($name);
}
/**
* Prepares a statement for execution and returns a statement object
*
* @link http://php.net/manual/en/pdo.prepare.php
* @param string $statement This must be a valid SQL statement template for the target DB server.
* @param array $driver_options [optional] This array holds one or more key=&gt;value pairs to
* set attribute values for the PDOStatement object that this method returns.
* @return TraceablePDOStatement|bool If the database server successfully prepares the statement,
* PDO::prepare returns a PDOStatement object. If the database server cannot successfully prepare
* the statement, PDO::prepare returns FALSE or emits PDOException (depending on error handling).
*/
/**
* Prepares a statement for execution and returns a statement object
*
* @link http://php.net/manual/en/pdo.prepare.php
* @param string $statement This must be a valid SQL statement template for the target DB server.
* @param array $driver_options [optional] This array holds one or more key=&gt;value pairs to
* set attribute values for the PDOStatement object that this method returns.
* @return TraceablePDOStatement|bool If the database server successfully prepares the statement,
* PDO::prepare returns a PDOStatement object. If the database server cannot successfully prepare
* the statement, PDO::prepare returns FALSE or emits PDOException (depending on error handling).
*/
#[\ReturnTypeWillChange]
public function prepare($statement, $driver_options = [])
{
return $this->pdo->prepare($statement, $driver_options);
}
/**
* Executes an SQL statement, returning a result set as a PDOStatement object
*
* @link http://php.net/manual/en/pdo.query.php
* @param string $statement
* @return TraceablePDOStatement|bool PDO::query returns a PDOStatement object, or FALSE on
* failure.
*/
public function query($statement)
/**
* Executes an SQL statement, returning a result set as a PDOStatement object
*
* @link http://php.net/manual/en/pdo.query.php
* @param string $statement
* @param int $fetchMode
* @param mixed ...$fetchModeArgs
* @return TraceablePDOStatement|bool PDO::query returns a PDOStatement object, or FALSE on
* failure.
*/
#[\ReturnTypeWillChange]
public function query($statement, $fetchMode = null, ...$fetchModeArgs)
{
return $this->profileCall('query', $statement, func_get_args());
}
@@ -158,6 +166,7 @@ class TraceablePDO extends PDO
* @return string|bool A quoted string that is theoretically safe to pass into an SQL statement.
* Returns FALSE if the driver does not support quoting in this way.
*/
#[\ReturnTypeWillChange]
public function quote($string, $parameter_type = PDO::PARAM_STR)
{
return $this->pdo->quote($string, $parameter_type);
@@ -169,7 +178,7 @@ class TraceablePDO extends PDO
* @link http://php.net/manual/en/pdo.rollback.php
* @return bool TRUE on success or FALSE on failure.
*/
public function rollBack()
public function rollBack() : bool
{
return $this->pdo->rollBack();
}
@@ -182,7 +191,7 @@ class TraceablePDO extends PDO
* @param mixed $value
* @return bool TRUE on success or FALSE on failure.
*/
public function setAttribute($attribute, $value)
public function setAttribute($attribute, $value) : bool
{
return $this->pdo->setAttribute($attribute, $value);
}
@@ -195,6 +204,7 @@ class TraceablePDO extends PDO
* @param array $args
* @return mixed The result of the call
*/
#[\ReturnTypeWillChange]
protected function profileCall($method, $sql, array $args)
{
$trace = new TracedStatement($sql);
@@ -226,7 +236,7 @@ class TraceablePDO extends PDO
*
* @param TracedStatement $stmt
*/
public function addExecutedStatement(TracedStatement $stmt)
public function addExecutedStatement(TracedStatement $stmt) : void
{
$this->executedStatements[] = $stmt;
}
@@ -234,9 +244,9 @@ class TraceablePDO extends PDO
/**
* Returns the accumulated execution time of statements
*
* @return int
* @return float
*/
public function getAccumulatedStatementsDuration()
public function getAccumulatedStatementsDuration() : float
{
return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getDuration(); });
}
@@ -246,7 +256,7 @@ class TraceablePDO extends PDO
*
* @return int
*/
public function getMemoryUsage()
public function getMemoryUsage() : int
{
return array_reduce($this->executedStatements, function ($v, $s) { return $v + $s->getMemoryUsage(); });
}
@@ -256,7 +266,7 @@ class TraceablePDO extends PDO
*
* @return int
*/
public function getPeakMemoryUsage()
public function getPeakMemoryUsage() : int
{
return array_reduce($this->executedStatements, function ($v, $s) { $m = $s->getEndMemory(); return $m > $v ? $m : $v; });
}
@@ -266,7 +276,7 @@ class TraceablePDO extends PDO
*
* @return TracedStatement[]
*/
public function getExecutedStatements()
public function getExecutedStatements() : array
{
return $this->executedStatements;
}
@@ -276,7 +286,7 @@ class TraceablePDO extends PDO
*
* @return TracedStatement[]
*/
public function getFailedExecutedStatements()
public function getFailedExecutedStatements() : array
{
return array_filter($this->executedStatements, function ($s) { return !$s->isSuccess(); });
}

View File

@@ -114,13 +114,13 @@ class Segment implements IteratorAggregate, Countable
// Remove the IF tag
$this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml);
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$this->xml = preg_replace($reg, '', $this->xml);
}
// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
else {
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER);
foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml);

View File

@@ -550,8 +550,8 @@ IMG;
private function _parse($type = 'content')
{
// Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
$matches = array();
$reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
$matches = array();
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
//var_dump($this->vars);exit;
@@ -572,7 +572,7 @@ IMG;
// Remove the IF tag
$this->contentXml = str_replace('[!-- IF '.$key.' --]', '', $this->contentXml);
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$this->contentXml = preg_replace($reg, '', $this->contentXml);
/*if ($sav != $this->contentXml)
{
@@ -585,7 +585,7 @@ IMG;
//dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF ");
//$sav=$this->contentXml;
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
$reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
if (!empty($match[3])) $this->contentXml = str_replace($match[0], $match[3], $this->contentXml);

View File

@@ -332,6 +332,8 @@ ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country;
ALTER TABLE llx_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255);
@@ -598,3 +600,172 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64);
-- ALL tms thanks to regis (commit 111f73bd863c7120a9c13a8fc9ae227a02079cb0)
ALTER TABLE llx_accounting_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_accounting_bookkeeping_tmp CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_accounting_fiscalyear CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_actioncomm_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_actioncomm CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_adherent_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_adherent CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_adherent_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_adherent_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_advtargetemailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_asset_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_asset CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_asset_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_asset_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bank_account_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bank_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bank CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_blockedlog_authority CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_blockedlog CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bom_bom_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bom_bomline_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bom_bom CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_boxes_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_budget_lines CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_budget CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_categories_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_categorie CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_c_email_senderprofile CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_c_email_templates CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_c_field_list CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_chargesociales CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commandedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseurdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseur_dispatch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseur_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseur_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_commande CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_comment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_const CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_contratdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_contratdet_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_contratdet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_contrat_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_contrat CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_cronjob CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_c_shipment_mode CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_deplacement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_don_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_don CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_element_resources CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_emailcollector_emailcollectoraction CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_emailcollector_emailcollectorfilter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_emailcollector_emailcollector CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_entrepot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_establishment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_events CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expeditiondet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expedition_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expedition CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expensereport_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expensereport_ik CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expensereport_rules CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facturedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facturedet_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_fourn_det_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_fourn_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_fourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture_rec CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_facture CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_fichinterdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_fichinter_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_fichinter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_holiday_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_holiday CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_loan_schedule CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_localtax CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mailing_cibles CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mailing_unsubscribe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_menu CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mrp_mo_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mrp_mo CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_mrp_production CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_notify_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_notify CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_online_signatures CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_opensurvey_comments CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_opensurvey_user_studs CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_paiementcharge CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_paiementfourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_paiement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_donation CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_salary_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_salary CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_payment_various CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_pos_cash_fence CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_printing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_batch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_customer_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_fournisseur_price_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_fournisseur_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_lot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_lot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_price_by_qty CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_stock_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_product_stock CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet_task_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet_task CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_propaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_propal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_propal_merge_pdf_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_propal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_reception_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_reception CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_resource_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_resource CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_address CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_contacts CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_prices CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_remise CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_remise_supplier CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_societe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_socpeople_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_socpeople CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_stock_mouvement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_subscription CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_supplier_proposaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_supplier_proposal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_supplier_proposal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_ticket_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_ticket CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_tva CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_user_employment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_user_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_usergroup_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_usergroup CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_user_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_user CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_website_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_website_page CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_website CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_zapier_hook CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;

View File

@@ -298,6 +298,12 @@ class KnowledgeManagement extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->knowledgerecord->array_options[$index] = $this->_checkValForAPI($field, $val, $this->knowledgerecord);
}
continue;
}
$this->knowledgerecord->$field = $this->_checkValForAPI($field, $value, $this->knowledgerecord);
}

View File

@@ -404,6 +404,7 @@ InvoiceAutoValidate=Validate invoices automatically
GeneratedFromRecurringInvoice=Generated from template recurring invoice %s
DateIsNotEnough=Date not reached yet
InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s
InvoiceGeneratedFromTemplateError=Error Invoice %s generated from recurring template invoice %s : %s
GeneratedFromTemplate=Generated from template invoice %s
WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date
WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date

View File

@@ -255,6 +255,12 @@ class MyModuleApi extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->myobject->array_options[$index] = $this->_checkValForAPI($field, $val, $this->myobject);
}
continue;
}
$this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject);
}

View File

@@ -185,13 +185,13 @@ class modMyModule extends DolibarrModules
// 'group' to add a tab in group view
// 'intervention' to add a tab in intervention view
// 'invoice' to add a tab in customer invoice view
// 'invoice_supplier' to add a tab in supplier invoice view
// 'supplier_invoice' to add a tab in supplier invoice view
// 'member' to add a tab in fundation member view
// 'opensurveypoll' to add a tab in opensurvey poll view
// 'order' to add a tab in sale order view
// 'order_supplier' to add a tab in supplier order view
// 'supplier_order' to add a tab in supplier order view
// 'payment' to add a tab in payment view
// 'payment_supplier' to add a tab in supplier payment view
// 'supplier_payment' to add a tab in supplier payment view
// 'product' to add a tab in product view
// 'propal' to add a tab in propal view
// 'project' to add a tab in project view

View File

@@ -238,6 +238,12 @@ class Mos extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->mo->array_options[$index] = $this->_checkValForAPI($field, $val, $this->mo);
}
continue;
}
$this->mo->$field = $value;
}

View File

@@ -255,6 +255,12 @@ class PartnershipApi extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->partnership->array_options[$index] = $this->_checkValForAPI($field, $val, $this->partnership);
}
continue;
}
$this->partnership->$field = $this->_checkValForAPI($field, $value, $this->partnership);
}

View File

@@ -361,6 +361,12 @@ class Products extends DolibarrApi
if ($field == 'stock_reel') {
throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead');
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->product->array_options[$index] = $this->_checkValForAPI($field, $val, $this->product);
}
continue;
}
$this->product->$field = $value;
}

View File

@@ -206,6 +206,12 @@ class Warehouses extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->warehouse->array_options[$index] = $this->_checkValForAPI($field, $val, $this->warehouse);
}
continue;
}
$this->warehouse->$field = $value;
}

View File

@@ -307,7 +307,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
}
}
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
if (!$updateoftaskdone && GETPOSTISSET($taskid.'progress')) { // Check to update progress if no update were done on task.
$object->fetch($taskid);
//var_dump($object->progress);
//var_dump(GETPOST($taskid . 'progress', 'int')); exit;

View File

@@ -462,6 +462,12 @@ class Projects extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->project->array_options[$index] = $this->_checkValForAPI($field, $val, $this->project);
}
continue;
}
$this->project->$field = $value;
}

View File

@@ -460,6 +460,12 @@ class Tasks extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->task->array_options[$index] = $this->_checkValForAPI($field, $val, $this->task);
}
continue;
}
$this->task->$field = $value;
}

View File

@@ -447,6 +447,12 @@ class Receptions extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->reception->array_options[$index] = $this->_checkValForAPI($field, $val, $this->reception);
}
continue;
}
$this->reception->$field = $value;
}

View File

@@ -330,6 +330,12 @@ class Contacts extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->contact->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contact);
}
continue;
}
$this->contact->$field = $value;
}

View File

@@ -301,6 +301,12 @@ class Thirdparties extends DolibarrApi
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->company->array_options[$index] = $this->_checkValForAPI($field, $val, $this->company);
}
continue;
}
$this->company->$field = $value;
}

View File

@@ -381,6 +381,15 @@ class Tickets extends DolibarrApi
}
foreach ($request_data as $field => $value) {
if ($field == 'id') {
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->ticket->array_options[$index] = $this->_checkValForAPI($field, $val, $this->ticket);
}
continue;
}
$this->ticket->$field = $value;
}

View File

@@ -406,6 +406,12 @@ class Users extends DolibarrApi
throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error);
}
} else {
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->useraccount->array_options[$index] = $this->_checkValForAPI($field, $val, $this->useraccount);
}
continue;
}
$this->useraccount->$field = $value;
}
}

View File

@@ -718,6 +718,7 @@ class User extends CommonObject
'mo' => 'mrp',
'order' => 'commande',
'produit' => 'product',
'productlot' => 'produit',
'project' => 'projet',
'propale' => 'propal',
'shipping' => 'expedition',

View File

@@ -226,7 +226,7 @@ if (is_array($object->lines) && (count($object->lines) > 0)) {
exit(-1);
}
}
$user->getrights();
$user->getrights('', 1); // We force rights reload to have the correct permissions for user in the entity we just switched in
}
// Reload langs

View File

@@ -303,6 +303,42 @@ class DateLibTest extends PHPUnit\Framework\TestCase
$result=num_open_day($date1, $date2, 'XX', 1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(3, $result, 'NumOpenDay for XX when saturday + sunday are working days'); // 3 opened day, 0 closes (even if country unknown)
// Define specific dates for these tests
$date_friday_4 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // Friday
$date_saturday_5 = dol_mktime(0, 0, 0, 1, 5, 2013, 'gmt'); // Saturday
$date_monday_7 = dol_mktime(0, 0, 0, 1, 7, 2013, 'gmt'); // Monday
$date_friday_11 = dol_mktime(0, 0, 0, 1, 11, 2013, 'gmt'); // Following Friday
// Case 1: Weekend Boundary (Friday morning -> Saturday morning)
// Expected: 1 day. No half-day deduction for end date on a non-working day.
// $starthalfday = 'morning', $endhalfday = 'morning' -> $halfday = 1
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
$result = num_open_day($date_friday_4, $date_saturday_5, 0, 1, 1, 'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(1, $result, 'Case 1: Friday morning to Saturday morning should be 1 day');
// Case 2: Full week with half-day (Friday morning -> Following Friday morning)
// Expected: 5.5 days.
// $starthalfday = 'morning', $endhalfday = 'morning' -> $halfday = 1
$result = num_open_day($date_friday_4, $date_friday_11, 0, 1, 1, 'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(5.5, $result, 'Case 2: Friday morning to next Friday morning should be 5.5 days');
// Case 3: Single Half-Day (Monday afternoon)
// Expected: 0.5 days.
// $starthalfday = 'afternoon' -> $halfday = -1
$result = num_open_day($date_monday_7, $date_monday_7, 0, 1, -1, 'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(0.5, $result, 'Case 3: A single Monday afternoon should be 0.5 days');
// Case 4: Standard Leave (Monday morning -> Friday evening)
// Expected: 5 days.
// $starthalfday = 'morning', $endhalfday = 'evening' -> $halfday = 0
$result = num_open_day($date_monday_7, $date_friday_11, 0, 1, 0, 'FR');
print __METHOD__." result=".$result."\n";
$this->assertEquals(5, $result, 'Case 4: Monday morning to Friday evening should be 5 days');
}
/**