2
0
forked from Wavyzz/dolibarr

Compare commits

..

214 Commits
14.0.1 ... 12.0

Author SHA1 Message Date
Laurent Destailleur
cf57e7e88b Merge 2024-10-29 15:44:25 +01:00
Laurent Destailleur
a186e16568 Backport fix for mysql 8 export 2024-10-29 15:32:54 +01:00
Laurent Destailleur
52138372ce Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2024-09-29 22:27:54 +02:00
Laurent Destailleur
a27538f582 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2024-09-29 22:27:42 +02:00
Laurent Destailleur
a621032643 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2024-09-29 19:28:05 +02:00
Laurent Destailleur
32646cb7f4 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2024-09-29 19:25:49 +02:00
Florian Mortgat
74b67eb6c6 FIX - use price() to display qty on a product's stats tab to avoid showing too many decimals when rounding errors are possible (#31165) 2024-09-29 15:57:05 +02:00
Laurent Destailleur
644f365455 Merge remote-tracking branch 'origin/11.0' into 12.0 2024-09-26 18:47:12 +02:00
Laurent Destailleur
667890247c Merge remote-tracking branch 'origin/10.0' into 11.0 2024-09-26 18:46:30 +02:00
Florian Mortgat
c727bbb530 FIX: when qty is not an integer, apply price() (#31138)
* FIX: when qty is not an integer, apply price() to avoid displaying precision errors if php.ini's precision settings are too high

* Apply eldy's suggestion to use price's parameters rather than a test
2024-09-26 18:41:41 +02:00
Laurent Destailleur
e2b5315e23 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2023-11-23 18:40:52 +01:00
Laurent Destailleur
2462daf1ed Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2023-11-05 19:36:01 +01:00
Laurent Destailleur
9c7381601f Backport or better module compatibility 2023-11-05 19:35:34 +01:00
Laurent Destailleur
35a25599e5 FIX Backport memory fix for fatal error when +100000 products 2023-11-05 19:28:04 +01:00
atm-lena
9bfeb5e424 Add Hook "printFieldListFrom" in supplier order list (#26376)
Co-authored-by: atm-lena <lena.papazian@atm-consulting.fr>
2023-10-26 17:13:36 +02:00
Laurent Destailleur
973a2ede97 Fix syntax error 2023-08-10 11:35:19 +02:00
Laurent Destailleur
d3fc152001 Merge 2023-08-10 10:46:44 +02:00
Laurent Destailleur
e8fd551043 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2023-08-10 10:43:44 +02:00
Laurent Destailleur
34b3113bb7 Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0 2023-08-10 10:41:20 +02:00
Laurent Destailleur
90854dc2bf FIX Use the wrong logo size on PDF 2023-07-30 19:53:56 +02:00
Laurent Destailleur
b44ddaa696 FIX Use the wrong logo size on PDF 2023-07-30 18:04:03 +02:00
Laurent Destailleur
d10f277bba Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2023-06-19 19:13:54 +02:00
Laurent Destailleur
03a9daa3e6 Merge pull request #25139 from atm-greg/Fix_11.0_bankentries_list_missing_hook
add missing hook printFieldListValue
2023-06-19 16:48:13 +02:00
atm-greg
e5193f16cc add printFieldListJoin 2023-06-19 16:09:34 +02:00
atm-greg
9abde6c057 add missing hook printFieldListValue 2023-06-19 14:26:49 +02:00
Laurent Destailleur
a52ae607ba Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2023-03-16 09:30:36 +01:00
Laurent Destailleur
6aa8ba8935 Removed unexpected files 2023-03-16 09:29:10 +01:00
Laurent Destailleur
5ad7894849 Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2022-11-22 22:05:43 +01:00
Laurent Destailleur
2c1571c514 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2022-11-22 22:05:33 +01:00
Laurent Destailleur
f782ac6654 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2022-11-22 22:03:47 +01:00
Laurent Destailleur
1e54e695b2 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2022-11-22 22:00:59 +01:00
Laurent Destailleur
f2eb3c1a55 Merge pull request #22919 from atm-maxime/11.0
Fix API right check
2022-11-22 21:40:12 +01:00
Laurent Destailleur
41a970c90f Merge pull request #22922 from ATM-Nicolas/fix_sql_request_parenthesis
FIX sql request parenthesis
2022-11-22 21:39:11 +01:00
ATM-Nicolas
3d9b2a1676 FIX : SQL request parenthesis 2022-11-22 15:32:37 +01:00
Maxime Kohlhaas
7be0e0da1c Fix API right check 2022-11-22 13:46:42 +01:00
Laurent Destailleur
bb01ad7d9a Merge pull request #22850 from daraelmin/patch-4
FIx #18304 No adh create if error on public form
2022-11-15 13:12:02 +01:00
stickler-ci
c81c91755d Fixing style errors. 2022-11-15 10:55:09 +00:00
daraelmin
cd2b9538c1 FIx #18304 No adh create if error on public form
FIX #18304 - Member subscription confirmation email sent even if mandatory fields are missing
2022-11-15 11:51:20 +01:00
Laurent Destailleur
eeaa4f8205 Revert "doc"
This reverts commit 380cae761a.
2022-06-25 04:06:55 +02:00
Laurent Destailleur
380cae761a doc 2022-06-25 04:06:18 +02:00
Laurent Destailleur
192510316b Merge pull request #21013 from atm-greg/FIX_12.0_get_batch_only_for_same_fk_product
fix sql to avoid getting product_stock of another product with same batch
2022-05-24 21:23:02 +02:00
Laurent Destailleur
6f83c8c6f3 Update productbatch.class.php 2022-05-24 21:22:14 +02:00
atm-greg
8213756c37 fix sql to avoid getting product_stock of another product with same batch 2022-05-24 16:49:55 +02:00
Laurent Destailleur
a254412c61 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
Conflicts:
	htdocs/debugbar/class/DataCollector/DolLogsCollector.php
2022-05-03 11:54:28 +02:00
Laurent Destailleur
cc1a3080d0 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2022-05-03 11:53:23 +02:00
Laurent Destailleur
b5f887b3e4 Fix DEBUGBAR_USE_LOG_FILE 2022-05-03 11:52:32 +02:00
Laurent Destailleur
694357d48e Merge pull request #19420 from marc-dll/12.0_FIX_project_activity_default_workingdays
FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed
2022-04-14 23:23:12 +02:00
Laurent Destailleur
c4f80b4e71 Merge pull request #19424 from marc-dll/12.0_FIX_employee_tab_holiday_length
FIX: user employee tab: offset in open days messes up holiday length calculation
2022-04-14 22:59:20 +02:00
Laurent Destailleur
ece9f3037a Merge pull request #19788 from OPEN-DSI/v12-fix-user-card-modify-transverse-rights
FIX user actions rights when multi-company transverse mode is enabled
2022-04-02 18:15:50 +02:00
Laurent Destailleur
8dd44246b0 Merge pull request #20348 from daraelmin/daraelmin-patch-5
Fix #20263 Accountancy setup displayed with right
2022-03-29 14:47:57 +02:00
Laurent Destailleur
76470c9548 Merge pull request #20297 from aspangaro/12p23
FIX #20279 Accountancy - PostGreSQL - Error on mass update lines already binded
2022-03-24 20:30:01 +01:00
stickler-ci
19be5f662d Fixing style errors. 2022-03-14 08:25:15 +00:00
daraelmin
3eebbc0b14 Fix #20263 Accountancy setup displayed with right
Fix #20263 Accountancy setup is displayed only for user with rights->accounting->chartofaccount
2022-03-14 09:24:26 +01:00
Laurent Destailleur
d27c0b31fc Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2022-03-10 15:54:08 +01:00
Laurent Destailleur
a1534955a1 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2022-03-10 15:52:50 +01:00
Laurent Destailleur
79371f66b0 Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0 2022-03-10 15:52:28 +01:00
Laurent Destailleur
4569cb82b2 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0 2022-03-10 15:52:04 +01:00
Laurent Destailleur
04d33f4594 Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0 2022-03-10 15:51:42 +01:00
Laurent Destailleur
af6e95aa79 Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-03-10 15:49:51 +01:00
Laurent Destailleur
5d942c9d1a Fix infinit logs 2022-03-10 15:46:00 +01:00
Laurent Destailleur
cc57d3dbc1 Fix phpcs 2022-03-09 22:25:29 +01:00
Alexandre SPANGARO
87b187bded FIX #20279 Accountancy - PostGreSQL - Error on mass update lines already binded 2022-03-08 03:43:40 +01:00
Laurent Destailleur
df0b20aad3 Merge pull request #20241 from noec764/12.0_Product_Fournisseur_Migration
Correction of the modification on the fly of the table llx_product_fournisseur_price
2022-03-07 15:01:40 +01:00
Laurent Destailleur
e085c3989a Update product.php 2022-03-07 14:59:55 +01:00
Laurent Destailleur
e67c208b57 Merge pull request #20271 from rycks/12.0
fix #20270 : use product_id in sql only if product_id is defined
2022-03-07 14:07:27 +01:00
Laurent Destailleur
e13038dc30 Update product.class.php 2022-03-07 14:06:54 +01:00
Eric Seigne
744b84cb09 fix #20270 : use product_id in sql only if product_id is defined 2022-03-04 15:20:50 +01:00
stickler-ci
5c3b0847c2 Fixing style errors. 2022-03-01 15:20:28 +00:00
noec764
f1af7ca2f2 Update product.php 2022-03-01 16:17:32 +01:00
Noé Courtier
035bc32323 Correction of the modification on the fly of the table llx_product_fournisseur_price by an addition in the script creation of the table as well as in the script of version upgrade from 12 ->13 2022-03-01 16:14:31 +01:00
Laurent Destailleur
a70d45b3ab Merge pull request #20148 from marc-dll/12.0_FIX_medias_blocked_when_logged_with_multicompany
FIX: viewimage.php blocks requests with multicompany from other enties
2022-02-25 14:32:49 +01:00
Marc de Lima Lucio
1574254dcf FIX: viewimage.php: bad call to dol_check_secure_access_document() caused images to be blocked with multicompany from entities > 1 2022-02-22 17:13:26 +01:00
Laurent Destailleur
1c129fd3ea Merge pull request #20038 from atm-quentin/FIX_12_sort_ht_amount
FIX sort amount ht on cabyprodserv.php
2022-02-18 21:04:52 +01:00
Laurent Destailleur
97575854d0 Merge pull request #20094 from thomas-Ngr/12_fix_ticket_public_email_wrong_custom_url
fix ticket: wrong link sent to customer
2022-02-17 19:18:36 +01:00
Laurent Destailleur
2e744a4517 Update create_ticket.php 2022-02-17 19:18:22 +01:00
Thomas Negre
1ad8700810 empty commit to force travis try rebuild 2022-02-17 11:08:23 +01:00
Thomas Negre
1c8c98ac0f fix ticket public interface:
When sending an email to the customer,
If a custom URL had been provided for ticket public interface,
the link provided in the email did lead to the index of the public interface.
We want it to lead to /view.php
2022-02-17 09:53:36 +01:00
Laurent Destailleur
92cb95a184 Merge pull request #20064 from ATM-Consulting/FIX_uniformize_pdf_logo_behaviour
Fix uniformize pdf logo behaviour for supplier orders
2022-02-16 21:09:45 +01:00
atm-greg
96c7a9f77c fix pdf_cornas 2022-02-14 15:16:36 +01:00
atm-greg
3ebdb89133 fix pdf_mucadet 2022-02-14 15:11:26 +01:00
Quentin VIAL-GOUTEYRON
d819d427c3 FIX sort amount ht 2022-02-10 16:46:19 +01:00
Laurent Destailleur
db81b32a5d Merge pull request #20028 from noec764/12.0_Fix_Double_CommandeFournisseurDet
Change of SQL request when fetching CommandeFournisseurLigne
2022-02-10 09:30:36 +01:00
Laurent Destailleur
793e43c7c6 Update fournisseur.commande.class.php 2022-02-10 09:29:11 +01:00
noec764
d9bac75a63 Merge branch '12.0' into 12.0_Fix_Double_CommandeFournisseurDet 2022-02-09 15:33:45 +01:00
Noé Courtier
e4c1978e12 Change of SQL request when fetching CommandeFournisseurLigne 2022-02-09 12:24:33 +01:00
Laurent Destailleur
a0154503f4 Merge pull request #19838 from OPEN-DSI/v12-fix-supplier-order-print-error
FIX replace print error with event message when error on update line …
2022-01-23 13:37:09 +01:00
lvessiller
a9c76f2e44 FIX replace print error with event message when error on update line in supplier order 2022-01-14 16:09:30 +01:00
Laurent Destailleur
5b6133ad62 Merge pull request #19821 from marc-dll/12.0_FIX_shipment_all_lines
FIX: order to shipment: debug hidden conf SHIPMENT_GETS_ALL_ORDER_PRODUCTS
2022-01-14 10:19:28 +01:00
Laurent Destailleur
90c3c90864 Merge pull request #19829 from OPEN-DSI/v12-fix-supplier-order-list-search-user
FIX search by user in supplier order list
2022-01-14 09:45:06 +01:00
lvessiller
cacff0c2d4 FIX cast int for search user 2022-01-13 16:18:57 +01:00
lvessiller
22f6d204a2 FIX search by user in supplier order list 2022-01-13 16:01:23 +01:00
Marc de Lima Lucio
b110ca6ead FIX: order to shipment: FIX hidden conf SHIPMENT_GETS_ALL_ORDER_PRODUCTS (still not working when not preselecting a warehouse) 2022-01-12 16:40:43 +01:00
lvessiller
400f6b244b FIX user actions rights when mulit-company transverse mode is enabled 2022-01-11 17:29:02 +01:00
Laurent Destailleur
cde290c78a Merge pull request #19402 from atm-gauthier/fix_reorder_lines_after_delete_line_everywhere
FIX : reorder all lines when delete document line everywhere (4 documents were missing)
2022-01-10 21:23:23 +01:00
Laurent Destailleur
b23b82bd6f Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2022-01-07 15:49:09 +01:00
Laurent Destailleur
7dfb369a98 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2022-01-07 15:48:23 +01:00
Laurent Destailleur
265aeb76e6 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0
Conflicts:
	htdocs/core/class/utils.class.php
	htdocs/expensereport/class/expensereport.class.php
2022-01-07 15:48:13 +01:00
Laurent Destailleur
5ee74d7c07 Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0 2022-01-07 15:45:51 +01:00
Laurent Destailleur
1541e20870 Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 9.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-01-07 15:43:28 +01:00
Laurent Destailleur
53709cf509 Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Conflicts:
	htdocs/core/class/utils.class.php
2022-01-07 15:40:05 +01:00
Laurent Destailleur
10e32c056e FIX avoid infinite loop on dump with popen 2022-01-07 15:35:33 +01:00
Laurent Destailleur
8728ad2eff Merge pull request #19730 from fmarcet/12.0
Fix: Correctly display product translations
2022-01-06 10:57:47 +01:00
Laurent Destailleur
5de6c193ff Merge pull request #19745 from daraelmin/patch-1
Fix #19723 - Belgium provinces incorrect mapping
2022-01-06 10:41:19 +01:00
daraelmin
1f6e9a1a9e Fix install - Belgium provinces incorrect mapping 2022-01-04 18:46:29 +01:00
Ferran Marcet
26c6908f66 Fix: Correctly display product translations 2022-01-03 13:22:07 +01:00
Ferran Marcet
08685cc6b0 Fix: Correctly display product translations 2022-01-03 13:14:40 +01:00
Laurent Destailleur
7bdfc998bf Fix regression 2021-12-30 17:49:53 +01:00
Laurent Destailleur
76a0caf116 Merge pull request #19717 from OPEN-DSI/fix-company-list-title-on-nature-of
FIX title for nature of third party in company list
2021-12-30 17:25:08 +01:00
Laurent Destailleur
c57dc82eaa Merge pull request #19688 from atm-maxime/fix_modbuilder_numbering_model
Fix modulebuilder params for updatemask action
2021-12-30 17:07:27 +01:00
lvessiller
f16166c47c FIX title for nature of third party in company list 2021-12-30 15:35:49 +01:00
Maxime Kohlhaas
d82c1f34e0 Fix modulebuilder params for updatemask action 2021-12-25 11:33:26 +01:00
Laurent Destailleur
0a72aed3d7 Fix missing space before union 2021-12-23 13:35:38 +01:00
Laurent Destailleur
856b010a45 FIX #19651 2021-12-21 15:56:59 +01:00
Laurent Destailleur
9d6ddced56 Merge pull request #19607 from fbosman/patch-1
Update functions.lib.php
2021-12-16 17:33:13 +01:00
Laurent Destailleur
36ba158a8b Merge pull request #19637 from atm-john/12.0_fix_get_prev_progress
FIX : test of method exist on wrong object
2021-12-16 16:49:59 +01:00
Laurent Destailleur
140cca7596 Merge pull request #19640 from atm-kevin/FIX_Holidays_Filter
FIX Holiday month report
2021-12-16 16:36:54 +01:00
kevin
a5b8d0cd4b FIX Take into consideration work leave over serveral months 2021-12-16 15:41:13 +01:00
John BOTELLA
d149596043 fix test of method exist on wrong object 2021-12-16 10:33:53 +01:00
Frans Bosman
cf05f38e54 Update functions.lib.php
Change exists to isset in price2num
2021-12-13 19:56:06 +01:00
Laurent Destailleur
57ebcf94c0 Merge pull request #19554 from atm-quentin/FIX_setoptionalfrompost
FIX set optional from post, we cant untick boolean field on product card
2021-12-08 16:27:41 +01:00
Quentin VIAL-GOUTEYRON
826bde0656 FIX set optional from post 2021-12-06 11:19:12 +01:00
Laurent Destailleur
d84d09556c Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-11-30 15:55:57 +01:00
Laurent Destailleur
7937a798b7 Merge pull request #18331 from marc-dll/12.0_FIX_invoice_multicurrency_discount
FIX: multicurrency: fields in discount unitialized when creating deposit
2021-11-30 14:23:37 +01:00
Laurent Destailleur
ce8312c744 Merge pull request #19464 from atm-quentin/FIX_11_TAB_INVOICE
FIX : Urgent onglet contact inaccessible depuis une facture
2021-11-30 11:45:56 +01:00
Laurent Destailleur
cf4beafb68 Merge pull request #19484 from aspangaro/12p23
FIX Option MAIN_DIRECT_STATUS_UPDATE broken. Ajax on/off not saving value in DB after updating to version >=12
2021-11-30 11:39:44 +01:00
Laurent Destailleur
9a72f147d1 Merge pull request #19500 from marc-dll/12.0_FIX_holiday_massdelete
FIX: holiday list: only mass delete if leave request is not in draft, canceled or refused, like in card
2021-11-30 11:31:59 +01:00
Marc de Lima Lucio
f5343c55c3 FIX: holiday mass deletion: correct return of record deleted 2021-11-26 18:23:31 +01:00
Marc de Lima Lucio
1361abffe5 FIX: holiday list: only mass delete if leave request is not in draft, canceled or refused, like in card 2021-11-26 18:22:31 +01:00
Alexandre SPANGARO
9d2fb782fa FIX Option MAIN_DIRECT_STATUS_UPDATE broken. Ajax on/off not saving value in DB after updating to version >=12 2021-11-25 15:41:28 +01:00
Quentin VIAL-GOUTEYRON
632147ad88 object->id is always empty 2021-11-24 12:04:18 +01:00
Marc de Lima Lucio
1129222064 FIX: user employee tab: offset in open days messes up holiday length calculation 2021-11-19 15:59:34 +01:00
Marc de Lima Lucio
7cb657c991 FIX: project timesheets: assume Saturday and Sunday are default weekend days when working days conf is empty or badly formed 2021-11-19 14:49:11 +01:00
Laurent Destailleur
efb9d184e4 Merge pull request #19382 from OPEN-DSI/fix-societe-list-region-filter
FIX filter on region in company list
2021-11-18 20:29:36 +01:00
Laurent Destailleur
44d4ab6f9c Merge pull request #19384 from fmarcet/12.0
Fix: Bad date conversion
2021-11-18 20:10:50 +01:00
Laurent Destailleur
8f96383186 Update expedition.class.php 2021-11-18 20:10:04 +01:00
Ferran Marcet
db975bbcc2 Fix: The error not correctly collected on insertation line failure 2021-11-18 17:17:00 +01:00
Gauthier PC portable 024
23249751d5 FIX : reorder all lines when delete document line everywhere 2021-11-17 12:10:12 +01:00
Ferran Marcet
7af883abc1 Fix: Bad date conversion 2021-11-15 16:43:54 +01:00
lvessiller
e365a14b5a FIX filter on region in company list 2021-11-15 14:41:16 +01:00
Laurent Destailleur
e188855dca Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
Conflicts:
	htdocs/datapolicy/class/datapolicy.class.php
2021-11-11 16:01:37 +01:00
Laurent Destailleur
9aa5c94612 Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0 2021-11-11 15:59:48 +01:00
Laurent Destailleur
ba724204a4 FIX Bad use of dol_concatdesc() 2021-11-11 15:50:32 +01:00
Laurent Destailleur
8518c772fb Merge pull request #19343 from OPEN-DSI/fix-takepos-report-terminal
FIX close cash with some terminals in TakePOS
2021-11-11 14:42:12 +01:00
lvessiller
33e40c12c8 FIX close cash with some terminals in TakePOS 2021-11-09 14:12:28 +01:00
Laurent Destailleur
19b9412c13 FIX #19305 2021-11-05 12:49:33 +01:00
Laurent Destailleur
23749b57ec Merge pull request #19311 from atm-john/12.0_fix_missing_return_status_for_getrow
FIX : missing return status
2021-11-05 12:42:54 +01:00
Laurent Destailleur
3959d12a39 Update DoliDB.class.php 2021-11-05 12:42:42 +01:00
ATM john
dd8d4e9e98 Fix missing return status 2021-11-04 12:10:19 +01:00
Laurent Destailleur
9247bbcc1d Merge pull request #19223 from noec764/12.0_FIX_resource_list_extrafields_filter
FIX: resource list : Use standard code to handle list filters
2021-10-31 16:15:08 +01:00
Laurent Destailleur
01c6de1085 Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-10-31 14:24:53 +01:00
Laurent Destailleur
6d918ad1c7 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-10-31 14:24:19 +01:00
Laurent Destailleur
ff696e0dad Merge pull request #19236 from marc-dll/11.0_FIX_invoice_creation_blocked
FIX: URGENT: impossible to create an invoice
2021-10-31 14:03:11 +01:00
Laurent Destailleur
3dcd1aa05d Update info.php 2021-10-31 14:02:34 +01:00
Laurent Destailleur
8dfe4fe05f Update note.php 2021-10-31 14:02:14 +01:00
Laurent Destailleur
65d59405da Update document.php 2021-10-31 14:01:56 +01:00
Laurent Destailleur
0e2e8fe27f Update contact.php 2021-10-31 14:01:40 +01:00
Laurent Destailleur
7232e38dbe Merge pull request #19248 from fmarcet/12.0
Fix: Import don't work if extrafield is separator
2021-10-31 13:54:31 +01:00
Laurent Destailleur
f2c282305e Merge pull request #19260 from aspangaro/12p21
FIX Ticket - Duplicate field project when we create ticket from project
2021-10-31 13:53:58 +01:00
Alexandre SPANGARO
54b81312b5 FIX Ticket - Duplicate field project when we create ticket from project 2021-10-30 22:49:32 +02:00
Ferran Marcet
1336d3e791 Fix: Import don't work if extrafield is separator 2021-10-29 12:25:50 +02:00
Marc de Lima Lucio
eb8d7f92c3 FIX: invoice: inpossible to create an invoice because of very bad check + warnings when trying to print tabs for invoice with no ID 2021-10-28 15:26:40 +02:00
Administrator
c998abe54e FIX: resource list : Use standard code to handle list filters 2021-10-27 11:09:00 +02:00
Laurent Destailleur
181991ee47 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-10-26 13:10:23 +02:00
Laurent Destailleur
c8bcd01a10 Merge pull request #19162 from atm-maxime/fix_no_mail_in_now_unsubscribe
Fix #18961 : no_email field has been replaced by mailing_unsubscribe table
2021-10-24 00:42:48 +02:00
Maxime Kohlhaas
983e28691b Use a subselect instead of a join 2021-10-24 00:02:55 +02:00
Maxime Kohlhaas
29950a6afa Replace != by <> in SQL requests 2021-10-23 22:27:29 +02:00
Maxime Kohlhaas
00b617d17f Fix #18961 : no_email field has been replaced by mailing_unsubscribe table 2021-10-23 22:22:45 +02:00
Laurent Destailleur
fc0c4295bd Merge pull request #19118 from atm-florianm/FIX_12.0_tcpdf_issue_315_roman_numeral_bomb_vulnerability
FIX tcpdf roman numeral rendering bomb, cf. tecnickom/TCPDF PR 315
2021-10-22 19:10:13 +02:00
atm-florian
17773f8414 FIX tcpdf vulnerability to roman numeral bomb, cf. tecnickom/TCPDF issue #315 2021-10-22 18:26:23 +02:00
Laurent Destailleur
e1af439a6d Merge pull request #18931 from atm-florianm/FIX_11.0_consistent_UX_for_invoices_when_no_id_or_ref
FIX: consistent UX when calling a tab from the invoice card with empty ref/id
2021-10-17 13:52:30 +02:00
Laurent Destailleur
bd52613331 Fix phpcs 2021-10-16 17:06:10 +02:00
Laurent Destailleur
3875d26a2f Fix filter for supplierinvoice stats 2021-10-14 15:55:12 +02:00
Laurent Destailleur
db3d16f080 Fix filter tag for supplier invoice statistics 2021-10-14 15:43:35 +02:00
Laurent Destailleur
bc230dbfc2 Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-10-14 12:00:33 +02:00
Laurent Destailleur
371c75e76a FIX list of categories in stats of supplier invoices 2021-10-14 11:58:21 +02:00
Laurent Destailleur
3a32787f15 Fix for backward compatibility 2021-10-11 16:14:34 +02:00
atm-florian
57052e2fba FIX PR#18931 Remove useless explicit call to dol_shutdown 2021-10-11 11:10:14 +02:00
atm-florian
2da16ade6c FIX: consistent UX when calling a tab from the invoice card with empty ref / id 2021-10-08 17:24:52 +02:00
Laurent Destailleur
68ac62d09c Fix phpcs 2021-10-07 11:05:06 +02:00
Laurent Destailleur
5910d10021 Add hidden option to allow to fix corrupted situations 2021-10-07 10:43:50 +02:00
Laurent Destailleur
eba377cdf0 Merge pull request #18860 from FHenry/12_fix_selectline_from_supplier_order_to_supplier_invoice
fix: Supplier order => Supplier Invoice : line selector (checkbox) wasn't working
2021-10-06 15:31:14 +02:00
Laurent Destailleur
10f0434116 Update card.php 2021-10-06 15:30:19 +02:00
Florian HENRY
6d00097c89 fix 2021-09-30 16:37:52 +02:00
Laurent Destailleur
fc4a16b356 Fix avoid error when trigger run on downgraded version. 2021-09-30 16:18:07 +02:00
Florian HENRY
d0508d557b fix: checkbox for line selection between supplier order and supplier invoice was infective 2021-09-30 14:56:02 +02:00
Laurent Destailleur
422191def1 Merge pull request #18858 from FHenry/12_fix_dict_tva
fix: search code on tva dict
2021-09-30 14:05:07 +02:00
Laurent Destailleur
620d7109b5 Update dict.php 2021-09-30 14:04:56 +02:00
Florian HENRY
332fa77d90 fix: search code on tva dict 2021-09-30 13:49:02 +02:00
Laurent Destailleur
c3d539abff Merge pull request #18833 from marc-dll/12.0_FIX_product_extrafields_update
FIX: products/services card: hidden extrafields were overridden
2021-09-28 12:13:08 +02:00
Marc de Lima Lucio
6abe6462e6 FIX: products/services card: hidden extrafields were overridden 2021-09-27 14:33:57 +02:00
Laurent Destailleur
505517d142 Merge pull request #18629 from Gjuju/12.0
Fix : GET extrafields on API "get events list" requests
2021-09-17 12:16:32 +02:00
Laurent Destailleur
1c43a83a8b Merge pull request #18737 from marc-dll/12.0_FIX_projet_task_time_user_filter
FIX: task time: can't filter by user with pgsql + show error message
2021-09-17 11:31:45 +02:00
Marc de Lima Lucio
571d130c3c FIX: task time: keep on using natural_search 2021-09-17 10:51:37 +02:00
Marc de Lima Lucio
88cd8fface FIX: task time: can't filter by user with pgsql + show error message 2021-09-16 17:53:47 +02:00
Laurent Destailleur
87bb971d75 FIX autocalculation of the supplier price in main currency.
Conflicts:
	htdocs/product/fournisseurs.php
2021-09-16 13:22:22 +02:00
Julien Gainza
65c4a21898 FIX move fetch_optionnal into $ac_static->fetch() 2021-09-13 16:35:13 +02:00
Julien Gainza
9d89e48d15 Fix : Add extrafields on API "get events list" 2021-09-06 15:55:33 +02:00
Laurent Destailleur
68bc85124b Merge pull request #18601 from frederic34/patch-8
fix #17634
2021-09-05 01:07:46 +02:00
Frédéric FRANCE
456f25d57e fix #17634 2021-09-04 11:30:03 +02:00
Laurent Destailleur
74f3b98ea9 Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into 12.0
Conflicts:
	htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
2021-09-01 17:54:21 +02:00
Laurent Destailleur
cd09099409 Merge pull request #18563 from atm-maxime/patch-3
Fix supplier invoice pdf generation canelle
2021-09-01 13:37:50 +02:00
Maxime Kohlhaas
d09d036f06 Fix supplier invoice pdf generation canelle
Thirdparty wrongly fetched was causing errors on mass generation
2021-08-31 16:10:55 +02:00
Laurent Destailleur
b28180d759 Merge pull request #18471 from aspangaro/12p19
FIX Accountancy - Some problems of length with general & subledger ac…
2021-08-24 14:19:16 +02:00
Alexandre SPANGARO
a0378549b8 FIX Accountancy - Some problems of length with general & subledger account 2021-08-23 15:19:27 +02:00
Laurent Destailleur
bdf8c3ddc6 Fix test 2021-08-20 23:26:56 +02:00
Laurent Destailleur
35e48f3a27 Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 12.0 2021-08-20 21:12:22 +02:00
Laurent Destailleur
9d285ea232 Fix: Can delete a price when date is in future to fix corrupted data 2021-08-20 21:11:20 +02:00
Laurent Destailleur
35ebaf7b79 Merge pull request #18282 from aspangaro/12p18
FIX: Manage credit note on situation invoice for calculate margin
2021-08-17 19:26:16 +02:00
Laurent Destailleur
16c290f735 Merge pull request #18383 from marc-dll/12.0_FIX_invoice_tiny_negative_vat
FIX: invoice validation: when checking if any VAT rate has a negative amount, prevent false positives with -1.0E-14 amounts
2021-08-17 18:24:33 +02:00
Alexandre SPANGARO
f88abb9a6f Add parenthesis 2021-08-15 07:32:46 +02:00
Alexandre SPANGARO
0d467972cd Merge branch '12.0' into 12p18 2021-08-15 07:19:33 +02:00
Marc de Lima Lucio
08f21e3fc4 FIX: invoice validation: when checking if any vat rate has a negative amount, prevent false positives with -1E-14 amounts 2021-08-10 10:23:56 +02:00
Marc de Lima Lucio
9d234a8541 FIX: multicurrency: fields in discount unitialized when creating deposit 2021-08-03 18:32:22 +02:00
Alexandre SPANGARO
ca6dd8850a FIX: Manage credit note on situation invoice for calculate margin 2021-07-29 15:24:08 +02:00
8391 changed files with 707256 additions and 700096 deletions

13
.gitattributes vendored
View File

@@ -11,31 +11,26 @@
*.htm text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.css text eol=lf
*.lang text eol=lf
*.txt text eol=lf
*.md text eol=lf
*.pp text eol=lf
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.conf text eol=lf
.bash_aliases text eol=lf
# Denote all files that are truly binary and should not be modified.
*.bmp binary
*.frm binary
*.ico binary
*.jpeg binary
*.png binary
*.jpg binary
*.odt binary
*.odf binary
*.frm binary
*.MYD binary
*.MYI binary
*.odf binary
*.odt binary
*.png binary
# Export ignores to generate clean production tarballs
/build export-ignore

View File

@@ -77,8 +77,8 @@ contact@dolibarr.org
## 10. License and attribution
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](https://creativecommons.org/licenses/by-sa/3.0/).
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](https://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
Retrieved on November 22, 2016 from [https://citizencodeofconduct.org/](http://citizencodeofconduct.org/)
Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)

View File

@@ -4,17 +4,14 @@ How to contribute to Dolibarr
Bug reports and feature requests
--------------------------------
<a name="not-a-support-forum"></a>*Note*: **GitHub Issues is not a support forum.** If you have questions about Dolibarr / need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages.
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum).
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
Default **language here is english**. So please prepare your contributions in english.
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
3. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version)
4. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
5. Delete unnecessary submissions.
6. **Check your Message at Preview before sending.**
4. Tell us the version you are using!
3. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
@@ -29,8 +26,7 @@ Default **language here is english**. So please prepare your contributions in en
4. Commit and push your changes.
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
<span id="branches" name="branches"></span>
### Branches
### <a name="branches"></a>Branches
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.
@@ -60,7 +56,7 @@ You can add it to your git configuration using:
git config --local commit.template .gitmessage
```
where
where
#### Keyword
In uppercase if you want to have the log comment appears into the generated ChangeLog file.
@@ -105,7 +101,7 @@ Long description (Can span accross multiple lines).
</pre>
### Pull Requests
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
a process to follow to optimize the chance to have PRs merged efficiently...
* A PR must be atomic. It means it must contains the lower possible changes for 1 need (1 bug fix or 1 new feature) without breaking usability of code. If a PR can be split into several PRs, it often means your PR is not atomic.
@@ -124,7 +120,7 @@ Once a PR has been submitted, you may need to wait for its integration. It is co
If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of PR (but it can be analyzed for discussion).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR.
@@ -145,7 +141,7 @@ Translations done on transifex are available in the next major release.
Note: Sometimes, the source text (english) is modified. In such a case, the translation is reset. Transifex assume that if the original source
has changed, the translation is surely no more correct so must be done again. But old translation is not lost and you can use the tab "History"
to retrieve all old translation of a source text, and restore the translation in one click with no need to retranslate it if there is no need to.
to retreive all old translation of a source text, and restore the translation in one click with no need to retranslate it if there is no need to.
### Resources

View File

@@ -1,17 +0,0 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: "Exakat analysis"
on:
schedule:
- cron: "0 20 * * *"
jobs:
exakat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Exakat
uses: docker://exakat/exakat-ga
with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/AddZero,Structures/DropElseAfterReturn,Structures/IfWithSameConditions,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/ExitUsage,Structures/RepeatedPrint,Structures/RepeatedRegex,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'

View File

@@ -14,11 +14,11 @@ jobs:
- uses: Dolibarr/stale@staleunstale
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 10 days (you should still be able to re-open it if required).'
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-label: 'Issue Stale (automatic label)'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,hacktoberfest,hacktoberfest-accepted,good first issue,Bug Security (CVE),Analysis of PR in progress'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres'
days-before-stale: 365
days-before-close: 10
days-before-close: 15
operations-per-run: 100
dry-run: false

15
.gitignore vendored
View File

@@ -37,21 +37,8 @@ htdocs/includes/jakub-onderka/
htdocs/includes/phpdocumentor/
htdocs/includes/phpspec/
htdocs/includes/phpunit/
htdocs/includes/php-parallel-lint/
htdocs/includes/sebastian/
htdocs/includes/squizlabs/
htdocs/includes/symfony/
htdocs/includes/webmozart/
htdocs/.well-known/apple-developer-merchantid-domain-association
# Node Modules
build/yarn-error.log
build/node_modules/
node_modules/
#yarn
yarn.lock
#package-lock
package-lock.json
doc/install.lock

View File

@@ -17,10 +17,8 @@ filter:
- build/*
- dev/*
- doc/*
- documents/*
- htdocs/includes/*
- node_modules/*
- test/*
- htdocs/includes/*
paths:
- htdocs/*
- scripts/*

View File

@@ -1,6 +1,6 @@
# This script is used by Travis CI to run automatically Continuous test integration
# from Dolibarr GitHub repository.
# For syntax, see https://docs.travis-ci.com/user/languages/php/
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
# We use dist: xenial to have php 5.6+ available
os: linux
@@ -9,9 +9,6 @@ dist: xenial
language: php
git:
depth: 1
# Start on every boot
services:
- memcached
@@ -41,23 +38,16 @@ env:
jobs:
fast_finish: true
#allow_failures:
#- php: nightly
allow_failures:
- php: nightly
include:
- stage: PHP 5.6-7.4
if: type = push
- if: type = push
php: '5.6'
env: DB=postgresql
- stage: PHP 5.6-7.4
if: type = pull_request OR type = push
- if: type = pull_request OR type = push
php: '7.4'
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = develop
php: nightly
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = 14.0
- if: type = push AND branch = develop
php: nightly
env: DB=mysql
@@ -80,6 +70,13 @@ before_install:
phpenv config-rm xdebug.ini
echo
- |
if [ "$DB" = 'postgresql' ]; then
echo "Check pgloader version"
pgloader --version
echo
fi
install:
- |
echo "Updating Composer"
@@ -93,32 +90,26 @@ install:
echo
- |
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
echo "Installing Composer dependencies (PHP Unit, Parallel Lint & PHP CodeSniffer"
if [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
composer -n require phpunit/phpunit ^4 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \
[ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^5 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
composer -n require --ignore-platform-reqs phpunit/phpunit ^5 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
fi
echo
- |
@@ -178,10 +169,6 @@ before_script:
mysql --version | head -
mysql -e "SELECT VERSION();" | head -
psql --version
if [ "$DB" = 'postgresql' ]; then
echo "Check pgloader version"
pgloader --version
fi
echo
- |
@@ -271,27 +258,20 @@ script:
echo
- |
echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)"
echo "Checking PHP syntax errors"
# Ensure we catch errors
set -e
#parallel-lint --exclude htdocs/includes --blame .
# Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame .
fi
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e
echo
- |
echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)"
echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ] && [ "$DB" = "mysql" ]; then
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e
@@ -405,22 +385,9 @@ script:
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log
php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log
php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
ls -alrt $TRAVIS_BUILD_DIR/
- |
echo "Enabling new modules"
# Enable modules not enabled into original dump
set -e
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log
echo $?
cd -
set +e

View File

@@ -128,12 +128,6 @@ source_file = htdocs/langs/en_US/errors.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.eventorganization]
file_filter = htdocs/langs/<lang>/eventorganization.lang
source_file = htdocs/langs/en_US/eventorganization.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.exports]
file_filter = htdocs/langs/<lang>/exports.lang
source_file = htdocs/langs/en_US/exports.lang
@@ -170,12 +164,6 @@ source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.intracommreport]
file_filter = htdocs/langs/<lang>/intracommreport.lang
source_file = htdocs/langs/en_US/intracommreport.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang
@@ -188,12 +176,6 @@ source_file = htdocs/langs/en_US/interventions.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.knowledgemanagement]
file_filter = htdocs/langs/<lang>/knowledgemanagement.lang
source_file = htdocs/langs/en_US/knowledgemanagement.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.languages-not-res]
file_filter = htdocs/langs/<lang>/languages.lang
source_file = htdocs/langs/en_US/languages.lang
@@ -290,12 +272,6 @@ source_file = htdocs/langs/en_US/other.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.partnership]
file_filter = htdocs/langs/<lang>/partnership.lang
source_file = htdocs/langs/en_US/partnership.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.paybox]
file_filter = htdocs/langs/<lang>/paybox.lang
source_file = htdocs/langs/en_US/paybox.lang
@@ -350,12 +326,6 @@ source_file = htdocs/langs/en_US/receptions.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.recruitment]
file_filter = htdocs/langs/<lang>/recruitment.lang
source_file = htdocs/langs/en_US/recruitment.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.resource]
file_filter = htdocs/langs/<lang>/resource.lang
source_file = htdocs/langs/en_US/resource.lang

View File

@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@@ -1,83 +1,73 @@
Copyright and license
----------------------
License
-------
The Dolibarr software as a whole is distributed under the GNU General Public License as published by the Free Software Foundation;
either version 3 of the License, or (at your option) any later version (GPL-3+). More information: https://www.gnu.org/licenses/gpl-3.0.txt.
A copy of this license is available in the COPYING file.
Dolibarr depends on third-party components and code snippets released under their own license (obviously, all compatible with the one of Dolibarr).
These dependencies are listed in the bottom of this file.
Dolibarr is released under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version (GPL-3+).
More information: https://www.gnu.org/licenses/gpl-3.0.txt
The Dolibarr images resources (available in the doc directory) is distributed under the Creative Commons Attribution 4.0 International license (CC BY 4.0).
The name Dolibarr is a trademark initially registered by Laurent Destailleur and ceased to the Dolibarr foundation. You can use the name Dolibarr
for your own need as long as you follow the rules defined on the page https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22
The use of the name DoliStore is also restricted to the same rules defined on https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22
Licence of dependencies of third-party components used by Dolibarr (all compatible with the Licence of Dolibarr):
Dolibarr uses some external libraries released under different licenses. This is compatibility summary:
Component Version License GPL Compatible Usage
-------------------------------------------------------------------------------------
PHP libraries:
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
GeoIP2 0.2.0 LGPL-2.1+ Yes Lib to make geoip convert
Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar)
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
PSR/Logs 1.0 Library for logs (used by DebugBar)
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
Stripe 7.67.0 MIT Licence Yes Library for Stripe module
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.43.1 MIT licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 2.9.4 MIT License Yes JS library for graph
jQuery 3.5.1 MIT License Yes JS library
ChartJS 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
jQuery jNotify 1.1.00 Apache License 2.0 Yes JS library plugin jNotify (to use ajax popups)
jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for filetree
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
jsGanttImproved 2.7.3 BSD License Yes JS library (to build Gantt reports)
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports)
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
Image libraries:
Octicons 8.1 MIT Yes
Font libraries:
Fontawesome 5.13 Font Awesome Free Licence Yes
Fontawesome 5.13 Font Awesome Free licence Yes
For more licenses compatibility informations: https://www.gnu.org/licenses/licenses.en.html
For licenses compatibility informations:
https://www.gnu.org/licenses/licenses.en.html
Authors
Copyright / Authors
-------------------
See page https://github.com/Dolibarr/dolibarr/graphs/contributors

798
ChangeLog
View File

@@ -2,711 +2,6 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 14.0.1 compared to 14.0.0 *****
FIX: $conf->task used but it does not exist, use $conf->projet instead
FIX: #18181
FIX: #18212 : Add url field
FIX: #18267
FIX: #18289 #18294
FIX: #18341 lang not loaded
FIX: #18389 Accountancy - Bug on LDcompta10 export for supplier invoice
FIX: #18399 Fix shipment validation email template override.
FIX: Accountancy - Debug Export Sage50 / CIEL Compta / CIEL Compta Evo (Format XIMPORT)
FIX: Accountancy - Rules to delete & modify transaction not applied in ledger & subledger
FIX: Accountancy - Search date on journal
FIX: Accountancy - SQL error on select journal on journal
FIX: Accountancy - SQL error when insert a manuel transaction
FIX: add include missing file '/core/actions_dellink.inc.php' in project card
FIX: avoid to have link to create bookmark on page to create bookmark
FIX: bad approver shown on holiday once approved
FIX: bad closing div on error message
FIX: cannot add time spentd when column ref is not displayed
FIX: Can't remove a permission of a group
FIX: Can't set cost price when product is not on purchase
FIX: compatibility postgresql
FIX: filter on status Draft in modulebuilder
FIX: holiday card: hooks uninitialized
FIX: Invoice - Missing button to reopen an abandoned situation invoice
FIX: Link of download main doc on vat list
FIX: look and field v14
FIX: Missing column Date validation in ledger & subledger
FIX: on admin/pdf.php (with javascript enabled) if you set some boolean confs then click on "save", all boolean values are reset
FIX: on supplier order, JOIN with product fourn price table must be done with fk_soc too to avoid display several times a same line (because of same supplier product ref)
FIX: postgresql filter select search extrafield
FIX: shipping validation workflow: 'ORDER_NEW' trigger called from wrong object
FIX: show info of company into user dropdown
FIX: totalDayAll hours in tasks
FIX: update product lot
FIX: using Tulip, deposit mask was not saved
FIX: #yogosha6907
***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users:
----------
NEW: Module Recruitment to follow application to job positions is now stable.
NEW: Feature to make Stock Inventories
NEW: Several security issues after a second private bug hunting campaign.
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
NEW: All main menu entries are using the picto of the module
NEW: Add a copy to clipboard button on some fields
NEW: Add an example of scheduled job to send email reminder for unpaid invoices
NEW: Add some color and picto for the direction of movement
NEW: add the column "Channel" into the list of orders
NEW: Add the column "alias" of company in the list of proposal, order, invoice
NEW: Add the column "Office phone" and "User mobile" in user list
NEW: Add the column "Price level" in thirdparty list
NEW: Add some company information in the dropdown login menu
NEW: Add edit/delete action icons on categories list pages
NEW: Add hidden option to auto load input line extrafield into new lines
NEW: Add import profile to import BOM
NEW: Add link picto to the stock movement on the detail of production
NEW: Add mass action "Set tag" for product/service, user, thirdparty, warehouse, project, bank account, members
NEW: Add bulk action Validate and Set to billed on order list.
NEW: Add possibility to exports userGroups fields on user exports
NEW: Can search on lots or serials into the quick search bar
NEW: Add support for Friday as a non working day
NEW: auto notification with module Notification can use templated emails
NEW: Can clone a cron job
NEW: Can create a lot from the list view (Look and feel standardization).
NEW: Can filter on extrafields date on lists
NEW: Can filter on rowid in list of blocked logs
NEW: Can hide columns "time consumed" on timesheet per week
NEW: Can set an employee on each social contribution
NEW: Can set order of execution of hooks
NEW: Can toggle FCKeditor on public/private notes
NEW: Check update availability for externals modules using a button on module page
NEW: Choose lines to use while creating intervention card from origin
NEW: Columns shipment method, payment mode, payment term in proposal and order list
NEW: Conf for default actioncomm status
NEW: Dictionary for availability - Add a column position
NEW: Can set a user related to a social contribution
NEW: ICS Direct debit can be set with a different value for each bank account
NEW: LDAP: usergroup search can be filtered
NEW: Make public bookmarks editable by admin users only
NEW: If main logo not defined, can use the squarred logo on login page
NEW: The manifest file can use the squared image if available
NEW: Enhance the multicurrency rate editor
NEW: Normalise Type company field with ajax combobox
NEW: preload product description on selection for customer propal/order/invoice
NEW: Search usergroups & resources
NEW: Setup Page for module creation with module builder enhancement #FoundationFunding
NEW: Show picto of module into the list of dictionaries
NEW: Show the total of payment on the payment confirmation page
NEW: The global setup for Mandatory fields can now be done on combo list too.
NEW: translate in "en_US" to complete PR 16980
NEW: Update the list of taxes available by default for France
NEW: Salary payment request and Salary payment are 2 different steps in workflow on Salary payment recording
NEW: VAT payment request and VAT payment are now 2 different steps in workflow on VAT payment recording
NEW: VAT report - Optimisation & collapse by rate
NEW: When a doc file is shared, link is visible from the main page of doc.
NEW: #16378 more E-Mail Contact substitution Values for better salutation
NEW: option to keep the "Automatically create the payment" checkbox empty on the tax creation page
Accountancy
NEW: Add FEC import
NEW: Add a confirmation form with options on export (for notified export and validate operations)
NEW: Add select date from/to in already bind customer and supplier list
NEW: FEC / FEC2 export - Add new field DateLimitReglmt
NEW: In ledger & journals, show link on bank transaction
NEW: Possibility to filter on journals in balance
NEW: Add a page to list subledger accounts
NEW: Multiselect journal code filter on journal / balance / ledger
NEW: Add first step to close fiscal year
Agenda
NEW: add support for Friday as a non working day
NEW: can show the leave dates/holidays on the agenda view
NEW: Support color for types of event
Bank
NEW: Bank Entries : display user linked to a salary or a taxes
NEW: Add bulk actions for Bank Transfer
ECM/GED
NEW: add DB fields note_public and note_private for ECM module
NEW: can filter files in ECM/GED on status Shared / Not shared
Invoices
NEW: add a check to avoid an invoice date in the future
NEW: add the total of margin in invoice list
NEW: can set a percentage when creating an invoice from another object
NEW: Support down payment on supplier invoice (& some adjustments)
Margin
NEW: add the total of margin in invoice list
NEW: add the total of margin in page by user
Members
NEW: #17292 default subscription amount by adherent type
NEW: option to automatically create a login/user when a new subscription of a member is done online
NEW: option to select membership type on the online payment page for membership subscription or renewal
Products
NEW: Add price min and price min including tax into product export
NEW: Add a ref in product customer price
NEW: customer ref for product customer prices
NEW: Set status of all variants when changing status of parent
Projects/Tasks
NEW: option to automatically close an open project when all its tasks are done (=progress 100%)
NEW: can show the project ref into PDF documents
NEW: when we add contacts/users to a project, ask to also affect them on tasks
NEW: Can hide columns "time consumed" on timesheet per week
Proposals
NEW: add bulk action to set a commercial proposal to status "Refused"
NEW: can set a warehouse in a proposal
NEW: date and user signature on proposal (Issue 16062) #16980
Shipment
NEW: add option in Workflow module to set a shipment as closed
TakePOS
NEW: delayed payment in TakePOS #14456?
NEW: display date range if exist in TakePOS
NEW: display resiliate status in TakePOS for member
NEW: edit sales lines rights in TakePOS
NEW: option for TakePOS to show the total price without tax
NEW: more permissions in TakePOS (can edit added line, can modify once order sent to kitchen)
Third Party / Contacts
NEW: add contact tag and bulk email status on the thirdparty + contact create form
NEW: can set a warehouse on a thirdparty
Tickets
NEW: can use captcha on public page to create a ticket #16347
NEW: can set if a ticket group is visible on public interface or not
Warehouse/Stock
NEW: Feature to make Stock Inventories
NEW: can make massive stock transfers from a CSV file
NEW: Stock movement list - add more complete date field
NEW: can set a warehouse in a proposal
NEW: can set a warehouse on a thirdparty
Website Module
NEW: #17113 Can upload a favicon in website module
NEW: add a new permission "Export website"
NEW: add last date of modification for website pages in the list of pages
NEW: Save old page with .old extension on disk when editing a website page
Workflows
NEW: add option in Workflow module to set a shipment as closed
for Admins
NEW: Add a security center page with all information and advices related to the security of your instance
NEW: Add a performance center page with all information and advices related to the performance of your instance
Modules
NEW: Module Recruitment is now stable
NEW: start new experimental module Event Organization Management
NEW: start new experimental module Partnership Management
NEW: start new experimental module Knowledge Management
NEW: start new experimental module Workstations Management
NEW: Check update availability for externals modules using a button on module page
Module SimplePOS is deprecated - TakePOS is recommended for the future
new Options
NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs
NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field
NEW: add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug"
NEW: add constant ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY to manage binding with accountancy account declared on thirdparty card
NEW: add constant MAIN_PRODUCT_PERENTITY_SHARED to manage some informations (Accounting account) when product is shared on several entities
NEW: add constant MAIN_COMPANY_PERENTITY_SHARED to manage some informations (Accounting account) when company is shared on several entities
For developers:
---------------
NEW: Can edit an object property in module builder
NEW: Add data-eec=1 for EEC countries on select for js interaction
NEW: Add experimental repair script to switch to dynamic row format and utf8mb4 encoding
NEW: Add function showValueWithClipboardCPButton() to add a copy/paste
NEW: Upgrade Stripe PHP lib to 7.67.0
NEW: Support sepa_debit in stripe paymentmethods list
NEW: Update doleditor.class.php for easily activate SCAYT
NEW: Add triggers in the function add_object_linked(), updateObjectLinked() and deleteObjectLinked()
NEW: Add triggers OBJECT_LINK_INSERT, OBJECT_LINK_UPDATE et OBJECT_LINK_DELETE in the function add_object_linked(), updateObjectLinked() and deleteObjectLinked()
NEW: can set a target image in dolcropresize function
NEW: can set a label as placeholder for combo lists
NEW: Add pagination on Get Products response API
NEW: Add the DefaultValues CRUD class
NEW: Extrafields of documents lines are inside the lines, not any more on separate TR
NEW: unit selection on object edit line
APIs
NEW: API add option $includeifobjectisused to get a product
NEW: API get the list of product ids only
NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc
NEW: add native compression in REST APIs
NEW: Product Variants API, add variant stock to response by parameter
NEW: Product API route added to get product stock and product with or without variants #13739 #17390
Hooks
NEW: hook printFieldListTitle for cabyprodserv.php
NEW: hook to allow external modules to add their own shortlist of recent objects
NEW: SQL-altering hooks in the turnover by product report
NEW: add form confirm hook on company card
NEW: add hook addSectionECMAuto method to add custom directory into ECM auto files
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Module SimplePOS is deprecated. If you need a POS module, please use the module TakePOS.
* The ICS value for direct debit or credit transfer is now stored on each bank account instead of into the global setup.
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods
* Field "total" renamed into "total_ht" for table llx_facture, llx_facture_rec for better field name consistency
* Field "tva" renamed into "total_tva" for table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency
* Field "total" renamed into "total_ttc" for table llx_propal, llx_supplier_proposal for better field name consistency
* If your database is PostgreSQL, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT)
* If your database is MySQL or MariaDB, you need at least version 5.1
* Function set_price_level() has been renamed into setPriceLevel() to follow camelcase rules
* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
***** ChangeLog for 13.0.4 compared to 13.0.3 *****
FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules).
FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling `ajax_autocompleter()`
FIX: #17919 pictures in docs.
FIX: #18006
FIX: Accountancy - if we define a date start, automatic binding try to continue to solve old binding
FIX: Accoutancy Limit date payment not registered on purchases operations
FIX: Can't edit replacement invoice
FIX: deposit can create credit note in payment conf
FIX: division by zero on create
FIX: holiday: balances not updated correctly with pgsql because of case sensitivity field
FIX: holiday: status filter parameter has been renamed but not in links it was used
FIX: List and Create Companies Left Menus
FIX: method exists
FIX: need to add payment sum to getlibstatus function in object linked block
FIX: permission to close a proposal when using advanced permissions
FIX: Problem of z-index with popup and top menu
FIX: same thing on supplier orders
FIX: Status of invoice when making a replacement invoice
FIX: update contact birthday alert
***** ChangeLog for 13.0.3 compared to 13.0.2 *****
FIX: 13.0 warning - missing quotes around 'label'
FIX: #16143 Old PG requires "()" on DROP FUNCTION
FIX: #16843
FIX: #17060
FIX: #17192 - With tz < 0, event is show in bad day on calendar views
FIX: #17363
FIX: #17476 releve.php: Fix SQL statement
FIX: #17967
Fix: #17906 : fix access denied
FIX: Accountancy - Import in general ledger
FIX: Accountancy - Quadra export - wrong data on credit
FIX: Accountancy - Warning on the pages of the preparatory statements of accounting entries
FIX: Add function price2num for rounding values in productAlertStock box
FIX: Add parameter to function price2num()
FIX: Cannot delete a batch material from item receipts
FIX: cast int
FIX: Change parameters MF to MS for price2num() function
FIX: create event from contact card preselect contact correctly
FIX: create sociales : keep values error form
FIX: dol_print_date for %a and %b with some timezone
FIX: email is not case sensitive
FIX: error for duplicate thirdparty found correctly returned by ws
FIX: Espadon PDF shippment model with long public note now working
FIX: esupplier order: error 500 when using packaging with product where it is not defined
FIX: Filter on debit/credit
FIX: Filter on supplier payment list
FIX: fix checkbox displayed according to module project setup parameters - work in progress
FIX: inconsistency in margin recording with option "Force to sale price"
FIX: invoice PDF generation after payment
FIX: mask selector fournisseur if module not activate
FIX: merge thirparty also work for bank URL entry
FIX: Missing extrafields into export of agenda record
FIX: missing parameter in select for POP
FIX: missing return edit if update error
FIX: missing token on dolGetButtonAction for action delete
FIX: payment creation: re-generate invoice PDF with correct display options
FIX: payment validation: invoices PDF were no re-generated, make it with correct display options
FIX: Periodicity by default on fiscal year, according to the now date, we have plus 1 year added
FIX: pgsql: prevent 'WHERE 1'
FIX: PHP version requirement in composer.json
FIX: project visibility field with two option
FIX: saving template email
FIX: search accented words in product description (consumption page)
FIX: Search on date in accountancy
FIX: selection of project for reception must use
FIX: shhhhhh ! There is nothing here...
FIX: Show input field checkbox selection
FIX: Show Ref.Supplier in LinkToObjectBlock
FIX: SQL Error show_contacts : socialnetworks
FIX: Start hour on ACCOUNTING_DATE_START_BINDING
FIX: supplier order: error 500 when using packaging with product where it is not defined
FIX: test must be === and not ==
FIX: test on link type
FIX: type link extrafield case for advanced target emailing
FIX: Write right on document
***** ChangeLog for 13.0.2 compared to 13.0.1 *****
FIX: 11.0 - $this->socid injected in query without checking for empty value
FIX: #16096 #16085 Any call of ajax pages must provide the token
FIX: #16296
FIX: #16325
FIX: #16341 : Fetch the Product ExtraFields in Shippment lines
FIX: #16366
FIX: #16393 Do not sanitize <!DOCTYPE html>
FIX: #16420 #16423 #16488 #16477
FIX: #16431
FIX: #16465
FIX: #16480
FIX: #16485
FIX: #16487
FIX: #16503
FIX: #16530
FIX: #16533
FIX: #16629
FIX: #16671 Can not generate zip file of documents in backup tool
FIX: Add "Now" link on social charges creation card
FIX: avoid undefined URL and missing token
FIX: Bad project filter in ticket list
FIX: Buttons to disable bindings not working
FIX: class not found when creating recuring invoice from invoice+discount
FIX: File attachment on lots/batches
FIX: handling $heightforinfotot when he's superior to a page height on Supplier Invoice
FIX: hourglass and hide button to pay
FIX: massaction validate invoice do not regenerate PDF
FIX: missing mp4 video mime
FIX: picto on shipment to reset qty to 0. Some quantities were not reset.
FIX: Protection to avoid #16504
FIX: rounding amount on card updating
FIX: rounding amount on social charges card updating
FIX: select list dependencies now work for ModuleBuilder sellist field
FIX: status in popup of member in widget
FIX: status on tooltip on widgets
FIX: Timezone management for datetime on list of events
FIX: Timezone management for datetime with modulebuilder and extrafields
FIX: Total_ht not show in contract link element
FIX: use post instead get
FIX: use var "saved_url" instead global var "$url"
FIX: Various payment - Missing fields for check transmitter & bank name
FIX: warning if setup of chart of account is not yet done.
FIX: wrong extension
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
FIX: 10.0 before crediting a withdrawal receipt, check whether it has been credited already.
FIX: 11.0 when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: create MO, Column 'tms' cannot be null
FIX: #14290 #15900
FIX: #16076 patch user/list.php for extrafields
FIX: #16077 patch wrong timezone
FIX: #16079 error of service date at duplicated invoice
FIX: #16080 mailing list title
FIX: #16084 DB error at projects
FIX: #16107
FIX: #16118 Timezone problem on some fields
FIX: #16131
FIX: #16135
FIX: #16143
FIX: #16156
FIX: #16160
FIX: #16165 Create customer discount without VAT
FIX: #16185
FIX: #16189 fix download/see check deposit PDF
FIX: #16215
FIX: Accountancy - label_operation is used instead of label_compte
FIX: Add critical price patch
FIX: Assignement of actors on tasks
FIX: Bad dates on info tabs
FIX: cash fence for takepos with multientity
FIX: CSRF errors on margin forms
FIX: encoding status in graph of vendor proposals
FIX: Fix detect dispached product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
FIX: hide/unhide external ICS calendars
FIX: link to create event when task is in a project with a thirdparty
FIX: Localtax must be converted with price2num
FIX: manage price min for PRODUIT_CUSTOMER_PRICES
FIX: Missing language ico
FIX: Must not be able to edit vat of all lines if not draft
FIX: Bad "htdocs" found into a path
FIX: removed no more used proc update_modified_column_date_m on pgsql (its presence triggered errors)
FIX: Vulnerability report by Ricardo Matias
FIX: select default mail template
FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql
FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label
FIX: SQL Error in group by with postgres or mysql strict mode
FIX: TakePOS : load date function
FIX: Timeout during import
FIX: Trigger on expense report was not fired
FIX: User creation of expense report not visible
FIX: warning when adding a line if $remise_percent is an empty string
FIX: status late on purchase orders
FIX: ODT generation very slow
FIX: amount in summary of report
FIX: VAT value when code contains number
FIX: payment term label on PDF
FIX: date selector when using reduced year (like on smartphone)
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
----------
NEW: Module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files.
NEW: Module Intracomm report
NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable.
NEW: Module Recruitment to manage Job position and applications.
NEW: Several security issues after a private bug bounty campaign.
NEW: Accountancy - add chart of sub accounts
NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules
NEW: Accountancy balance - add a menu entry to show subtotal by group
NEW: Accountancy - change menu disposition
NEW: Accountancy - on transfers, select the periodicity by default
NEW: Accountancy - add export for Gestinum (v3 & v5) #15180
NEW: new currency rate editor
NEW: Solve blocking feature. Can increase stock of a Kit without changing subproduct stock.
NEW: add a widget to show the customers with outstanding limits reached
NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: add a counter of number of words for pages in website module
NEW: add a page to list Stock at a given date in the past
NEW: add a start date to begin binding in accountancy
NEW: add a statistics page to list popularity of products on invoices
NEW: add calendar selection for agenda view
NEW: Support documents generation for ticket edition (PDF or ODT)
NEW: add column payment term into list of supplier invoices
NEW: add column quantity in product margin page
NEW: add column vat rate in page to define accounting account on product/service
NEW: add costprice in fields of products list
NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
NEW: add employee link in expense report binding page
NEW: add EORI No. as ProfID5 #15382
NEW: add export for various payments
NEW: add Extrafields labels and values in mail on create ticket
NEW: add Extrafields support on ECM module
NEW: add filter rules "is answer" and "is not answer" in email collector
NEW: add focus when editing on product/stock/product.php -> close #14548
NEW: add free text on each terminal of cash desk
NEW: add global search for customer payments and vendor payments
NEW: add global search for miscellaneous payments
NEW: add helper function for table headers with numbers
NEW: add link to edit property from the search result of website pages
NEW: add link to reset qty on supplier dispatch page
NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header stored by email collector
NEW: add Manufacturing Orders attached files into the automatic ECM view
NEW: add margin info in invoice list
NEW: add mass action to set category on a list of website pages
NEW: add mass deletion for events
NEW: add mass deletion for draft invoices
NEW: add more filters on monthly statement list
NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
NEW: add option to define a default warehouse at user level
NEW: add option to include products without alert in replenish
NEW: add order by lastname and firstname by default in get sales representatives
NEW: add PDF document templates for warehouses (list of stock)
NEW: add a prospect status for the contact with managment of custom icon
NEW: add public note on products ; this also partially fix the #14342
NEW: add quick dropdown menu in top right menu (experimental with MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)
NEW: add region in export companies and contacts
NEW: add rights on margin info on invoice list
NEW: add search param for close date on order list
NEW: add show preview for mail attachement on form mail
NEW: add State/Province origin for products
NEW: add the workflow interaction close intervention on closing ticket
NEW: add tracking number in list and search_all items
NEW: add vcard for adherent and user
NEW: add week number for month view in agenda
NEW: Algeria data (VAT and forme_juridique)
NEW: allow click on all header numbers on commerce area
NEW: allow to reopen interventions (green button)
NEW: allow zero quantity on supplier/vendor order line
NEW: better currency rate editor
NEW: can build vendor invoice from vendor orders
NEW: can change a product in lines of a recurring invoice or contract
NEW: can set the size of the logo on PDF documents
NEW: can change VAT rate of all lines of a draft object in one step
NEW: can define date range of validity of a login during creation
NEW: can disable, from edit page, the whole web site
NEW: can edit and set sales representatives directly on thirdparty card
NEW: can edit the list of sending email profiles
NEW: can enable/disable users in bulk actions
NEW: can filter on accounting system ref in export of chart of account
NEW: can filter on container type, language and tags in the list of web pages
NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_EATBY and PRODUCT_DISABLE_SELLBY
NEW: can import proposals, sales orders, supplier invoices
NEW: can set a dedicated SMTP config for sending email from public ticket interface
NEW: can set tags/categories to website pages
NEW: can set type of price without tax per default for new sale price creation
NEW: can use desired stock of a given warehouse for replenishment
NEW: common behavior for monthly leave list view
NEW: convert all subscription in datetime
NEW: date shipment from order accepts hours
NEW: price level compatibility for variant
NEW: display stat for BOM on "object referent"/linked Object product tab
NEW: Email configuration - allow auto signed certificate when smtp ssl activated
NEW: enable free emails input with select2
NEW: Events in agenda for contact
NEW: filter on progress column in task list
NEW: filter product list by country and/or state/province
NEW: format tickets sent by mail in public interface
NEW: form to add customer/supplier into categories
NEW: Framework is ready for CSRF token protection on explicit GET URLs
NEW: helper functions for export with phpspreadsheet
NEW: hide closed contract lines
NEW: hide label in PDF for variants
NEW: if specific help page is available, we change color of icon
NEW: include the tag editor of page as a popup into website editor
NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: introducing new modal boxes in TakePOS
NEW: keep TakePOS terminal when login/logout
NEW: link on balance to the ledger
NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
NEW: more filter for "View change logs"
NEW: multiselect type and date to date filter
NEW: new line template: hidden conf to fill service dates from the last service line
NEW: PDF model storm for delivery
NEW: possibilty to group payments by mode and show their subtotal
NEW: Priority and transparency from external calendar events
NEW: Products - Nature of product is now a dictionary #13287
NEW: Products Import/Export 'default warehouse' and 'use batch number' fields
NEW: Purchase price table: added filterable table columns
NEW: rate editor for multicurrency
NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines
NEW: remove new lines in mail on add ticket message
NEW: Rule "email to" accept wildcard *
NEW: save filter of the project homepage
NEW: select-able columns on customer and supplier invoice paymnet list
NEW: select-able columns on miscellaneous payments + more data columns
NEW: select-able columns on social taxes list
NEW: send context and remove new lines on create ticket
NEW: show category filter on lists only when user have rights to read categories
NEW: show header number and make it clickable in warehouse area, payment area, shipment area
NEW: show image of user in the combo select of users
NEW: show label on batch card
NEW: show links for select and multi-select in category extra field
NEW: show module and permission ids on user/group rights (only admin)
NEW: show place from events on import calender
NEW: show references in contract form on interventions
NEW: show tags and status in search list of website pages
NEW: show user on external calender events (when found)
NEW: subject title with company name instead of application title in ticket message
NEW: Support for Samba4 AD
NEW: TakePOS appearance tab with more visual parameters
NEW: TakePOS add alert before changing thirdparty
NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS add delayed payment
NEW: TakePOS display date range if exist
NEW: TakePOS display resiliate status for members
NEW: TakePOS Gift Receipt
NEW: TakePOS multicurrency compatibility
NEW: TakePOS multicurrency total
NEW: TakePOS print payment method and change
NEW: TakePOS restrict thirdparty to customer
NEW: TakePOS show available stock
NEW: TakePOS Weighing Scale compatibility with TakePOS connector #14725
NEW: Thirdparty Import new fields: mother company,outstanding debt limit,bank account,incoterms
NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late
NEW: Ticket classification on create from email collector
NEW: Ticket message notifications when edited from public interface
NEW: Ticket translate classification labels in ticket
NEW: VAT rate for Angola #15606
NEW: VAT and juridical status for Algeria
NEW: VAT report - Invert constant to show by default zero VAT in reports
NEW: website page fields selection
NEW: website - global header of a website can also have dynamic content
NEW: when creating a user from a member linked to a thirdparty, you can choose to create it as external or internal user
NEW: add clone button on miscellaneous payment
NEW: add option to put the product label in bold in the PDF templates if configured #15065
NEW: add option "If the feature to manage kits of module Stock is used, show details of subproducts of a kit on PDF."
For developers:
---------------
NEW: add __MEMBER_TYPE__ and __TYPE__ substitution key
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup
NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
NEW: can force the antivirus from conf file or autoprepend ini setup
NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object
NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations
NEW: OAuth SCOPE for Admin SDK
NEW: standardizes API thirdparties by email like other object
NEW: Triggers Attributes and Attributes values
NEW: add incoterms data into the substitution array
NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection
NEW: add validation of MX domain for emails
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
NEW: Graphics can be horizontal bars
NEW: add param to not show links when output tags
APIs
NEW: API get contacts list of a given order
NEW: API endpoint getContacts and clean results
NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
NEW: API get users by email / login
NEW: fetch contact by email with REST API
NEW: get state dictionnary by REST API
NEW: improve Product API for variant products
NEW: retrieve discount from invoice from API
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
HOOKs
NEW: add hook on propal card
NEW: add hooks on newpayment page to allow external payment modules
NEW: add hooks on stats pages
NEW: add formConfirm hook on product page
NEW: add two hooks printFieldListFrom and printFieldSearchParam
NEW: add hook "loginCheckSecurityAccess"
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The object "livraison" has been renamed into "delivery" (directory, class, keys, methods with livraison in name ...).
* All properties ->contactid have been renamed into ->contact_id
* All properties ->titre have been renamed into ->title
* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id
* Property 'num_paiement' has been renamed 'num_payment' everywhere for better code consistency.
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace it with __USER_SIGNATURE__ if you used the old syntax in your email templates.
* The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday.
* If you build a class that implement CommonObject to use the incoterm properties or methods (->fk_incoterm, ->label_incoterm, ->location_incoterm),
you must now also include declaration of the Trait 'CommonIncoterm' in your class. All incoterm functions were moved into this Trait.
* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml') so no html will be allowed. Use GETPOST(..., 'restricthtml') to accept HTML.
* If you have links in your code with '&action=add', '&action=update', '&action=delete' as a parameter, you must also add '&token='.newToken() as another parameter to avoid CSRF protection errors.
* The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of simple amount.
* The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed.
* Depreciate all methods with name ->valide(). Use instead methods ->validate().
* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used.
* Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
* Database transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code.
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
***** ChangeLog for 12.0.5 compared to 12.0.4 *****
FIX: before crediting a withdrawal receipt, check whether it has been credited already
@@ -884,7 +179,7 @@ FIX: Look and feel v12: First tab must be name of object
FIX: missing entity check
FIX: missing param for hook
FIX: Missing transaction on PO actions
FIX: MySQL Strict mode
FIX: MySql Strict mode
FIX: param entity in html form file
FIX: Problems on FEC format
FIX: round stock value on product list
@@ -903,7 +198,6 @@ FIX: Visualization rights correction on last modified contacts box
FIX: Wrong redirection
FIX: Yogosha report 4425 (backport)
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
FIX: DebugBar hides content at page bottom
@@ -992,8 +286,8 @@ FIX: SQL Problem in customer invoice list
FIX: SQL Problem in social contribution list
FIX: SQL Problem in supplier invoice list
FIX: SQL syntax error when editing extrafields
FIX: SQL type
FIX: TakePOS 12 hook
FIX: Sql type
FIX: takepos 12 hook
FIX: Update form erased extrafields that were hidden
FIX: Update of extrafields date
FIX: Update of extrafiels on draft object
@@ -1007,7 +301,7 @@ For users:
NEW: Module MO (Manufacturing Order) is available as stable module.
NEW: Receipt printer module moved from 'development' to 'experimental'
NEW: add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists
NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists.
NEW: add numbering module for TakePOS module
NEW: 2 new options when creating an invoice from time spent on a project : by period or by task
NEW: Accountancy add column thirdparty on binding page
@@ -1018,19 +312,19 @@ NEW: Accountancy - Add possibility to manage a short alternative label for accou
NEW: Accountancy - General ledger - Add an option to search not reconciled lines
NEW: Add accountancy code of thirdparty in contact and supplier export
NEW: support webp image format
NEW: add checkbox "overwrite if exists" into ECM/DMS module
NEW: Add checkbox "overwrite if exists" into ECM/DMS module
NEW: add a link to notes in members list
NEW: add a parameter to group same products in TakePOS
NEW: add a parameter to sort product by label in TakePOS
NEW: add a profil to import contact categories
NEW: add company extrafields into order export
NEW: Add a profil to import contact categories
NEW: Add company extrafields into order export
NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation
NEW: add const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons
NEW: add csv separator setup in module admin
NEW: add dedicated substitutions keys for extrafields of type date and datetime
NEW: add default warehouse for dispatch
NEW: add due date in feature "Export accounting documents"
NEW: add duration information for fichinter
NEW: Add due date in feature "Export accounting documents"
NEW: Add duration information for fichinter
NEW: Start support of Dark theme into ELDY theme
NEW: Add field author public alias for blog post on website module
NEW: Add "finished" field on product list
@@ -1215,29 +509,29 @@ Following changes may create regressions for some external modules, but were nec
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests with
HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
the HTML code of content (in such a case, sanitize data later)
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
by a "_" automatically when a reference (with a custom numbering mask that use it) is generated.
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
by a "_" automatically when a reference (with a custom numbering mask that use it) is generated.
* Library jflot (replace with chartjs) was removed.
* Library geoip (replaced with geoip2) was removed.
* Library geoip (replaced with geoip2) was removed.
* Hidden constant COMMANDE_VALID_AFTER_CLOSE_PROPAL was renamed into ORDER_VALID_AFTER_CLOSE_PROPAL.
* Object field ref_int is deprecated and set to 'not used', method to fetch object by only ref_int is not supported anymore.
* UserGroup class has been refactored with new architecture. Triggers of class UserGroup are now USERGROUP_CREATE, USERGROUP_MODIFY, USERGROUP_DELETE
* A new way to navigate between pages in list is available. To use it (not mandatory), you must:
- replace line $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- replace line $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste()
WARNING FOR DOLIWAMP USERS ONLY:
Only people that installed Dolibarr using the all-in-one auto-installer for Windows called "DoliWAMP" are concerned by the following warnings:
* DoliWAMP auto-installer for Windows is no more available on 32 bits systems. Use standard package if you need to use such architecture.
* It is not possible to migrate from an installation done with the old DoliWAMP auto-installer for Windows by using this new one.
You must make a backup of your database, make a fresh installation using the new installer and reload your backup.
Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but is not recommended as a production
solution on a local desktop since a local desktop computer has often no backup and security policy, or not as good as on a server (when there is one).
DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard packages for production.
Only people that installed Dolibarr using the all-in-one autoinstaller for Windows called "DoliWAMP" are concerned by the following warnings:
* DoliWAMP autoinstaller for Windows is not more available on 32bits systems. Use standard package if you need to use such architecture.
* It is not possible to migrate from an installation done with the old DoliWAMP autoinstaller for Windows by using this new one. You must make a backup
of your database, make a fresh installation using the new installer and reload.
* Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but was never recommanded as a production
solution on a local desktop since a desktop computer has not a backup and security policy as good as on a server (when there is one).
DoliWAMP remains a solution for fast test or demo purposes.
***** ChangeLog for 11.0.5 compared to 11.0.4 *****
@@ -1400,7 +694,7 @@ FIX: #13118
FIX: #13124
FIX: #13131
FIX: #13135
FIX: #13146
FIX: #13146
FIX: #13198
FIX: #13175
FIX: #13182
@@ -1467,7 +761,7 @@ FIX: Confusion between 'bank reconciled' and 'accounted'. Show both data.
FIX: Count of Stripe payment mode must take test/live into account
FIX: Creation of Stripe card from backoffice must return a clean message
FIX: CVE-201917223
FIX: CVE-201917223
FIX: CVE-201917223
FIX: CVE-2020-7994
FIX: CVE Need permission to be able to develop modules
FIX: #13053
@@ -1667,7 +961,7 @@ NEW: #4301
For Developers or integrators:
NEW: Compatible with PHP 7.4
NEW: Compatible with PHP 7.4
NEW: Code for extrafields uses the new array $extrafields->attributes
NEW: Can set a filter on object linked in modulebuilder.
NEW: Can defined a position of numbering submodules for thirdparties
@@ -1734,9 +1028,9 @@ Following changes may create regressions for some external modules, but were nec
* Removed function dol_micro_time. Use native PHP microtime instead.
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS.
* If your logo is no more visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible again.
* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'.
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* If your logo is no more visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible again.
* All properties 'libstatut', 'labelstatut', 'labelstatus' were renamed into 'labelStatus'.
* All properties 'labelstatusshort' and 'labelstatut_short' were renamed into 'labelStatusShort'.
* All properties 'type_libelle' were renamed into 'type_label'.
* Renamed property of thirdparty "statut_commercial" into "status_prospect_label"
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
@@ -1886,11 +1180,11 @@ FIX: wrong invoice id for fetchObjetctLinked
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
The unit were not saved correctly in database making calculation on shipments wrong.
The unit were not saved correctly in database making calculation on shipments wrong.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
FIX: #11702
FIX: #11702
FIX: #11861 No consistent code to manage measuring units
FIX: #11942
FIX: #12026
@@ -1952,7 +1246,7 @@ FIX: wrong test
FIX: XSS
FIX: Payment from POS ware not recorded.
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
VAT that includes a deposit without vat.
VAT that includes a deposit without vat.
***** ChangeLog for 10.0.2 compared to 10.0.1 *****
FIX: #10460 compatibility with MariaDB 10.4
@@ -2055,14 +1349,14 @@ FIX: Wrong variable. Must be PROJECT_HIDE_UNSELECTABLES
***** ChangeLog for 10.0.1 compared to 10.0.0 *****
FIX: #10930
FIX: #10984
FIX: #10984
FIX: reposition on "Build backup" button
FIX: #11400
FIX: #11412
FIX: #11460
FIX: #11460
FIX: #11463
FIX: #11466
FIX: #11492
FIX: #11492
FIX: #11498
FIX: #11505
FIX: #11506
@@ -2071,7 +1365,7 @@ FIX: #11509
FIX: #11537
FIX: #11543
FIX: #11553
FIX: #11576
FIX: #11576
FIX: #11584
FIX: #11590
FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface
@@ -2164,14 +1458,14 @@ FIX: wrong path sociales/index.php doesnt exist anymore
***** ChangeLog for 10.0.1 compared to 10.0.0 *****
FIX: #10930
FIX: #10984
FIX: #10984
FIX: reposition on "Build backup" button
FIX: #11400
FIX: #11412
FIX: #11460
FIX: #11460
FIX: #11463
FIX: #11466
FIX: #11492
FIX: #11492
FIX: #11498
FIX: #11505
FIX: #11506
@@ -2180,7 +1474,7 @@ FIX: #11509
FIX: #11537
FIX: #11543
FIX: #11553
FIX: #11576
FIX: #11576
FIX: #11584
FIX: #11590
FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface
@@ -2349,7 +1643,7 @@ NEW: Manage account sell_intra & sell_export in page accoutancy admin default pr
NEW: Manage loan schedule.
NEW: Manage status of member types.
NEW: Mass action "create bills" for validated reception
NEW: Measuring unit are now defined into an editable dictionary. Add product size/unit into product import.
NEW: Measuring unit are now defined into an editable dictionary. Add product size/unit into product import.
NEW: Template pdf 'canelle_reception' displays linked reception lines.
NEW: Moral/physic status can be defined at member type level
NEW: Pagination into list of time spent.
@@ -2412,7 +1706,7 @@ NEW: Enhance management of webhooks
NEW: Generation of doc by modulebuilder can include README and CHANGELOG
NEW: massfilesarea feature is possible for external modules
NEW: Show list of enabled modules in dol_print_error().
NEW: Simplification of CSS styles of default themes.
NEW: Simplification of CSS styles of default themes.
NEW: Clean code of a lot of deprecated code.
NEW: Add hidden option to set a search entry to the top
NEW: add hidden option DISPLAY_DISCOUNTED_SUPPLIER_PRICE
@@ -2432,8 +1726,8 @@ Following changes may create regressions for some external modules, but were nec
* The PHP extension php-intl is not mandatory and must be installed to have new features working correctly.
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming
* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming
convention of extension .inc.php for files to be included.
* All methods set_draft() were renamed into setDraft().
* Signatures of methods createFromClone() has been standardized. All methods requires the object User as first parameter.
@@ -2445,7 +1739,7 @@ Following changes may create regressions for some external modules, but were nec
* Deprecated property ->fk_departement is now ->state_id everywhere.
* Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr.
* Column llx_facture.facnumber change to llx_facture.ref
* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable
* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable
called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features.
@@ -4217,7 +3511,7 @@ Following changes may create regression for some external modules, but were nece
entities and to review completely the rights of the groups and the users.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retrieve the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
* The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint".
@@ -6963,7 +6257,7 @@ For users:
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
- Fix: [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
- Fix: Expedition creation, can retrieve product from other expedition
- Fix: Expedition creation, can retreive product from other expedition
For translators:
- Update language files.

34
DCO
View File

@@ -1,34 +0,0 @@
Developer Certificate of Origin
Version 1.1
Copyright (C) 2002 - Today, The Dolibarr team and its contributors.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

6
INSTALL Normal file
View File

@@ -0,0 +1,6 @@
INSTALL
-------
English: See README.md file.
French: Voir fichier README-FR.md.

View File

@@ -6,14 +6,12 @@
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg)
## LICENCE
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
## INSTALLER DOLIBARR
### Configuration simple
@@ -54,7 +52,6 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
- Suivez les instructions de l'installateur
## METTRE A JOUR DOLIBARR
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
@@ -67,11 +64,9 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
*Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
## CE QUI EST NOUVEAU
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
Voir fichier ChangeLog.
## CE QUE DOLIBARR PEUT FAIRE
@@ -87,17 +82,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Calendrier/Agenda partagé (avec export ical, vcal)
- Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...)
- Gestion de contrats de services
- Gestion de stock et inventaires
- Gestion de stock
- Gestion des expéditions
- Gestion des demandes de congès
- Gestion des notes de frais
- Gestion de recrutement
- GED (Gestion Electronique de Documents)
- EMailings de masse
- Réalisation de sondages
- Gestion d'adhérents
- Point de vente/Caisse enregistreuse
- (près de 100 modules disponibles en standard, près de 1000 autre sur la place de marché d'extensions)
-
### Autres modules
@@ -142,36 +135,31 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com).
## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
- Dolibarr ne contient pas de module de génération de feuille de paie.
- Dolibarr ne contient pas de module de Gestion de la paie.
- Les tâches du module de gestion de projets n'ont pas de dépendances entre elle.
- Dolibarr n'embarque pas de Webmail intégré nativement.
- Dolibarr ne fait pas le café (pas encore).
## DOCUMENTATION
La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org).
## CONTRIBUER
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
## CREDITS
Dolibarr est le résultat du travail de nombreux contributeurs depuis des années et utilise des librairies d'autres contributeurs.
Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
## ACTUALITES ET RESEAUX SOCIAUX
Suivez le projet Dolibarr project sur les réseaux francophones

170
README.md
View File

@@ -2,20 +2,16 @@
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
It's an Open Source Software suite (written in PHP with optional JavaScript enhancements) designed for small, medium or large companies, foundations and freelancers.
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelancers.
You can freely use, study, modify or distribute it according to its licence.
You can freely use, study, modify or distribute it according to its Free Software licence.
You can use it as a standalone application or as a web application to access it from the Internet or a LAN.
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
Dolibarr has a large community ready to help you, free forums and [preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org)
![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg)
![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_1920x1080.jpg)
## LICENSE
@@ -31,23 +27,19 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_DoliWamp)
- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian)
- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp)
- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
Releases can be downloaded from [official website](https://www.dolibarr.org/).
### Advanced setup
You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Versions).
#### Generic install steps:
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you know git as it makes it easier if you want to upgrade later):
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git):
`git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...)
@@ -71,7 +63,6 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Follow the installer instructions
### Saas/Cloud setup
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
@@ -79,173 +70,122 @@ If you don't have time to install it yourself, you can try some commercial 'read
## UPGRADING
Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
- At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
## WHAT'S NEW
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
## FEATURES
### Main application/modules (all optional)
- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
- Members/Membership/Foundation management
Product Management
- Products and/or Services catalog
- Stock / Warehouse management + Inventory
- Barcodes
- Batches / Lots / Serials
- Product Variants
- Bill of Materials (BOM)
- Manufacturing Orders
Customer/Sales Management
- Customers/Prospects + Contacts management
- Opportunities or Leads management
- Commercial proposals management
- Customer Orders management
- Contracts/Subscription management
- Interventions management
- Ticket System
- Shipping management
- Customer Invoices/Credit notes and payment management
- Point of Sale (POS)
Supplier/Purchase Management
- Suppliers/Vendors + Contacts
- Supplier (price) requests
- Purchase Orders management
- Delivery/Receiption
- Supplier Invoices/credit notes and payment management
- INCOTERMS
Finance / Accounting
- Invoices / Payments
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Donations management
- Loan management
- Margins
- Reports
Collaboration
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Projects & Tasks management
- Ticket System
- Surveys
HR
- Employee's leave requests management
- Expense reports
- Recruitment management
- Timesheets
- Customers, Prospects (Leads) and/or Suppliers directory + Contacts
- Members management
- Products and/or Services catalog
- Commercial proposals management
- Customer & Supplier Orders management
- Invoices and payment management
- Shipping management
- Warehouse/Stock management
- Manufacturing Orders
- Bank accounts management
- Direct debit orders management (European SEPA)
- Accounting management
- Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities or Leads management
- Projects & Tasks management
- Contracts management
- Interventions management
- Employee's leave requests management
- Expense reports
- Timesheets
- Electronic Document Management (EDM)
- Foundations members management
- Point of Sale (POS)
-
### Other application/modules
- Electronic Document Management (EDM)
- Bookmarks management
- Donations management
- Reporting
- Surveys
- Data export/import
- Barcodes
- Barcodes support
- Margin calculations
- LDAP connectivity
- ClickToDial integration
- Mass emailing
- RSS integration
- Skype integration
- Social platforms linking
- Payment platforms integration (PayPal, Stripe, Paybox...)
- Email-Collector
(around 100 modules available by default, 1000+ on the addon market place)
-
### Other general features
- Localization in most major languages
- Multi-Language Support
- Multi-Users and groups with finely grained rights
- Multi-Currency
- Multi-Company (by adding of an external module)
- Multi-currency
- Multi-company by adding of an external module
- Very user friendly and easy to use
- customizable Dashboard
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- APIs (REST, SOAP)
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
- APIs
- An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture)
- Support a lot of country specific features:
- Spanish Tax RE and ISPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
- Argentina invoice numbering using A,B,C...
- Compatible with [European directives] (https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with European GDPR rules
- ...
- Flexible PDF & ODT generation for invoices, proposals, orders...
- PDF or ODT generation for invoice, proposals, orders...
-
### System Environment / Requirements
- PHP
- MariaDB, MySQL or PostgreSQL
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)
- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
### Extending
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
## WHAT DOLIBARR CAN'T DO YET
These are features that Dolibarr does **not** yet fully support:
- Tasks dependencies in projects
- Payroll module
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
- No native embedded Webmail
- Dolibarr can't do coffee (yet)
## DOCUMENTATION
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](https://wiki.dolibarr.org).
## CONTRIBUTING
This project exists thanks to all the people who contribute.
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
A view on Contributors:
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
## CREDITS
Dolibarr is the work of many contributors over the years and uses some fine PHP libraries.
Dolibarr is the work of many contributors over the years and uses some fine libraries.
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on:
@@ -256,8 +196,6 @@ Follow Dolibarr project on:
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]

View File

@@ -1,103 +1,13 @@
# Security Policy
This file contains some policies about the security reports on Dolibarr ERP CRM project, one of the most popular Open Source ERP and CRM in the world.
## Supported Versions for security reports
| Version | Supported |
| --------- | ------------------ |
| <= 12.* | :x: |
| >= 13.* | :white_check_mark: |
## Supported Versions
| Version | Supported |
| -------- | ------------------ |
| <= 8.0.* | :x: |
| >= 9.0.* | :white_check_mark: |
## Reporting a Vulnerability
To report a vulnerability, please use GitHub security advisory at https://github.com/Dolibarr/dolibarr/security/advisories/new (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody)
## Hunting vulnerabilities on Dolibarr
We believe that future of software is online SaaS. This means software are more and more critical and no technology is perfect. Working with skilled security researchers is crucial in identifying weaknesses in our technology.
If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery.
Any type of denial of service attacks is strictly forbidden, as well as any interference with network equipment and Dolibarr infrastructure.
We recommand to install Dolibarr ERP CRM on your own server (as most Open Source software, download and use is free: https://www.dolibarr.org/download) to get access on every side of application.
### User Agent
If you try to find bug on Dolibarr, we recommend to append to your user-agent header the following value: '-securitytest-for-dolibarr'.
### Account access
You can install the web application yourself on your own platform/server so you get full access to application and sources. Download the zip of the files to put into your own web server virtual host from https://www.dolibarr.org/download
## Eligibility and Responsible Disclosure
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr however, only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
You must be the first reporter of the vulnerability (duplicate reports are closed).
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install softwate on your own platform.
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
## Scope for qualified vulnerabilities
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
* $dolibarr_main_prod must be set to 1 into conf.php
* $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value)
* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default)
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
* CSRF attacks are accepted when using a POST URL, but when using GET URL, they are validated only for creating, updating or deleting data resctricted from pages restricted to admin users.
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
Scope is the web application (back office) and the APIs.
## Qualifying vulnerabilities for reporting
* Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...)
* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose or into module "Web site" when permission to edit website content is allowed).
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
* Open redirect
* Broken authentication & session management
* Insecure direct object references
* CORS with real security impact
* Horizontal and vertical privilege escalation
* "HTTP Host Header" XSS
* Software version disclosure (for non admin users only)
* Stack traces or path disclosure (for non admin users only)
## Non-qualifying vulnerabilities for reporting
* "Self" XSS
* SSL/TLS best practices
* Denial of Service attacks
* Clickjacking/UI redressing
* Physical or social engineering attempts or issues that require physical access to a victims computer/device
* Presence of autocomplete attribute on web forms
* Vulnerabilities affecting outdated browsers or platforms
* Logout and other instances of low-severity Cross-Site Request Forgery
* Missing cookie flags
* Missing security-related HTTP headers which do not lead directly to a vulnerability
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
* Reports on features flagged as "experimental" or "development"
* Software version or private IP disclosure when logged user is admin
* Stack traces or path disclosure when logged user is admin
* Any vulnerabilities due to a configuration different than the one defined into chapter "Scope for qualified vulnerabilities".
To report a vulnerability, please send an email to security@dolibarr.org
In most cases, after fixing the security, we make an answer by email to say the issue has been fixed.

102
build.xml Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Script build for hudson CI -->
<project name="dolibarr" default="hudson" basedir=".">
<!-- Exclude/ignore paths -->
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
<target name="clean">
<!-- Clean up -->
<delete dir="${basedir}/hudson"/>
<delete dir="${basedir}/generatedJUnitFiles"/>
<!-- Create build directories -->
<mkdir dir="${basedir}/hudson/doxygen"/>
<mkdir dir="${basedir}/hudson/logs"/>
<mkdir dir="${basedir}/hudson/coverage"/>
</target>
<!-- Run phpmd, phpcpd, phpcs, doxygen and phploc in parallel -->
<target name="parallelTasks">
<parallel>
<!-- <antcall target="phpmd"/> -->
<antcall target="phpcpd"/>
<!-- <antcall target="phpcs"/> -->
<antcall target="doxygen"/>
<antcall target="phploc"/>
</parallel>
</target>
<!-- Generate pmd.xml -->
<!--
<target name="phpmd">
<exec executable="phpmd">
<arg line="htdocs xml codesize,unusedcode
-\-reportfile '${basedir}/hudson/logs/pmd.xml'
-\-ignore=${ignorepaths}
" />
</exec>
</target>
-->
<!-- Generate pmd-cpd.xml -->
<target name="phpcpd">
<exec executable="phpcpd">
<arg line=" --log-pmd '${basedir}/hudson/logs/pmd-cpd.xml'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
--min-tokens 70
--min-lines 20
htdocs
" />
</exec>
</target>
<!-- Generate phploc.csv -->
<target name="phploc">
<exec executable="phploc">
<arg line=" --log-csv '${basedir}/hudson/logs/phploc.csv'
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
htdocs
" />
</exec>
</target>
<!-- Generate checkstyle.xml -->
<target name="phpcs">
<exec executable="phpcs" dir="${basedir}">
<arg line=" --standard=${basedir}/dev/codesniffer/jenkins_ruleset.xml
--report=checkstyle
--report-file=${basedir}/hudson/logs/checkstyle.xml
--ignore=${ignorepaths},${ignoreregexp}
htdocs
"/>
</exec>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}" failonerror="true">
<arg line=" --configuration ${basedir}/test/phpunit/phpunittest.xml
--log-junit ${basedir}/hudson/logs/junit.xml
--coverage-clover ${basedir}/hudson/coverage/clover.xml
--coverage-html ${basedir}/hudson/coverage/
test/phpunit/AllTests.php
"/>
</exec>
</target>
<!-- Generate Doxygen documentation -->
<target name="doxygen" description="Dolibarr documentation" >
<exec executable="doxygen" dir="${basedir}" failonerror="false">
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
</exec>
</target>
<target name="hudson" depends="clean,phpunit,phpcs,parallelTasks"/>
</project>

View File

@@ -1,64 +1,48 @@
README (English)
Path: /dolibarr/build/README
##################################################
Building packages
##################################################
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
The build directory and all its contents is absolutely not required to make Dolibarr working.
It is here only to build Dolibarr packages, and those generated packages will not contains this "build" directory.
There are several tools:
- To build full Dolibarr packages, launch the script
> Launch command perl makepack-dolibarr.pl
--------------------------------------------------------------------------------------------------
Prerequisites to build tgz, debian and rpm packages:
Note: Prerequisites to build tgz, debian, rpm package
> apt-get install tar dpkg dpatch p7zip-full rpm zip
--------------------------------------------------------------------------------------------------
Prerequisites to build autoexe DoliWamp package:
Note: Prerequisites to build autoexe DoliWamp package:
> apt-get install wine q4wine
> Launch "wine cmd" to check a drive Z: pointing to / exists.
> Install InnoSetup
For example by running isetup-5.5.8.exe (https://www.jrsoftware.org) https://files.jrsoftware.org/is/5/
> Install WampServer into "C:\wamp64" to have Apache, PHP and MariaDB
For example by running wampserver3.2.0_x64.exe (https://www.wampserver.com).
See file build/exe/doliwamp.iss to know the doliwamp version currently setup.
For example by running isetup-5.3.9.exe (http://www.jrsoftware.org)
> Install WampServer into "C:\Program Files\Wamp"
For example by running wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe (http://www.wampserver.com)
> Install WampServer addon to have versions: Mysql5.0.45
For example by running WampServer2-MYSQL5045.exe (http://www.wampserver.com)
> To build from Windows (running from makepack-dolibarr.pl script is however
recommanded), open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
> Add path to ISCC into PATH windows var:
Launch wine cmd, then regedit and add entry int HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\PATH
> To build manually the .exe from Windows (running from makepack-dolibarr.pl script is however recommanded),
open file build/exe/doliwamp.iss and click on button "Compile".
The .exe file will be build into directory build.
--------------------------------------------------------------------------------------------------
- To build a theme package, launch the script
> perl makepack-dolibarrtheme.pl
--------------------------------------------------------------------------------------------------
- To build a package for a module, launch the script
> perl makepack-dolibarrmodule.pl
--------------------------------------------------------------------------------------------------
- To build developper documentation, launch the script
> perl dolibarr-doxygen-build.pl
--------------------------------------------------------------------------------------------------
Note:
The build directory and all its contents is absolutely not required to make
Dolibarr working. It is here only to build Dolibarr packages, and those
generated packages will not contains this "build" directory.
You can find in "build", following sub-directories:
@@ -75,9 +59,6 @@ To build Mac OS package (not ready yet).
* doap:
To build Doap descriptor to promote/describe Dolibarr releases.
* docker:
To deploy Dolibarr with docker.
* doxygen:
Dir with config file to build doxygen documentation.
@@ -85,12 +66,12 @@ Dir with config file to build doxygen documentation.
To build exe package for Windows that distribute Dolibarr sources or
to build the complete DoliWamp package.
* gource:
To build the video of history of git changes.
* launchpad:
Doc file to explain how to use launchpad.
* live:
Doc file to explain how to create a demo live CD.
* obs:
Doc file to explain how to push release onto OBS.
@@ -109,8 +90,5 @@ To build Redhat, Opensuse or Mandriva package.
* tgz:
To build a tgz package.
* travis-ci:
Used by travis to make CI.
* zip:
To build a zip package.

View File

@@ -51,17 +51,16 @@ export DEBEMAIL="eldy@destailleur.fr"
export QUILT_PATCHES=debian/patches
# Note: alioth.debian.org is outdated --> https://alioth-archive.debian.org/ --> https://salsa.debian.org/public
* Create an account login
* Update your ~/.ssh/config file to add:
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org
# To use Alioth.debian.org
* Create an account login
* Update your ~/.ssh/config file to add:
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org
User eldy-guest
IdentityFile ~/.ssh/id_rsa
* Check login on page https://alioth.debian.org/users/login
Ex: https://alioth.debian.org/users/eldy-guest
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH
* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
* Check login on page https://alioth.debian.org/users/login
Ex: https://alioth.debian.org/users/eldy-guest
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH
* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
@@ -83,7 +82,7 @@ export QUILT_PATCHES=debian/patches
# dpkg -c package.deb List content of package
# dpkg -I package.deb Give informations on package
# dpkg -i package.deb Install a package
# dpkg-reconfigure -plow package Reconfigure package
# dpkg-reconfigure -plow package Reconfigure package
# dpkg -L packagename List content of installed package
# dpkg -r packagename Remove config files and interactive saved answers
# dpkg -s packagename Give status of installed package
@@ -91,7 +90,7 @@ export QUILT_PATCHES=debian/patches
#
# dpkg-buildpackage -us -uc Build a source and binary package
#
# gdebi package.deb Install a package + dependencies
# gdebi package.deb Install a package + dependencies
@@ -99,21 +98,21 @@ export QUILT_PATCHES=debian/patches
- Post an ITP with reportbugs :
> reportbug -B debian --email username@domain.tld wnpp
See page https://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents.
See page http://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents.
- Wait until you received bug number.
For first ITP submission of Dolibarr, bug id was 634783.
- Check bug is into database by searching with id on
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783
- Add a line for upstream into file changelog with bug number
- Call for a mentor on ML debian-mentors to upload packages
- Once package is uploaded, following URL are available:
https://packages.qa.debian.org/package.html
https://bugs.debian.org/package
http://packages.qa.debian.org/package.html
http://bugs.debian.org/package
##### Modify severity of a bug ticket
@@ -307,7 +306,7 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER
- htdocs/includes/jquery/plugins/datatables
- htdocs/includes/jszip
- htdocs/includes/mike42
- htdocs/includes/phpoffice
- htdocs/includes/phpexcel or htdocs/includes/phpoffice
- htdocs/includes/restler/framework/Luracast/Restler/explorer
- htdocs/includes/swiftmailer
- htdocs/includes/tcpdf or htdocs/includes/tecnickcom

View File

@@ -232,7 +232,7 @@ $dolibarr_main_prod='0';
# Examples:
# $dolibarr_mailing_limit_sendbycli='0';
# dolibarr_main_distrib
# dolibarr_distrib
# A key to identify the distribution used for first installation
$dolibarr_main_distrib = 'debian';
$dolibarr_distrib = 'deb';

View File

@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
# Uploaders: Laurent Destailleur (eldy) <eldy@users.sourceforge.net> # Only if differs from Maintainer
Standards-Version: 3.9.6
Homepage: https://www.dolibarr.org
Homepage: http://www.dolibarr.org
Build-Depends: debhelper (>= 9), po-debconf
# This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
@@ -33,7 +33,7 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
Recommends: apache2 | lighttpd | httpd,
mariadb-server | virtual-mysql-server,
# Required PHP extensions for debian 9 but we can't add them into a Depends, it does not exists on debian 7 and 8
php-xml, php-mbstring, php-intl
php-xml, php-mbstring
Suggests: www-browser, php5-geoip
Description: Web based software to manage a company or foundation
Dolibarr ERP & CRM is an easy to use open source/free software package for

View File

@@ -1,4 +1,4 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: https://www.dolibarr.org/files/stable/standard/
@@ -37,8 +37,7 @@ Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
2010, Servitux Servicios Informaticos <info@servitux.es>
2011, Herve Prot <herve.prot@symeos.com>
2011, Remy Younes <ryounes@gmail.com>
2012-2013, Christophe Battarel <christophe.battarel@altairis.fr>
2012-2013, Christophe Battarel <christophe.battarel@altairis.fr>
License: GPL-3+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
@@ -57,9 +56,7 @@ License: GPL-3+
.
On Debian systems, the full text of the GNU General Public
License version 3 can be found in the file
'/usr/share/common-licenses/GPL-3'.
------------------------------------------------------------
`/usr/share/common-licenses/GPL-3'.
Files: htdocs/includes/adodbtime/*
Copyright: 2003-2005, John Lim
@@ -83,9 +80,6 @@ Comment:
Those files are not shipped in the binary package since we use
the library as packaged in "libphp-adodb".
------------------------------------------------------------
Files: htdocs/includes/ckeditor/*
Copyright: 2003-2012 CKSource - Frederico Knabben
License: GPL-2+
@@ -115,9 +109,6 @@ Comment:
Those files are not shipped in the binary package since we use the
library as packaged in "ckeditor".
------------------------------------------------------------
Files: htdocs/includes/fonts/*
Copyright: 2003, Bitstream Inc
unknown, Gavin Graham
@@ -167,10 +158,7 @@ License: other
Comments:
Those files are not shipped in the binary package as we
configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core".
------------------------------------------------------------
Files: doc/images/*
Copyright: Laurent Destailleur
License: CC-BY-SA-3.0
@@ -186,15 +174,33 @@ License: CC-BY-SA-3.0
distribute the resulting work only under the same, similar or a compatible
license.
.
For more information, see https://creativecommons.org/licenses/by-sa/3.0/
For more information, see http://creativecommons.org/licenses/by-sa/3.0/
Files: htdocs/includes/fpdfi/*
Copyright: 2004-2011 Setasign - Jan Slabon
License: GPL-2+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.
.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
Files: htdocs/includes/geoip2/*
Files: htdocs/includes/geoip/*
Copyright: 2007 MaxMind LLC
License: CC-By-SA
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@@ -210,14 +216,10 @@ License: CC-By-SA
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
'/usr/share/common-licenses/LGPL-2.1'.
------------------------------------------------------------
`/usr/share/common-licenses/LGPL-2.1'.
Files: htdocs/includes/jquery/*
Copyright: JQuery team
https://www.jquery.com
License: GPL-2+ or MIT
=== GPL-2+ LICENSE NOTICE ===
.
@@ -238,7 +240,7 @@ License: GPL-2+ or MIT
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
'/usr/share/common-licenses/GPL-2'.
`/usr/share/common-licenses/GPL-2'.
.
=== MIT LICENSE ===
.
@@ -265,8 +267,6 @@ Comment:
"libjs-jquery-ui". Most of the plugins are shipped though.
------------------------------------------------------------
Files: htdocs/includes/jquery/plugins/flot/*
Copyright: Flot team
License: Public-Domain
@@ -275,9 +275,6 @@ Comment:
Those files are not shipped in the binary package because we configure
Dolibarr to use the files provided by "libjs-flot".
------------------------------------------------------------
Files: htdocs/includes/jsgantt/*
Copyright: JSGantt team
License: GPL-2+
@@ -298,10 +295,7 @@ License: GPL-2+
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
'/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/nusoap/*
Copyright: 2002-2010 NuSphere Corporation
@@ -321,14 +315,11 @@ License: LGPL-2.1+
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
'/usr/share/common-licenses/LGPL-2.1'.
`/usr/share/common-licenses/LGPL-2.1'.
Comment:
Those files are not shipped in the binary package since we
configure Dolibarr to use the library provided in "libnusoap-php".
------------------------------------------------------------
Files: htdocs/includes/odtphp/*
Copyright: 2008, Julien Pauli
2008, Cyril PIERRE de GEYER
@@ -351,12 +342,29 @@ License: GPL-2+
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
'/usr/share/common-licenses/GPL-2'.
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/phpexcel/*
Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
------------------------------------------------------------
Files: htdocs/includes/tecnickcom/*
Files: htdocs/includes/tcpdf/*
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD
License: LGPL-3.0+
TCPDF is free software: you can redistribute it and/or modify it

View File

@@ -23,7 +23,7 @@ setup_empty_conf() {
mkdir -p /etc/dolibarr
touch /etc/dolibarr/conf.php
chown root:www-data /etc/dolibarr/conf.php
chmod 660 /etc/dolibarr/conf.php
chmod 664 /etc/dolibarr/conf.php
}
is_new_upstream_version() {
@@ -150,6 +150,7 @@ case "$1" in
##grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
#grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
##grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
##grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
#grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@@ -24,7 +24,6 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='debian';
// Value to overwrite path to use shared libraries/fonts instead of embedded one.
// If during install, we enable/disable declaration to use non embedded libraries, we must also check they are
@@ -35,6 +34,7 @@ $force_install_distrib='debian';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
//$force_dolibarr_lib_PHPEXCEL_PATH=''; // Use '' or 'disabled'
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor'; // Use '/javascript/ckeditor' or 'disabled'
//$force_dolibarr_js_JQUERY='/javascript/jquery';
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';

View File

@@ -103,6 +103,8 @@ override_dh_install:
# clean from useless files
rm -fr htdocs/includes/jquery/plugins/multiselect
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PDF
rm -fr htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip
rm -fr htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-2.33
rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919
rm -fr htdocs/includes/tcpdf/fonts/utils
@@ -111,6 +113,7 @@ override_dh_install:
# Licence files are already included into copyright file.
rm -f htdocs/includes/jquery/plugins/flot/LICENSE.txt
rm -f htdocs/includes/phpexcel/license.txt
rm -f htdocs/includes/tcpdf/LICENSE.TXT
# Drop unwanted executable permissions

View File

@@ -1,63 +1,38 @@
FROM php:7.3-apache
FROM php:7.2-apache
ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC'
ENV PHP_INI_MEMORY_LIMIT 256M
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg62-turbo-dev \
libjpeg62-turbo \
libpng-dev \
libpng16-16 \
libldap2-dev \
libxml2-dev \
libzip-dev \
zlib1g-dev \
libicu-dev \
g++ \
default-mysql-client \
unzip \
curl \
apt-utils \
msmtp \
msmtp-mta \
mailutils \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install -j$(nproc) calendar intl mysqli pdo_mysql gd soap zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install -j$(nproc) ldap && \
mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \
&& docker-php-ext-install zip \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \
&& docker-php-ext-install mysqli \
&& docker-php-ext-install calendar \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++
RUN mkdir /var/documents
RUN chown www-data:www-data /var/documents
RUN chown www-data /var/documents
COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'localhost docker.host' >> /etc/hosts
# set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc
RUN echo "auth off" >> /etc/msmtprc
RUN echo "port 25" >> /etc/msmtprc
RUN echo "host mail" >> /etc/msmtprc
RUN echo "from local@localdomain.com" >> /etc/msmtprc
RUN echo "domain localhost.localdomain" >> /etc/msmtprc
RUN echo "sendmail_path=/usr/bin/msmtp -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini
RUN echo "localhost localhost.localdomain" >> /etc/hosts
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_host=docker.host' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini
RUN echo '172.17.0.1 docker.host' >> /etc/hosts
EXPOSE 80

View File

@@ -1,8 +1,6 @@
# How to use it ?
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
This docker image intended for developpement usage.
For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr
Before build/run, define the variable HOST_USER_ID as following:
@@ -16,7 +14,7 @@ And then, you can run :
docker-compose up
This will run 4 containers Docker : Dolibarr, MariaDB, PhpMyAdmin and MailDev.
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
The URL to go to the Dolibarr is :
@@ -25,10 +23,6 @@ The URL to go to the Dolibarr is :
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080
In Dolibarr configuration Email let PHP mail function, To see all mail send by Dolibarr go to maildev
http://0.0.0.0:8081
Setup the database connection during the installation process, please use mariadb (name of the database container) as database host.
Setup documents folder, during the installation process, to /var/documents
Setup the database connection during the installation process, please use mariad
b (name of the database container) as database host.

View File

@@ -1,57 +1,25 @@
version: '3'
mariadb:
build: mariadb
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dolibarr
networks:
internal-pod:
internal: true
external-pod:
internal: false
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: mariadb
links:
- mariadb
ports:
- "8080:80"
services:
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dolibarr
ports:
- "3306:3306"
networks:
- internal-pod
- external-pod
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: mariadb
depends_on:
- mariadb
ports:
- "8080:80"
networks:
- internal-pod
- external-pod
web:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
volumes:
- ../../htdocs:/var/www/html/
- ../../documents:/var/documents
ports:
- "80:80"
- "9000:9000"
depends_on:
- mariadb
- mail
networks:
- internal-pod
- external-pod
mail:
image: maildev/maildev
ports:
- "8081:80"
- "25:25"
networks:
- internal-pod
- external-pod
web:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
volumes:
- ../../htdocs:/var/www/html
links:
- mariadb
ports:
- "80:80"

View File

@@ -1,21 +1,15 @@
#!/bin/bash
usermod -u ${HOST_USER_ID} www-data
groupmod -g ${HOST_USER_ID} www-data
usermod -u $HOST_USER_ID www-data
groupmod -g $HOST_USER_ID www-data
chgrp -hR www-data /var/www/html
chmod g+rwx /var/www/html/conf
if [ ! -d /var/documents ]; then
echo "[docker-run] => create volume directory /var/documents ..."
mkdir -p /var/documents
fi
echo "[docker-run] => Set Permission to www-data for /var/documents"
chown -R www-data:www-data /var/documents
if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE
display_errors = On
EOF
fi

View File

@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dolibarr source code documentation</title>
<title>$title</title>
<!-- from dolibarr.org -->
<meta http-equiv="Content-Type" content="text/html" charset=utf-8 />
<meta name="verify-v1"

View File

@@ -5,7 +5,6 @@ It's a dedicated Dolibarr version for Windows newbies with no technical knowledg
This directory contains files used by *makepack-dolibarr.pl* script to build the all-in-on .EXE package DoliWamp, ready
to be distributed (for Windows).
The build of .exe files need to have some windows executable files already installed (Apache, MariaDb). The package to install to get this files are defined into the file *doliwamp.iss* (searhc line starting with "; Value OK:")
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).

View File

@@ -118,7 +118,7 @@ Source: "C:\wamp64\bin\mariadb\mariadb10.4.10\*.*"; DestDir: "{app}\bin\mariadb\
;Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mariadb\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
; Dolibarr
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"

View File

@@ -22,7 +22,6 @@ $force_install_databaserootpass='WAMPMYSQLNEWPASSWORD';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='644';
$force_install_distrib='doliwamp';
$force_install_module='';
?>

View File

@@ -22,9 +22,7 @@
* \brief This script create a xml checksum file
*/
if (! defined('NOREQUIREDB')) {
define('NOREQUIREDB', '1'); // Do not create database handler $db
}
if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
@@ -32,8 +30,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
require_once $path."../htdocs/master.inc.php";
@@ -48,33 +46,30 @@ $includecustom=0;
$includeconstants=array();
if (empty($argv[1])) {
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
}
parse_str($argv[1]);
$i=0;
while ($i < $argc) {
if (! empty($argv[$i])) {
parse_str($argv[$i]);
}
if (preg_match('/includeconstant=/', $argv[$i])) {
$tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str()
if (count($tmp) != 3) {
print "Error: Bad parameter includeconstant=".$includeconstant."\n";
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
}
$i++;
if (! empty($argv[$i])) parse_str($argv[$i]);
if (preg_match('/includeconstant=/', $argv[$i])) {
$tmp=explode(':', $includeconstant, 3);
if (count($tmp) != 3) {
print "Error: Bad parameter includeconstant ".$includeconstant."\n";
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
}
$i++;
}
if (empty($release)) {
print "Error: Missing release paramater\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
print "Error: Missing release paramater\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
$savrelease = $release;
@@ -82,44 +77,42 @@ $savrelease = $release;
// If release is auto, we take current version
$tmpver=explode('-', $release, 2);
if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') {
$release=DOL_VERSION;
if ($tmpver[1] && $tmpver[0] == 'auto') {
$release.='-'.$tmpver[1];
}
$release=DOL_VERSION;
if ($tmpver[1] && $tmpver[0] == 'auto') $release.='-'.$tmpver[1];
}
if (empty($includecustom)) {
$tmpverbis=explode('-', $release, 2);
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') {
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
} else {
$tmpverter=explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0]) {
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}
$tmpverbis=explode('-', $release, 2);
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') {
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
} else {
$tmpverter=explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0]) {
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}
} else {
if (! preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
if (! preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Release : ".$release."\n";
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) {
foreach ($tmp as $constname => $constvalue) {
print $constname.'='.$constvalue." ";
}
foreach($tmp as $constname => $constvalue) {
print $constname.'='.$constvalue." ";
}
}
print "\n";
@@ -132,22 +125,17 @@ $checksumconcat=array();
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
$fp = fopen($outputfile, 'w');
if (empty($fp)) {
print 'Failed to open file '.$outputfile."\n";
exit(-1);
}
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n");
foreach ($includeconstants as $countrycode => $tmp) {
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach ($tmp as $constname => $constvalue) {
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
$checksumconcat[]=$valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
}
fputs($fp, '</dolibarr_constants>'."\n");
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach($tmp as $constname => $constvalue) {
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
$checksumconcat[]=$valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
}
fputs($fp, '</dolibarr_constants>'."\n");
}
fputs($fp, '<dolibarr_htdocs_dir includecustom="'.$includecustom.'">'."\n");
@@ -157,30 +145,27 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
// Need to ignore document custom etc. Note: this also ignore natively symbolic links.
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
*/
// Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
$regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir='';
$needtoclose=0;
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose)
fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
fputs($fp, ' </dir>'."\n");
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
@@ -208,23 +193,22 @@ $files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoincl
$dir='';
$needtoclose=0;
foreach ($files as $filetmp) {
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
}
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
$file = $filetmp['fullname'];
//$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose)
fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
}
}
fputs($fp, ' </dir>'."\n");
fputs($fp, '</dolibarr_script_dir>'."\n");

View File

@@ -390,9 +390,6 @@ if ($nboftargetok) {
$olddir=getcwd();
chdir("$SOURCE");
print "Clean $SOURCE/htdocs\n";
$ret=`rm -f $SOURCE/htdocs/includes/autoload.php`;
$ret=`git ls-files . --exclude-standard --others`;
if ($ret)
{
@@ -479,7 +476,6 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`;
$ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`;
$ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`;
@@ -507,10 +503,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/mysql/README`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/install/pgsql/README`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/sqlite3`;
$ret=`rm -fr $BUILDROOT/$PROJECT/node_modules`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`;
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
@@ -582,53 +575,52 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
# Removed other test files
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
# Removed files installed by the awful composer
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball for official debian, not for the rest
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/composer`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/doctrine`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/.github`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
}
# Build package for each target

View File

@@ -1,10 +1,9 @@
To make htmldoc working from wiki.dolibarr.org, the wiki must be modified to have
To make htmldoc working from wiki.dolibarr.org, them must be modified to have
To disable part of content, add:
class="htmldoc-ignore"
with css
.htmldoc-ignore { display: none; }
Note:
$_SERVER["HTTP_USER_AGENT"] is "HTMLDOC/x.y.z"
$_COOKIE["htmldoc"] may also be defined if set on command line.
To disable part, add
class="htmldoc-ignore" with css
.htmldoc-ignore { display: none; }

View File

@@ -1,4 +1,4 @@
#HTMLDOC 1.8.27
-t pdf14 -f "../../doc/dolibarr_en.pdf" --webpage --no-title --logoimage "../../doc/images/dolibarr_256x256.png" --linkcolor #2200c0 --linkstyle plain --size Universal --left 0.30in --right 0.30in --top 0.40in --bottom 0.30in --header ... --header1 ... --footer c/d --nup 1 --tocheader ... --tocfooter ... --portrait --color --no-pscommands --no-xrxcomments --compression=9 --jpeg=50 --fontsize 10.0 --fontspacing 1.0 --headingfont Helvetica --bodyfont Helvetica --headfootsize 9.0 --headfootfont Helvetica --charset iso-8859-1 --links --no-embedfonts --pagemode document --pagelayout single --firstpage p1 --pageeffect none --pageduration 10 --effectduration 1.0 --no-encryption --permissions all --owner-password "" --user-password "" --browserwidth 680 --no-strict --no-overflow
https://wiki.dolibarr.org/index.php/Home
https://wiki.dolibarr.org/index.php/What_Dolibarr_Does
http://wiki.dolibarr.org/index.php/Main_Page
http://wiki.dolibarr.org/index.php/What_Dolibarr_Do

View File

@@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2020 Regis Houssin <regis.houssin@inodbox.com>
# \author (c)2009-2019 Regis Houssin <regis.houssin@inodbox.com>
#----------------------------------------------------------------------------
@@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
return ( "10.0.0", "9.0.3", "8.0.5", "7.0.5", "6.0.8" );
}
sub script_dolibarr_release
@@ -77,16 +77,6 @@ if ($ver >= 3.6) {
push(@rv, "Dolibarr requires PHP version 5.3 or later");
}
}
if ($ver >= 12.0) {
# Check for PHP 5.6+
local $phpv = &get_php_version($phpver || 5, $d);
if (!$phpv) {
push(@rv, "Could not work out exact PHP version");
}
elsif ($phpv < 5.6) {
push(@rv, "Dolibarr requires PHP version 5.6 or later");
}
}
return @rv;
}
@@ -386,7 +376,7 @@ sub script_dolibarr_realversion
local ($d, $opts, $sinfo) = @_;
local $lref = &read_file_lines("$opts->{'dir'}/filefunc.inc.php", 1);
foreach my $l (@$lref) {
if ($l =~ /'DOL_VERSION',\s?'([0-9a-z\.\-]+)'/) {
if ($l =~ /'DOL_VERSION','([0-9a-z\.\-]+)'/) {
return $1;
}
}
@@ -400,8 +390,6 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
@@ -422,7 +410,7 @@ return $ver eq $vers[0] ? undef : $vers[0];
sub script_dolibarr_site
{
return 'https://www.dolibarr.org/';
return 'http://www.dolibarr.org/';
}
sub script_dolibarr_passmode

View File

@@ -1,9 +0,0 @@
PHPStan
https://phpstan.org
PHPStan requires PHP >= 7.1
Install: composer require --dev phpstan/phpstan
Config File: phpstan.neon

View File

@@ -3,54 +3,48 @@ README (English)
RPM Package tools
##################################################
This directory contains files used by makepack-dolibarr.pl script to build a package,
ready to be distributed with format RPM (https://rpm.org)
for Linux Distributions like Redhat, Fedora, CentOS, OpenSuse, OpenMandriva, Mageia ...
This directory contains files used by makepack-dolibarr.pl
script to build a package, ready to be distributed,
with format RPM (for Redhat, OpenSuse, Mandriva, ...).
# This is standard command to work on RPM packaging:
#
# To install all packagers tools:
- Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it
- OpenSuse: yast --install update-desktop-files
# Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it
# OpenSuse: yast --install update-desktop-files
#
# rpmlint file.rpm Test a package
# mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm
# On Fedora
# =========
# rpm -i --test dolibarr-...rpm to list dependencies of RPM
# yum -v install dolibarr-...rpm to install package and dependencies
# yum -v erase dolibarr to remove package
# chcon -R -h -t httpd_sys_script_rw_t /file to add temporary context rw for httpd on /file
# restorecon -R -v /file to restore values into files (cancel chcon, validate semanage)
# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" to add persistent context rw for httpd on /dir (this add file_contexts.local)
# On OpenSuse
# ===========
# zypper install dolibarr-...rpm to install package and dependencies
# zypper remove dolibarr to remove package
# zypper search xxx to search a package
# On Mageia (after su - root)
# ===========================
# urpmi dolibarr-...rpm to install package and dependencies
# urpme dolibarr to remove package
#
# On Fedora
# rpm -i --test dolibarr-...rpm To list dependencies of RPM
# yum -v install dolibarr-...rpm To install package and dependencies
# yum -v erase dolibarr To remove package
# chcon -R -h -t httpd_sys_script_rw_t /file To add temporary context rw for httpd on /file
# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" To add persistent context rw for httpd on /dir (this add file_contexts.local)
# restorecon -R -v /file Restore values into files (cancel chcon, validate semanage)
#
# On OpenSuse
# zypper install dolibarr-...rpm To install package and dependencies
# zypper remove dolibarr To remove package
# zypper search xxx To search a package
#
# On Mageia (after su - root)
# urpmi dolibarr-...rpm To install package and dependencies
# urpme dolibarr To remove package
#
# More on rpm on page http://www.trustonme.net/didactels/273.html
To submit a package to Fedora:
- Create account on https://bugzilla.redhat.com
- Create account on https://developer.fedoraproject.org/
- Create SRPMS package
- Upload package on https://fedorapeople.org
- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review
- Create account on bugzilla.redhat.com
- Create account on fedoraproject.org
- Create SRPMS package.
- Upload package onf http://fedorapeople.org
- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review
This is example of content of review field (used for Bug 723326 - https://bugzilla.redhat.com/show_bug.cgi?id=723326):
SRPMS URL: https://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm
SRPMS URL: http://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm
Description: Dolibarr ERP & CRM is an easy to use open source/free software
for small and medium companies, foundations or freelances. It includes
different features for Enterprise Resource Planning (ERP) and Customer
@@ -62,4 +56,4 @@ is my first package to maintain myself. So i'm seeking a sponsor.
- Install fedora packager tools: yum install fedora-packager
- Setup fedora packagers tools: fedora-packager-setup
- Send your package: koji build --scratch f16 path_to_source_RPM
- Check if package is available: https://koji.fedoraproject.org/koji/
- Check if package is available: http://koji.fedoraproject.org/koji/

View File

@@ -181,11 +181,9 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/delivery
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/eventorganization
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports
@@ -198,9 +196,8 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
@@ -208,14 +205,12 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/partnership
%_datadir/dolibarr/htdocs/paybox
%_datadir/dolibarr/htdocs/paypal
%_datadir/dolibarr/htdocs/printing
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@@ -230,7 +225,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch
@@ -279,6 +273,7 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@@ -67,8 +67,7 @@ Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring
Requires: mysql-server, mysql
Requires: php-mysqli >= 4.1.0
%endif
%endif%_datadir/dolibarr/htdocs/eventorganization
%endif
%endif
# Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse)
@@ -262,11 +261,9 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/delivery
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/eventorganization
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports
@@ -279,9 +276,8 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
@@ -289,14 +285,12 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/partnership
%_datadir/dolibarr/htdocs/paybox
%_datadir/dolibarr/htdocs/paypal
%_datadir/dolibarr/htdocs/printing
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@@ -311,7 +305,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch
@@ -430,6 +423,7 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@@ -177,12 +177,10 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/custom
%_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/delivery
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/eventorganization
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports
@@ -195,9 +193,8 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
@@ -205,14 +202,12 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/partnership
%_datadir/dolibarr/htdocs/paybox
%_datadir/dolibarr/htdocs/paypal
%_datadir/dolibarr/htdocs/printing
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@@ -227,7 +222,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch
@@ -276,6 +270,7 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@@ -189,11 +189,9 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/datapolicy
%_datadir/dolibarr/htdocs/dav
%_datadir/dolibarr/htdocs/debugbar
%_datadir/dolibarr/htdocs/delivery
%_datadir/dolibarr/htdocs/don
%_datadir/dolibarr/htdocs/ecm
%_datadir/dolibarr/htdocs/emailcollector
%_datadir/dolibarr/htdocs/eventorganization
%_datadir/dolibarr/htdocs/expedition
%_datadir/dolibarr/htdocs/expensereport
%_datadir/dolibarr/htdocs/exports
@@ -206,9 +204,8 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/livraison
%_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip
%_datadir/dolibarr/htdocs/margin
@@ -216,14 +213,12 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/mrp
%_datadir/dolibarr/htdocs/multicurrency
%_datadir/dolibarr/htdocs/opensurvey
%_datadir/dolibarr/htdocs/partnership
%_datadir/dolibarr/htdocs/paybox
%_datadir/dolibarr/htdocs/paypal
%_datadir/dolibarr/htdocs/printing
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries
@@ -238,7 +233,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch
@@ -287,6 +281,7 @@ then
#grep -q -c "dolibarr_lib_GEOIP_PATH" $config || echo "<?php \$dolibarr_lib_GEOIP_PATH=''; ?>" >> $config
grep -q -c "dolibarr_lib_NUSOAP_PATH" $config || [ ! -d "/usr/share/php/nusoap" ] || echo "<?php \$dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap'; ?>" >> $config
grep -q -c "dolibarr_lib_ODTPHP_PATHTOPCLZIP" $config || [ ! -d "/usr/share/php/libphp-pclzip" ] || echo "<?php \$dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip'; ?>" >> $config
#grep -q -c "dolibarr_lib_PHPEXCEL_PATH" $config || echo "<?php \$dolibarr_lib_PHPEXCEL_PATH=''; ?>" >> $config
#grep -q -c "dolibarr_lib_TCPDF_PATH" $config || echo "<?php \$dolibarr_lib_TCPDF_PATH=''; ?>" >> $config
grep -q -c "dolibarr_js_CKEDITOR" $config || [ ! -d "/usr/share/javascript/ckeditor" ] || echo "<?php \$dolibarr_js_CKEDITOR='/javascript/ckeditor'; ?>" >> $config
grep -q -c "dolibarr_js_JQUERY" $config || [ ! -d "/usr/share/javascript/jquery" ] || echo "<?php \$dolibarr_js_JQUERY='/javascript/jquery'; ?>" >> $config

View File

@@ -17,7 +17,6 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmfedora';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@@ -25,6 +24,7 @@ $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@@ -17,7 +17,6 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmgeneric';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
// We don't force any external lib with generic package

View File

@@ -17,7 +17,6 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmmandriva';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@@ -25,6 +24,7 @@ $force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
//$force_dolibarr_lib_GEOIP_PATH='';
$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@@ -17,7 +17,6 @@ $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1';
$force_install_lockinstall='444';
$force_install_distrib='rpmopensuse';
// Value to overwrite path to use shared libraries/fonts instead of embedded one
//$force_dolibarr_lib_ADODB_PATH='/usr/share/php/adodb';
@@ -25,6 +24,7 @@ $force_install_distrib='rpmopensuse';
//$force_dolibarr_lib_GEOIP_PATH='';
//$force_dolibarr_lib_NUSOAP_PATH='/usr/share/php/nusoap';
//$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP='/usr/share/php/libphp-pclzip';
$force_dolibarr_lib_PHPEXCEL_PATH='';
$force_dolibarr_lib_TCPDF_PATH='';
//$force_dolibarr_js_CKEDITOR='/javascript/ckeditor';
//$force_dolibarr_js_JQUERY='/javascript/jquery';

View File

@@ -1,5 +1,5 @@
# Format of sitemap file is available at
# https://www.sitemaps.org/protocol.html
# http://www.sitemaps.org/protocol.html
# To build a sitemap from urllist-bing.txt, run
# google-sitemapgen --config=config-bing.xml --testing

View File

@@ -1 +1 @@
https://wiki.dolibarr.org/
http://wiki.dolibarr.org/

View File

@@ -29,17 +29,15 @@
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "2.2",
"mobiledetect/mobiledetectlib" : "2.8.34",
"phpoffice/phpexcel" : "1.8.2",
"phpoffice/phpexcel" : "1.8.1",
"restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1",
"symfony/var-dumper" : "3"
"stripe/stripe-php" : "6.43.1"
},
"require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0",
"php-parallel-lint/php-console-highlighter" : "^0",
"jakub-onderka/php-parallel-lint" : "^0",
"jakub-onderka/php-console-highlighter" : "^0",
"phpunit/phpunit" : "^4",
"squizlabs/php_codesniffer" : "^2",
"phpunit/phpunit-selenium" : "^2"
@@ -59,4 +57,4 @@
"ext-zip" : "ODT, Excel and file compression support",
"ext-xml" : "Excel support"
}
}
}

735
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,13 @@
README (English)
--------------------------------
This directory contains sub-directories to provide tools or
documentation for developers.
Note: All files in this directory are in VCS only and are not
provided with a standard release.
This directory contains sub-directories to provide tools or documentation for developers.
Note: All files in this directory are in the source repository only and are not provided with a standard release. They are useless to make Dolibarr working.
You may find a more complete documentation on Dolibarr on the wiki:
There is also some documentation on Dolibarr Wiki:
https://wiki.dolibarr.org/
and on
and
https://doxygen.dolibarr.org/

View File

@@ -28,6 +28,19 @@ With
DEBUGBAR:
---------
Move
this.options = {
bodyMarginBottom: true,
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
};
few line lower in the
initialize: function() {
ESCPOS:
-------
Replace
@@ -48,14 +61,6 @@ By
* In file nusoap.php, to avoid a warning,
Replace call to serialize_val with no bugged value
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
* Line 4222 of file nusoap.php
$rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
@@ -133,15 +138,17 @@ with
}
}
elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
* In tecnickcom/tcpdf/include/tcpdf_static.php, in function fopenLocal, replace
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
if (strpos($filename, '://') === false) {
with
if (strpos($filename, '//') === 0) {
if (strpos($filename, '//') === 0)
{
// Share folder on a (windows) server
// e.g.: "//[MyServerName]/[MySharedFolder]/"
//
@@ -168,22 +175,33 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
of the function, replace:
$roman = '';
with:
$roman = '';
if ($number >= 4000) {
// do not represent numbers above 4000 in Roman numerals
return strval($number);
}
TCPDI:
------
Add file fpdf_tpl.php 1.2
Add fpdf_tpl.php 1.2
Add tcpdi.php
Add file tcpdi.php
Add file tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
Add tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
with:
require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php');
require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php');
* Fix syntax error by replacing
* Fix by replacing
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {
with
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {
@@ -193,23 +211,25 @@ with
JSGANTT:
--------
* Replace in function JSGantt.taskLink
var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
with
// LDR To open in same window
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
window.location.href=pRef
// LDR To open in same window
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
window.location.href=pRef
* Replace
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
with
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink());
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink());
* Replace '% Comp.' to have a smaller text column header
'comp':'% Comp.'
'comp':'% Comp.'
with
'comp':'%'
'comp':'%'
@@ -223,44 +243,30 @@ JQUERYFILETREE:
* Remove directory htdocs/includes/jquery/plugins/jqueryFileTree/connectors
PHPEXCEL:
---------
* Replace in htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE.php
continue;
with:
continue 2;
RESTLER:
--------
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
+With swagger 2:
* Add line into Util.php to complete function
public static function getShortName($className)
{
// @CHANGE LDR
if (!is_string($className)) return;
if (! is_string($className)) return;
//var_dump($className);
* Add line into Data/Text.php to complete function
public static function endsWith($haystack, $needle)
{
$length = strlen($needle);
if ($length == 0) {
return true;
}
// @CHANGE LDR
if (!is_string($haystack)) return false;
* Replace
$loaders = array_unique(static::$rogueLoaders);
with
$loaders = array_unique(static::$rogueLoaders, SORT_REGULAR);
+With swagger 2 provided into /explorer:
----------------------------------------
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
PARSEDOWN
---------

View File

@@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@@ -49,10 +49,7 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -85,16 +82,19 @@ $obj->lines[]=$line1;
// Create invoice
$idobject=$obj->create($user);
if ($idobject > 0) {
if ($idobject > 0)
{
// Change status to validated
$result=$obj->validate($user);
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
$error++;
dol_print_error($db, $obj->error);
}
} else {
}
else
{
$error++;
dol_print_error($db, $obj->error);
}
@@ -102,10 +102,13 @@ if ($idobject > 0) {
// -------------------- END OF YOUR CODE --------------------
if (! $error) {
if (! $error)
{
$db->commit();
print '--- end ok'."\n";
} else {
}
else
{
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@@ -49,10 +49,7 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -83,16 +80,19 @@ $com->lines[]=$orderline1;
// Create order
$idobject=$com->create($user);
if ($idobject > 0) {
if ($idobject > 0)
{
// Change status to validated
$result=$com->valid($user);
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
$error++;
dol_print_error($db, $com->error);
}
} else {
}
else
{
$error++;
dol_print_error($db, $com->error);
}
@@ -100,10 +100,13 @@ if ($idobject > 0) {
// -------------------- END OF YOUR CODE --------------------
if (! $error) {
if (! $error)
{
$db->commit();
print '--- end ok'."\n";
} else {
}
else
{
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@@ -49,10 +49,7 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -82,19 +79,25 @@ $myproduct->weight_units = 0;
// Create product in database
$idobject = $myproduct->create($user);
if ($idobject > 0) {
if ($idobject > 0)
{
print "OK Object created with id ".$idobject."\n";
} else {
}
else
{
$error++;
dol_print_error($db, $myproduct->error);
}
// -------------------- END OF YOUR CODE --------------------
if (! $error) {
if (! $error)
{
$db->commit();
print '--- end ok'."\n";
} else {
}
else
{
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@@ -49,10 +49,7 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -72,18 +69,23 @@ $obj->nom = 'ABCDEF';
// Create user
$idobject=$obj->create($user);
if ($idobject > 0) {
if ($idobject > 0)
{
// Change status to validated
$result=$obj->setStatut(1);
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
$error++;
dol_print_error($db, $obj->error);
}
} elseif ($obj->error == 'ErrorLoginAlreadyExists') {
print "User with login ".$obj->login." already exists\n";
} else {
}
elseif ($obj->error == 'ErrorLoginAlreadyExists')
{
print "User with login ".$obj->login." already exists\n";
}
else
{
$error++;
dol_print_error($db, $obj->error);
}
@@ -91,10 +93,13 @@ if ($idobject > 0) {
// -------------------- END OF YOUR CODE --------------------
if (! $error) {
if (! $error)
{
$db->commit();
print '--- end ok'."\n";
} else {
}
else
{
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@@ -49,17 +49,14 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1])) { // Check parameters
print "Usage: ".$script_file." id_thirdparty ...\n";
exit;
print "Usage: ".$script_file." id_thirdparty ...\n";
exit;
}
print '--- start'."\n";
print 'Argument id_thirdparty='.$argv[1]."\n";

View File

@@ -1,89 +0,0 @@
Delivered-To: testldrdev@gmail.com
Received: by 2002:a2e:9b9a:0:0:0:0:0 with SMTP id z26csp1425223lji;
Thu, 20 Aug 2020 08:29:02 -0700 (PDT)
X-Received: by 2002:a05:620a:1292:: with SMTP id w18mr2938234qki.158.1597937342304;
Thu, 20 Aug 2020 08:29:02 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1597937342; cv=none;
d=google.com; s=arc-20160816;
b=FhT/+rJ/zNYgVQ5Nt/rLZJycGd/Ntkhm6LwI16YUfmEmxeGrP/cXXQULrqQ1LhBr9B
oRKweltTdnpyA14gm0kzbs1vUkf5HxLUuGk8IqqJWAPMUZoN8oUPkzq2BuKNQGxPiE+y
Hsg/fnYp8WzcAlZOLsEP2kcFIdA95Dyy5LkM8HgphI1jSS1d6gkx6nDGIMIpDD9D+w4X
ISxRUXp5JlDwFCUMOPoAvHIBUdJ3jpLsjesbMEnU4ssFqhxU21pBq+Fc+csSPeY5DL0M
HR1o+ChEAXIdDOrDqa0ohHfqR216juGCzH8YuEQ88LT0Qbst9IkOYWiAQv4TIh7vHtvQ
TMvA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=to:subject:message-id:date:from:mime-version:dkim-signature;
bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=;
b=CRlrRPfoGkfmz6iXKy4HdxKQ4SeJTiIxjC2jNkgQPSnIDFJgDkJcwASJVpcjTmlVmH
Z9WnHKVUPRIHGDEoMRlx6eUx9QfelWqPYu3BBQGFry9sgth0BR/1s6tmQ+P+bAj23ryo
aL3UkF6KCSx4GhEk3MfHA5Ex81YDFHvHL3BZ2kb3XCVSlPiBq2szw1ETmRAsDdS5Gbu+
ZlzBbl4pRtUWgi1fB5H4Wcv7e90F4Et1SBP8IKSCa23qu2nV9xefgjfMw2ndxCj1zgCL
c3l7Ul6pw32nqf6+vxfZTstwIwgu6dXZXCHDqJqesI2g8RGxeba+LfKZEDpBuSeINS9r
GMvw==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@destailleur.fr header.s=google header.b=IPMz90Yj;
spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr
Return-Path: <contact@destailleur.fr>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
by mx.google.com with SMTPS id w14sor2138230qtb.9.2020.08.20.08.29.00
for <testldrdev@gmail.com>
(Google Transport Security);
Thu, 20 Aug 2020 08:29:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass header.i=@destailleur.fr header.s=google header.b=IPMz90Yj;
spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=destailleur.fr; s=google;
h=mime-version:from:date:message-id:subject:to;
bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=;
b=IPMz90Yjw1Mf57/rYWUYGtpc+IazEWcy6/bqxf1j0h6rxDH/wjhxsCWzfARgqqlfVj
ACg4IbPpZZlKFIYDSCbfMlWF65rbKfNre56HldfQgy0Tq3LC434zHz2ZZMOVCM52w3J9
VGBpASUlSL1o+YRmzOpRtHVu7I9aNwGxHuA070Yka8XLV76vV3P0vdL8PcoHq0jUUEoi
+dCZ9NCPuAFtGK2IavNoM2qQrLdfYIi+RwgWBtqjTwzyvDEJR+p5fIPK142ynMbHgWYO
RVtMqAgxjvL4sfyKZ5KuzKXkQNM3zyzMinWK89scBl+QLFCcWA4Qqc0dJjqLCBhh8lmq
n67g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=sojOjnIKAXmsZ9zvMk5MGvY3qyOaFgnpRe6YPMYutOI=;
b=H0GsrFAi9JmRTKQ2budtDeLBqCaTisHKYCVVziyxmv+/tIcrSZBA4tdKwm+wR80r50
zMJXmyVS2DMDWfnIlOv39wcwQjYN3WK1aRJfV0bVuEWrQuzt5MMWbskf6xbzo201nhr9
ZlqATsEV7v1u5EHmfYwRhR8+AOmENdnm0g9RXPJVrFS58WNEJUSotS5Y5rZPjnT943y0
62Kf4Bd6uWvXhPFXWQoZLtWrPpkbcYPWIBmpftKhD0PD9c6rKaVduV0WhbigYsDoxb3F
iIafGPOyq91hiHR2gTLHiMmTDm+IDQ4n6gSkS7HKpZlLQhHoBMnpqJZYoxMJTxdpAbSy
mY+A==
X-Gm-Message-State: AOAM5325RcN4/ThWbYCO3vWRMFFBrfzJUHC1bd1Z9VB3/2Q3RuF9lmIJ +SjshEErhK68Of2pHDZQ3aPU4rzDfV8ozbvRsgChdfZg8aA=
X-Google-Smtp-Source: ABdhPJxUOUdurKEQfLldtiQGRkgC/h8gKQG1zhS+8k93p6N1SsOn517+GeRyT3E+/Uw536pmReO29la3EIAS6VT33SE=
X-Received: by 2002:aed:3e8e:: with SMTP id n14mr3191190qtf.67.1597937340509; Thu, 20 Aug 2020 08:29:00 -0700 (PDT)
MIME-Version: 1.0
From: John Tester <customer@customercompany.fr>
Date: Thu, 20 Aug 2020 17:28:34 +0200
Message-ID: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
Subject: Support besoin
To: testldrdev@gmail.com
Content-Type: multipart/alternative; boundary="0000000000008e099705ad50c772"
--0000000000008e099705ad50c772
Content-Type: text/plain; charset="UTF-8"
adfsdfsdfds
--
Laurent.
------------------------------------------------------------------------------------
Twitter: https://www.twitter.com/eldy10
--0000000000008e099705ad50c772
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">adfsdfsdfds<br clear=3D"all"><div><br></div>-- <br><div di=
r=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature">Laur=
ent.<br>-------------------------------------------------------------------=
-----------------<br>Twitter: <a href=3D"https://www.twitter.com/eldy10" ta=
rget=3D"_blank">https://www.twitter.com/eldy10</a></div></div>
--0000000000008e099705ad50c772--

View File

@@ -1,57 +0,0 @@
Return-Path: <testldrdev@gmail.com>
Received: from smtp.gmail.com ([2a01:e0a:7e:4ae0:329c:23ff:feb8:dc8d])
by smtp.gmail.com with ESMTPSA id 32sm5811196wrh.18.2020.08.20.09.31.37
for <customer@customercompany.fr>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 20 Aug 2020 09:31:37 -0700 (PDT)
From: testldrdev@gmail.com
X-Google-Original-From: <aa@aa.comg>
To: customer@customercompany.fr
Subject: [MyBigCompany - Ticket #TS2008-0040] Nouveau message
Date: Thu, 20 Aug 2020 18:31:37 +0200
Message-ID: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
References: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
X-Dolibarr-TRACKID: tic58@83b5bc91f83a56e458db71e0adac2b62
X-RemoteAddr: 127.0.0.1
X-Mailer: Dolibarr version 13.0.0-alpha (using SMTPs Mailer)
X-Dolibarr-Option: MAIN_MAIL_USE_MULTI_PART
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="multipart_x.1597941097.x_boundary"
Content-Transfer-Encoding: 8bit
--multipart_x.1597941097.x_boundary
Content-Type: multipart/alternative; boundary="mul_872cdd6a64216735955664484832b075"
--mul_872cdd6a64216735955664484832b075
Content-Type: text/plain; charset=UTF-8
Bonjour
Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici
le message :PredefinedMailContentTicket_send
Vous pouvez voir la progression du ticket en cliquant sur le lien
ci-dessus. : fr5uw2yospypn2rz
Cordialement,
--
--mul_872cdd6a64216735955664484832b075
Content-Type: text/html; charset=UTF-8
<html><head><title></title></head><body>Bonjour<br>
<br>
Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici
le message :PredefinedMailContentTicket_send<br>
<br>
<br>
Vous pouvez voir la progression du ticket en cliquant sur le lien
ci-dessus. : <a
href="http://localhostgit/dolibarr_dev/htdocs/public/ticket/view.php?track_id=fr5uw2yospypn2rz">fr5uw2yospypn2rz</a><br>
<br>Cordialement,<br>
<br>
--</body></html>
--mul_872cdd6a64216735955664484832b075--
--multipart_x.1597941097.x_boundary--

View File

@@ -1,48 +0,0 @@
MIME-Version: 1.0
Date: Thu, 20 Aug 2020 18:34:01 +0200
References: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
In-Reply-To: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
Message-ID: <CAC8+=32ccpEo12RR-juT=FW6+gNV-DcvNjxs_0s6Wn40xmfhug@mail.gmail.com>
Subject: Re: Support besoin
From: John Tester <testldrdev@gmail.com>
To: John Tester <customer@customercompany.fr>
Content-Type: multipart/alternative; boundary="0000000000001620dd05ad51b075"
--0000000000001620dd05ad51b075
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Merci pour votre question.
Voici la rep.
Le jeu. 20 ao=C3=BBt 2020 =C3=A0 17:29, John Tester <laurent@destai=
lleur.fr>
a =C3=A9crit :
> adfsdfsdfds
>
> --
> Laurent.
>
> -------------------------------------------------------------------------=
-----------
> Twitter: https://www.twitter.com/eldy10
>
--0000000000001620dd05ad51b075
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Merci pour votre question.<div>Voici la rep.</div></div><b=
r><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">Le=C2=A0=
jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A017:29, John Tester &lt;<a href=
=3D"mailto:customer@customercompany.fr">customer@customercompany.fr</a>&gt; a =C3=A9c=
rit=C2=A0:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div =
dir=3D"ltr">adfsdfsdfds<br clear=3D"all"><div><br></div>-- <br><div dir=3D"=
ltr">Laurent.<br>----------------------------------------------------------=
--------------------------<br>Twitter: <a href=3D"https://www.twitter.com/e=
ldy10" target=3D"_blank">https://www.twitter.com/eldy10</a></div></div>
</blockquote></div>
--0000000000001620dd05ad51b075--

View File

@@ -1,134 +0,0 @@
Delivered-To: testldrdev@gmail.com
Received: by 2002:a2e:9b9a:0:0:0:0:0 with SMTP id z26csp1483607lji;
Thu, 20 Aug 2020 09:56:03 -0700 (PDT)
X-Received: by 2002:ac8:3868:: with SMTP id r37mr3301993qtb.95.1597942563252;
Thu, 20 Aug 2020 09:56:03 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1597942563; cv=none;
d=google.com; s=arc-20160816;
b=skUGL+keim3FdNXfKGgQokCfj85gnhYhuLbMM61qY5W6ixSH9s8I6uoNh3gzVy89XM
NGbZiajjDiPMBryl87PhD+ACBjv8WoZAQiojAga0ELPPmVDnhrtWKANLbRrkUI3Xtfoj
b1o2iHP2Q12Vqs6xiAy86yxURlIKGM3tw91WryWiIPiAL7bRZPn49N3XbO2ULE0QKTBq
BI5YnOxt9NfTj0xhKaLLIJ9M1qa4e1QyOHl56WuEv3Gx6uHDAQDYz+C5G0VgdjBvwRzH
pJaiAulc1uW/V9TcRMwvwIWtI7eWygvU2PiuI/c05G1KVKibAubHE55IjOJCn2O2UaH4
WMNQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:dkim-signature;
bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=;
b=Ps5kk+tBGQzMP6ugDCwKf4hzn8fn3DU4AFz1dJvkHdDestLZWN99Qtr6iNMdslsHJm
ov378c+8oCfcV7shyBYjlAFfikFi7o4RM/evh3yqqjAnhyVfcYH7c9cexVvDo/AXUAZ7
N7Mh7EOvyDXXsaHK2l89XiAxZx/hZh/O+/HR2EoVEGre1eYRYwI/aEfPN8d4/fL2VtCD
0wzAwnUrINuXmcaUDT30Twjk9kwGjjTsM6Z531vKM6L3y48a7f3GTE7V+vo2QxHdUT54
fQVue9OO7b4VKTEj/x/dmNr+92sHRAMMS7dj/VXMmzM+WttUCAPNxZ27/bvt4bBc5oBp
QPEA==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@destailleur.fr header.s=google header.b=SEYSmxbT;
spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr
Return-Path: <contact@destailleur.fr>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
by mx.google.com with SMTPS id q3sor2285165qtn.34.2020.08.20.09.56.02
for <testldrdev@gmail.com>
(Google Transport Security);
Thu, 20 Aug 2020 09:56:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass header.i=@destailleur.fr header.s=google header.b=SEYSmxbT;
spf=pass (google.com: domain of contact@destailleur.fr designates 209.85.220.41 as permitted sender) smtp.mailfrom=contact@destailleur.fr;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=destailleur.fr
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=destailleur.fr; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=;
b=SEYSmxbTKCuc1baQZzjIJwm7WXvgjt/nEGhMLqWxQCU3beM3qhH8wYlSeMyB8Z/9pi
tszZFZhZ3cjnIbbJnjzsMYJgBnYbkf6hz14+BsFwyPU030EkDjJy2i3DSXzYK7A+GbBn
G9I9foG/4+pcx0LnFsjchGsRhLFkTKJIsP2SVfOx0wlim3WHMIqIXvKsxY05PoPyf8Tp
IwQi7iNl/+nTyjNHl2DQh+ty3CRTmUw9uEbY+jRRvIg5i/7cfREekK98d7qi/5HQycr6
aptRDdCVHXpe47q+c7OPiMEEQWs+mFJhBqPXIlU54fwFApEEnLn/jwGbrPsrPYJaswgI
vd/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=j6+rsx5MBsg1/s7LIIfByV7u0jGK09n72bnK4XcN6ZQ=;
b=M6a4k1gKc4e7TwKncuNPy0b3KxutR1FLFJGWxd4NyW84b7f3LfIR94IeInLQIWmY8C
Ddus0upZJI4+NN9XBGvXCdsiiYlwFGBJRWwjv82XFKVAKL5DD94RJNQZJUiE39hgJ2aa
6V9gasiP+nUAX4ZV9bZmw21CgKEZrZVXh5unmW2ABrfcx8lHjp/DUw5XEkym1J92Wo1l
g0H3XrC2FL+aQuj+WpCynMNkY9ljw71oqyv3SP9pjnVNHArAdZiPMHkNxiuPdq7q41fg
eIbdRCQXYZL5O48QsjDdiXwaQzx+NcYtrKAH0RIVD1lG6zc9pxqDJsbGxP9VLs8jGDTT
mSdQ==
X-Gm-Message-State: AOAM532LuATWDKbo1HImMWshHVqb0kC0isehf3owfYUKq5J68o3juKbm kCgUMt25A2C7QoNMDXcjfJyteBNQD7ZhSh3yeYTGoLSvsD4=
X-Google-Smtp-Source: ABdhPJyQYCpCHSwA87x030i8YChySZqcNXxT1qVlZyEA+XM6DTyPZusa8gtbDUVcMyx7Jma/7toh+4EEE2bWg0bG+2E=
X-Received: by 2002:aed:3e8e:: with SMTP id n14mr3547383qtf.67.1597942562373; Thu, 20 Aug 2020 09:56:02 -0700 (PDT)
MIME-Version: 1.0
References: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com> <CAC8+=32ccpEo12RR-juT=FW6+gNV-DcvNjxs_0s6Wn40xmfhug@mail.gmail.com>
In-Reply-To: <CAC8+=32ccpEo12RR-juT=FW6+gNV-DcvNjxs_0s6Wn40xmfhug@mail.gmail.com>
From: John Tester <customer@customercompany.fr>
Date: Thu, 20 Aug 2020 18:55:36 +0200
Message-ID: <CALeEO_nLUY8Tk+o7WoaHtBkxvOy0dhvt+fL0MwPrApGty_AG_g@mail.gmail.com>
Subject: Re: Support besoin
To: John Tester <testldrdev@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000cd54be05ad51fe67"
--000000000000cd54be05ad51fe67
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Merci
Le jeu. 20 ao=C3=BBt 2020 =C3=A0 18:34, John Tester <testldrdev@gma=
il.com> a
=C3=A9crit :
> Merci pour votre question.
> Voici la rep.
>
> Le jeu. 20 ao=C3=BBt 2020 =C3=A0 17:29, John Tester <laurent@dest=
ailleur.fr>
> a =C3=A9crit :
>
>> adfsdfsdfds
>>
>> --
>> Laurent.
>>
>> ------------------------------------------------------------------------=
------------
>> Twitter: https://www.twitter.com/eldy10
>>
>
--=20
Laurent.
---------------------------------------------------------------------------=
---------
Twitter: https://www.twitter.com/eldy10
--000000000000cd54be05ad51fe67
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Merci</div><br><div class=3D"gmail_quote"><div dir=3D"ltr"=
class=3D"gmail_attr">Le=C2=A0jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A018:34, Lau=
rent Destailleur &lt;<a href=3D"mailto:testldrdev@gmail.com">testldrdev@gma=
il.com</a>&gt; a =C3=A9crit=C2=A0:<br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex"><div dir=3D"ltr">Merci pour votre question.<div>Voici la=
rep.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g=
mail_attr">Le=C2=A0jeu. 20 ao=C3=BBt 2020 =C3=A0=C2=A017:29, Laurent Destai=
lleur &lt;<a href=3D"mailto:customer@customercompany.fr" target=3D"_blank">laure=
nt@destailleur.fr</a>&gt; a =C3=A9crit=C2=A0:<br></div><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div dir=3D"ltr">adfsdfsdfds<br clear=3D"all"=
><div><br></div>-- <br><div dir=3D"ltr">Laurent.<br>-----------------------=
-------------------------------------------------------------<br>Twitter: <=
a href=3D"https://www.twitter.com/eldy10" target=3D"_blank">https://www.twi=
tter.com/eldy10</a></div></div>
</blockquote></div>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
class=3D"gmail_signature">Laurent.<br>------------------------------------=
------------------------------------------------<br>Twitter: <a href=3D"htt=
ps://www.twitter.com/eldy10" target=3D"_blank">https://www.twitter.com/eldy=
10</a></div>
--000000000000cd54be05ad51fe67--

View File

@@ -1,21 +0,0 @@
# EditorConfig is awesome: https://editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
[*.js]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = false

View File

@@ -5,4 +5,3 @@ node_modules
.environment
.env
.zapierapprc
package-lock.json

View File

@@ -1,6 +0,0 @@
# HOW TO BUILD
Take a look at the dolibarr wiki page of Zapier module:
https://wiki.dolibarr.org/index.php?title=Module_Zapier

View File

@@ -1,6 +1,6 @@
/*jshint esversion: 6 */
const test = (z , bundle) => {
const url = bundle.authData.url+'/api/index.php/status';
const testAuth = (z , bundle) => {
const url = bundle.authData.url+'/api/index.php/login';
// Normally you want to make a request to an endpoint that is either specifically designed to test auth, or one that
// every user will have access to, such as an account or profile endpoint like /me.
// In this example, we'll hit httpbin, which validates the Authorization Header against the arguments passed in the URL path
@@ -11,92 +11,67 @@ const test = (z , bundle) => {
// This method can return any truthy value to indicate the credentials are valid.
// Raise an error to show
return promise.then((response) => {
if (response.status === 400) {
throw new Error('400 -The Session Key you supplied is invalid');
}
if (response.status === 403) {
throw new Error('403 -The Session Key you supplied is invalid');
if (response.status === 401) {
throw new Error('The Session Key you supplied is invalid');
}
return response;
});
};
// To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
}
return request;
};
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
const getSessionKey = async (z, bundle) => {
const getSessionKey = (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/login';
const response = await z.request({
url: url,
const promise = z.request({
method: 'POST',
url: url,
body: {
login: bundle.authData.login,
password: bundle.authData.password,
},
}
});
// if (response.status === 401) {
// throw new Error('The login/password you supplied is invalid');
// }
const json = JSON.parse(response.content);
return {
sessionKey: json.success.token || '',
};
return promise.then((response) => {
if (response.status === 401) {
throw new Error('The login/password you supplied is invalid');
}
const json = JSON.parse(response.content);
return {
sessionKey: json.success.token || 'secret'
};
});
};
module.exports = {
config: {
type: 'session',
sessionConfig: {
perform: getSessionKey
type: 'session',
// Define any auth fields your app requires here. The user will be prompted to enter this info when
// they connect their account.
fields: [
{
key: 'url',
label: 'Url of service',
required: true,
type: 'string'
},
// Define any auth fields your app requires here. The user will be prompted to enter this info when
// they connect their account.
fields: [
{
key: 'url',
label: 'Url of service without trailing-slash',
required: true,
type: 'string'
},
{
key: 'login',
label: 'Login',
required: true,
type: 'string'
},
{
key: 'password',
label: 'Password',
required: true,
type: 'password'
}
],
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time.
test,
// The method that will exchange the fields provided by the user for session credentials.
// assuming "login" is a key returned from the test
connectionLabel: '{{login}}'
{
key: 'login',
label: 'Login',
required: true,
type: 'string'
},
{
key: 'password',
label: 'Password',
required: true,
type: 'password'
}
],
// The test method allows Zapier to verify that the credentials a user provides are valid. We'll execute this
// method whenever a user connects their account for the first time.
test: testAuth,
// The method that will exchange the fields provided by the user for session credentials.
sessionConfig: {
perform: getSessionKey
},
befores: [includeSessionKeyHeader],
afters: [sessionRefreshIf401],
// assuming "login" is a key returned from the test
connectionLabel: '{{login}}'
};

View File

@@ -1,74 +0,0 @@
/*jshint esversion: 6 */
// create a particular contact by name
const createContact = async (z, bundle) => {
const apiurl = bundle.authData.url + '/api/index.php/contacts';
const response = await z.request({
method: 'POST',
url: apiurl,
body: {
name: bundle.inputData.name,
name_alias: bundle.inputData.name_alias,
ref_ext: bundle.inputData.ref_ext,
ref_int: bundle.inputData.ref_int,
address: bundle.inputData.address,
zip: bundle.inputData.zip,
town: bundle.inputData.town,
country_code: bundle.inputData.country_code,
country_id: bundle.inputData.country_id,
country: bundle.inputData.country,
phone: bundle.inputData.phone,
email: bundle.inputData.email,
sens: 'fromzapier'
}
});
const result = z.JSON.parse(response.content);
// api returns an integer when ok, a json when ko
return result.response || {id: response};
};
module.exports = {
key: 'contact',
noun: 'Contact',
display: {
label: 'Create Contact',
description: 'Creates a contact.'
},
operation: {
inputFields: [
{key: 'name', required: true},
{key: 'name_alias', required: false},
{key: 'address', required: false},
{key: 'zip', required: false},
{key: 'town', required: false},
{key: 'email', required: false}
],
perform: createContact,
sample: {
id: 1,
name: 'DUPOND',
name_alias: 'DUPOND Ltd',
address: 'Rue des Canaries',
zip: '34090',
town: 'MONTPELLIER',
phone: '0123456789',
fax: '2345678901',
email: 'robot@domain.com'
},
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'address', label: 'Address'},
{key: 'zip', label: 'Zip'},
{key: 'town', label: 'Town'},
{key: 'phone', label: 'Phone'},
{key: 'fax', label: 'Fax'},
{key: 'email', label: 'Email'}
]
}
};

View File

@@ -1,74 +0,0 @@
/*jshint esversion: 6 */
// create a particular member by name
const createMember = async (z, bundle) => {
const apiurl = bundle.authData.url + '/api/index.php/members';
const response = await z.request({
method: 'POST',
url: apiurl,
body: {
name: bundle.inputData.name,
name_alias: bundle.inputData.name_alias,
ref_ext: bundle.inputData.ref_ext,
ref_int: bundle.inputData.ref_int,
address: bundle.inputData.address,
zip: bundle.inputData.zip,
town: bundle.inputData.town,
country_code: bundle.inputData.country_code,
country_id: bundle.inputData.country_id,
country: bundle.inputData.country,
phone: bundle.inputData.phone,
email: bundle.inputData.email,
sens: 'fromzapier'
}
});
const result = z.JSON.parse(response.content);
// api returns an integer when ok, a json when ko
return result.response || {id: response};
};
module.exports = {
key: 'member',
noun: 'Member',
display: {
label: 'Create Member',
description: 'Creates a member.'
},
operation: {
inputFields: [
{key: 'name', required: true},
{key: 'name_alias', required: false},
{key: 'address', required: false},
{key: 'zip', required: false},
{key: 'town', required: false},
{key: 'email', required: false}
],
perform: createMember,
sample: {
id: 1,
name: 'DUPOND',
name_alias: 'DUPOND Ltd',
address: 'Rue des Canaries',
zip: '34090',
town: 'MONTPELLIER',
phone: '0123456789',
fax: '2345678901',
email: 'robot@domain.com'
},
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'address', label: 'Address'},
{key: 'zip', label: 'Zip'},
{key: 'town', label: 'Town'},
{key: 'phone', label: 'Phone'},
{key: 'fax', label: 'Fax'},
{key: 'email', label: 'Email'}
]
}
};

View File

@@ -6,7 +6,7 @@ const createThirdparty = async (z, bundle) => {
const response = await z.request({
method: 'POST',
url: apiurl,
body: {
body: JSON.stringify({
name: bundle.inputData.name,
name_alias: bundle.inputData.name_alias,
ref_ext: bundle.inputData.ref_ext,
@@ -24,7 +24,7 @@ const createThirdparty = async (z, bundle) => {
code_client: bundle.inputData.code_client,
code_fournisseur: bundle.inputData.code_fournisseur,
sens: 'fromzapier'
}
})
});
const result = z.JSON.parse(response.content);
// api returns an integer when ok, a json when ko
@@ -72,7 +72,7 @@ module.exports = {
},
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'id', label: 'ID'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'address', label: 'Address'},
@@ -81,8 +81,8 @@ module.exports = {
{key: 'phone', label: 'Phone'},
{key: 'fax', label: 'Fax'},
{key: 'email', label: 'Email'},
{key: 'client', type: "integer", label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', type: "integer", label: 'Supplier 0/1'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'}
]

View File

@@ -1,45 +1,33 @@
/*jshint esversion: 6 */
const triggerAction = require('./triggers/action');
const triggerOrder = require('./triggers/order');
const triggerThirdparty = require('./triggers/thirdparty');
const triggerContact = require('./triggers/contact');
const triggerTicket = require('./triggers/ticket');
const triggerUser = require('./triggers/user');
const triggerMember = require('./triggers/member');
const triggerOrder = require('./triggers/order');
const triggerAction = require('./triggers/action');
const searchThirdparty = require('./searches/thirdparty');
const searchContact = require('./searches/contact');
const searchMember = require('./searches/member');
const createThirdparty = require('./creates/thirdparty');
const createContact = require('./creates/contact');
const createMember = require('./creates/member');
const {
config: authentication,
befores = [],
afters = [],
} = require('./authentication');
const authentication = require('./authentication');
// To include the session key header on all outbound requests, simply define a function here.
// It runs runs before each request is sent out, allowing you to make tweaks to the request in a centralized spot
// const includeSessionKeyHeader = (request, z, bundle) => {
// if (bundle.authData.sessionKey) {
// request.headers = request.headers || {};
// request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
// }
// return request;
// };
const includeSessionKeyHeader = (request, z, bundle) => {
if (bundle.authData.sessionKey) {
request.headers = request.headers || {};
request.headers['DOLAPIKEY'] = bundle.authData.sessionKey;
}
return request;
};
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
// const sessionRefreshIf401 = (response, z, bundle) => {
// if (bundle.authData.sessionKey) {
// if (response.status === 401) {
// throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
// }
// }
// return response;
// };
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
// We can roll up all our behaviors in an App.
const App = {
@@ -52,11 +40,11 @@ const App = {
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [
...befores
includeSessionKeyHeader
],
afterResponse: [
...afters
sessionRefreshIf401
],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
@@ -65,27 +53,19 @@ const App = {
// If you want your trigger to show up, you better include it here!
triggers: {
[triggerAction.key]: triggerAction,
[triggerOrder.key]: triggerOrder,
[triggerThirdparty.key]: triggerThirdparty,
[triggerContact.key]: triggerContact,
[triggerTicket.key]: triggerTicket,
[triggerUser.key]: triggerUser,
[triggerMember.key]: triggerMember,
[triggerOrder.key]: triggerOrder,
[triggerAction.key]: triggerAction
},
// If you want your searches to show up, you better include it here!
searches: {
[searchThirdparty.key]: searchThirdparty,
[searchContact.key]: searchContact,
[searchMember.key]: searchMember,
},
// If you want your creates to show up, you better include it here!
creates: {
[createThirdparty.key]: createThirdparty,
[createContact.key]: createContact,
[createMember.key]: createMember,
}
};

405
dev/examples/zapier/package-lock.json generated Normal file
View File

@@ -0,0 +1,405 @@
{
"name": "Dolibarr",
"version": "1.0.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "8.10.20",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.20.tgz",
"integrity": "sha512-M7x8+5D1k/CuA6jhiwuSCmE8sbUWJF0wYsjcig9WrXvwUI5ArEoUBdOXpV4JcEMrLp02/QbDjw+kI+vQeKyQgg==",
"optional": true
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
"bluebird": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz",
"integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
},
"combined-stream": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"content-disposition": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
"dotenv": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz",
"integrity": "sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow=="
},
"encoding": {
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=",
"requires": {
"iconv-lite": "~0.4.13"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"form-data": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "1.0.6",
"mime-types": "^2.1.12"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"he": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
"dev": true
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"dev": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
"dev": true
},
"is-stream": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
},
"json-tryparse": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/json-tryparse/-/json-tryparse-1.0.5.tgz",
"integrity": "sha1-Khy6CLTjEjNo+p+2o01GQwBFeyc="
},
"jsonschema": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.1.1.tgz",
"integrity": "sha1-PO3o4+QR03eHLu+8n98mODy8Ptk="
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"mime-db": {
"version": "1.38.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz",
"integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg=="
},
"mime-types": {
"version": "2.1.22",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz",
"integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==",
"requires": {
"mime-db": "~1.38.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"mocha": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz",
"integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==",
"dev": true,
"requires": {
"browser-stdout": "1.3.1",
"commander": "2.15.1",
"debug": "3.1.0",
"diff": "3.5.0",
"escape-string-regexp": "1.0.5",
"glob": "7.1.2",
"growl": "1.10.5",
"he": "1.1.1",
"minimatch": "3.0.4",
"mkdirp": "0.5.1",
"supports-color": "5.4.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"node-fetch": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz",
"integrity": "sha512-j8XsFGCLw79vWXkZtMSmmLaOk9z5SQ9bV/tkbZVCqvgwzrjAGq66igobLofHtF63NvMTp2WjytpsNTGKa+XRIQ==",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
"integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg=="
},
"should": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",
"integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==",
"dev": true,
"requires": {
"should-equal": "^2.0.0",
"should-format": "^3.0.3",
"should-type": "^1.4.0",
"should-type-adaptors": "^1.0.1",
"should-util": "^1.0.0"
}
},
"should-equal": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz",
"integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==",
"dev": true,
"requires": {
"should-type": "^1.4.0"
}
},
"should-format": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz",
"integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=",
"dev": true,
"requires": {
"should-type": "^1.3.0",
"should-type-adaptors": "^1.0.1"
}
},
"should-type": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz",
"integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=",
"dev": true
},
"should-type-adaptors": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz",
"integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==",
"dev": true,
"requires": {
"should-type": "^1.3.0",
"should-util": "^1.0.0"
}
},
"should-util": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz",
"integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=",
"dev": true
},
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
"integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
},
"zapier-platform-core": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/zapier-platform-core/-/zapier-platform-core-8.0.1.tgz",
"integrity": "sha512-vuAe7JkFQ88AeQ//NwwNEh8ZjiZr30GRWtwYo7Wo/nx1cqZwq+CRc9zJU2WRrhJfJOtOOTUF6w+pArBTtMOC5A==",
"requires": {
"@types/node": "8.10.20",
"bluebird": "3.5.0",
"content-disposition": "0.5.2",
"dotenv": "5.0.1",
"form-data": "2.3.2",
"lodash": "4.17.11",
"node-fetch": "1.7.1",
"oauth-sign": "0.9.0",
"semver": "5.6.0",
"zapier-platform-schema": "8.0.1"
}
},
"zapier-platform-schema": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/zapier-platform-schema/-/zapier-platform-schema-8.0.1.tgz",
"integrity": "sha512-97KJ0xVLtpU4BiXVaMTPQpiA0T6CQIEzWfzAWwJAWbu5336+6DMFUzDWN4bANBeD3CIsRHHPcZkP8n/17U05ag==",
"requires": {
"jsonschema": "1.1.1",
"lodash": "4.17.10"
},
"dependencies": {
"lodash": {
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
}
}
}
}
}

View File

@@ -1,9 +1,9 @@
{
"name": "dolibarr",
"version": "1.14.0",
"name": "Dolibarr",
"version": "1.0.0",
"description": "An app for connecting Dolibarr to the Zapier platform.",
"repository": "Dolibarr/dolibarr",
"homepage": "https://www.dolibarr.org/",
"homepage": "https://www.dolibarr.fr/",
"author": "Frédéric France <frederic.france@netlogic.fr>",
"license": "BSD-3-Clause",
"main": "index.js",
@@ -11,11 +11,11 @@
"test": "mocha --recursive"
},
"engines": {
"node": "14.0.0",
"node": "8.10.0",
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "11.0.1"
"zapier-platform-core": "8.0.1"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@@ -1,95 +0,0 @@
module.exports = {
key: 'contact',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Contact',
display: {
label: 'Find a Contact',
description: 'Search for contact.'
},
// `operation` is where we make the call to your API to do the search
operation: {
// This search only has one search field. Your searches might have just one, or many
// search fields.
inputFields: [
{
key: 'lastname',
type: 'string',
label: 'Lastname',
helpText: 'Lastname to limit to the search to (i.e. The company or %company%).'
},
{
key: 'email',
type: 'string',
label: 'Email',
helpText: 'Email to limit to the search to.'
}
],
perform: async (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/contacts/';
// Put the search value in a query param. The details of how to build
// a search URL will depend on how your API works.
let filter = '';
if (bundle.inputData.lastname) {
filter = "t.lastname like \'%"+bundle.inputData.name+"%\'";
}
if (bundle.inputData.email) {
if (bundle.inputData.lastname) {
filter += " and ";
}
filter += "t.email like \'"+bundle.inputData.email+"\'";
}
const response = await z.request({
url: url,
// this parameter avoid throwing errors and let us manage them
skipThrowForStatus: true,
params: {
sqlfilters: filter
}
});
//z.console.log(response);
if (response.status != 200) {
return [];
}
return response.json;
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
name: 'DOE',
firstname: 'John',
authorId: 1,
directions: '1. Boil Noodles\n2.Serve with sauce',
style: 'italian'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'firstname', label: 'Firstname'},
{key: 'directions', label: 'Directions'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{
key: 'style',
label: 'Style'
}
]
}
};

View File

@@ -1,88 +0,0 @@
module.exports = {
key: 'member',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Member',
display: {
label: 'Find a Member',
description: 'Search for member.'
},
// `operation` is where we make the call to your API to do the search
operation: {
// This search only has one search field. Your searches might have just one, or many
// search fields.
inputFields: [
{
key: 'lastname',
type: 'string',
label: 'Lastname',
helpText: 'Lastname to limit to the search to (i.e. The company or %company%).'
},
{
key: 'email',
type: 'string',
label: 'Email',
helpText: 'Email to limit to the search to.'
}
],
perform: async (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/members/';
// Put the search value in a query param. The details of how to build
// a search URL will depend on how your API works.
let filter = '';
if (bundle.inputData.lastname) {
filter = "t.lastname like \'%" + bundle.inputData.name + "%\'";
}
if (bundle.inputData.email) {
if (bundle.inputData.lastname) {
filter += " and ";
}
filter += "t.email like \'" + bundle.inputData.email + "\'";
}
const response = await z.request({
url: url,
// this parameter avoid throwing errors and let us manage them
skipThrowForStatus: true,
params: {
sqlfilters: filter
}
});
//z.console.log(response);
if (response.status != 200) {
return [];
}
return response.json;
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
name: 'DOE',
firstname: 'John',
authorId: 1,
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{ key: 'createdAt', type: "integer", label: 'Created At' },
{ key: 'name', label: 'Name' },
{ key: 'firstname', label: 'Firstname' },
{ key: 'authorId', type: "integer", label: 'Author ID' },
]
}
};

View File

@@ -19,43 +19,21 @@ module.exports = {
type: 'string',
label: 'Name',
helpText: 'Name to limit to the search to (i.e. The company or %company%).'
},
{
key: 'email',
type: 'string',
label: 'Email',
helpText: 'Email to limit to the search to.'
}
],
perform: async (z, bundle) => {
perform: (z, bundle) => {
const url = bundle.authData.url + '/api/index.php/thirdparties/';
// Put the search value in a query param. The details of how to build
// a search URL will depend on how your API works.
let filter = '';
if (bundle.inputData.name) {
filter = "t.nom like \'%"+bundle.inputData.name+"%\'";
}
if (bundle.inputData.email) {
if (bundle.inputData.name) {
filter += " and ";
}
filter += "t.email like \'"+bundle.inputData.email+"\'";
}
const response = await z.request({
url: url,
// this parameter avoid throwing errors and let us manage them
skipThrowForStatus: true,
const options = {
params: {
sqlfilters: filter
sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'"
}
});
//z.console.log(response);
if (response.status != 200) {
return [];
}
return response.json;
};
return z.request(url, options).then(response => JSON.parse(response.content));
},
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
@@ -76,20 +54,13 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'firstname', label: 'Firstname'},
{key: 'directions', label: 'Directions'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{
key: 'style',
label: 'Style'
}
{key: 'authorId', label: 'Author ID'},
{key: 'style', label: 'Style'}
]
}
};

View File

@@ -10,14 +10,14 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
body: JSON.stringify(data)
};
// You may return a promise or a normal data structure from any perform method.
@@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
@@ -74,7 +74,7 @@ const getFallbackRealAction = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/agendaevents/0',
url: bundle.authData.url + '/api/index.php/agendaevents/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
@@ -100,7 +100,7 @@ module.exports = {
noun: 'Action',
display: {
label: 'New Agenda',
description: 'Triggers when a new agenda with action is done in Dolibarr.'
description: 'Trigger when a new agenda with action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@@ -111,7 +111,6 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of agenda this should trigger on.',
choices: {
@@ -146,33 +145,12 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'name',
label: 'Name'
},
{
key: 'usertodo__name',
label: 'UserToDo Name'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
label: 'Action'
}
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'usertodo__name', label: 'UserToDo Name'},
{key: 'authorId', label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

View File

@@ -1,171 +0,0 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'contact',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getContact = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const contact = {
id: bundle.cleanedRequest.id,
name: bundle.cleanedRequest.name,
name_alias: bundle.cleanedRequest.name_alias,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email: bundle.cleanedRequest.email,
phone_pro: bundle.cleanedRequest.phone_pro,
phone_perso: bundle.cleanedRequest.phone_perso,
phone_mobile: bundle.cleanedRequest.phone_mobile,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [contact];
};
const getFallbackRealContact = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/contacts/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// contacts: "Contact",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'contact',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Contact',
display: {
label: 'New Contact',
description: 'Triggers when a new contact action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a user could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of contact this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getContact,
performList: getFallbackRealContact,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'lastname', label: 'Lastname'},
{key: 'firstname', label: 'Firstname'},
{key: 'phone', label: 'Phone pro'},
{key: 'phone_perso', label: 'Phone perso'},
{key: 'phone_mobile', label: 'Phone mobile'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

View File

@@ -1,171 +0,0 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'member',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getMember = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const member = {
id: bundle.cleanedRequest.id,
name: bundle.cleanedRequest.name,
name_alias: bundle.cleanedRequest.name_alias,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email: bundle.cleanedRequest.email,
phone_pro: bundle.cleanedRequest.phone_pro,
phone_perso: bundle.cleanedRequest.phone_perso,
phone_mobile: bundle.cleanedRequest.phone_mobile,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [member];
};
const getFallbackRealMember = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/members/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// members: "Member",
// members: "Members"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'member',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'Member',
display: {
label: 'New Member',
description: 'Triggers when a new member action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a user could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of member this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getMember,
performList: getFallbackRealMember,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'lastname', label: 'Lastname'},
{key: 'firstname', label: 'Firstname'},
{key: 'phone', label: 'Phone pro'},
{key: 'phone_perso', label: 'Phone perso'},
{key: 'phone_mobile', label: 'Phone mobile'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

View File

@@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = {
url: url,
method: 'POST',
body: data,
body: JSON.stringify(data)
};
// You may return a promise or a normal data structure from any perform method.
@@ -90,7 +90,7 @@ module.exports = {
noun: 'Order',
display: {
label: 'New Order',
description: 'Triggers when a new order with action is done in Dolibarr.'
description: 'Trigger when a new order with action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@@ -101,7 +101,6 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of order this should trigger on.',
choices: {
@@ -137,11 +136,11 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'directions', label: 'Directions'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'authorId', label: 'Author ID'},
{key: 'module', label: 'Module'},
{key: 'action', label: 'Action'}
]

View File

@@ -17,7 +17,7 @@ const subscribeHook = (z, bundle) => {
const options = {
url: url,
method: 'POST',
body: data,
body: JSON.stringify(data)
};
// You may return a promise or a normal data structure from any perform method.
@@ -56,12 +56,6 @@ const getThirdparty = (z, bundle) => {
fournisseur: bundle.cleanedRequest.fournisseur,
code_client: bundle.cleanedRequest.code_client,
code_fournisseur: bundle.cleanedRequest.code_fournisseur,
idprof1: bundle.cleanedRequest.idprof1,
idprof2: bundle.cleanedRequest.idprof2,
idprof3: bundle.cleanedRequest.idprof3,
idprof4: bundle.cleanedRequest.idprof4,
idprof5: bundle.cleanedRequest.idprof5,
idprof6: bundle.cleanedRequest.idprof6,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
@@ -118,7 +112,7 @@ module.exports = {
noun: 'Thirdparty',
display: {
label: 'New Thirdparty',
description: 'Triggers when a new thirdparty action is done in Dolibarr.'
description: 'Trigger when a new thirdpaty action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
@@ -129,7 +123,6 @@ module.exports = {
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of thirdparty this should trigger on.',
choices: {
@@ -166,23 +159,17 @@ module.exports = {
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'id', label: 'ID'},
{key: 'createdAt', label: 'Created At'},
{key: 'name', label: 'Name'},
{key: 'name_alias', label: 'Name alias'},
{key: 'firstname', label: 'Firstname'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'firstname', label: 'Firstame'},
{key: 'authorId', label: 'Author ID'},
{key: 'action', label: 'Action'},
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'},
{key: 'idprof1', label: 'Id Prof 1'},
{key: 'idprof2', label: 'Id Prof 2'},
{key: 'idprof3', label: 'Id Prof 3'},
{key: 'idprof4', label: 'Id Prof 4'},
{key: 'idprof5', label: 'Id Prof 5'},
{key: 'idprof6', label: 'Id Prof 6'}
{key: 'code_fournisseur', label: 'Supplier code'}
]
}
};

View File

@@ -1,237 +0,0 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'ticket',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getTicket = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const ticket = {
id: bundle.cleanedRequest.id,
track_id: bundle.cleanedRequest.track_id,
subject: bundle.cleanedRequest.subject,
message: bundle.cleanedRequest.message,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email_from: bundle.cleanedRequest.email_from,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [ticket];
};
const getFallbackRealTicket = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/tickets/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// tickets: "Ticket",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'ticket',
// You'll want to provide some helpful display labels and descriptions
// for tickets. Zapier will put them into the UX.
noun: 'Ticket',
display: {
label: 'New Ticket',
description: 'Triggers when a new ticket action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a ticket could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
type: 'string',
required: true,
helpText: 'Which action of ticket this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getTicket,
performList: getFallbackRealTicket,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
track_id: 'Xaz123er',
subject: 'Subject',
message: 'Message',
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
email_from: 'doe.john@example;com',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{
key: 'id',
type: "integer",
label: 'ID'
},
{
key: 'track_id',
type: "string",
label: 'TrackID'
},
{
key: 'subject',
type: "string",
label: 'Subject'
},
{
key: 'message',
type: "string",
label: 'Message'
},
{
key: 'createdAt',
type: "integer",
label: 'Created At'
},
{
key: 'lastname',
label: 'Lastname'
},
{
key: 'firstname',
label: 'Firstname'
},
{
key: 'email',
label: 'Email'
},
{
key: 'address',
label: 'Address'
},
{
key: 'zip',
label: 'Zip'
},
{
key: 'town',
label: 'Town'
},
{
key: 'email_from',
type: 'string',
label: 'Email from'
},
{
key: 'authorId',
type: "integer",
label: 'Author ID'
},
{
key: 'action',
type: 'string',
label: 'Action'
}
]
}
};

View File

@@ -1,177 +0,0 @@
const subscribeHook = (z, bundle) => {
// `z.console.log()` is similar to `console.log()`.
z.console.log('suscribing hook!');
// bundle.targetUrl has the Hook URL this app should call when an action is created.
const data = {
url: bundle.targetUrl,
event: bundle.event,
module: 'user',
action: bundle.inputData.action
};
const url = bundle.authData.url + '/api/index.php/zapierapi/hook';
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: url,
method: 'POST',
body: data,
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const unsubscribeHook = (z, bundle) => {
// bundle.subscribeData contains the parsed response JSON from the subscribe
// request made initially.
z.console.log('unsuscribing hook!');
// You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this.
const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id,
method: 'DELETE',
};
// You may return a promise or a normal data structure from any perform method.
return z.request(options).then((response) => JSON.parse(response.content));
};
const getUser = (z, bundle) => {
// bundle.cleanedRequest will include the parsed JSON object (if it's not a
// test poll) and also a .querystring property with the URL's query string.
const user = {
id: bundle.cleanedRequest.id,
lastname: bundle.cleanedRequest.lastname,
firstname: bundle.cleanedRequest.firstname,
address: bundle.cleanedRequest.address,
zip: bundle.cleanedRequest.zip,
town: bundle.cleanedRequest.town,
email: bundle.cleanedRequest.email,
login: bundle.cleanedRequest.login,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
};
return [user];
};
const getFallbackRealUser = (z, bundle) => {
// For the test poll, you should get some real data, to aid the setup process.
const module = bundle.inputData.module;
const options = {
url: bundle.authData.url + '/api/index.php/users/0',
};
return z.request(options).then((response) => [JSON.parse(response.content)]);
};
// const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices',
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// const getModulesChoices = () => {
// return {
// orders: "Order",
// invoices: "Invoice",
// thirdparties: "Thirdparty",
// users: "User",
// contacts: "Contacts"
// };
// };
// const getActionsChoices = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module;
// const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`,
// };
// return z.request(options).then((response) => JSON.parse(response.content));
// };
// We recommend writing your triggers separate like this and rolling them
// into the App definition at the end.
module.exports = {
key: 'user',
// You'll want to provide some helpful display labels and descriptions
// for users. Zapier will put them into the UX.
noun: 'User',
display: {
label: 'New User',
description: 'Triggers when a new user action is done in Dolibarr.'
},
// `operation` is where the business logic goes.
operation: {
// `inputFields` can define the fields a user could provide,
// we'll pass them in as `bundle.inputData` later.
inputFields: [
{
key: 'action',
required: true,
type: 'string',
helpText: 'Which action of user this should trigger on.',
choices: {
create: "Create",
modify: "Modify",
validate: "Validate",
}
}
],
type: 'hook',
performSubscribe: subscribeHook,
performUnsubscribe: unsubscribeHook,
perform: getUser,
performList: getFallbackRealUser,
// In cases where Zapier needs to show an example record to the user, but we are unable to get a live example
// from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of
// returned records, and have obviously dummy values that we can show to any user.
sample: {
id: 1,
createdAt: 1472069465,
lastname: 'DOE',
firstname: 'John',
email: 'john@doe.com',
address: 'Park Avenue',
zip: '12345',
town: 'NEW-YORK',
login: 'doe.john',
authorId: 1,
action: 'create'
},
// If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom
// field definitions. The result will be used to augment the sample.
// outputFields: () => { return []; }
// Alternatively, a static field definition should be provided, to specify labels for the fields
outputFields: [
{key: 'id', type: "integer", label: 'ID'},
{key: 'createdAt', type: "integer", label: 'Created At'},
{key: 'lastname', label: 'Lastname'},
{key: 'firstname', label: 'Firstname'},
{key: 'email', label: 'Email'},
{key: 'address', label: 'Address'},
{key: 'zip', label: 'Zip'},
{key: 'town', label: 'Town'},
{key: 'login', label: 'Login'},
{key: 'authorId', type: "integer", label: 'Author ID'},
{key: 'action', label: 'Action'}
]
}
};

View File

@@ -30,8 +30,8 @@ $script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -62,40 +62,40 @@ $startlinenb = empty($argv[3]) ? 1 : (int) $argv[3];
$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4];
if (empty($filepath)) {
print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n";
print "Example: php $script_file myfilepath.dbf 0 2 1002\n";
print "\n";
exit(-1);
print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n";
print "Example: php $script_file myfilepath.dbf 0 2 1002\n";
print "\n";
exit(-1);
}
if (!file_exists($filepath)) {
print "Error: File " . $filepath . " not found.\n";
print "\n";
exit(-1);
print "Error: File " . $filepath . " not found.\n";
print "\n";
exit(-1);
}
$ret = $user->fetch('', 'admin');
if (!$ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
}
$user->getrights();
// Ask confirmation
if (!$confirmed) {
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
}
// Open input and output files
$fhandle = dbase_open($filepath, 0);
if (!$fhandle) {
print 'Error: Failed to open file ' . $filepath . "\n";
exit(1);
print 'Error: Failed to open file ' . $filepath . "\n";
exit(1);
}
$fhandleerr = fopen($filepatherr, 'w');
if (!$fhandleerr) {
print 'Error: Failed to open file ' . $filepatherr . "\n";
exit(1);
print 'Error: Failed to open file ' . $filepatherr . "\n";
exit(1);
}
$langs->setDefaultLang($defaultlang);
@@ -105,23 +105,23 @@ $table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.'));
print 'Info: ' . $record_numbers . " lines in file \n";
$header = dbase_get_header_info($fhandle);
if ($deleteTable) {
$db->query("DROP TABLE IF EXISTS `$table_name`");
$db->query("DROP TABLE IF EXISTS `$table_name`");
}
$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT ";
$fieldArray = array("`id`");
foreach ($header as $value) {
$fieldName = substr(str_replace('_', '', $value['name']), $startchar);
$fieldArray[] = "`$fieldName`";
$sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL ";
$fieldName = substr(str_replace('_', '', $value['name']), $startchar);
$fieldArray[] = "`$fieldName`";
$sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL ";
}
$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB";
$resql = $db->query($sqlCreate);
if ($resql !== false) {
print "Table $table_name created\n";
print "Table $table_name created\n";
} else {
var_dump($db->errno());
print "Impossible : " . $sqlCreate . "\n";
die();
var_dump($db->errno());
print "Impossible : " . $sqlCreate . "\n";
die();
}
$i = 0;
@@ -131,33 +131,30 @@ $fields = implode(',', $fieldArray);
//var_dump($fieldArray);die();
$maxLength = 0;
for ($i = 1; $i <= $record_numbers; $i++) {
if ($startlinenb && $i < $startlinenb) {
continue;
}
if ($endlinenb && $i > $endlinenb) {
continue;
}
$row = dbase_get_record_with_names($fhandle, $i);
if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1')) {
continue;
}
$sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,";
array_shift($row); // remove delete column
foreach ($row as $value) {
$sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', ";
}
replaceable_echo(implode("\t", $row));
$sqlInsert = rtrim($sqlInsert, ', ');
$sqlInsert .= ")";
$resql = $db->query($sqlInsert);
if ($resql === false) {
print "Impossible : " . $sqlInsert . "\n";
var_dump($row, $db->errno());
die();
}
if ($startlinenb && $i < $startlinenb)
continue;
if ($endlinenb && $i > $endlinenb)
continue;
$row = dbase_get_record_with_names($fhandle, $i);
if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1'))
continue;
$sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,";
array_shift($row); // remove delete column
foreach ($row as $value) {
$sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', ";
}
replaceable_echo(implode("\t", $row));
$sqlInsert = rtrim($sqlInsert, ', ');
$sqlInsert .= ")";
$resql = $db->query($sqlInsert);
if ($resql === false) {
print "Impossible : " . $sqlInsert . "\n";
var_dump($row, $db->errno());
die();
}
// $fields = (object) $row;
// var_dump($fields);
continue;
continue;
}
die();
@@ -169,11 +166,11 @@ die();
print "Nb of lines qualified: " . $nboflines . "\n";
print "Nb of errors: " . $error . "\n";
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
print "Rollback any changes.\n";
$db->rollback();
print "Rollback any changes.\n";
$db->rollback();
} else {
print "Commit all changes.\n";
$db->commit();
print "Commit all changes.\n";
$db->commit();
}
$db->close();
@@ -192,43 +189,43 @@ exit($error);
*/
function replaceable_echo($message, $force_clear_lines = null)
{
static $last_lines = 0;
static $last_lines = 0;
if (!is_null($force_clear_lines)) {
$last_lines = $force_clear_lines;
}
if (!is_null($force_clear_lines)) {
$last_lines = $force_clear_lines;
}
$toss = array();
$status = 0;
$term_width = exec('tput cols', $toss, $status);
if ($status) {
$term_width = 64; // Arbitrary fall-back term width.
}
$toss = array();
$status = 0;
$term_width = exec('tput cols', $toss, $status);
if ($status) {
$term_width = 64; // Arbitrary fall-back term width.
}
$line_count = 0;
foreach (explode("\n", $message) as $line) {
$line_count += count(str_split($line, $term_width));
}
$line_count = 0;
foreach (explode("\n", $message) as $line) {
$line_count += count(str_split($line, $term_width));
}
// Erasure MAGIC: Clear as many lines as the last output had.
for ($i = 0; $i < $last_lines; $i++) {
// Return to the beginning of the line
echo "\r";
// Erase to the end of the line
echo "\033[K";
// Move cursor Up a line
echo "\033[1A";
// Return to the beginning of the line
echo "\r";
// Erase to the end of the line
echo "\033[K";
// Return to the beginning of the line
echo "\r";
// Can be consolodated into
// echo "\r\033[K\033[1A\r\033[K\r";
}
// Erasure MAGIC: Clear as many lines as the last output had.
for ($i = 0; $i < $last_lines; $i++) {
// Return to the beginning of the line
echo "\r";
// Erase to the end of the line
echo "\033[K";
// Move cursor Up a line
echo "\033[1A";
// Return to the beginning of the line
echo "\r";
// Erase to the end of the line
echo "\033[K";
// Return to the beginning of the line
echo "\r";
// Can be consolodated into
// echo "\r\033[K\033[1A\r\033[K\r";
}
$last_lines = $line_count;
$last_lines = $line_count;
echo $message . "\n";
echo $message . "\n";
}

View File

@@ -29,8 +29,8 @@ $sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -50,18 +50,18 @@ $confirmed = 1;
$error = 0;
$tvas = [
'1' => "20.00",
'2' => "5.50",
'3' => "0.00",
'4' => "20.60",
'5' => "19.60",
'1' => "20.00",
'2' => "5.50",
'3' => "0.00",
'4' => "20.60",
'5' => "19.60",
];
$tvasD = [
'1' => "20",
'2' => "5.5",
'3' => "0",
'4' => "20",
'5' => "20",
'1' => "20",
'2' => "5.5",
'3' => "0",
'4' => "20",
'5' => "20",
];
/*
@@ -75,167 +75,160 @@ dol_syslog($script_file . " launched with arg " . implode(',', $argv));
$table = $argv[1];
if (empty($argv[1])) {
print "Error: Which table ?\n";
print "\n";
exit(-1);
print "Error: Which table ?\n";
print "\n";
exit(-1);
}
$ret = $user->fetch('', 'admin');
if (!$ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
}
$sql = "SELECT * FROM `$table` WHERE 1";
$resql = $db->query($sql);
if ($resql) {
while ($fields = $db->fetch_array($resql)) {
$errorrecord = 0;
if ($fields === false) {
continue;
if ($resql)
while ($fields = $db->fetch_array($resql)) {
$errorrecord = 0;
if ($fields === false)
continue;
$nboflines++;
$produit = new Product($db);
$produit->type = 0;
$produit->status = 1;
$produit->ref = trim($fields['REF']);
if ($produit->ref == '')
continue;
print "Process line nb " . $j . ", ref " . $produit->ref;
$produit->label = trim($fields['LIBELLE']);
if ($produit->label == '')
$produit->label = $produit->ref;
if (empty($produit->label))
continue;
//$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : ''));
// $produit->volume = price2num($fields[8]);
// $produit->volume_unit = 0;
$produit->weight = price2num($fields['MASSE']);
$produit->weight_units = 0; // -3 = g
//$produit->customcode = $fields[10];
$produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT);
$produit->barcode_type = '2';
$produit->import_key = $fields['CODE'];
$produit->status = 1;
$produit->status_buy = 1;
$produit->finished = 1;
// $produit->multiprices[0] = price2num($fields['TARIF0']);
// $produit->multiprices[1] = price2num($fields['TARIF1']);
// $produit->multiprices[2] = price2num($fields['TARIF2']);
// $produit->multiprices[3] = price2num($fields['TARIF3']);
// $produit->multiprices[4] = price2num($fields['TARIF4']);
// $produit->multiprices[5] = price2num($fields['TARIF5']);
// $produit->multiprices[6] = price2num($fields['TARIF6']);
// $produit->multiprices[7] = price2num($fields['TARIF7']);
// $produit->multiprices[8] = price2num($fields['TARIF8']);
// $produit->multiprices[9] = price2num($fields['TARIF9']);
// $produit->price_min = null;
// $produit->price_min_ttc = null;
// $produit->price = price2num($fields[11]);
// $produit->price_ttc = price2num($fields[12]);
// $produit->price_base_type = 'TTC';
// $produit->tva_tx = price2num($fields[13]);
$produit->tva_tx = (int) ($tvas[$fields['CODTVA']]);
$produit->tva_npr = 0;
// $produit->cost_price = price2num($fields[16]);
//compta
$produit->accountancy_code_buy = trim($fields['COMACH']);
$produit->accountancy_code_sell = trim($fields['COMVEN']);
// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']);
// $produit->accountancy_code_sell_export=trim($fields['COMVEN']);
// Extrafields
// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
$produit->seuil_stock_alerte = $fields['STALERTE'];
$ret = $produit->create($user, 0);
if ($ret < 0) {
print " - Error in create result code = " . $ret . " - " . $produit->errorsToString();
$errorrecord++;
} else {
print " - Creation OK with ref " . $produit->ref . " - id = " . $ret;
}
dol_syslog("Add prices");
// If we use price level, insert price for each level
if (!$errorrecord && 1) {
//$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
$ret1 = false;
for ($i = 0; $i < 10; $i++) {
if ($fields['TARIF' . ($i)] == 0)
continue;
$ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0;
}
$nboflines++;
$produit = new Product($db);
$produit->type = 0;
$produit->status = 1;
$produit->ref = trim($fields['REF']);
if ($produit->ref == '') {
continue;
}
print "Process line nb " . $j . ", ref " . $produit->ref;
$produit->label = trim($fields['LIBELLE']);
if ($produit->label == '') {
$produit->label = $produit->ref;
}
if (empty($produit->label)) {
continue;
}
//$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : ''));
// $produit->volume = price2num($fields[8]);
// $produit->volume_unit = 0;
$produit->weight = price2num($fields['MASSE']);
$produit->weight_units = 0; // -3 = g
//$produit->customcode = $fields[10];
$produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT);
$produit->barcode_type = '2';
$produit->import_key = $fields['CODE'];
$produit->status = 1;
$produit->status_buy = 1;
$produit->finished = 1;
// $produit->multiprices[0] = price2num($fields['TARIF0']);
// $produit->multiprices[1] = price2num($fields['TARIF1']);
// $produit->multiprices[2] = price2num($fields['TARIF2']);
// $produit->multiprices[3] = price2num($fields['TARIF3']);
// $produit->multiprices[4] = price2num($fields['TARIF4']);
// $produit->multiprices[5] = price2num($fields['TARIF5']);
// $produit->multiprices[6] = price2num($fields['TARIF6']);
// $produit->multiprices[7] = price2num($fields['TARIF7']);
// $produit->multiprices[8] = price2num($fields['TARIF8']);
// $produit->multiprices[9] = price2num($fields['TARIF9']);
// $produit->price_min = null;
// $produit->price_min_ttc = null;
// $produit->price = price2num($fields[11]);
// $produit->price_ttc = price2num($fields[12]);
// $produit->price_base_type = 'TTC';
// $produit->tva_tx = price2num($fields[13]);
$produit->tva_tx = (int) ($tvas[$fields['CODTVA']]);
$produit->tva_npr = 0;
// $produit->cost_price = price2num($fields[16]);
//compta
$produit->accountancy_code_buy = trim($fields['COMACH']);
$produit->accountancy_code_sell = trim($fields['COMVEN']);
// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']);
// $produit->accountancy_code_sell_export=trim($fields['COMVEN']);
// Extrafields
// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
$produit->seuil_stock_alerte = $fields['STALERTE'];
$ret = $produit->create($user, 0);
if ($ret < 0) {
print " - Error in create result code = " . $ret . " - " . $produit->errorsToString();
if ($ret1) {
print " - Error in updatePrice result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - Creation OK with ref " . $produit->ref . " - id = " . $ret;
print " - updatePrice OK";
}
dol_syslog("Add prices");
// If we use price level, insert price for each level
if (!$errorrecord && 1) {
//$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
$ret1 = false;
for ($i = 0; $i < 10; $i++) {
if ($fields['TARIF' . ($i)] == 0) {
continue;
}
$ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0;
}
if ($ret1) {
print " - Error in updatePrice result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - updatePrice OK";
}
}
// dol_syslog("Add multilangs");
// Add alternative languages
// if (!$errorrecord && 1) {
// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private);
// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private);
//
// $ret = $produit->setMultiLangs($user);
// if ($ret < 0) {
// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString();
// $errorrecord++;
// } else {
// print " - setMultiLangs OK";
// }
// }
dol_syslog("Add stocks");
// stocks
if (!$errorrecord && $fields['STOCK'] != 0) {
$rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé');
if ($rets < 0) {
print " - Error in correct_stock result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - correct_stock OK";
}
}
//update date créa
if (!$errorrecord) {
$date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2);
$retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id");
if ($retd < 1) {
print " - Error in update date créa result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - update date créa OK";
}
}
print "\n";
if ($errorrecord) {
print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n");
var_dump($db);
die();
$error++; // $errorrecord will be reset
}
$j++;
}
} else {
die("error : $sql");
}
// dol_syslog("Add multilangs");
// Add alternative languages
// if (!$errorrecord && 1) {
// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private);
// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private);
//
// $ret = $produit->setMultiLangs($user);
// if ($ret < 0) {
// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString();
// $errorrecord++;
// } else {
// print " - setMultiLangs OK";
// }
// }
dol_syslog("Add stocks");
// stocks
if (!$errorrecord && $fields['STOCK'] != 0) {
$rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé');
if ($rets < 0) {
print " - Error in correct_stock result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - correct_stock OK";
}
}
//update date créa
if (!$errorrecord) {
$date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2);
$retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id");
if ($retd < 1) {
print " - Error in update date créa result " . $produit->errorsToString();
$errorrecord++;
} else {
print " - update date créa OK";
}
}
print "\n";
if ($errorrecord) {
print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n");
var_dump($db);
die();
$error++; // $errorrecord will be reset
}
$j++;
} else
die("error : $sql");

View File

@@ -29,8 +29,8 @@ $sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -50,73 +50,73 @@ $confirmed = 1;
$error = 0;
$civilPrivate = array("MLLE",
"MM",
"MM/MADAME",
"MME",
"MME.",
"MME²",
"MMONSIEUR",
"MMR",
"MOBNSIEUR",
"MOMSIEUR",
"MON SIEUR",
"MONDIAL",
"MONIEUR",
"MONJSIEUR",
"MONNSIEUR",
"MONRIEUR",
"MONS",
"MONSIEÕR",
"MONSIER",
"MONSIERU",
"MONSIEU",
"monsieue",
"MONSIEUR",
"Monsieur     \"",
"MONSIEUR    \"",
"MONSIEUR   E",
"MONSIEUR  DENIS",
"MONSIEUR ET MME",
"MONSIEUR!",
"MONSIEUR.",
"MONSIEUR.MADAME",
"MONSIEUR3",
"MONSIEURN",
"MONSIEURT",
"MONSIEUR£",
"MONSIEYR",
"Monsigur",
"MONSIIEUR",
"MONSIUER",
"MONSIZEUR",
"MOPNSIEUR",
"MOSIEUR",
"MR",
"Mr  Mme",
"Mr - MME",
"MR BLANC",
"MR ET MME",
"mr mm",
"MR OU MME",
"Mr.",
"MR/MME",
"MRME",
"MRR",
"Mrs",
"Mademoiselle",
"MADAOME",
"madamme",
"MADAME",
"M0NSIEUR",
"M.et Madame",
"M. ET MR",
"M.",
"M%",
"M MME",
"M ET MME",
"M",
"M CROCE",
"M DIEVART",
"MM",
"MM/MADAME",
"MME",
"MME.",
"MME²",
"MMONSIEUR",
"MMR",
"MOBNSIEUR",
"MOMSIEUR",
"MON SIEUR",
"MONDIAL",
"MONIEUR",
"MONJSIEUR",
"MONNSIEUR",
"MONRIEUR",
"MONS",
"MONSIEÕR",
"MONSIER",
"MONSIERU",
"MONSIEU",
"monsieue",
"MONSIEUR",
"Monsieur     \"",
"MONSIEUR    \"",
"MONSIEUR   E",
"MONSIEUR  DENIS",
"MONSIEUR ET MME",
"MONSIEUR!",
"MONSIEUR.",
"MONSIEUR.MADAME",
"MONSIEUR3",
"MONSIEURN",
"MONSIEURT",
"MONSIEUR£",
"MONSIEYR",
"Monsigur",
"MONSIIEUR",
"MONSIUER",
"MONSIZEUR",
"MOPNSIEUR",
"MOSIEUR",
"MR",
"Mr  Mme",
"Mr - MME",
"MR BLANC",
"MR ET MME",
"mr mm",
"MR OU MME",
"Mr.",
"MR/MME",
"MRME",
"MRR",
"Mrs",
"Mademoiselle",
"MADAOME",
"madamme",
"MADAME",
"M0NSIEUR",
"M.et Madame",
"M. ET MR",
"M.",
"M%",
"M MME",
"M ET MME",
"M",
"M CROCE",
"M DIEVART",
);
/*
@@ -130,134 +130,129 @@ dol_syslog($script_file . " launched with arg " . implode(',', $argv));
$table = $argv[1];
if (empty($argv[1])) {
print "Error: Quelle table ?\n";
print "\n";
exit(-1);
print "Error: Quelle table ?\n";
print "\n";
exit(-1);
}
$ret = $user->fetch('', 'admin');
if (!$ret > 0) {
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
exit;
}
$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC";
$resql = $db->query($sql);
//$db->begin();
if ($resql) {
while ($fields = $db->fetch_array($resql)) {
$i++;
$errorrecord = 0;
if ($resql)
while ($fields = $db->fetch_array($resql)) {
$i++;
$errorrecord = 0;
if ($startlinenb && $i < $startlinenb) {
continue;
}
if ($endlinenb && $i > $endlinenb) {
continue;
}
if ($startlinenb && $i < $startlinenb)
continue;
if ($endlinenb && $i > $endlinenb)
continue;
$nboflines++;
$nboflines++;
$object = new Societe($db);
$object->import_key = $fields['CODE'];
$object->state = 1;
$object->client = 3;
$object->fournisseur = 0;
$object = new Societe($db);
$object->import_key = $fields['CODE'];
$object->state = 1;
$object->client = 3;
$object->fournisseur = 0;
$object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM'];
//$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
$object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM'];
//$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
$date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101');
$object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT);
$date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101');
$object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT);
$object->address = trim($fields['FADR1']);
if ($fields['FADR2']) {
$object->address .= "\n" . trim($fields['FADR2']);
}
if ($fields['FADR3']) {
$object->address .= "\n" . trim($fields['FADR3']);
}
$object->address = trim($fields['FADR1']);
if ($fields['FADR2'])
$object->address .= "\n" . trim($fields['FADR2']);
if ($fields['FADR3'])
$object->address .= "\n" . trim($fields['FADR3']);
$object->zip = trim($fields['FPOSTE']);
$object->town = trim($fields['FVILLE']);
if ($fields['FPAYS']) {
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
$object->zip = trim($fields['FPOSTE']);
$object->town = trim($fields['FVILLE']);
if ($fields['FPAYS'])
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
else
$object->country_id = 1;
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
$object->phone = substr($object->phone, 0, 20);
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
$object->fax = substr($object->fax, 0, 20);
$object->email = trim($fields['FMAIL']);
// $object->idprof2 = trim($fields[29]);
$object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']);
$object->tva_intra = substr($object->tva_intra, 0, 20);
$object->default_lang = 'fr_FR';
$object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1);
$object->multicurrency_code = 'EUR';
if ($fields['REMISE'] != '0.00') {
$object->remise_percent = abs($fields['REMISE']);
}
// $object->code_client = $fields[9];
// $object->code_fournisseur = $fields[10];
if ($fields['FCIVIL']) {
$labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL';
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code');
}
// Set price level
$object->price_level = $fields['TARIF'] + 1;
// if ($labeltype == 'Revendeur')
// $object->price_level = 2;
print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name;
// Extrafields
$object->array_options['options_banque'] = $fields['BANQUE'];
$object->array_options['options_banque2'] = $fields['BANQUE2'];
$object->array_options['options_banquevalid'] = $fields['VALID'];
if (!$errorrecord) {
$ret = $object->create($user);
if ($ret < 0) {
print " - Error in create result code = " . $ret . " - " . $object->errorsToString();
$errorrecord++;
var_dump($object->code_client, $db);
die();
} else {
$object->country_id = 1;
print " - Creation OK with name " . $object->name . " - id = " . $ret;
}
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
$object->phone = substr($object->phone, 0, 20);
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
$object->fax = substr($object->fax, 0, 20);
$object->email = trim($fields['FMAIL']);
// $object->idprof2 = trim($fields[29]);
$object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']);
$object->tva_intra = substr($object->tva_intra, 0, 20);
$object->default_lang = 'fr_FR';
}
$object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1);
$object->multicurrency_code = 'EUR';
if (!$errorrecord) {
dol_syslog("Set price level");
$object->set_price_level($object->price_level, $user);
}
if (!$errorrecord && @$object->remise_percent) {
dol_syslog("Set remise client");
$object->set_remise_client($object->remise_percent, 'Importé', $user);
}
if ($fields['REMISE'] != '0.00') {
$object->remise_percent = abs($fields['REMISE']);
}
// $object->code_client = $fields[9];
// $object->code_fournisseur = $fields[10];
if ($fields['FCIVIL']) {
$labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL';
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code');
}
// Set price level
$object->price_level = $fields['TARIF'] + 1;
// if ($labeltype == 'Revendeur')
// $object->price_level = 2;
print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name;
// Extrafields
$object->array_options['options_banque'] = $fields['BANQUE'];
$object->array_options['options_banque2'] = $fields['BANQUE2'];
$object->array_options['options_banquevalid'] = $fields['VALID'];
if (!$errorrecord) {
$ret = $object->create($user);
if ($ret < 0) {
print " - Error in create result code = " . $ret . " - " . $object->errorsToString();
$errorrecord++;
var_dump($object->code_client, $db);
die();
} else {
print " - Creation OK with name " . $object->name . " - id = " . $ret;
}
}
if (!$errorrecord) {
dol_syslog("Set price level");
$object->set_price_level($object->price_level, $user);
}
if (!$errorrecord && @$object->remise_percent) {
dol_syslog("Set remise client");
$object->set_remise_client($object->remise_percent, 'Importé', $user);
}
dol_syslog("Add contact");
// Insert an invoice contact if there is an invoice email != standard email
if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) {
$madame = array("MADAME",
dol_syslog("Add contact");
// Insert an invoice contact if there is an invoice email != standard email
if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) {
$madame = array("MADAME",
"MADEMOISELLE",
"MELLE",
"MLLE",
"MM",
"Mme",
"MNE",
);
$monsieur = array("M",
);
$monsieur = array("M",
"M ET MME",
"M MME",
"M.",
@@ -274,84 +269,79 @@ if ($resql) {
"MONSIUER",
"MONSKIEUR",
"MR",
);
$ret1 = $ret2 = 0;
);
$ret1 = $ret2 = 0;
$contact = new Contact($db);
if (in_array($fields['LCIVIL'], $madame)) {
// une dame
$contact->civility_id = 'MME';
$contact->lastname = $fields['LNOM'];
} elseif (in_array($fields['LCIVIL'], $monsieur)) {
// un monsieur
$contact->civility_id = 'MR';
$contact->lastname = $fields['LNOM'];
} elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) {
// un monsieur
$contact->civility_id = 'DR';
$contact->lastname = $fields['LNOM'];
} else {
// un a rattraper
$contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM'];
}
$contact->address = trim($fields['LADR1']);
if ($fields['LADR2']) {
$contact->address .= "\n" . trim($fields['LADR2']);
}
if ($fields['LADR3']) {
$contact->address .= "\n" . trim($fields['LADR3']);
}
$contact->zip = trim($fields['LPOSTE']);
$contact->town = trim($fields['LVILLE']);
if ($fields['FPAYS']) {
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
} else {
$contact->country_id = 1;
}
$contact->email = $fields['LMAIL'];
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
$contact->socid = $object->id;
$ret1 = $contact->create($user);
if ($ret1 > 0) {
//$ret2=$contact->add_contact($object->id, 'BILLING');
}
if ($ret1 < 0 || $ret2 < 0) {
print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString();
$errorrecord++;
} else {
print " - create contact OK";
}
$contact = new Contact($db);
if (in_array($fields['LCIVIL'], $madame)) {
// une dame
$contact->civility_id = 'MME';
$contact->lastname = $fields['LNOM'];
} elseif (in_array($fields['LCIVIL'], $monsieur)) {
// un monsieur
$contact->civility_id = 'MR';
$contact->lastname = $fields['LNOM'];
} elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) {
// un monsieur
$contact->civility_id = 'DR';
$contact->lastname = $fields['LNOM'];
} else {
// un a rattraper
$contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM'];
}
$contact->address = trim($fields['LADR1']);
if ($fields['LADR2'])
$contact->address .= "\n" . trim($fields['LADR2']);
if ($fields['LADR3'])
$contact->address .= "\n" . trim($fields['LADR3']);
$contact->zip = trim($fields['LPOSTE']);
$contact->town = trim($fields['LVILLE']);
if ($fields['FPAYS'])
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
else
$contact->country_id = 1;
$contact->email = $fields['LMAIL'];
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
$contact->socid = $object->id;
//update date créa
if (!$errorrecord) {
$datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
$retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id");
if ($retd < 1) {
print " - Error in update date créa result " . $object->errorsToString();
$errorrecord++;
} else {
print " - update date créa OK";
}
$ret1 = $contact->create($user);
if ($ret1 > 0) {
//$ret2=$contact->add_contact($object->id, 'BILLING');
}
print "\n";
if ($errorrecord) {
print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n");
var_dump($db, $object, $contact);
// $db->rollback();
die();
$error++; // $errorrecord will be reset
if ($ret1 < 0 || $ret2 < 0) {
print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString();
$errorrecord++;
} else {
print " - create contact OK";
}
$j++;
}
} else {
die("error : $sql");
}
//update date créa
if (!$errorrecord) {
$datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
$retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id");
if ($retd < 1) {
print " - Error in update date créa result " . $object->errorsToString();
$errorrecord++;
} else {
print " - update date créa OK";
}
}
print "\n";
if ($errorrecord) {
print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n");
var_dump($db, $object, $contact);
// $db->rollback();
die();
$error++; // $errorrecord will be reset
}
$j++;
} else
die("error : $sql");
$db->commit();

View File

@@ -18,582 +18,385 @@ define('DBASE_TYPE_FOXPRO', 1);
*/
class DBase
{
private $fd;
private $headerLength = 0;
private $fields = array();
private $fieldCount = 0;
private $recordLength = 0;
private $recordCount = 0;
private $fd;
private $headerLength = 0;
private $fields = array();
private $fieldCount = 0;
private $recordLength = 0;
private $recordCount = 0;
/**
* resource dbase_open
* @param string $filename filename
* @param int $mode mode
* @return DBase
*/
public static function open($filename, $mode)
//resource dbase_open ( string $filename , int $mode )
public static function open($filename, $mode)
{
if (!file_exists($filename)) {
return false;
}
$modes = array('r', 'w', 'r+');
$mode = $modes[$mode];
$fd = fopen($filename, $mode);
if (!$fd) {
return false;
}
return new DBase($fd);
}
if (!file_exists($filename))
return false;
$modes = array('r', 'w', 'r+');
$mode = $modes[$mode];
$fd = fopen($filename, $mode);
if (!$fd)
return false;
return new DBase($fd);
}
/**
* resource dbase_create
* @param string $filename filename
* @param array $fields fields
* @param int $type DBASE_TYPE_DBASE
* @return DBase
*/
public static function create($filename, $fields, $type = DBASE_TYPE_DBASE)
//resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] )
public static function create($filename, $fields, $type = DBASE_TYPE_DBASE)
{
if (file_exists($filename)) {
return false;
}
$fd = fopen($filename, 'c+');
if (!$fd) {
return false;
}
// Byte 0 (1 byte): Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3
// indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the
// presence of a SQL table, bit 7 indicates the presence of any memo file
// (either dBASE m PLUS or dBASE for DOS)
self::putChar8($fd, 5);
// Byte 1-3 (3 bytes): Date of last update; formatted as YYMMDD
self::putChar8($fd, date('Y') - 1900);
self::putChar8($fd, date('m'));
self::putChar8($fd, date('d'));
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
self::putInt32($fd, 0);
// Byte 8-9 (16-bit number): Number of bytes in the header.
self::putInt16($fd, 32 + (32 * count($fields)) + 1);
// Byte 10-11 (16-bit number): Number of bytes in record.
// Make sure the include the byte for deleted flag
$len = 1;
foreach ($fields as &$field) {
$len += self::length($field);
}
self::putInt16($fd, $len);
// Byte 12-13 (2 bytes): Reserved, 0 filled.
self::putInt16($fd, 0);
// Byte 14 (1 byte): Flag indicating incomplete transaction
// The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
self::putChar8($fd, 0);
// Byte 15 (1 byte): Encryption flag. If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
self::putChar8($fd, 0);
// Byte 16-27 (12 bytes): Reserved for dBASE for DOS in a multi-user environment
self::putInt32($fd, 0);
self::putInt32($fd, 0);
self::putInt32($fd, 0);
// Byte 28 (1 byte): Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
self::putChar8($fd, 0);
// Byte 29 (1 byte): Language driver ID
// (no clue what this is)
self::putChar8($fd, 0);
// Byte 30-31 (2 bytes): Reserved, 0 filled.
self::putInt16($fd, 0);
// Byte 32 - n (32 bytes each): Field descriptor array
foreach ($fields as &$field) {
self::putString($fd, $field[0], 11); // Byte 0 - 10 (11 bytes): Field name in ASCII (zero-filled)
self::putString($fd, $field[1], 1); // Byte 11 (1 byte): Field type in ASCII (C, D, F, L, M, or N)
self::putInt32($fd, 0); // Byte 12 - 15 (4 bytes): Reserved
self::putChar8($fd, self::length($field)); // Byte 16 (1 byte): Field length in binary. The maximum length of a field is 254 (0xFE).
self::putChar8($fd, $field[3]); // Byte 17 (1 byte): Field decimal count in binary
self::putInt16($fd, 0); // Byte 18 - 19 (2 bytes): Work area ID
self::putChar8($fd, 0); // Byte 20 (1 byte): Example (??)
self::putInt32($fd, 0); // Byte 21 - 30 (10 bytes): Reserved
self::putInt32($fd, 0);
self::putInt16($fd, 0);
self::putChar8($fd, 0); // Byte 31 (1 byte): Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
}
// Byte n + 1 (1 byte): 0x0D as the field descriptor array terminator
self::putChar8($fd, 0x0D);
return new DBase($fd);
}
if (file_exists($filename))
return false;
$fd = fopen($filename, 'c+');
if (!$fd)
return false;
// Byte 0 (1 byte): Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3
// indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the
// presence of a SQL table, bit 7 indicates the presence of any memo file
// (either dBASE m PLUS or dBASE for DOS)
self::putChar8($fd, 5);
// Byte 1-3 (3 bytes): Date of last update; formatted as YYMMDD
self::putChar8($fd, date('Y') - 1900);
self::putChar8($fd, date('m'));
self::putChar8($fd, date('d'));
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
self::putInt32($fd, 0);
// Byte 8-9 (16-bit number): Number of bytes in the header.
self::putInt16($fd, 32 + (32 * count($fields)) + 1);
// Byte 10-11 (16-bit number): Number of bytes in record.
// Make sure the include the byte for deleted flag
$len = 1;
foreach ($fields as &$field)
$len += self::length($field);
self::putInt16($fd, $len);
// Byte 12-13 (2 bytes): Reserved, 0 filled.
self::putInt16($fd, 0);
// Byte 14 (1 byte): Flag indicating incomplete transaction
// The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
self::putChar8($fd, 0);
// Byte 15 (1 byte): Encryption flag. If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
self::putChar8($fd, 0);
// Byte 16-27 (12 bytes): Reserved for dBASE for DOS in a multi-user environment
self::putInt32($fd, 0);
self::putInt32($fd, 0);
self::putInt32($fd, 0);
// Byte 28 (1 byte): Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
self::putChar8($fd, 0);
// Byte 29 (1 byte): Language driver ID
// (no clue what this is)
self::putChar8($fd, 0);
// Byte 30-31 (2 bytes): Reserved, 0 filled.
self::putInt16($fd, 0);
// Byte 32 - n (32 bytes each): Field descriptor array
foreach ($fields as &$field) {
self::putString($fd, $field[0], 11); // Byte 0 - 10 (11 bytes): Field name in ASCII (zero-filled)
self::putString($fd, $field[1], 1); // Byte 11 (1 byte): Field type in ASCII (C, D, F, L, M, or N)
self::putInt32($fd, 0); // Byte 12 - 15 (4 bytes): Reserved
self::putChar8($fd, self::length($field)); // Byte 16 (1 byte): Field length in binary. The maximum length of a field is 254 (0xFE).
self::putChar8($fd, $field[3]); // Byte 17 (1 byte): Field decimal count in binary
self::putInt16($fd, 0); // Byte 18 - 19 (2 bytes): Work area ID
self::putChar8($fd, 0); // Byte 20 (1 byte): Example (??)
self::putInt32($fd, 0); // Byte 21 - 30 (10 bytes): Reserved
self::putInt32($fd, 0);
self::putInt16($fd, 0);
self::putChar8($fd, 0); // Byte 31 (1 byte): Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
}
// Byte n + 1 (1 byte): 0x0D as the field descriptor array terminator
self::putChar8($fd, 0x0D);
return new DBase($fd);
}
/**
* Create DBase instance
* @param mixed $fd file descriptor
* @return void
*/
private function __construct($fd)
// Create DBase instance
private function __construct($fd)
{
$this->fd = $fd;
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
fseek($this->fd, 4, SEEK_SET);
$this->recordCount = self::getInt32($fd);
// Byte 8-9 (16-bit number): Number of bytes in the header.
fseek($this->fd, 8, SEEK_SET);
$this->headerLength = self::getInt16($fd);
// Number of fields is (headerLength - 33) / 32)
$this->fieldCount = ($this->headerLength - 33) / 32;
// Byte 10-11 (16-bit number): Number of bytes in record.
fseek($this->fd, 10, SEEK_SET);
$this->recordLength = self::getInt16($fd);
// Byte 32 - n (32 bytes each): Field descriptor array
fseek($fd, 32, SEEK_SET);
for ($i = 0; $i < $this->fieldCount; $i++) {
$data = fread($this->fd, 32);
$field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data));
$this->fields[] = $field;
}
}
$this->fd = $fd;
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
fseek($this->fd, 4, SEEK_SET);
$this->recordCount = self::getInt32($fd);
// Byte 8-9 (16-bit number): Number of bytes in the header.
fseek($this->fd, 8, SEEK_SET);
$this->headerLength = self::getInt16($fd);
// Number of fields is (headerLength - 33) / 32)
$this->fieldCount = ($this->headerLength - 33) / 32;
// Byte 10-11 (16-bit number): Number of bytes in record.
fseek($this->fd, 10, SEEK_SET);
$this->recordLength = self::getInt16($fd);
// Byte 32 - n (32 bytes each): Field descriptor array
fseek($fd, 32, SEEK_SET);
for ($i = 0; $i < $this->fieldCount; $i++) {
$data = fread($this->fd, 32);
$field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data));
$this->fields[] = $field;
}
}
/**
* dbase_close
* @return void
*/
public function close()
//bool dbase_close ( resource $dbase_identifier )
public function close()
{
fclose($this->fd);
}
fclose($this->fd);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_get_header_info
* @return array
*/
public function get_header_info()
//array dbase_get_header_info ( resource $dbase_identifier )
public function get_header_info()
{
// phpcs:disable
return $this->fields;
}
return $this->fields;
}
/**
* dbase_numfields
* @return int
*/
public function numfields()
//int dbase_numfields ( resource $dbase_identifier )
public function numfields()
{
return $this->fieldCount;
}
return $this->fieldCount;
}
/**
* dbase_numrecords
* @return int
*/
public function numrecords()
//int dbase_numrecords ( resource $dbase_identifier )
public function numrecords()
{
return $this->recordCount;
}
return $this->recordCount;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_add_record
* @param array $record record
* @return bool
*/
public function add_record($record)
//bool dbase_add_record ( resource $dbase_identifier , array $record )
public function add_record($record)
{
// phpcs:enable
if (count($record) != $this->fieldCount) {
return false;
}
// Seek to end of file, minus the end of file marker
fseek($this->fd, 0, SEEK_END);
// Put the deleted flag
self::putChar8($this->fd, 0x20);
// Put the record
if (!$this->putRecord($record)) {
return false;
}
// Update the record count
fseek($this->fd, 4);
self::putInt32($this->fd, ++$this->recordCount);
return true;
}
if (count($record) != $this->fieldCount)
return false;
// Seek to end of file, minus the end of file marker
fseek($this->fd, 0, SEEK_END);
// Put the deleted flag
self::putChar8($this->fd, 0x20);
// Put the record
if (!$this->putRecord($record))
return false;
// Update the record count
fseek($this->fd, 4);
self::putInt32($this->fd, ++$this->recordCount);
return true;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_replace_record
* @param array $record record
* @param int $record_number record number
* @return bool
*/
public function replace_record($record, $record_number)
//bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number )
public function replace_record($record, $record_number)
{
// phpcs:enable
if (count($record) != $this->fieldCount) {
return false;
}
if ($record_number < 1 || $record_number > $this->recordCount) {
return false;
}
// Skip to the record location, plus the 1 byte for the deleted flag
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1);
return $this->putRecord($record);
}
if (count($record) != $this->fieldCount)
return false;
if ($record_number < 1 || $record_number > $this->recordCount)
return false;
// Skip to the record location, plus the 1 byte for the deleted flag
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1);
return $this->putRecord($record);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_delete_record
* @param int $record_number record number
* @return bool
*/
public function delete_record($record_number)
//bool dbase_delete_record ( resource $dbase_identifier , int $record_number )
public function delete_record($record_number)
{
// phpcs:enable
if ($record_number < 1 || $record_number > $this->recordCount) {
return false;
}
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
self::putChar8($this->fd, 0x2A);
return true;
}
if ($record_number < 1 || $record_number > $this->recordCount)
return false;
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
self::putChar8($this->fd, 0x2A);
return true;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_get_record
* @param int $record_number record number
* @return array
*/
public function get_record($record_number)
//array dbase_get_record ( resource $dbase_identifier , int $record_number )
public function get_record($record_number)
{
// phpcs:enable
if ($record_number < 1 || $record_number > $this->recordCount) {
return false;
}
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
$record = array(
'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0
);
foreach ($this->fields as $i => &$field) {
$value = trim(fread($this->fd, $field['length']));
if ($field['type'] == 'L') {
$value = strtolower($value);
if ($value == 't' || $value == 'y') {
$value = true;
} elseif ($value == 'f' || $value == 'n') {
$value = false;
} else {
$value = null;
}
}
$record[$i] = $value;
}
return $record;
}
if ($record_number < 1 || $record_number > $this->recordCount)
return false;
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
$record = array(
'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0
);
foreach ($this->fields as $i => &$field) {
$value = trim(fread($this->fd, $field['length']));
if ($field['type'] == 'L') {
$value = strtolower($value);
if ($value == 't' || $value == 'y')
$value = true;
elseif ($value == 'f' || $value == 'n')
$value = false;
else
$value = null;
}
$record[$i] = $value;
}
return $record;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* dbase_get_record_with_names
* @param int $record_number record number
* @return array
*/
public function get_record_with_names($record_number)
//array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number )
public function get_record_with_names($record_number)
{
// phpcs:enable
if ($record_number < 1 || $record_number > $this->recordCount) {
return false;
}
$record = $this->get_record($record_number);
foreach ($this->fields as $i => &$field) {
$record[$field['name']] = $record[$i];
unset($record[$i]);
}
return $record;
}
if ($record_number < 1 || $record_number > $this->recordCount)
return false;
$record = $this->get_record($record_number);
foreach ($this->fields as $i => &$field) {
$record[$field['name']] = $record[$i];
unset($record[$i]);
}
return $record;
}
/**
* dbase_pack
* @return void
*/
public function pack()
//bool dbase_pack ( resource $dbase_identifier )
public function pack()
{
$in_offset = $out_offset = $this->headerLength;
$new_count = 0;
$rec_count = $this->recordCount;
while ($rec_count > 0) {
fseek($this->fd, $in_offset, SEEK_SET);
$record = fread($this->fd, $this->recordLength);
$deleted = substr($record, 0, 1);
if ($deleted != '*') {
fseek($this->fd, $out_offset, SEEK_SET);
fwrite($this->fd, $record);
$out_offset += $this->recordLength;
$new_count++;
}
$in_offset += $this->recordLength;
$rec_count--;
}
ftruncate($this->fd, $out_offset);
// Update the record count
fseek($this->fd, 4);
self::putInt32($this->fd, $new_count);
}
$in_offset = $out_offset = $this->headerLength;
$new_count = 0;
$rec_count = $this->recordCount;
while ($rec_count > 0) {
fseek($this->fd, $in_offset, SEEK_SET);
$record = fread($this->fd, $this->recordLength);
$deleted = substr($record, 0, 1);
if ($deleted != '*') {
fseek($this->fd, $out_offset, SEEK_SET);
fwrite($this->fd, $record);
$out_offset += $this->recordLength;
$new_count++;
}
$in_offset += $this->recordLength;
$rec_count--;
}
ftruncate($this->fd, $out_offset);
// Update the record count
fseek($this->fd, 4);
self::putInt32($this->fd, $new_count);
}
/*
* A few utilitiy functions
*/
/*
* A few utilitiy functions
*/
/**
* @param string $field field
* @return int
*/
private static function length($field)
private static function length($field)
{
switch ($field[1]) {
case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
return 8;
case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro)
return 18;
case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
case 'N': // Number: -.0123456789 (right justified, padded with whitespaces)
case 'F': // Float: -.0123456789 (right justified, padded with whitespaces)
case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length)
return $field[2];
case 'L': // Boolean: YyNnTtFf? (? when not initialized)
return 1;
}
return 0;
}
switch ($field[1]) {
case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
return 8;
case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro)
return 18;
case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
case 'N': // Number: -.0123456789 (right justified, padded with whitespaces)
case 'F': // Float: -.0123456789 (right justified, padded with whitespaces)
case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length)
return $field[2];
case 'L': // Boolean: YyNnTtFf? (? when not initialized)
return 1;
}
return 0;
}
/*
* Functions for reading and writing bytes
*/
/*
* Functions for reading and writing bytes
*/
/**
* getChar8
* @param mixed $fd file descriptor
* @return int
*/
private static function getChar8($fd)
private static function getChar8($fd)
{
return ord(fread($fd, 1));
}
return ord(fread($fd, 1));
}
/**
* putChar8
* @param mixed $fd file descriptor
* @param mixed $value value
* @return bool
*/
private static function putChar8($fd, $value)
private static function putChar8($fd, $value)
{
return fwrite($fd, chr($value));
}
return fwrite($fd, chr($value));
}
/**
* getInt16
* @param mixed $fd file descriptor
* @param int $n n
* @return bool
*/
private static function getInt16($fd, $n = 1)
private static function getInt16($fd, $n = 1)
{
$data = fread($fd, 2 * $n);
$i = unpack("S$n", $data);
if ($n == 1) {
return (int) $i[1];
} else {
return array_merge($i);
}
}
$data = fread($fd, 2 * $n);
$i = unpack("S$n", $data);
if ($n == 1)
return (int) $i[1];
else
return array_merge($i);
}
/**
* putInt16
* @param mixed $fd file descriptor
* @param mixed $value value
* @return bool
*/
private static function putInt16($fd, $value)
private static function putInt16($fd, $value)
{
return fwrite($fd, pack('S', $value));
}
return fwrite($fd, pack('S', $value));
}
/**
* getInt32
* @param mixed $fd file descriptor
* @param int $n n
* @return bool
*/
private static function getInt32($fd, $n = 1)
private static function getInt32($fd, $n = 1)
{
$data = fread($fd, 4 * $n);
$i = unpack("L$n", $data);
if ($n == 1) {
return (int) $i[1];
} else {
return array_merge($i);
}
}
$data = fread($fd, 4 * $n);
$i = unpack("L$n", $data);
if ($n == 1)
return (int) $i[1];
else
return array_merge($i);
}
/**
* putint32
* @param mixed $fd file descriptor
* @param mixed $value value
* @return bool
*/
private static function putInt32($fd, $value)
private static function putInt32($fd, $value)
{
return fwrite($fd, pack('L', $value));
}
return fwrite($fd, pack('L', $value));
}
/**
* putString
* @param mixed $fd file descriptor
* @param mixed $value value
* @param int $length length
* @return bool
*/
private static function putString($fd, $value, $length = 254)
private static function putString($fd, $value, $length = 254)
{
$ret = fwrite($fd, pack('A' . $length, $value));
}
$ret = fwrite($fd, pack('A' . $length, $value));
}
/**
* putRecord
* @param mixed $record record
* @return bool
*/
private function putRecord($record)
private function putRecord($record)
{
foreach ($this->fields as $i => &$field) {
$value = $record[$i];
// Number types are right aligned with spaces
if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) {
$value = str_repeat(' ', $field['length'] - strlen($value)) . $value;
}
self::putString($this->fd, $value, $field['length']);
}
return true;
}
foreach ($this->fields as $i => &$field) {
$value = $record[$i];
// Number types are right aligned with spaces
if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) {
$value = str_repeat(' ', $field['length'] - strlen($value)) . $value;
}
self::putString($this->fd, $value, $field['length']);
}
return true;
}
}
if (!function_exists('dbase_open')) {
/**
* dbase_open
* @param string $filename filename
* @param int $mode mode
* @return DBase
*/
function dbase_open($filename, $mode)
{
return DBase::open($filename, $mode);
}
/**
* dbase_create
* @param string $filename filename
* @param array $fields fields
* @param int $type type
* @return DBase
*/
function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE)
function dbase_open($filename, $mode)
{
return DBase::create($filename, $fields, $type);
}
return DBase::open($filename, $mode);
}
/**
* dbase_close
* @param Resource $dbase_identifier dbase identifier
* @return bool
*/
function dbase_close($dbase_identifier)
function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE)
{
return $dbase_identifier->close();
}
return DBase::create($filename, $fields, $type);
}
/**
* dbase_get_header_info
* @param Resource $dbase_identifier dbase identifier
* @return string
*/
function dbase_get_header_info($dbase_identifier)
function dbase_close($dbase_identifier)
{
return $dbase_identifier->get_header_info();
}
return $dbase_identifier->close();
}
/**
* dbase_numfields
* @param Resource $dbase_identifier dbase identifier
* @return int
*/
function dbase_numfields($dbase_identifier)
function dbase_get_header_info($dbase_identifier)
{
$dbase_identifier->numfields();
}
return $dbase_identifier->get_header_info();
}
/**
* dbase_numrecords
* @param Resource $dbase_identifier dbase identifier
* @return int
*/
function dbase_numrecords($dbase_identifier)
function dbase_numfields($dbase_identifier)
{
return $dbase_identifier->numrecords();
}
$dbase_identifier->numfields();
}
/**
* dbase_add_record
* @param Resource $dbase_identifier dbase identifier
* @param array $record record
* @return bool
*/
function dbase_add_record($dbase_identifier, $record)
function dbase_numrecords($dbase_identifier)
{
return $dbase_identifier->add_record($record);
}
return $dbase_identifier->numrecords();
}
/**
* dbase_delete_record
* @param Resource $dbase_identifier dbase identifier
* @param int $record_number record number
* @return bool
*/
function dbase_delete_record($dbase_identifier, $record_number)
function dbase_add_record($dbase_identifier, $record)
{
return $dbase_identifier->delete_record($record_number);
}
return $dbase_identifier->add_record($record);
}
/**
* dbase_replace_record
* @param Resource $dbase_identifier dbase identifier
* @param array $record record
* @param int $record_number record number
* @return bool
*/
function dbase_replace_record($dbase_identifier, $record, $record_number)
function dbase_delete_record($dbase_identifier, $record_number)
{
return $dbase_identifier->replace_record($record, $record_number);
}
return $dbase_identifier->delete_record($record_number);
}
/**
* dbase_get_record
* @param Resource $dbase_identifier dbase identifier
* @param int $record_number record number
* @return bool
*/
function dbase_get_record($dbase_identifier, $record_number)
function dbase_replace_record($dbase_identifier, $record, $record_number)
{
return $dbase_identifier->get_record($record_number);
}
return $dbase_identifier->replace_record($record, $record_number);
}
/**
* dbase_get_record_with_names
* @param Resource $dbase_identifier dbase identifier
* @param int $record_number record number
* @return bool
*/
function dbase_get_record_with_names($dbase_identifier, $record_number)
function dbase_get_record($dbase_identifier, $record_number)
{
return $dbase_identifier->get_record_with_names($record_number);
}
return $dbase_identifier->get_record($record_number);
}
/**
* dbase_pack
* @param Resource $dbase_identifier dbase identifier
* @return bool
*/
function dbase_pack($dbase_identifier)
function dbase_get_record_with_names($dbase_identifier, $record_number)
{
return $dbase_identifier->pack();
}
return $dbase_identifier->get_record_with_names($record_number);
}
function dbase_pack($dbase_identifier)
{
return $dbase_identifier->pack();
}
}

View File

@@ -48,59 +48,60 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
define(GEN_NUMBER_FACTURE, 1);
$year = 2016;
$dates = array (mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
@@ -110,10 +111,12 @@ $user->getrights();
$socids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client in (1, 3)";
$resql = $db->query($sql);
if ($resql) {
if ($resql)
{
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
while ($i < $num_thirdparties)
{
$i++;
$row = $db->fetch_row($resql);
$socids[$i] = $row[0];
@@ -123,10 +126,12 @@ if ($resql) {
$prodids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
$resql = $db->query($sql);
if ($resql) {
if ($resql)
{
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
while ($i < $num_prods)
{
$i++;
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
@@ -135,7 +140,8 @@ if ($resql) {
$i=0;
$result=0;
while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
while ($i < GEN_NUMBER_FACTURE && $result >= 0)
{
$i++;
$socid = mt_rand(1, $num_thirdparties);
@@ -147,32 +153,40 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) {
$object->cond_reglement_id = 3;
$object->mode_reglement_id = 3;
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$result=$object->create($fuser);
if ($result >= 0) {
if ($result >= 0)
{
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp) {
while ($xnbp < $nbp)
{
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
if ($result < 0) {
dol_print_error($db, $propal->error);
}
$xnbp++;
if ($result < 0)
{
dol_print_error($db, $propal->error);
}
$xnbp++;
}
$result=$object->validate($fuser);
if ($result) {
$result=$object->validate($fuser);
if ($result)
{
print " OK with ref ".$object->ref."\n";;
} else {
}
else
{
dol_print_error($db, $object->error);
}
} else {
}
else
{
dol_print_error($db, $object->error);
}
}

View File

@@ -31,8 +31,8 @@ $path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -54,61 +54,62 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
define(GEN_NUMBER_COMMANDE, 10);
$year = 2016;
$dates = array (mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret=$user->fetch('', 'admin');
if ($ret <= 0) {
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
if ($ret <= 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
$user->getrights();
@@ -116,100 +117,107 @@ $societesid = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe where client in (1, 3)";
$resql=$db->query($sql);
if ($resql) {
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
$i++;
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
}
} else {
print "err";
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
$i++;
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
}
}
else { print "err"; }
$commandesid = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande";
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$i++;
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
}
} else {
print "err";
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$i++;
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
}
}
else { print "err"; }
$prodids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
$resql = $db->query($sql);
if ($resql) {
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
}
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
print "Build ".GEN_NUMBER_COMMANDE." orders\n";
for ($s = 0; $s < GEN_NUMBER_COMMANDE; $s++) {
print "Process order ".$s."\n";
for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
{
print "Process order ".$s."\n";
$object = new Commande($db);
$object = new Commande($db);
$object->socid = $societesid[mt_rand(1, $num_thirdparties)];
$object->date_commande = $dates[mt_rand(1, count($dates)-1)];
$object->note = 'My small comment about this order. Hum. Nothing.';
$object->source = 1;
$object->fk_project = 0;
$object->remise_percent = 0;
$object->shipping_method_id = mt_rand(1, 2);
$object->cond_reglement_id = mt_rand(0, 2);
$object->more_reglement_id = mt_rand(0, 7);
$object->availability_id = mt_rand(0, 1);
$object->socid = $societesid[mt_rand(1, $num_thirdparties)];
$object->date_commande = $dates[mt_rand(1, count($dates)-1)];
$object->note = 'My small comment about this order. Hum. Nothing.';
$object->source = 1;
$object->fk_project = 0;
$object->remise_percent = 0;
$object->shipping_method_id = mt_rand(1, 2);
$object->cond_reglement_id = mt_rand(0, 2);
$object->more_reglement_id = mt_rand(0, 7);
$object->availability_id = mt_rand(0, 1);
$listofuserid=array(12,13,16);
$listofuserid=array(12,13,16);
$fuser = new User($db);
$fuser->fetch($listofuserid[mt_rand(0, 2)]);
$fuser->getRights();
$fuser = new User($db);
$fuser->fetch($listofuserid[mt_rand(0, 2)]);
$fuser->getRights();
$db->begin();
$db->begin();
$result=$object->create($fuser);
if ($result >= 0) {
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp) {
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
if ($result <= 0) {
dol_print_error($db, $object->error);
}
$xnbp++;
}
$result=$object->create($fuser);
if ($result >= 0)
{
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
{
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
if ($result <= 0)
{
dol_print_error($db, $object->error);
}
$xnbp++;
}
$result=$object->valid($fuser);
if ($result > 0) {
$db->commit();
print " OK with ref ".$object->ref."\n";
} else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
} else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
$result=$object->valid($fuser);
if ($result > 0)
{
$db->commit();
print " OK with ref ".$object->ref."\n";
}
else
{
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}

View File

@@ -31,8 +31,8 @@ $path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -54,7 +54,8 @@ define(GEN_NUMBER_PRODUIT, 100000);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
@@ -64,50 +65,38 @@ $user->getrights();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
$row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++;
}
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; }
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
$row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++;
}
} else {
print "err";
}
while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; }
} else { print "err"; }
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
$row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++;
}
} else {
print "err";
}
while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; }
} else { print "err"; }
print "Generates ".GEN_NUMBER_PRODUIT." products\n";
for ($s = 0; $s < GEN_NUMBER_PRODUIT; $s++) {
print "Product ".$s;
$produit = new Product($db);
$produit->type = mt_rand(0, 1);
$produit->status = 1;
$produit->ref = ($produit->type?'S':'P').time().$s;
$produit->label = 'Label '.time().$s;
$produit->description = 'Description '.time().$s;
$produit->price = mt_rand(1, 999.99);
$produit->tva_tx = "20.0";
$ret=$produit->create($user);
if ($ret < 0) {
print "Error $ret - ".$produit->error."\n";
} else {
print " OK with ref ".$produit->ref."\n";
}
for ($s = 0 ; $s < GEN_NUMBER_PRODUIT ; $s++)
{
print "Product ".$s;
$produit = new Product($db);
$produit->type = mt_rand(0, 1);
$produit->status = 1;
$produit->ref = ($produit->type?'S':'P').time().$s;
$produit->label = 'Label '.time().$s;
$produit->description = 'Description '.time().$s;
$produit->price = mt_rand(1, 1000);
$produit->tva_tx = "19.6";
$ret=$produit->create($user);
if ($ret < 0) print "Error $ret - ".$produit->error."\n";
else print " OK with ref ".$produit->ref."\n";
}

View File

@@ -50,59 +50,60 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
define(GEN_NUMBER_PROPAL, 10);
$year = 2016;
$dates = array (mktime(12, 0, 0, 1, 3, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
mktime(12, 0, 0, 1, 9, $year),
mktime(12, 0, 0, 2, 13, $year),
mktime(12, 0, 0, 2, 23, $year),
mktime(12, 0, 0, 3, 30, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 4, 3, $year),
mktime(12, 0, 0, 5, 9, $year),
mktime(12, 0, 0, 5, 1, $year),
mktime(12, 0, 0, 5, 13, $year),
mktime(12, 0, 0, 5, 19, $year),
mktime(12, 0, 0, 5, 23, $year),
mktime(12, 0, 0, 6, 3, $year),
mktime(12, 0, 0, 6, 19, $year),
mktime(12, 0, 0, 6, 24, $year),
mktime(12, 0, 0, 7, 3, $year),
mktime(12, 0, 0, 7, 9, $year),
mktime(12, 0, 0, 7, 23, $year),
mktime(12, 0, 0, 7, 30, $year),
mktime(12, 0, 0, 8, 9, $year),
mktime(12, 0, 0, 9, 23, $year),
mktime(12, 0, 0, 10, 3, $year),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 1, 3, ($year - 1)),
mktime(12, 0, 0, 1, 9, ($year - 1)),
mktime(12, 0, 0, 2, 13, ($year - 1)),
mktime(12, 0, 0, 2, 23, ($year - 1)),
mktime(12, 0, 0, 3, 30, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 4, 3, ($year - 1)),
mktime(12, 0, 0, 5, 9, ($year - 1)),
mktime(12, 0, 0, 5, 1, ($year - 1)),
mktime(12, 0, 0, 5, 13, ($year - 1)),
mktime(12, 0, 0, 5, 19, ($year - 1)),
mktime(12, 0, 0, 5, 23, ($year - 1)),
mktime(12, 0, 0, 6, 3, ($year - 1)),
mktime(12, 0, 0, 6, 19, ($year - 1)),
mktime(12, 0, 0, 6, 24, ($year - 1)),
mktime(12, 0, 0, 7, 3, ($year - 1)),
mktime(12, 0, 0, 7, 9, ($year - 1)),
mktime(12, 0, 0, 7, 23, ($year - 1)),
mktime(12, 0, 0, 7, 30, ($year - 1)),
mktime(12, 0, 0, 8, 9, ($year - 1)),
mktime(12, 0, 0, 9, 23, ($year - 1)),
mktime(12, 0, 0, 10, 3, ($year - 1)),
mktime(12, 0, 0, 11, 12, $year),
mktime(12, 0, 0, 11, 13, $year),
mktime(12, 0, 0, 12, 12, $year),
mktime(12, 0, 0, 12, 13, $year),
);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
@@ -112,10 +113,12 @@ $user->getrights();
$socids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client in (1,3)";
$resql = $db->query($sql);
if ($resql) {
if ($resql)
{
$num_thirdparties = $db->num_rows($resql);
$i = 0;
while ($i < $num_thirdparties) {
while ($i < $num_thirdparties)
{
$i++;
$row = $db->fetch_row($resql);
$socids[$i] = $row[0];
@@ -125,10 +128,12 @@ if ($resql) {
$contids = array();
$sql = "SELECT rowid, fk_soc FROM ".MAIN_DB_PREFIX."socpeople";
$resql = $db->query($sql);
if ($resql) {
if ($resql)
{
$num_conts = $db->num_rows($resql);
$i = 0;
while ($i < $num_conts) {
while ($i < $num_conts)
{
$i++;
$row = $db->fetch_row($resql);
$contids[$row[1]][0] = $row[0]; // A ameliorer
@@ -138,10 +143,12 @@ if ($resql) {
$prodids = array();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1";
$resql = $db->query($sql);
if ($resql) {
if ($resql)
{
$num_prods = $db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
while ($i < $num_prods)
{
$i++;
$row = $db->fetch_row($resql);
$prodids[$i] = $row[0];
@@ -152,13 +159,15 @@ $user->rights->propal->creer=1;
$user->rights->propal->propal_advance->validate=1;
if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) {
if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php";
}
$i=0;
$result=0;
while ($i < GEN_NUMBER_PROPAL && $result >= 0) {
while ($i < GEN_NUMBER_PROPAL && $result >= 0)
{
$i++;
$socid = mt_rand(1, $num_thirdparties);
print "Proposal ".$i." for socid ".$socid;
@@ -168,9 +177,9 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) {
$object = new Propal($db);
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$object->contactid = $contids[$socids[$socid]][0];
$object->socid = $socids[$socid];
@@ -179,30 +188,38 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) {
$object->mode_reglement_id = 3;
$result=$object->create($fuser);
if ($result >= 0) {
if ($result >= 0)
{
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp) {
while ($xnbp < $nbp)
{
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0);
if ($result < 0) {
if ($result < 0)
{
dol_print_error($db, $object->error);
}
$xnbp++;
}
$result=$object->valid($fuser);
if ($result > 0) {
$db->commit();
print " OK with ref ".$object->ref."\n";
} else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
if ($result > 0)
{
$db->commit();
print " OK with ref ".$object->ref."\n";
}
} else {
else
{
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
dol_print_error($db, $object->error);
}
}

View File

@@ -31,8 +31,8 @@ $path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -57,7 +57,8 @@ define(GEN_NUMBER_SOCIETE, 10);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
@@ -67,8 +68,8 @@ $user->getrights();
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
$row = $db->fetch_row($resql);
$productsid[$i] = $row[0];
$i++;
@@ -79,65 +80,65 @@ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
while ($i < $num) {
$row = $db->fetch_row($resql);
$societesid[$i] = $row[0];
$i++;
}
} else {
print "err";
}
} else { print "err"; }
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array();
$resql=$db->query($sql);
if ($resql) {
$num = $db->num_rows($resql); $i = 0;
while ($i < $num) {
while ($i < $num) {
$row = $db->fetch_row($resql);
$commandesid[$i] = $row[0];
$i++;
}
} else {
print "err";
}
} else { print "err"; }
print "Generates ".GEN_NUMBER_SOCIETE." companies\n";
for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) {
print "Company $s\n";
$soc = new Societe($db);
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[mt_rand(0, count($listoftown)-1)];
$soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur
$soc->code_client='CU'.time()."$s";
$soc->code_fournisseur='SU'.time()."$s";
$soc->tva_assuj=1;
$soc->country_id=1;
$soc->country_code='FR';
for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
{
print "Company $s\n";
$soc = new Societe($db);
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[mt_rand(0, count($listoftown)-1)];
$soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur
$soc->code_client='CU'.time()."$s";
$soc->code_fournisseur='SU'.time()."$s";
$soc->tva_assuj=1;
$soc->country_id=1;
$soc->country_code='FR';
// Un client sur 3 a une remise de 5%
$user_remise=mt_rand(1, 3); if ($user_remise==3) {
$soc->remise_percent=5;
}
$user_remise=mt_rand(1, 3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
if ($socid >= 0) {
$rand = mt_rand(1, 4);
print "> Generates $rand contact(s)\n";
for ($c = 0; $c < $rand; $c++) {
$contact = new Contact($db);
$contact->socid = $soc->id;
$contact->lastname = "Lastname".$c;
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
if ($contact->create($user)) {
}
}
if ($socid >= 0)
{
$rand = mt_rand(1, 4);
print "> Generates $rand contact(s)\n";
for ($c = 0 ; $c < $rand ; $c++)
{
$contact = new Contact($db);
$contact->socid = $soc->id;
$contact->lastname = "Lastname".$c;
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
if ( $contact->create($user) )
{
}
}
print "Company ".$s." created nom=".$soc->name."\n";
} else {
print "Error: ".$soc->error."\n";
}
print "Company ".$s." created nom=".$soc->name."\n";
}
else
{
print "Error: ".$soc->error."\n";
}
}

View File

@@ -30,8 +30,8 @@ $sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -67,40 +67,44 @@ $startlinenb = empty($argv[4])?1:$argv[4];
$endlinenb = empty($argv[5])?0:$argv[5];
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n";
print "\n";
exit(-1);
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n";
print "\n";
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
}
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
$user->getrights();
// Ask confirmation
if (! $confirmed) {
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (! $confirmed)
{
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
}
// Open input and output files
$fhandle = fopen($filepath, 'r');
if (! $fhandle) {
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
if (! $fhandle)
{
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
}
$fhandleerr = fopen($filepatherr, 'w');
if (! $fhandleerr) {
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
if (! $fhandleerr)
{
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
}
$langs->setDefaultLang($defaultlang);
@@ -110,96 +114,105 @@ $db->begin();
$i=0;
$nboflines++;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
$i++;
$errorrecord=0;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
{
$i++;
$errorrecord=0;
if ($startlinenb && $i < $startlinenb) {
continue;
}
if ($endlinenb && $i > $endlinenb) {
continue;
}
if ($startlinenb && $i < $startlinenb) continue;
if ($endlinenb && $i > $endlinenb) continue;
$nboflines++;
$nboflines++;
$produit = new Product($db);
$produit->type = 0;
$produit->status = 1;
$produit->ref = trim($fields[0]);
$produit = new Product($db);
$produit->type = 0;
$produit->status = 1;
$produit->ref = trim($fields[0]);
print "Process line nb ".$i.", ref ".$produit->ref;
$produit->label = trim($fields[2]);
$produit->description = trim($fields[4]."\n".($fields[5] ? $fields[5].' x '.$fields[6].' x '.$fields[7] : ''));
$produit->volume = price2num($fields[8]);
$produit->volume_unit = 0;
$produit->weight = price2num($fields[9]);
$produit->weight_units = 0; // -3 = g
print "Process line nb ".$i.", ref ".$produit->ref;
$produit->label = trim($fields[2]);
$produit->description = trim($fields[4]."\n".($fields[5] ? $fields[5].' x '.$fields[6].' x '.$fields[7] : ''));
$produit->volume = price2num($fields[8]);
$produit->volume_unit = 0;
$produit->weight = price2num($fields[9]);
$produit->weight_units = 0; // -3 = g
$produit->customcode = $fields[10];
$produit->barcode = $fields[1];
$produit->customcode = $fields[10];
$produit->barcode = $fields[1];
$produit->status = 1;
$produit->status_buy = 1;
$produit->status = 1;
$produit->status_buy = 1;
$produit->finished = 1;
$produit->finished = 1;
$produit->price_min = null;
$produit->price_min_ttc = null;
$produit->price = price2num($fields[11]);
$produit->price_ttc = price2num($fields[12]);
$produit->price_base_type = 'TTC';
$produit->tva_tx = price2num($fields[13]);
$produit->tva_npr = 0;
$produit->price_min = null;
$produit->price_min_ttc = null;
$produit->price = price2num($fields[11]);
$produit->price_ttc = price2num($fields[12]);
$produit->price_base_type = 'TTC';
$produit->tva_tx = price2num($fields[13]);
$produit->tva_npr = 0;
$produit->cost_price = price2num($fields[16]);
$produit->cost_price = price2num($fields[16]);
// Extrafields
$produit->array_options['options_ecotaxdeee']=price2num($fields[17]);
// Extrafields
$produit->array_options['options_ecotaxdeee']=price2num($fields[17]);
$ret=$produit->create($user);
if ($ret < 0) {
print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
} else {
print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
$ret=$produit->create($user);
if ($ret < 0)
{
print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
}
dol_syslog("Add prices");
// If we use price level, insert price for each level
if (! $errorrecord && 1) {
$ret1=$produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
$ret2=$produit->updatePrice(price2num($fields[14]), 'HT', $user, $produit->tva_tx, $produit->price_min, 2, $produit->tva_npr, 0, 0, array());
if ($ret1 < 0 || $ret2 < 0) {
print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
$errorrecord++;
} else {
print " - updatePrice OK";
}
// If we use price level, insert price for each level
if (! $errorrecord && 1)
{
$ret1=$produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
$ret2=$produit->updatePrice(price2num($fields[14]), 'HT', $user, $produit->tva_tx, $produit->price_min, 2, $produit->tva_npr, 0, 0, array());
if ($ret1 < 0 || $ret2 < 0)
{
print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
print " - updatePrice OK";
}
}
dol_syslog("Add multilangs");
// Add alternative languages
if (! $errorrecord && 1) {
$produit->multilangs['fr_FR']=array('label'=>$produit->label, 'description'=>$produit->description, 'note'=>$produit->note_private);
$produit->multilangs['en_US']=array('label'=>$fields[3], 'description'=>$produit->description, 'note'=>$produit->note_private);
if (! $errorrecord && 1)
{
$produit->multilangs['fr_FR']=array('label'=>$produit->label, 'description'=>$produit->description, 'note'=>$produit->note_private);
$produit->multilangs['en_US']=array('label'=>$fields[3], 'description'=>$produit->description, 'note'=>$produit->note_private);
$ret=$produit->setMultiLangs($user);
if ($ret < 0) {
print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
} else {
print " - setMultiLangs OK";
}
$ret=$produit->setMultiLangs($user);
if ($ret < 0)
{
print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
print " - setMultiLangs OK";
}
}
print "\n";
if ($errorrecord) {
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$produit->errorsToString()."\n");
$error++; // $errorrecord will be reset
if ($errorrecord)
{
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$produit->errorsToString()."\n");
$error++; // $errorrecord will be reset
}
}
@@ -210,12 +223,15 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
// commit or rollback
print "Nb of lines qualified: ".$nboflines."\n";
print "Nb of errors: ".$error."\n";
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
print "Rollback any changes.\n";
$db->rollback();
} else {
print "Commit all changes.\n";
$db->commit();
if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
{
print "Rollback any changes.\n";
$db->rollback();
}
else
{
print "Commit all changes.\n";
$db->commit();
}
$db->close();

View File

@@ -30,8 +30,8 @@ $sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -67,40 +67,44 @@ $startlinenb = empty($argv[3])?1:$argv[3];
$endlinenb = empty($argv[4])?0:$argv[4];
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(-1);
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
}
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
$user->getrights();
// Ask confirmation
if (! $confirmed) {
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (! $confirmed)
{
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
}
// Open input and output files
$fhandle = fopen($filepath, 'r');
if (! $fhandle) {
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
if (! $fhandle)
{
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
}
$fhandleerr = fopen($filepatherr, 'w');
if (! $fhandleerr) {
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
if (! $fhandleerr)
{
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
}
//$langs->setDefaultLang($defaultlang);
@@ -110,173 +114,183 @@ $db->begin();
$i=0;
$nboflines=0;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
$i++;
$errorrecord=0;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
{
$i++;
$errorrecord=0;
if ($startlinenb && $i < $startlinenb) {
continue;
}
if ($endlinenb && $i > $endlinenb) {
continue;
}
if ($startlinenb && $i < $startlinenb) continue;
if ($endlinenb && $i > $endlinenb) continue;
$nboflines++;
$nboflines++;
$object = new Societe($db);
$object->state = $fields[6];
$object->client = $fields[7];
$object->fournisseur = $fields[8];
$object = new Societe($db);
$object->state = $fields[6];
$object->client = $fields[7];
$object->fournisseur = $fields[8];
$object->name = $fields[13]?trim($fields[13]):$fields[0];
$object->name_alias = $fields[0]!=$fields[13]?trim($fields[0]):'';
$object->name = $fields[13]?trim($fields[13]):$fields[0];
$object->name_alias = $fields[0]!=$fields[13]?trim($fields[0]):'';
$object->address = trim($fields[14]);
$object->zip = trim($fields[15]);
$object->town = trim($fields[16]);
$object->country_id = dol_getIdFromCode($db, trim($fields[21]), 'c_country', 'code', 'rowid');
$object->phone = trim($fields[22]);
$object->fax = trim($fields[23]);
$object->email = trim($fields[26]);
$object->idprof2 = trim($fields[29]);
$object->tva_intra = trim($fields[34]);
$object->default_lang = trim($fields[43]);
$object->address = trim($fields[14]);
$object->zip = trim($fields[15]);
$object->town = trim($fields[16]);
$object->country_id = dol_getIdFromCode($db, trim($fields[21]), 'c_country', 'code', 'rowid');
$object->phone = trim($fields[22]);
$object->fax = trim($fields[23]);
$object->email = trim($fields[26]);
$object->idprof2 = trim($fields[29]);
$object->tva_intra = trim($fields[34]);
$object->default_lang = trim($fields[43]);
//$condpayment = dol_string_unaccent(trim($fields[36]));
if ($fields[36]) {
$condpayment = trim($fields[36]);
if ($condpayment == 'A la commande') {
$condpayment = 'A réception de commande';
}
if ($condpayment == 'A reception facture') {
$condpayment = 'Réception de facture';
}
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
if (empty($object->cond_reglement_id)) {
print " - Error cant find payment mode for ".$condpayment."\n";
$errorrecord++;
}
}
//$condpayment = dol_string_unaccent(trim($fields[36]));
if ($fields[36])
{
$condpayment = trim($fields[36]);
if ($condpayment == 'A la commande') $condpayment = 'A réception de commande';
if ($condpayment == 'A reception facture') $condpayment = 'Réception de facture';
$object->cond_reglement_id = dol_getIdFromCode($db, $condpayment, 'c_payment_term', 'libelle_facture', 'rowid', 1);
if (empty($object->cond_reglement_id))
{
print " - Error cant find payment mode for ".$condpayment."\n";
$errorrecord++;
}
}
$object->code_client = $fields[9];
$object->code_fournisseur = $fields[10];
$object->code_client = $fields[9];
$object->code_fournisseur = $fields[10];
$labeltype = trim($fields[1]);
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'libelle');
$labeltype = trim($fields[1]);
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'libelle');
// Set price level
$object->price_level = 1;
if ($labeltype == 'Revendeur') {
$object->price_level = 2;
}
// Set price level
$object->price_level = 1;
if ($labeltype == 'Revendeur') $object->price_level = 2;
print "Process line nb ".$i.", name ".$object->name;
print "Process line nb ".$i.", name ".$object->name;
// Extrafields
$object->array_options['options_anastate']=price2num($fields[20]);
$object->array_options['options_anaregion']=price2num($fields[17]);
// Extrafields
$object->array_options['options_anastate']=price2num($fields[20]);
$object->array_options['options_anaregion']=price2num($fields[17]);
if (! $errorrecord) {
$ret=$object->create($user);
if ($ret < 0) {
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
} else {
print " - Creation OK with name ".$object->name." - id = ".$ret;
}
}
if (! $errorrecord)
{
$ret=$object->create($user);
if ($ret < 0)
{
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
}
else
{
print " - Creation OK with name ".$object->name." - id = ".$ret;
}
}
if (! $errorrecord) {
dol_syslog("Set price level");
$object->set_price_level($object->price_level, $user);
}
if (! $errorrecord)
{
dol_syslog("Set price level");
$object->set_price_level($object->price_level, $user);
}
// Assign sales representative
if (! $errorrecord && $fields[3]) {
$salesrep=new User($db);
if (! $errorrecord && $fields[3])
{
$salesrep=new User($db);
$tmp=explode(' ', $fields[3], 2);
$salesrep->firstname = trim($tmp[0]);
$salesrep->lastname = trim($tmp[1]);
if ($salesrep->lastname) {
$salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0));
} else {
$salesrep->login=strtolower($salesrep->firstname);
}
$salesrep->login=preg_replace('/ /', '', $salesrep->login);
$salesrep->fetch(0, $salesrep->login);
$tmp=explode(' ', $fields[3], 2);
$salesrep->firstname = trim($tmp[0]);
$salesrep->lastname = trim($tmp[1]);
if ($salesrep->lastname) $salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0));
else $salesrep->login=strtolower($salesrep->firstname);
$salesrep->login=preg_replace('/ /', '', $salesrep->login);
$salesrep->fetch(0, $salesrep->login);
$result = $object->add_commercial($user, $salesrep->id);
if ($result < 0) {
print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString();
$errorrecord++;
} else {
print " - create link sale representative OK";
}
$result = $object->add_commercial($user, $salesrep->id);
if ($result < 0)
{
print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString();
$errorrecord++;
}
else
{
print " - create link sale representative OK";
}
}
dol_syslog("Add invoice contacts");
// Insert an invoice contact if there is an invoice email != standard email
if (! $errorrecord && $fields[27] && $fields[26] != $fields[27]) {
$ret1=$ret2=0;
if (! $errorrecord && $fields[27] && $fields[26] != $fields[27])
{
$ret1=$ret2=0;
$contact = new Contact($db);
$contact->lastname = $object->name;
$contact->address=$object->address;
$contact->zip=$object->zip;
$contact->town=$object->town;
$contact->country_id=$object->country_id;
$contact->email=$fields[27];
$contact->socid=$object->id;
$contact = new Contact($db);
$contact->lastname = $object->name;
$contact->address=$object->address;
$contact->zip=$object->zip;
$contact->town=$object->town;
$contact->country_id=$object->country_id;
$contact->email=$fields[27];
$contact->socid=$object->id;
$ret1=$contact->create($user);
if ($ret1 > 0) {
//$ret2=$contact->add_contact($object->id, 'BILLING');
}
if ($ret1 < 0 || $ret2 < 0) {
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
} else {
print " - create contact OK";
}
$ret1=$contact->create($user);
if ($ret1 > 0)
{
//$ret2=$contact->add_contact($object->id, 'BILLING');
}
if ($ret1 < 0 || $ret2 < 0)
{
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
}
else
{
print " - create contact OK";
}
}
dol_syslog("Add delivery contacts");
// Insert a delivery contact
if (! $errorrecord && $fields[47]) {
$ret1=$ret2=0;
if (! $errorrecord && $fields[47])
{
$ret1=$ret2=0;
$contact2 = new Contact($db);
$contact2->lastname = 'Service livraison - '.$fields[47];
$contact2->address = $fields[48];
$contact2->zip = $fields[50];
$contact2->town = $fields[51];
$contact2->country_id=dol_getIdFromCode($db, trim($fields[52]), 'c_country', 'code', 'rowid');
$contact2->note_public=$fields[54];
$contact2->socid=$object->id;
$contact2 = new Contact($db);
$contact2->lastname = 'Service livraison - '.$fields[47];
$contact2->address = $fields[48];
$contact2->zip = $fields[50];
$contact2->town = $fields[51];
$contact2->country_id=dol_getIdFromCode($db, trim($fields[52]), 'c_country', 'code', 'rowid');
$contact2->note_public=$fields[54];
$contact2->socid=$object->id;
// Extrafields
$contact2->array_options['options_anazoneliv']=price2num($fields[53]);
// Extrafields
$contact2->array_options['options_anazoneliv']=price2num($fields[53]);
$ret1=$contact2->create($user);
if ($ret1 > 0) {
//$ret2=$contact2->add_contact($object->id, 'SHIPPING');
}
if ($ret1 < 0 || $ret2 < 0) {
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
} else {
print " - create contact OK";
}
$ret1=$contact2->create($user);
if ($ret1 > 0)
{
//$ret2=$contact2->add_contact($object->id, 'SHIPPING');
}
if ($ret1 < 0 || $ret2 < 0)
{
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
}
else
{
print " - create contact OK";
}
}
print "\n";
if ($errorrecord) {
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
$error++; // $errorrecord will be reset
if ($errorrecord)
{
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
$error++; // $errorrecord will be reset
}
}
@@ -287,12 +301,15 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
// commit or rollback
print "Nb of lines qualified: ".$nboflines."\n";
print "Nb of errors: ".$error."\n";
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
print "Rollback any changes.\n";
$db->rollback();
} else {
print "Commit all changes.\n";
$db->commit();
if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
{
print "Rollback any changes.\n";
$db->rollback();
}
else
{
print "Commit all changes.\n";
$db->commit();
}
$db->close();

View File

@@ -30,8 +30,8 @@ $sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Recupere root dolibarr
@@ -67,40 +67,44 @@ $startlinenb = empty($argv[3])?1:$argv[3];
$endlinenb = empty($argv[4])?0:$argv[4];
if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(-1);
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
exit(-1);
}
if (! file_exists($filepath)) {
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
print "Error: File ".$filepath." not found.\n";
print "\n";
exit(-1);
}
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
exit;
}
$user->getrights();
// Ask confirmation
if (! $confirmed) {
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (! $confirmed)
{
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
}
// Open input and output files
$fhandle = fopen($filepath, 'r');
if (! $fhandle) {
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
if (! $fhandle)
{
print 'Error: Failed to open file '.$filepath."\n";
exit(1);
}
$fhandleerr = fopen($filepatherr, 'w');
if (! $fhandleerr) {
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
if (! $fhandleerr)
{
print 'Error: Failed to open file '.$filepatherr."\n";
exit(1);
}
//$langs->setDefaultLang($defaultlang);
@@ -110,48 +114,46 @@ $db->begin();
$i=0;
$nboflines=0;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) {
$i++;
$errorrecord=0;
while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
{
$i++;
$errorrecord=0;
if ($startlinenb && $i < $startlinenb) {
continue;
}
if ($endlinenb && $i > $endlinenb) {
continue;
}
if ($startlinenb && $i < $startlinenb) continue;
if ($endlinenb && $i > $endlinenb) continue;
$nboflines++;
$nboflines++;
$object = new User($db);
$object->statut = 1;
$object = new User($db);
$object->statut = 1;
$tmp=explode(' ', $fields[3], 2);
$object->firstname = trim($tmp[0]);
$object->lastname = trim($tmp[1]);
if ($object->lastname) {
$object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0));
} else {
$object->login=strtolower($object->firstname);
}
$object->login=preg_replace('/ /', '', $object->login);
$object->password = 'init';
$tmp=explode(' ', $fields[3], 2);
$object->firstname = trim($tmp[0]);
$object->lastname = trim($tmp[1]);
if ($object->lastname) $object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0));
else $object->login=strtolower($object->firstname);
$object->login=preg_replace('/ /', '', $object->login);
$object->password = 'init';
print "Process line nb ".$i.", login ".$object->login;
print "Process line nb ".$i.", login ".$object->login;
$ret=$object->create($user);
if ($ret < 0) {
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
} else {
print " - Creation OK with login ".$object->login." - id = ".$ret;
$ret=$object->create($user);
if ($ret < 0)
{
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
}
else
{
print " - Creation OK with login ".$object->login." - id = ".$ret;
}
print "\n";
if ($errorrecord) {
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
$error++; // $errorrecord will be reset
if ($errorrecord)
{
fwrite($fhandleerr, 'Error on record nb '.$i." - ".$object->errorsToString()."\n");
$error++; // $errorrecord will be reset
}
}
@@ -162,12 +164,15 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
// commit or rollback
print "Nb of lines qualified: ".$nboflines."\n";
print "Nb of errors: ".$error."\n";
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
print "Rollback any changes.\n";
$db->rollback();
} else {
print "Commit all changes.\n";
$db->commit();
if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
{
print "Rollback any changes.\n";
$db->rollback();
}
else
{
print "Commit all changes.\n";
$db->commit();
}
$db->close();

View File

@@ -26,12 +26,12 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=__DIR__.'/';
$path=dirname(__FILE__).'/';
// Test si mode batch
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit(-1);
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit(-1);
}
// Recupere root dolibarr
@@ -52,121 +52,121 @@ $error=0;
// List of sql to execute
$sqls=array(
'user'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'",
),
'event'=>array(
//"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE datec < '__DATE__'",
),
'payment'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)",
),
'supplier_payment'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn where fk_facturefourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn where rowid NOT IN (SELECT fk_paiementfourn FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn)",
),
'bank'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__'",
),
'bankaccount'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."bank_account WHERE datec < '__DATE__'",
),
'invoice'=>array(
'@payment',
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_source IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_line IN (select rowid FROM ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture IN (select rowid from ".MAIN_DB_PREFIX."facture where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."facture_rec where datec < '__DATE__'",
"DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"UPDATE ".MAIN_DB_PREFIX."facture SET fk_facture_source = NULL WHERE fk_facture_source IN (select f2.rowid FROM (select * from ".MAIN_DB_PREFIX."facture) as f2 where f2.datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__'",
),
'accounting'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."accounting_bookkeeping where doc_date < '__DATE__'",
),
'proposal'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."propal WHERE datec < '__DATE__'",
),
"supplier_proposal"=>array(
"DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal where datec < '__DATE__'",
),
'order'=>array(
'@shipment',
"DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__'",
),
'supplier_order'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'",
),
'user'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'",
),
'event'=>array(
//"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE datec < '__DATE__'",
),
'payment'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)",
),
'supplier_payment'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn where fk_facturefourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."paiementfourn where rowid NOT IN (SELECT fk_paiementfourn FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn)",
),
'bank'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__'",
),
'bankaccount'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."bank_account WHERE datec < '__DATE__'",
),
'invoice'=>array(
'@payment',
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_source IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_line IN (select rowid FROM ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture IN (select rowid from ".MAIN_DB_PREFIX."facture where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."facture_rec where datec < '__DATE__'",
"DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"UPDATE ".MAIN_DB_PREFIX."facture SET fk_facture_source = NULL WHERE fk_facture_source IN (select f2.rowid FROM (select * from ".MAIN_DB_PREFIX."facture) as f2 where f2.datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__'",
),
'accounting'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."accounting_bookkeeping where doc_date < '__DATE__'",
),
'proposal'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."propal WHERE datec < '__DATE__'",
),
"supplier_proposal"=>array(
"DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal where datec < '__DATE__'",
),
'order'=>array(
'@shipment',
"DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__'",
),
'supplier_order'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'",
),
'supplier_invoice'=>array(
'@supplier_payment',
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'",
),
'shipment'=>array(
'@delivery',
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch WHERE fk_expeditiondet IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'",
),
'delivery'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."deliverydet WHERE fk_delivery IN (select rowid FROM ".MAIN_DB_PREFIX."delivery where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."delivery where date_creation < '__DATE__'",
),
'contract'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat WHERE datec < '__DATE__'",
),
'intervention'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter IN (select rowid FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__'",
),
'stock'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement WHERE datem < '__DATE__'",
),
'product'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_lang WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty WHERE fk_product_price IN (select rowid FROM ".MAIN_DB_PREFIX."product_price where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."product_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE fk_product_stock IN (select rowid FROM ".MAIN_DB_PREFIX."product_stock where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_lot WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
),
'project'=>array(
// TODO set fk_project to null on object that refer to project
"DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
),
'contact'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople IN (select rowid FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__'",
),
'thirdparty'=>array(
'@contact',
"DELETE FROM ".MAIN_DB_PREFIX."cabinetmed_cons WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = NULL WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."categorie_fournisseur WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__'",
)
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'",
),
'shipment'=>array(
'@delivery',
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch WHERE fk_expeditiondet IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'",
),
'delivery'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."livraisondet WHERE fk_livraison IN (select rowid FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__'",
),
'contract'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat WHERE datec < '__DATE__'",
),
'intervention'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter IN (select rowid FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__'",
),
'stock'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement WHERE datem < '__DATE__'",
),
'product'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_lang WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty WHERE fk_product_price IN (select rowid FROM ".MAIN_DB_PREFIX."product_price where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."product_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE fk_product_stock IN (select rowid FROM ".MAIN_DB_PREFIX."product_stock where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product_lot WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
),
'project'=>array(
// TODO set fk_project to null on object that refer to project
"DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
),
'contact'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople IN (select rowid FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__'",
),
'thirdparty'=>array(
'@contact',
"DELETE FROM ".MAIN_DB_PREFIX."cabinetmed_cons WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = NULL WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."categorie_fournisseur WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__'",
)
);
@@ -183,42 +183,44 @@ $option = $argv[2];
$date = $argv[3];
if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
if (empty($option)) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
if (empty($option))
{
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
if ($option != 'all') {
$listofoptions=explode(',', $option);
foreach ($listofoptions as $cursoroption) {
if (! in_array($cursoroption, array_keys($sqls))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
}
if ($option != 'all')
{
$listofoptions=explode(',', $option);
foreach($listofoptions as $cursoroption)
{
if (! in_array($cursoroption, array_keys($sqls))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
}
}
if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
exit(-1);
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
exit(-1);
}
if ($date == 'all') {
$date = '2199-01-01';
}
if ($date == 'all') $date = '2199-01-01';
// Replace database handler
if (! empty($argv[4])) {
if (! empty($argv[4]))
{
$db->close();
unset($db);
$db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);
@@ -227,7 +229,8 @@ if (! empty($argv[4])) {
//var_dump($user->db->database_name);
$ret=$user->fetch('', 'admin');
if (! $ret > 0) {
if (! $ret > 0)
{
print 'An admin user with login "admin" must exists to use this script.'."\n";
exit;
}
@@ -242,9 +245,10 @@ print "Database port = ".$db->database_port."\n";
print "User = ".$db->database_user."\n";
print "\n";
if (! $confirmed) {
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
if (! $confirmed)
{
print "Hit Enter to continue or CTRL+C to stop...\n";
$input = trim(fgets(STDIN));
}
@@ -257,71 +261,75 @@ if (! $confirmed) {
*/
function processfamily($family, $date)
{
global $db, $sqls;
global $db, $sqls;
$error=0;
foreach ($sqls[$family] as $sql) {
if (preg_match('/^@/', $sql)) {
$newfamily=preg_replace('/@/', '', $sql);
processfamily($newfamily, $date);
continue;
}
$error=0;
foreach($sqls[$family] as $sql)
{
if (preg_match('/^@/', $sql))
{
$newfamily=preg_replace('/@/', '', $sql);
processfamily($newfamily, $date);
continue;
}
$sql = preg_replace('/__DATE__/', $date, $sql);
$sql = preg_replace('/__DATE__/', $date, $sql);
print "Run sql: ".$sql."\n";
print "Run sql: ".$sql."\n";
$resql=$db->query($sql);
if (! $resql) {
if ($db->errno() != 'DB_ERROR_NOSUCHTABLE') {
$error++;
}
}
$resql=$db->query($sql);
if (! $resql)
{
if ($db->errno() != 'DB_ERROR_NOSUCHTABLE')
{
$error++;
}
}
if ($error) {
print $db->lasterror();
$error++;
break;
}
}
if ($error)
{
print $db->lasterror();
$error++;
break;
}
}
if ($error) {
return -1;
} else {
return 1;
}
if ($error) return -1;
else return 1;
}
$db->begin();
$listofoptions=explode(',', $option);
foreach ($listofoptions as $cursoroption) {
$oldfamily='';
foreach ($sqls as $family => $familysql) {
if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) {
continue;
}
foreach($listofoptions as $cursoroption)
{
$oldfamily='';
foreach($sqls as $family => $familysql)
{
if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue;
if ($family != $oldfamily) {
print "Process action for family ".$family."\n";
}
$oldfamily = $family;
if ($family != $oldfamily) print "Process action for family ".$family."\n";
$oldfamily = $family;
$result=processfamily($family, $date);
if ($result < 0) {
$error++;
break;
}
}
$result=processfamily($family, $date);
if ($result < 0)
{
$error++;
break;
}
}
}
if ($error || $mode != 'confirm') {
print "\nRollback any changes.\n";
$db->rollback();
} else {
print "Commit all changes.\n";
$db->commit();
if ($error || $mode != 'confirm')
{
print "\nRollback any changes.\n";
$db->rollback();
}
else
{
print "Commit all changes.\n";
$db->commit();
}
$db->close();

View File

@@ -1 +0,0 @@
/initdemopostsql.sql

View File

@@ -12,11 +12,6 @@ The script initdemo.sh will erase current database with data into mysqldump_doli
Do a chmod 700 initdemo.sh
then run ./initdemo.sh to launch Graphic User Interface.
After loading the demo files, admin login may be:
- admin / admin
or
- admin / adminadmin
*** Save demo

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

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