mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Compare commits
263 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4df49f6c8 | ||
|
|
5b00ba11fd | ||
|
|
cabbb9e421 | ||
|
|
e8fb89f89f | ||
|
|
4dcdea5219 | ||
|
|
1d8a3809f0 | ||
|
|
80943111cc | ||
|
|
f8e8fe6f34 | ||
|
|
190f12c4c4 | ||
|
|
ea7eb241e3 | ||
|
|
973e2253bf | ||
|
|
2a486f471b | ||
|
|
5f594d55ac | ||
|
|
f6616deef3 | ||
|
|
f8e8b39ff2 | ||
|
|
b7228e191c | ||
|
|
5395465cfd | ||
|
|
29f562460a | ||
|
|
9a32d7ec2f | ||
|
|
c976d32e7d | ||
|
|
1b56144cb8 | ||
|
|
5d65d666f7 | ||
|
|
179309710c | ||
|
|
42455f771a | ||
|
|
d2603d5308 | ||
|
|
b203263e91 | ||
|
|
a6b0f6cfac | ||
|
|
6309d2133f | ||
|
|
f1032baaab | ||
|
|
43efd76b24 | ||
|
|
7419319c0f | ||
|
|
290856db1c | ||
|
|
cfaaf56428 | ||
|
|
fdd34c582c | ||
|
|
5a66e1f98a | ||
|
|
ab77158757 | ||
|
|
b8c512a3d5 | ||
|
|
be9ddb7748 | ||
|
|
37d8dafd40 | ||
|
|
4de4c66bb7 | ||
|
|
ed6abb0f79 | ||
|
|
e49a46a386 | ||
|
|
5f49b2a9bb | ||
|
|
b7cf0ded00 | ||
|
|
7b035d3b5f | ||
|
|
b75722d450 | ||
|
|
9b69b64626 | ||
|
|
4201cf9f7f | ||
|
|
7375256b99 | ||
|
|
51522decf3 | ||
|
|
8b307aac56 | ||
|
|
e0af2feced | ||
|
|
0000043c96 | ||
|
|
2b8efc302a | ||
|
|
ae41d38a96 | ||
|
|
3073aab48b | ||
|
|
0b6c3cada3 | ||
|
|
54b8aa8a0b | ||
|
|
c0ddfbfab7 | ||
|
|
8f0c41dbd2 | ||
|
|
6173706531 | ||
|
|
9cfb295675 | ||
|
|
bbd01c0c8d | ||
|
|
728b64e334 | ||
|
|
aba83b6467 | ||
|
|
1f5ca497d3 | ||
|
|
0e2bc5608d | ||
|
|
914b324a67 | ||
|
|
bb83eb0f68 | ||
|
|
9d8cb459f1 | ||
|
|
35a6ed90a0 | ||
|
|
345b609ff0 | ||
|
|
06c749942a | ||
|
|
7a2942684c | ||
|
|
6afde94acf | ||
|
|
a42eb7b787 | ||
|
|
a92c8ccbd5 | ||
|
|
8ce66aad79 | ||
|
|
d8b50722f3 | ||
|
|
f9608bf41d | ||
|
|
54645f0a3b | ||
|
|
5c8e92d52a | ||
|
|
50091dfe8b | ||
|
|
611406b75e | ||
|
|
65f4a818d4 | ||
|
|
40860a84d1 | ||
|
|
092dd38851 | ||
|
|
dfe4837dbc | ||
|
|
f38212f20e | ||
|
|
104bbfdc1c | ||
|
|
65ec02bae1 | ||
|
|
fd8d09c8c0 | ||
|
|
b5690142aa | ||
|
|
253955dc31 | ||
|
|
ffe1ee0d84 | ||
|
|
d0e4d8046b | ||
|
|
78638a30cd | ||
|
|
e59fed9f38 | ||
|
|
b250c5588e | ||
|
|
2a4687834d | ||
|
|
ea7f00e777 | ||
|
|
b52ee1d069 | ||
|
|
56295ed438 | ||
|
|
c4ff66c5d7 | ||
|
|
a9eebb33fd | ||
|
|
89b22be063 | ||
|
|
da72cf387b | ||
|
|
4a9a3ab04b | ||
|
|
da042c1677 | ||
|
|
7cab558ed2 | ||
|
|
41b09d8c70 | ||
|
|
242a71e967 | ||
|
|
734a7dd5c7 | ||
|
|
f484abe5ec | ||
|
|
05a2a6af00 | ||
|
|
154e1a7991 | ||
|
|
978dc8170d | ||
|
|
f8dfa61859 | ||
|
|
9d320e4268 | ||
|
|
9a7346f889 | ||
|
|
5f9f536f0b | ||
|
|
4e144b6b76 | ||
|
|
41c55d1913 | ||
|
|
77605bce3e | ||
|
|
7876238823 | ||
|
|
a421564b84 | ||
|
|
7ca8fdb20c | ||
|
|
bfe9bf7a47 | ||
|
|
72da9b52af | ||
|
|
d9ab05833f | ||
|
|
29c39d61fb | ||
|
|
56635cea98 | ||
|
|
bd6b465ee1 | ||
|
|
e1e31de229 | ||
|
|
d549c00b2e | ||
|
|
d46c76311c | ||
|
|
3a917a0d1f | ||
|
|
fd18aa8717 | ||
|
|
cb32dbc7b8 | ||
|
|
639aaebacb | ||
|
|
ec56667f5e | ||
|
|
d1a4b6c2c5 | ||
|
|
e7d95f553b | ||
|
|
ceb3920381 | ||
|
|
9ebd79f528 | ||
|
|
ead6b4bf95 | ||
|
|
231c3f57d3 | ||
|
|
50142a1e6c | ||
|
|
fc415fc3c9 | ||
|
|
f831bdd231 | ||
|
|
6d25cf6f6a | ||
|
|
8f339712ab | ||
|
|
89b9364837 | ||
|
|
9eb26c66de | ||
|
|
9f8bee3501 | ||
|
|
ca64763440 | ||
|
|
0a1ade22c8 | ||
|
|
3efb737cbf | ||
|
|
6f08893016 | ||
|
|
0a81fe667f | ||
|
|
5db4bb68a4 | ||
|
|
2c074a94f3 | ||
|
|
6189db677d | ||
|
|
039a184d70 | ||
|
|
7dea799a9e | ||
|
|
863c1f7a13 | ||
|
|
6531a5c6c7 | ||
|
|
f1d5e1ba7b | ||
|
|
a9dc6bb3d7 | ||
|
|
58a61e1294 | ||
|
|
949f9e40a0 | ||
|
|
5747dbfe9b | ||
|
|
d9ac21ab82 | ||
|
|
db9d727eb8 | ||
|
|
07877bc381 | ||
|
|
e8b2b22c32 | ||
|
|
d10e28db36 | ||
|
|
6eb0d34032 | ||
|
|
3940abe7c1 | ||
|
|
b8b9df7b95 | ||
|
|
65efa7ddf7 | ||
|
|
eb2c5c29b7 | ||
|
|
212319b1f8 | ||
|
|
3bb6a5e8af | ||
|
|
fd93e9f322 | ||
|
|
3ad61e4dc8 | ||
|
|
fb865e8184 | ||
|
|
0c63644038 | ||
|
|
ef35483494 | ||
|
|
3ec5b46864 | ||
|
|
87b75126aa | ||
|
|
2581592441 | ||
|
|
04f83ae4ff | ||
|
|
11dd32a8fd | ||
|
|
568d5cb5ba | ||
|
|
b7cff09ce6 | ||
|
|
3af67b414e | ||
|
|
b809f0aeb8 | ||
|
|
5ec0b32ab0 | ||
|
|
08214999a7 | ||
|
|
5ed5a729d5 | ||
|
|
7b7b8f376f | ||
|
|
a696ad62c3 | ||
|
|
ff65035aee | ||
|
|
5ec7b10dc7 | ||
|
|
d1e2ab6f56 | ||
|
|
a0de75c727 | ||
|
|
7c5927ef93 | ||
|
|
abf961707d | ||
|
|
b3e216b8f1 | ||
|
|
ccaab5e183 | ||
|
|
c35de1aa06 | ||
|
|
c1f3d66686 | ||
|
|
cef48d1275 | ||
|
|
0513ce25e5 | ||
|
|
056c0b0ca1 | ||
|
|
a51ea308f5 | ||
|
|
05f08a7181 | ||
|
|
b1f889e1d1 | ||
|
|
896b924380 | ||
|
|
2f4352c759 | ||
|
|
1a552cf643 | ||
|
|
4639ce3364 | ||
|
|
17b14eed88 | ||
|
|
78905c6af1 | ||
|
|
003aa5ee44 | ||
|
|
dacec491ff | ||
|
|
7f59cf9194 | ||
|
|
cc9197e4c8 | ||
|
|
103a433bdf | ||
|
|
41e01a22a3 | ||
|
|
ed839114ab | ||
|
|
068045f6a0 | ||
|
|
a64084308d | ||
|
|
fe5533d1c3 | ||
|
|
d1a0187f82 | ||
|
|
767afd3c9f | ||
|
|
5087ac8153 | ||
|
|
6f00cecd81 | ||
|
|
4c8de74140 | ||
|
|
999a6052ff | ||
|
|
61809ef6b5 | ||
|
|
88c3509dd0 | ||
|
|
71b609fab0 | ||
|
|
d40eab2494 | ||
|
|
4da52cf733 | ||
|
|
7b4cf976df | ||
|
|
85b1188593 | ||
|
|
6c4702f282 | ||
|
|
7e16d0c1d3 | ||
|
|
d2cd841573 | ||
|
|
26cad2400e | ||
|
|
c441aa89db | ||
|
|
90add2fa96 | ||
|
|
32edb33411 | ||
|
|
068ae7f0d4 | ||
|
|
4ce7a27dca | ||
|
|
a668d163fd | ||
|
|
e5f81b1fec | ||
|
|
337d055872 | ||
|
|
191d4467e3 | ||
|
|
1ab6955494 | ||
|
|
619bcb44df |
@@ -52,6 +52,9 @@ http://www.fsf.org/licensing/licenses/index_html
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2015
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
Copyright (C) 2014
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
- Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
|
||||
74
ChangeLog
74
ChangeLog
@@ -2,14 +2,50 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
|
||||
- Fix: ref_ext was not saved when recording a customer order from web service
|
||||
- Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid.
|
||||
- Fix: [ bug #1788 ] Duplicated doActions hook in product/fournisseurs.php
|
||||
- Fix: withdrawal create error if in the same month are deleted previous withdrawals.
|
||||
- Fix: [ bug #1801 ] FAC_FORCE_DATE_VALIDATION constant alters supplier invoice date given to numeration modules
|
||||
- Fix: [ bug #1802 ] SQL error when updating a task with PostgreSQL database
|
||||
- Fix: [ bug #1785 ] Start date is lost in Project > Linked objects
|
||||
- Fix: [ bug #1804 ] SQL error when sending email without address
|
||||
- Fix: [ bug #1803 ] AJAX company contact input is not aligned
|
||||
- Fix: [ bug #1787 ] Incorrect behaviour of doActions hook
|
||||
- Fix: [ bug #1796 ] Unable to use numeration modules from an external module
|
||||
- Fix: [ bug #1783 ] SQL error when enabling 3rd party module with PostgreSQL and MySQL strict mode ON
|
||||
- Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount
|
||||
- Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme
|
||||
- Fix: Tracking number not visible on shipment pdf
|
||||
- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL database
|
||||
- Fix: [ bug #1819 ] SQL error when searching for an invoice payment
|
||||
- Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
|
||||
- Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL
|
||||
- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object
|
||||
- Fix: [ bug #1833 ] user permissions in contact/note.php not working
|
||||
- Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php
|
||||
- Fix: [ bug #1830 ] Salaries payment only allows checking accounts
|
||||
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
|
||||
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
|
||||
- Fix: Bad SEPA xml file creation
|
||||
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
|
||||
- Fix: Showing system error if not enough stock of product into orders creation with lines
|
||||
- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract
|
||||
- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line
|
||||
- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project
|
||||
- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme
|
||||
- Fix: [ bug #2542 ] Contracts store localtax preferences
|
||||
- Fix: Bad permission assignments for stock movements actions
|
||||
|
||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||
- Fix: bug 1588 : relative discount.
|
||||
- Fix: label of input method not tranlated.
|
||||
- Fix: box of customer and propsects were not correctly disabled.
|
||||
- Fix: label of input method not translated.
|
||||
- Fix: box of customer and prospects were not correctly disabled.
|
||||
- Fix: [ bug #1618 ] PHP Error thrown when saving a barcode
|
||||
- Fix: Civility & birthdate wasn't save into adherent module.
|
||||
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
|
||||
- Fix: webservice Thirdparty parameter lastname for individual creation is now lastname and not ref
|
||||
- Fix: Chars - is no more allowed into value for code for extra fields.
|
||||
- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
|
||||
- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
|
||||
@@ -36,14 +72,14 @@ For users:
|
||||
- Fix: Iban was used instead of Bic into SEPA file.
|
||||
- Fix: Must unaccent strings into SEPA file.
|
||||
- Fix: Extrafield feature select from table should try to translate multiple column when not needed
|
||||
- Fix: cents for indian ruppes are calle paisa and paise.
|
||||
- Fix: cents for indian ruppes are called paisa and paise.
|
||||
- Fix: Invoices payments may be older than invoices.
|
||||
- Fix: Withdrawal total amount is double
|
||||
- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
|
||||
- Fix: Web service categorie WDSL declaration is correct
|
||||
- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined
|
||||
- Fix: Category creation failed and no message output
|
||||
- Fix: Lanf for Payment Type
|
||||
- Fix: Lang for Payment Type
|
||||
- Fix: PHPCheckstyle 1.5.5
|
||||
|
||||
***** ChangeLog for 3.6 compared to 3.5.* *****
|
||||
@@ -65,12 +101,12 @@ For users:
|
||||
- New: Improved Opensurvey module:
|
||||
Added options to disable comments and disable public votes.
|
||||
Limit dates use calendar popup.
|
||||
Description of survey use wysiwig editor.
|
||||
Description of survey use wysiwyg editor.
|
||||
More information shown on result tab.
|
||||
Renamed "survey" into "poll" (better translation).
|
||||
- New: Add filter on text and status into survey list. Can also sort on id, text and date end.
|
||||
- New: The box "balance of bank accounts" show all opened accounts.
|
||||
- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale represnative into public
|
||||
- New: Add option MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE to add sale representative into public
|
||||
note of generated documents.
|
||||
- New: Add warning if supplier payment is higher that due amount.
|
||||
- New: Increase length of url into bookmark module.
|
||||
@@ -83,7 +119,7 @@ For users:
|
||||
- New: Add barcode fields into user database.
|
||||
- New: Add manager name (ceo, director, president...) into main company information page.
|
||||
- New: Add field url as product properties.
|
||||
- New: More options to create a credit note (can be filled autatically according to remain to pay).
|
||||
- New: More options to create a credit note (can be filled automatically according to remain to pay).
|
||||
- New: Can define custom fields for categories.
|
||||
- New: Prepare generation of SEPA files into module withdrawal.
|
||||
- New: [ task #1164 ] Add "Ref. supplier" search box in supplier orders
|
||||
@@ -100,7 +136,7 @@ For users:
|
||||
- New: [ task #926 ] Add extrafield feature on order lines.
|
||||
- New: [ task #927 ] Add extrafield feature on Proposal lines.
|
||||
- New: [ task #928 ] Add extrafield feature on invoice lines.
|
||||
- New: Paypal/paybox email sent after backcall of a payment is now a formated and translated
|
||||
- New: Paypal/paybox email sent after backcall of a payment is now a formatted and translated
|
||||
HTML content. For member subscription renewal, there is also a link to member.
|
||||
- New: When a subscription is recorded with invoice and payment:
|
||||
- the document (PDF) of invoice is also generated.
|
||||
@@ -151,14 +187,24 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
So check that return value is 0 to keep default standard behaviour after hook or 1 to disable
|
||||
default standard behaviour.
|
||||
- Properties "civilite_id" were renamed into "civility_id".
|
||||
- Remove add_photo_web() that is ot used anymore by core code.
|
||||
- Remove add_photo_web() that is not used anymore by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken dur to SSL v3 closed.
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
||||
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
||||
Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date
|
||||
Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled
|
||||
Fix: [ bug #1846 ] Browser IE11 not detected
|
||||
Fix: [ bug #1906 ] Deplacement does not allow translated decimal format
|
||||
Fix: [ bug #1905 ] Custom deplacement types do not get translated in deplacement card
|
||||
Fix: [ bug #2583 ] Unable to create a bank transfer with localized numbers
|
||||
Fix: [ bug #2577 ] Incorrect invoice status in "Linked objects" page of a project
|
||||
Fix: [ bug #2576 ] Unable to edit a dictionary entry that has # in its ref
|
||||
Fix: [ bug #2758 ] Product::update sets product note to "null" when $prod->note is null
|
||||
Fix: [ bug #2757 ] Deleting product category photo gives "Forbidden access" error
|
||||
|
||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||
@@ -172,7 +218,7 @@ Fix: Bad days and month reported by function.
|
||||
Fix: Bad margin calculation.
|
||||
|
||||
***** ChangeLog for 3.5.5 compared to 3.5.4 *****
|
||||
Fix: Holiday module was broken. Initializaion of amount of holidays failed.
|
||||
Fix: Holiday module was broken. Initialization of amount of holidays failed.
|
||||
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
|
||||
Fix: Fusion PDF button on unpaid invoice is no more displayed.
|
||||
Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click).
|
||||
@@ -207,7 +253,7 @@ Fix: When using option MAIN_MAIL_ALLOW_SENDMAIL_F, a mail was sent to sender.
|
||||
Fix: Question about warehouse must not be done when module stock is disabled.
|
||||
Fix: Option STOCK_SUPPORTS_SERVICES was not correctly implemented
|
||||
(missing test at some places).
|
||||
Fix: Renaming a project with uplaoded files failed.
|
||||
Fix: Renaming a project with uploaded files failed.
|
||||
Fix: [ bug #1476 ] Invoice creation form loses invoice date when there is a validation error.
|
||||
Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin.
|
||||
Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order.
|
||||
@@ -228,7 +274,7 @@ Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and
|
||||
Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler.
|
||||
Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order.
|
||||
Fix: [ bug #1454 ] Mention de bas de page erroné
|
||||
Fix: Do not display dictionnay for non activated module
|
||||
Fix: Do not display dictionary for non activated module
|
||||
Fix: Link element from element project pages
|
||||
Fix: [ bug #1509 ] Expedition admin free text & watermark submit error
|
||||
Fix: [ bug #1349 ] AJAX contact selector does not work fine in Project card
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
dolibarr (3.6.2-3) unstable; urgency=low
|
||||
dolibarr (3.6.4-3) UNRELEASED; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Sat, 27 dec 2014 12:00:00 +0100
|
||||
|
||||
dolibarr (3.6.1-3) unstable; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 23 Sep 2014 12:00:00 +0100
|
||||
|
||||
dolibarr (3.6.0-3) unstable; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 15 July 2014 12:00:00 +0100
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 12 May 2015 12:00:00 +0100
|
||||
|
||||
@@ -32,7 +32,7 @@ AppPublisherURL=http://www.nltechno.com
|
||||
AppSupportURL=http://www.dolibarr.org
|
||||
AppUpdatesURL=http://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||
AppCopyright=Copyright (C) 2008-2014 Laurent Destailleur, NLTechno
|
||||
AppCopyright=Copyright (C) 2008-2015 Laurent Destailleur, NLTechno
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
@@ -108,7 +108,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\m
|
||||
; Mysql data files (does not overwrite if exists)
|
||||
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\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\*,nltechno*\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,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: "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*\*,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\*,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"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,6 @@ beta version of Dolibarr, step by step.
|
||||
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z-w in build/debian/changelog
|
||||
- Update version number with x.y.z-w in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.y.z-w in build/rpm/*.spec
|
||||
- Commit all changes.
|
||||
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
||||
- Create a branch (x.y).
|
||||
@@ -34,7 +33,6 @@ complete release of Dolibarr, step by step.
|
||||
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z in build/debian/changelog
|
||||
- Update version number with x.y.z in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.y.z in build/rpm/*.spec
|
||||
- Commit all changes.
|
||||
|
||||
- Build Dolibarr and DoliWamp packages with makepack-dolibarr.pl
|
||||
|
||||
@@ -333,11 +333,4 @@ fi
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
|
||||
- Upstream release
|
||||
__CHANGELOGSTRING__
|
||||
|
||||
@@ -569,12 +569,4 @@ fi
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
|
||||
- Upstream release
|
||||
|
||||
__CHANGELOGSTRING__
|
||||
|
||||
@@ -338,12 +338,4 @@ fi
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
|
||||
- Upstream release
|
||||
|
||||
__CHANGELOGSTRING__
|
||||
|
||||
@@ -349,12 +349,4 @@ fi
|
||||
|
||||
# version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release
|
||||
%changelog
|
||||
* Sat Dec 27 2014 Laurent Destailleur 3.6.2-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Sep 24 2014 Laurent Destailleur 3.6.1-0.3
|
||||
- Upstream release
|
||||
|
||||
* Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3
|
||||
- Upstream release
|
||||
|
||||
__CHANGELOGSTRING__
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
@@ -228,6 +229,23 @@
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingAuthorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingCategoryTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingLicenseTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingLinkTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingPackageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
@@ -1116,7 +1116,7 @@ if ($id)
|
||||
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) $iserasable=0;
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&';
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
|
||||
@@ -100,6 +100,7 @@ print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Add hook to add information
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
|
||||
@@ -1060,6 +1060,7 @@ class ActionComm extends CommonObject
|
||||
$this->datef=$now;
|
||||
$this->author=$user;
|
||||
$this->usermod=$user;
|
||||
$this->usertodo=$user;
|
||||
$this->fulldayevent=0;
|
||||
$this->punctual=0;
|
||||
$this->percentage=0;
|
||||
|
||||
@@ -1038,7 +1038,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other');
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday'; }
|
||||
else { $numother++; $cssclass='family_other'; }
|
||||
|
||||
@@ -79,76 +79,78 @@ $object = new Societe($db);
|
||||
$parameters = array('socid' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
|
||||
|
||||
//Some actions show a "cancel" input submit button with name="cancel"
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
if (empty($reshook)) {
|
||||
//Some actions show a "cancel" input submit button with name="cancel"
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
if ($action == 'setcustomeraccountancycode')
|
||||
{
|
||||
if (!$cancelbutton) {
|
||||
$result=$object->fetch($id);
|
||||
$object->code_compta=$_POST["customeraccountancycode"];
|
||||
$result=$object->update($object->id,$user,1,1,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesgs[]=join(',',$object->errors);
|
||||
if ($action == 'setcustomeraccountancycode')
|
||||
{
|
||||
if (!$cancelbutton) {
|
||||
$result=$object->fetch($id);
|
||||
$object->code_compta=$_POST["customeraccountancycode"];
|
||||
$result=$object->update($object->id,$user,1,1,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesgs[]=join(',',$object->errors);
|
||||
}
|
||||
$action="";
|
||||
}
|
||||
$action="";
|
||||
}
|
||||
}
|
||||
|
||||
// conditions de reglement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->tva_assuj=$_POST['assujtva_value'];
|
||||
|
||||
// TODO move to DAO class
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=GETPOST('stcomm','int');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'setOutstandingBill')
|
||||
{
|
||||
if (!$cancelbutton) {
|
||||
// conditions de reglement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit = GETPOST('OutstandingBill');
|
||||
$result = $object->set_OutstandingBill($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->tva_assuj=$_POST['assujtva_value'];
|
||||
|
||||
// TODO move to DAO class
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE rowid='".$id."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=GETPOST('stcomm','int');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
// Update communication level
|
||||
if ($action == 'setOutstandingBill')
|
||||
{
|
||||
if (!$cancelbutton) {
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit = GETPOST('OutstandingBill');
|
||||
$result = $object->set_OutstandingBill($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,446 +102,390 @@ $object->substitutionarrayfortest=array(
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||
if (empty($reshook)) {
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$object->createFromClone($object->id,$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
|
||||
if ($result > 0)
|
||||
if (empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit;
|
||||
$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
}
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Action send emailing for everybody
|
||||
if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
{
|
||||
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
||||
{
|
||||
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
|
||||
// on affiche donc juste un message
|
||||
$mesg='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
|
||||
$mesg.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
|
||||
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
|
||||
$action='';
|
||||
}
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
$mesg='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>';
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
dol_print_error('','ErrorMailIsNotValidated');
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = $object->id;
|
||||
$subject = $object->sujet;
|
||||
$message = $object->body;
|
||||
$from = $object->email_from;
|
||||
$replyto = $object->email_replyto;
|
||||
$errorsto = $object->email_errorsto;
|
||||
// Le message est-il en html
|
||||
$msgishtml=-1; // Unknown by default
|
||||
if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
|
||||
|
||||
// Warning, we must not use begin-commit transaction here
|
||||
// because we want to save update for each mail sent.
|
||||
|
||||
$nbok=0; $nbko=0;
|
||||
|
||||
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
|
||||
// ou envoyes en erreur (statut=-1)
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
|
||||
|
||||
dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql); // nb of possible recipients
|
||||
|
||||
if ($num)
|
||||
$result=$object->createFromClone($object->id,$_REQUEST["clone_content"],$_REQUEST["clone_receivers"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
dol_syslog("comm/mailing/fiche.php: nb of targets = ".$num, LOG_DEBUG);
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
}
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
$now=dol_now();
|
||||
// Action send emailing for everybody
|
||||
if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
{
|
||||
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
|
||||
{
|
||||
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
|
||||
// on affiche donc juste un message
|
||||
$mesg='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>';
|
||||
$mesg.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>';
|
||||
$mesg.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>';
|
||||
$action='';
|
||||
}
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
|
||||
{
|
||||
$mesg='<div class="warning">'.$langs->trans("NotEnoughPermissions").'</div>';
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
// Positionne date debut envoi
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate($now)." WHERE rowid=".$object->id;
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
dol_print_error('','ErrorMailIsNotValidated');
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = $object->id;
|
||||
$subject = $object->sujet;
|
||||
$message = $object->body;
|
||||
$from = $object->email_from;
|
||||
$replyto = $object->email_replyto;
|
||||
$errorsto = $object->email_errorsto;
|
||||
// Le message est-il en html
|
||||
$msgishtml=-1; // Unknown by default
|
||||
if (preg_match('/[\s\t]*<html>/i',$message)) $msgishtml=1;
|
||||
|
||||
// Warning, we must not use begin-commit transaction here
|
||||
// because we want to save update for each mail sent.
|
||||
|
||||
$nbok=0; $nbko=0;
|
||||
|
||||
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
|
||||
// ou envoyes en erreur (statut=-1)
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
|
||||
|
||||
dol_syslog("fiche.php: select targets sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql); // nb of possible recipients
|
||||
|
||||
if ($num)
|
||||
{
|
||||
dol_syslog("comm/mailing/fiche.php: nb of targets = ".$num, LOG_DEBUG);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne date debut envoi
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Loop on each email and send it
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||
{
|
||||
|
||||
$res=1;
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// sendto en RFC2822
|
||||
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
|
||||
|
||||
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
|
||||
$other=explode(';',$obj->other);
|
||||
$tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $obj->source_id,
|
||||
'__EMAIL__' => $obj->email,
|
||||
'__LASTNAME__' => $obj->lastname,
|
||||
'__FIRSTNAME__' => $obj->firstname,
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||
'__OTHER1__' => $other1,
|
||||
'__OTHER2__' => $other2,
|
||||
'__OTHER3__' => $other3,
|
||||
'__OTHER4__' => $other4,
|
||||
'__OTHER5__' => $other5,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||
);
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
|
||||
}
|
||||
$substitutionisok=true;
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$newsubject=make_substitutions($subject,$substitutionarray);
|
||||
$newmessage=make_substitutions($message,$substitutionarray);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$arr_css = array();
|
||||
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||
$arr_name[]=$listofpaths[$key]['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Fabrication du mail
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css);
|
||||
|
||||
if ($mail->error)
|
||||
{
|
||||
$res=0;
|
||||
}
|
||||
if (! $substitutionisok)
|
||||
{
|
||||
$mail->error='Some substitution failed';
|
||||
$res=0;
|
||||
}
|
||||
|
||||
// Send mail
|
||||
if ($res)
|
||||
{
|
||||
$res=$mail->sendfile();
|
||||
}
|
||||
|
||||
if ($res)
|
||||
{
|
||||
// Mail successful
|
||||
$nbok++;
|
||||
|
||||
dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.=" SET statut=1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if cheack read is use then update prospect contact status
|
||||
if (strpos($message, '__CHECK_READ__') !== false)
|
||||
{
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
|
||||
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//test if CHECK READ change statut prospect contact
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mail failed
|
||||
$nbko++;
|
||||
|
||||
dol_syslog("comm/mailing/fiche.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
|
||||
}
|
||||
|
||||
// Loop finished, set global statut of mail
|
||||
if ($nbko > 0)
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because at least one error)
|
||||
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($nbok >= $num)
|
||||
{
|
||||
$statut=3; // Send to everybody
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
else
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because not send to everybody)
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
}
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
|
||||
dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Loop on each email and send it
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||
{
|
||||
|
||||
$res=1;
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// sendto en RFC2822
|
||||
$sendto = str_replace(',',' ',dolGetFirstLastname($obj->firstname, $obj->lastname))." <".$obj->email.">";
|
||||
|
||||
// Make substitutions on topic and body. From (AA=YY;BB=CC;...) we keep YY, CC, ...
|
||||
$other=explode(';',$obj->other);
|
||||
$tmpfield=explode('=',$other[0],2); $other1=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[1],2); $other2=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[2],2); $other3=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[3],2); $other4=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
|
||||
// Array of possible substitutions (See also fie mailing-send.php that should manage same substitutions)
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $obj->source_id,
|
||||
'__EMAIL__' => $obj->email,
|
||||
'__LASTNAME__' => $obj->lastname,
|
||||
'__FIRSTNAME__' => $obj->firstname,
|
||||
'__MAILTOEMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
|
||||
'__OTHER1__' => $other1,
|
||||
'__OTHER2__' => $other2,
|
||||
'__OTHER3__' => $other3,
|
||||
'__OTHER4__' => $other4,
|
||||
'__OTHER5__' => $other5,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||
);
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||
{
|
||||
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
|
||||
}
|
||||
$substitutionisok=true;
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$newsubject=make_substitutions($subject,$substitutionarray);
|
||||
$newmessage=make_substitutions($message,$substitutionarray);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$arr_css = array();
|
||||
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||
$arr_name[]=$listofpaths[$key]['name'];
|
||||
}
|
||||
}
|
||||
|
||||
// Fabrication du mail
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css);
|
||||
|
||||
if ($mail->error)
|
||||
{
|
||||
$res=0;
|
||||
}
|
||||
if (! $substitutionisok)
|
||||
{
|
||||
$mail->error='Some substitution failed';
|
||||
$res=0;
|
||||
}
|
||||
|
||||
// Send mail
|
||||
if ($res)
|
||||
{
|
||||
$res=$mail->sendfile();
|
||||
}
|
||||
|
||||
if ($res)
|
||||
{
|
||||
// Mail successful
|
||||
$nbok++;
|
||||
|
||||
dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG);
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if cheack read is use then update prospect contact status
|
||||
if (strpos($message, '__CHECK_READ__') !== false)
|
||||
{
|
||||
//Update status communication of thirdparty prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".$obj->rowid.")";
|
||||
dol_syslog("fiche.php: set prospect thirdparty status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//Update status communication of contact prospect
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".$obj->rowid." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
|
||||
dol_syslog("fiche.php: set prospect contact status sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//test if CHECK READ change statut prospect contact
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mail failed
|
||||
$nbko++;
|
||||
|
||||
dol_syslog("comm/mailing/fiche.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.=" SET statut=-1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"));
|
||||
}
|
||||
|
||||
// Loop finished, set global statut of mail
|
||||
if ($nbko > 0)
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because at least one error)
|
||||
if ($nbok > 0) setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($nbok >= $num)
|
||||
{
|
||||
$statut=3; // Send to everybody
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
else
|
||||
{
|
||||
$statut=2; // Status 'sent partially' (because not send to everybody)
|
||||
setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok));
|
||||
}
|
||||
}
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$object->id;
|
||||
dol_syslog("comm/mailing/fiche.php: update global status sql=".$sql, LOG_DEBUG);
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
dol_syslog($db->error());
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog($db->error());
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Action send test emailing
|
||||
if ($action == 'send' && empty($_POST["cancel"]))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
$object->sendto = $_POST["sendto"];
|
||||
if (! $object->sendto)
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
// Action send test emailing
|
||||
if ($action == 'send' && empty($_POST["cancel"]))
|
||||
{
|
||||
// Le message est-il en html
|
||||
$msgishtml=-1; // Inconnu par defaut
|
||||
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
|
||||
$error=0;
|
||||
|
||||
// Pratique les substitutions sur le sujet et message
|
||||
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
|
||||
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$arr_css = array();
|
||||
|
||||
// Ajout CSS
|
||||
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor;
|
||||
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
|
||||
|
||||
// Attached files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
$object->sendto = $_POST["sendto"];
|
||||
if (! $object->sendto)
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Le message est-il en html
|
||||
$msgishtml=-1; // Inconnu par defaut
|
||||
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
|
||||
|
||||
// Pratique les substitutions sur le sujet et message
|
||||
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
|
||||
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
$arr_css = array();
|
||||
|
||||
// Ajout CSS
|
||||
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor;
|
||||
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
|
||||
|
||||
// Attached files
|
||||
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
|
||||
if (count($listofpaths))
|
||||
{
|
||||
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||
$arr_name[]=$listofpaths[$key]['name'];
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
$arr_file[]=$listofpaths[$key]['fullname'];
|
||||
$arr_mime[]=dol_mimetype($listofpaths[$key]['name']);
|
||||
$arr_name[]=$listofpaths[$key]['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$mesg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
|
||||
}
|
||||
|
||||
$action='';
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$mesg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($object->email_from,2),$mailfile->getValidAddress($object->sendto,2)).'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
|
||||
}
|
||||
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
// Action add emailing
|
||||
if ($action == 'add')
|
||||
{
|
||||
$object->email_from = trim($_POST["from"]);
|
||||
$object->email_replyto = trim($_POST["replyto"]);
|
||||
$object->email_errorsto = trim($_POST["errorsto"]);
|
||||
$object->titre = trim($_POST["titre"]);
|
||||
$object->sujet = trim($_POST["sujet"]);
|
||||
$object->body = trim($_POST["body"]);
|
||||
$object->bgcolor = trim($_POST["bgcolor"]);
|
||||
$object->bgimage = trim($_POST["bgimage"]);
|
||||
|
||||
if (! $object->titre) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
|
||||
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
|
||||
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
if ($object->create($user) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
$mesg=$object->error;
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="create";
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
||||
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
|
||||
else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha'));
|
||||
else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha'));
|
||||
|
||||
else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
|
||||
else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom"));
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
if ($object->update($user) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
$mesg=$object->error;
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="";
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (! empty($_POST['addfile']))
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
dol_add_file_process($upload_dir,0,0);
|
||||
|
||||
$action="edit";
|
||||
}
|
||||
|
||||
// Action remove file
|
||||
if (! empty($_POST["removedfile"]))
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_remove_file_process($_POST['removedfile'],0);
|
||||
|
||||
$action="edit";
|
||||
}
|
||||
|
||||
// Action update emailing
|
||||
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$isupload=0;
|
||||
|
||||
if (! $isupload)
|
||||
// Action add emailing
|
||||
if ($action == 'add')
|
||||
{
|
||||
$object->email_from = trim($_POST["from"]);
|
||||
$object->email_replyto = trim($_POST["replyto"]);
|
||||
$object->email_errorsto = trim($_POST["errorsto"]);
|
||||
$object->titre = trim($_POST["titre"]);
|
||||
$object->sujet = trim($_POST["sujet"]);
|
||||
$object->body = trim($_POST["body"]);
|
||||
$object->bgcolor = trim($_POST["bgcolor"]);
|
||||
$object->bgimage = trim($_POST["bgimage"]);
|
||||
|
||||
if (! $object->titre) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
|
||||
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
|
||||
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
if ($object->create($user) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
$mesg=$object->error;
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="create";
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
if ($action == 'settitre' || $action == 'setemail_from' || $actino == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha'));
|
||||
else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha'));
|
||||
else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha'));
|
||||
else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha'));
|
||||
|
||||
else if ($action == 'settitre' && empty($object->titre)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle"));
|
||||
else if ($action == 'setfrom' && empty($object->email_from)) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom"));
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
if ($object->update($user) >= 0)
|
||||
@@ -553,78 +497,136 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="";
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (! empty($_POST['addfile']))
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
dol_add_file_process($upload_dir,0,0);
|
||||
|
||||
$action="edit";
|
||||
}
|
||||
else
|
||||
|
||||
// Action remove file
|
||||
if (! empty($_POST["removedfile"]))
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_remove_file_process($_POST['removedfile'],0);
|
||||
|
||||
$action="edit";
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation validation
|
||||
if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
// Action update emailing
|
||||
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
||||
{
|
||||
$object->valid($user);
|
||||
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Resend
|
||||
if ($action == 'confirm_reset' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$db->begin();
|
||||
$isupload=0;
|
||||
|
||||
$result=$object->valid($user);
|
||||
if ($result > 0)
|
||||
if (! $isupload)
|
||||
{
|
||||
$result=$object->reset_targets_status($user);
|
||||
$object->sujet = trim($_POST["sujet"]);
|
||||
$object->body = trim($_POST["body"]);
|
||||
$object->bgcolor = trim($_POST["bgcolor"]);
|
||||
$object->bgimage = trim($_POST["bgimage"]);
|
||||
|
||||
if (! $object->sujet) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTopic"));
|
||||
if (! $object->body) $mesg.=($mesg?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailMessage"));
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
if ($object->update($user) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
$mesg=$object->error;
|
||||
}
|
||||
|
||||
$mesg='<div class="error">'.$mesg.'</div>';
|
||||
$action="edit";
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
$action="edit";
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation validation
|
||||
if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->valid($user);
|
||||
setEventMessage($langs->trans("MailingSuccessfullyValidated"));
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Resend
|
||||
if ($action == 'confirm_reset' && $confirm == 'yes')
|
||||
{
|
||||
dol_print_error($db);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$object->valid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$object->reset_targets_status($user);
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation suppression
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->delete($object->id))
|
||||
{
|
||||
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
|
||||
header("Location: ".$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($_POST["cancel"]))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation suppression
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->delete($object->id))
|
||||
{
|
||||
$url= (! empty($urlfrom) ? $urlfrom : 'liste.php');
|
||||
header("Location: ".$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($_POST["cancel"]))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2564,11 +2564,14 @@ class Propal extends CommonObject
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/propale/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
|
||||
@@ -141,7 +141,9 @@ if (! $sortorder) $sortorder='DESC';
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
|
||||
$sql = 'SELECT s.rowid, s.nom, s.town, s.client, s.code_client,';
|
||||
if (! $sall) $sql = 'SELECT';
|
||||
else $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.client, s.code_client,';
|
||||
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
@@ -388,7 +390,7 @@ if ($result)
|
||||
|
||||
// Date proposal
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->dp), 'day');
|
||||
print dol_print_date($db->jdate($objp->dp), 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date end validity
|
||||
|
||||
@@ -162,11 +162,13 @@ $hookmanager->initHooks(array('prospectlist'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
||||
$sql .= " WHERE rowid = ".$_GET["socid"];
|
||||
$result=$db->query($sql);
|
||||
if (empty($reshook)) {
|
||||
if ($action == 'cstc')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$_GET["pstcomm"];
|
||||
$sql .= " WHERE rowid = ".$_GET["socid"];
|
||||
$result=$db->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@@ -100,6 +100,11 @@ class Commande extends CommonOrder
|
||||
// Pour board
|
||||
var $nbtodo;
|
||||
var $nbtodolate;
|
||||
|
||||
/**
|
||||
* ERR Not engouch stock
|
||||
*/
|
||||
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
|
||||
|
||||
|
||||
/**
|
||||
@@ -137,17 +142,20 @@ class Commande extends CommonOrder
|
||||
$classname = $conf->global->COMMANDE_ADDON;
|
||||
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/commande/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/commande/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
@@ -658,18 +666,19 @@ class Commande extends CommonOrder
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
|
||||
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int";
|
||||
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
|
||||
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".($this->fk_project>0?$this->fk_project:"null");
|
||||
$sql.= ", '".$this->db->idate($date)."'";
|
||||
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
|
||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
||||
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
||||
$sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
|
||||
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
||||
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
||||
$sql.= ", '".$this->modelpdf."'";
|
||||
$sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null");
|
||||
@@ -730,8 +739,11 @@ class Commande extends CommonOrder
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
if ($result != self::STOCK_NOT_ENOUGH_FOR_ORDER)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@@ -904,7 +916,7 @@ class Commande extends CommonOrder
|
||||
$modCommande = new $obj;
|
||||
$this->ref = $modCommande->getNextValue($objsoc,$this);
|
||||
|
||||
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
@@ -1165,10 +1177,12 @@ class Commande extends CommonOrder
|
||||
$result=$product->fetch($fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty) {
|
||||
if($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -112,7 +113,7 @@ $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Ped
|
||||
llxHeader('',$langs->trans("Orders"),$help_url);
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as facturee';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
@@ -306,11 +307,11 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">';
|
||||
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
|
||||
print '</td><td class="liste_titre">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
|
||||
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
|
||||
@@ -340,7 +341,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_livraison)) < ($now - $conf->commande->client->warning_delay))
|
||||
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && max($db->jdate($objp->date_commande),$db->jdate($objp->date_delivery)) < ($now - $conf->commande->client->warning_delay))
|
||||
print img_picto($langs->trans("Late"),"warning");
|
||||
if(!empty($objp->note_private))
|
||||
{
|
||||
|
||||
@@ -130,7 +130,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@@ -179,7 +179,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@@ -238,7 +238,7 @@ if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total ").$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -360,7 +360,7 @@ if ($result)
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='user') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche?id='.$links[$key]['url_id'].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowUser'),'user').' ';
|
||||
print $langs->trans("User");
|
||||
print '</a>';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -48,7 +49,7 @@ if ($action == 'add')
|
||||
$mesg='';
|
||||
$dateo = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||
$label = GETPOST('label','alpha');
|
||||
$amount= GETPOST('amount','int');
|
||||
$amount= GETPOST('amount');
|
||||
|
||||
if (! $label)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -98,8 +99,14 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$km = GETPOST('km');
|
||||
|
||||
if ($km) {
|
||||
$km = price2num($km);
|
||||
}
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
$object->km = GETPOST('km','int');
|
||||
$object->km = $km;
|
||||
$object->type = GETPOST('type','alpha');
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->fk_user = GETPOST('fk_user','int');
|
||||
@@ -157,8 +164,14 @@ else if ($action == 'update' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$km = GETPOST('km');
|
||||
|
||||
if ($km) {
|
||||
$km = price2num($km);
|
||||
}
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
$object->km = GETPOST('km','int');
|
||||
$object->km = $km;
|
||||
$object->type = GETPOST('type','alpha');
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->fk_user = GETPOST('fk_user','int');
|
||||
@@ -200,12 +213,6 @@ else if ($action == 'setdated' && $user->rights->deplacement->creer)
|
||||
$result=$object->setValueFrom('dated',$dated,'','','date');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
else if ($action == 'setkm' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setValueFrom('km',GETPOST('km','int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -348,7 +355,7 @@ else if ($id)
|
||||
|
||||
// Km
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
||||
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
||||
print '<input name="km" class="flat" size="10" value="'.price($object->km).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Where
|
||||
@@ -416,10 +423,12 @@ else if ($id)
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
$form->load_cache_types_fees();
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
||||
print $form->editfieldval("Type",'type', $form->cache_types_fees[$object->type],$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');
|
||||
print '</td></tr>';
|
||||
|
||||
// Who
|
||||
@@ -440,7 +449,7 @@ else if ($id)
|
||||
print '<tr><td valign="top">';
|
||||
print $form->editfieldkey("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("FeesKilometersOrAmout",'km',$object->km,$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
||||
print $form->editfieldval("FeesKilometersOrAmout",'km',price($object->km),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'numeric:6');
|
||||
print "</td></tr>";
|
||||
|
||||
// Where
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2504,52 +2504,64 @@ class Facture extends CommonInvoice
|
||||
else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre';
|
||||
else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure';
|
||||
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->FACTURE_ADDON.".php";
|
||||
$classname = $conf->global->FACTURE_ADDON;
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
if (! empty($conf->global->FACTURE_ADDON))
|
||||
{
|
||||
$dir = $dirroot."/core/modules/facture/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->FACTURE_ADDON.".php";
|
||||
$classname = $conf->global->FACTURE_ADDON;
|
||||
|
||||
// For compatibility
|
||||
if (! $mybool)
|
||||
{
|
||||
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
|
||||
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/facture/";
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/facture/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
}
|
||||
//print "xx".$mybool.$dir.$file."-".$classname;
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
// For compatibility
|
||||
if (! $mybool)
|
||||
{
|
||||
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
|
||||
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/facture/";
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this,$mode);
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this,$mode);
|
||||
|
||||
if ($numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return false;
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (empty($mode))
|
||||
{
|
||||
@@ -649,13 +649,12 @@ if ($resql)
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
print '<td align="right">';
|
||||
$cn=$facturestatic->getSumCreditNotesUsed();
|
||||
if (! empty($objp->am)) print price($objp->am);
|
||||
if (! empty($objp->am) && ! empty($cn)) print '+';
|
||||
if (! empty($cn)) print price($cn);
|
||||
$dep=$facturestatic->getSumDepositsUsed();
|
||||
print price($objp->am + $cn + $dep);
|
||||
print '</td>';
|
||||
|
||||
// Remain to receive
|
||||
print '<td align="right">'.((! empty($objp->am) || ! empty($cn))?price($objp->total_ttc-$objp->am-$cn):' ').'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc-$objp->am-$cn-$dep).'</td>';
|
||||
|
||||
// Status of invoice
|
||||
print '<td align="right" class="nowrap">';
|
||||
@@ -685,7 +684,7 @@ if ($resql)
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_tva+=($objp->total_tva + $tx1 + $tx2 + $revenuestamp);
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_paid+=$objp->am + $cn;
|
||||
$total_paid+=$objp->am + $cn + $dep;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -71,182 +71,184 @@ $hookmanager->initHooks(array('paiementcard'));
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
{
|
||||
$error = 0;
|
||||
if (empty($reshook)) {
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$paiement_id = 0;
|
||||
$totalpayment = 0;
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
|
||||
$tmpinvoice=new Facture($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
{
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
$error = 0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$paiement_id = 0;
|
||||
$totalpayment = 0;
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
|
||||
$tmpinvoice=new Facture($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
$cursorfacid = substr($key,7);
|
||||
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
|
||||
$totalpayment = $totalpayment + $amounts[$cursorfacid];
|
||||
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||
$result=$tmpinvoice->fetch($cursorfacid);
|
||||
if ($result <= 0) dol_print_error($db);
|
||||
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
|
||||
if ($amounts[$cursorfacid])
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
{
|
||||
// Check amount
|
||||
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
|
||||
{
|
||||
$addwarning=1;
|
||||
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
|
||||
}
|
||||
// Check date
|
||||
if ($datepaye && ($datepaye < $tmpinvoice->date))
|
||||
{
|
||||
$langs->load("errors");
|
||||
//$error++;
|
||||
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
|
||||
}
|
||||
}
|
||||
$cursorfacid = substr($key,7);
|
||||
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
|
||||
$totalpayment = $totalpayment + $amounts[$cursorfacid];
|
||||
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||
$result=$tmpinvoice->fetch($cursorfacid);
|
||||
if ($result <= 0) dol_print_error($db);
|
||||
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
|
||||
if ($amounts[$cursorfacid])
|
||||
{
|
||||
// Check amount
|
||||
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
|
||||
{
|
||||
$addwarning=1;
|
||||
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' '.$langs->trans("HelpPaymentHigherThanReminderToPay");
|
||||
}
|
||||
// Check date
|
||||
if ($datepaye && ($datepaye < $tmpinvoice->date))
|
||||
{
|
||||
$langs->load("errors");
|
||||
//$error++;
|
||||
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if (! GETPOST('paiementcode'))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// If bank module is on, account is required to enter a payment
|
||||
if (GETPOST('accountid') <= 0)
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($datepaye))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Action add_paiement
|
||||
*/
|
||||
if ($action == 'add_paiement')
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
$action = 'create';
|
||||
}
|
||||
// Le reste propre a cette action s'affiche en bas de page.
|
||||
}
|
||||
|
||||
/*
|
||||
* Action confirm_paiement
|
||||
*/
|
||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
if (GETPOST('type') == 2)
|
||||
{
|
||||
foreach ($amounts as $key => $value) // How payment is dispatch
|
||||
{
|
||||
$newvalue = price2num($value,'MT');
|
||||
$amounts[$key] = -$newvalue;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
|
||||
if (GETPOST('accountid') <= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Creation of payment line
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement');
|
||||
$paiement->num_paiement = $_POST['num_paiement'];
|
||||
$paiement->note = $_POST['comment'];
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$label='(CustomerInvoicePayment)';
|
||||
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
|
||||
$result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
|
||||
$invoiceid=0;
|
||||
foreach ($paiement->amounts as $key => $amount)
|
||||
{
|
||||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0)
|
||||
{
|
||||
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
|
||||
else $invoiceid=$facid;
|
||||
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
|
||||
}
|
||||
}
|
||||
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/compta/facture.php?facid='.$invoiceid;
|
||||
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
|
||||
// Check parameters
|
||||
if (! GETPOST('paiementcode'))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// If bank module is on, account is required to enter a payment
|
||||
if (GETPOST('accountid') <= 0)
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($datepaye))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
/*
|
||||
* Action add_paiement
|
||||
*/
|
||||
if ($action == 'add_paiement')
|
||||
{
|
||||
$db->rollback();
|
||||
if ($error)
|
||||
{
|
||||
$action = 'create';
|
||||
}
|
||||
// Le reste propre a cette action s'affiche en bas de page.
|
||||
}
|
||||
|
||||
/*
|
||||
* Action confirm_paiement
|
||||
*/
|
||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
if (GETPOST('type') == 2)
|
||||
{
|
||||
foreach ($amounts as $key => $value) // How payment is dispatch
|
||||
{
|
||||
$newvalue = price2num($value,'MT');
|
||||
$amounts[$key] = -$newvalue;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
|
||||
if (GETPOST('accountid') <= 0)
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Creation of payment line
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db,$_POST['paiementcode'],'c_paiement');
|
||||
$paiement->num_paiement = $_POST['num_paiement'];
|
||||
$paiement->note = $_POST['comment'];
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0));
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$label='(CustomerInvoicePayment)';
|
||||
if (GETPOST('type') == 2) $label='(CustomerInvoicePaymentBack)';
|
||||
$result=$paiement->addPaymentToBank($user,'payment',$label,GETPOST('accountid'),GETPOST('chqemetteur'),GETPOST('chqbank'));
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
|
||||
$invoiceid=0;
|
||||
foreach ($paiement->amounts as $key => $amount)
|
||||
{
|
||||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0)
|
||||
{
|
||||
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
|
||||
else $invoiceid=$facid;
|
||||
}
|
||||
}
|
||||
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/compta/facture.php?facid='.$invoiceid;
|
||||
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -53,6 +54,8 @@ $limit = $conf->liste_limit;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="p.rowid";
|
||||
|
||||
$search_ref = GETPOST("search_ref",'int');
|
||||
$search_account = GETPOST("search_account",'int');
|
||||
|
||||
|
||||
|
||||
@@ -109,11 +112,13 @@ else
|
||||
if ($userid == -1) $sql.= " AND f.fk_user_author IS NULL";
|
||||
else $sql.= " AND f.fk_user_author = ".$userid;
|
||||
}
|
||||
|
||||
|
||||
// Search criteria
|
||||
if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int');
|
||||
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
|
||||
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
|
||||
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
|
||||
if ($search_ref) $sql .=" AND p.rowid=".$search_ref;
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".$db->escape(GETPOST("search_paymenttype"))."'";
|
||||
if (GETPOST("search_amount")) $sql .=" AND p.amount='".$db->escape(price2num(GETPOST("search_amount")))."'";
|
||||
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company'));
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
@@ -129,7 +134,7 @@ if ($resql)
|
||||
|
||||
$paramlist='';
|
||||
$paramlist.=(GETPOST("orphelins")?"&orphelins=1":"");
|
||||
$paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:"");
|
||||
$paramlist.=($search_ref?"&search_ref=".$search_ref:"");
|
||||
$paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:"");
|
||||
$paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:"");
|
||||
|
||||
@@ -154,7 +159,7 @@ if ($resql)
|
||||
// Lines for filters fields
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">';
|
||||
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$_REQUEST["search_ref"].'">';
|
||||
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="left">';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
@@ -890,29 +890,30 @@ class BonPrelevement extends CommonObject
|
||||
*/
|
||||
if (!$error)
|
||||
{
|
||||
$ref = "T".substr($year,-2).$month;
|
||||
$ref = substr($year,-2).$month;
|
||||
|
||||
$sql = "SELECT count(*)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql.= " WHERE ref LIKE '".$ref."%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql = "SELECT substring(ref from char_length(ref) - 1)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||
$sql.= " WHERE ref LIKE '%".$ref."%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY ref DESC LIMIT 1";
|
||||
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
dol_syslog("Erreur recherche reference");
|
||||
}
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
dol_syslog("Erreur recherche reference");
|
||||
}
|
||||
|
||||
$ref = $ref . substr("00".($row[0]+1), -2);
|
||||
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1),2,"0",STR_PAD_LEFT);
|
||||
|
||||
$filebonprev = $ref;
|
||||
$filebonprev = $ref;
|
||||
|
||||
// Create withdraw receipt in database
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
|
||||
@@ -1326,11 +1327,26 @@ class BonPrelevement extends CommonObject
|
||||
$fileDebiteurSection = '';
|
||||
$fileEmetteurSection = '';
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
$this->total = 0;
|
||||
|
||||
/*
|
||||
* section Debiteur (sepa Debiteurs bloc lines)
|
||||
*/
|
||||
|
||||
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_pays as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
while ($j < $num)
|
||||
{
|
||||
$objfac = $this->db->fetch_object($resql);
|
||||
$ListOfFactures = $ListOfFactures . $objfac->fac . ",";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.code as country_code,";
|
||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||
@@ -1356,7 +1372,7 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
@@ -1393,13 +1409,14 @@ class BonPrelevement extends CommonObject
|
||||
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
|
||||
fputs($this->file, ' <InitgPty>'.$CrLf);
|
||||
fputs($this->file, ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf);
|
||||
/* fputs($this->file, ' <Id>'.$CrLf);
|
||||
fputs($this->file, ' <Othr>'.$CrLf);
|
||||
fputs($this->file, ' <Id>0533883248</Id>'.$CrLf);
|
||||
fputs($this->file, ' <Issr>KBO-BCE</Issr>'.$CrLf);
|
||||
fputs($this->file, ' <Id>'.$CrLf);
|
||||
fputs($this->file, ' <PrvtId>'.$CrLf);
|
||||
fputs($this->file, ' <Othr>'.$CrLf);
|
||||
fputs($this->file, ' <Id>'.$conf->global->PRELEVEMENT_ICS.'</Id>'.$CrLf);
|
||||
fputs($this->file, ' </Othr>'.$CrLf);
|
||||
fputs($this->file, ' </PrvtId>'.$CrLf);
|
||||
fputs($this->file, ' </Id>'.$CrLf);
|
||||
*/ fputs($this->file, ' </InitgPty>'.$CrLf);
|
||||
fputs($this->file, ' </InitgPty>'.$CrLf);
|
||||
fputs($this->file, ' </GrpHdr>'.$CrLf);
|
||||
// SEPA File Emetteur
|
||||
if ($result != -2)
|
||||
@@ -1582,6 +1599,7 @@ class BonPrelevement extends CommonObject
|
||||
$CrLf = "\n";
|
||||
$Rowing = sprintf("%06d", $row_idfac);
|
||||
$Date_Rum = strtotime($row_datec);
|
||||
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
||||
$pre = ($date_Rum > 1359673200) ? 'Rum' : '++R';
|
||||
$Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum);
|
||||
$XML_DEBITOR ='';
|
||||
@@ -1589,11 +1607,11 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf;
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy.="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
$XML_DEBITOR .=' <MndtRltdInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DtOfSgntr>'.$row_datec.'</DtOfSgntr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AmdmntInd>false</AmdmntInd>'.$CrLf;
|
||||
$XML_DEBITOR .=' </MndtRltdInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTx>'.$CrLf;
|
||||
@@ -1606,17 +1624,18 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Id>'.$CrLf;
|
||||
$XML_DEBITOR .=' <IBAN>'.$row_iban.'</IBAN>'.$CrLf;
|
||||
$XML_DEBITOR .=' <IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
|
||||
$XML_DEBITOR .=' </Id>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.$row_facnumber.'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@@ -551,7 +551,7 @@ $sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
|
||||
$sql.= " GROUP BY u.rowid";
|
||||
$sql.= " GROUP BY u.rowid, p.label, p.datep, p.fk_user";
|
||||
$sql.= " ORDER BY u.firstname";
|
||||
|
||||
dol_syslog("get payment salaries sql=".$sql);
|
||||
|
||||
@@ -248,7 +248,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,'',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ if ($id)
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
if ($salpayment->rappro == 0)
|
||||
{
|
||||
if (! empty($user->rights->tax->charges->supprimer))
|
||||
if (! empty($user->rights->salaries->delete))
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$salpayment->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ class Contact extends CommonObject
|
||||
$sql.= ", statut";
|
||||
$sql.= ", canvas";
|
||||
$sql.= ", entity";
|
||||
$sql.= ",ref_ext";
|
||||
$sql.= ", import_key";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->idate($now)."',";
|
||||
@@ -152,6 +153,7 @@ class Contact extends CommonObject
|
||||
$sql.= " ".$this->statut.",";
|
||||
$sql.= " ".(! empty($this->canvas)?"'".$this->canvas."'":"null").",";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= "'".$this->db->escape($this->ref_ext)."',";
|
||||
$sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
@@ -496,10 +498,12 @@ class Contact extends CommonObject
|
||||
*
|
||||
* @param int $id id du contact
|
||||
* @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact
|
||||
* @param string $ref_ext External reference, not given by Dolibarr
|
||||
* @return int -1 if KO, 0 if OK but not found, 1 if OK
|
||||
*/
|
||||
function fetch($id, $user=0)
|
||||
function fetch($id, $user=0, $ref_ext='')
|
||||
{
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
global $langs;
|
||||
|
||||
$langs->load("companies");
|
||||
@@ -521,7 +525,8 @@ class Contact extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
$sql.= " WHERE c.rowid = ". $id;
|
||||
if ($id) $sql.= " WHERE c.rowid = ". $id;
|
||||
elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@@ -36,7 +36,7 @@ $langs->load("companies");
|
||||
// Security check
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $id=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $id, '&societe');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$object = new Contact($db);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
|
||||
@@ -92,23 +92,31 @@ class Contrat extends CommonObject
|
||||
global $db, $langs, $conf;
|
||||
$langs->load("contracts");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/contract";
|
||||
|
||||
if (empty($conf->global->CONTRACT_ADDON))
|
||||
if (!empty($conf->global->CONTRACT_ADDON))
|
||||
{
|
||||
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
|
||||
}
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->CONTRACT_ADDON.".php";
|
||||
$file = $conf->global->CONTRACT_ADDON.".php";
|
||||
$classname = $conf->global->CONTRACT_ADDON;
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$classname = $conf->global->CONTRACT_ADDON;
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/contract/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$result=include_once $dir.'/'.$file;
|
||||
if ($result)
|
||||
{
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
@@ -118,15 +126,17 @@ class Contrat extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $obj->error;
|
||||
dol_print_error($db,get_class($this)."::getNextValue ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined");
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1137,7 +1137,7 @@ else
|
||||
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) {
|
||||
if ($action == 'edit_extras' && $user->rights->contrat->creer && GETPOST('attribute') == $key) {
|
||||
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formcontract">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="attribute" value="' . $key . '">';
|
||||
@@ -1150,7 +1150,7 @@ else
|
||||
print '</form>';
|
||||
} else {
|
||||
print $extrafields->showOutputField($key, $value);
|
||||
if ($object->statut == 0 && $user->rights->commande->creer)
|
||||
if ($object->statut == 0 && $user->rights->contrat->creer)
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
print '</td></tr>' . "\n";
|
||||
|
||||
@@ -184,7 +184,7 @@ class HookManager
|
||||
}*/
|
||||
}
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
}
|
||||
// Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||
|
||||
@@ -203,7 +203,7 @@ class Form
|
||||
else
|
||||
{
|
||||
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
|
||||
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs,0,0,-1,$conf->currency) : '');
|
||||
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs,0,-1,-1,$conf->currency) : '');
|
||||
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
|
||||
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
||||
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
|
||||
|
||||
@@ -610,8 +610,6 @@ class FormCompany
|
||||
}
|
||||
|
||||
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
|
||||
print '<td class="nobordernopadding">';
|
||||
if ($obj->rowid == 0)
|
||||
{
|
||||
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="" '.$htmloption.' />';
|
||||
@@ -621,9 +619,6 @@ class FormCompany
|
||||
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$obj->nom.'" '.$htmloption.' />';
|
||||
}
|
||||
print ajax_autocompleter(($socid?$socid:-1),$htmlname,DOL_URL_ROOT.'/societe/ajaxcompanies.php','',$minLength);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print "\n";
|
||||
return $socid;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -254,6 +255,7 @@ class FormMail
|
||||
if ($this->withform == 1)
|
||||
{
|
||||
$out.= '<form method="POST" name="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n";
|
||||
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
|
||||
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
}
|
||||
foreach ($this->param as $key=>$value)
|
||||
|
||||
@@ -152,7 +152,7 @@ class Menubase
|
||||
$sql.= " '".$this->fk_menu."',";
|
||||
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
||||
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
||||
$sql.= " '".$this->position."',";
|
||||
$sql.= " '".(int) $this->position."',";
|
||||
$sql.= " '".$this->db->escape($this->url)."',";
|
||||
$sql.= " '".$this->db->escape($this->target)."',";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
|
||||
@@ -130,7 +130,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td align="center" valign="middle" class="nowrap">';
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print 'jQuery(document).ready(function () {' . "\n";
|
||||
print 'jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
|
||||
print 'jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
print 'jQuery(".family_birthday").toggle();' . "\n";
|
||||
print '});' . "\n";
|
||||
@@ -140,20 +139,24 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
if (count($showextcals) > 0)
|
||||
{
|
||||
print '<tr><td><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>';
|
||||
print '<tr><td>';
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
jQuery("form.listactionsfilter input[name^=\"check_\"]").click(function() {
|
||||
var name = $(this).attr("name");
|
||||
|
||||
jQuery(".family_" + name.replace("check_", "")).toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '<input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda") . '</td></tr>';
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$htmlname = md5($val['name']);
|
||||
|
||||
print '<tr><td>';
|
||||
print '<script type="text/javascript">' . "\n";
|
||||
print 'jQuery(document).ready(function () {' . "\n";
|
||||
print ' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
print ' /* alert("'.$htmlname.'"); */';
|
||||
print ' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
print ' });' . "\n";
|
||||
print '});' . "\n";
|
||||
print '</script>' . "\n";
|
||||
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
|
||||
print '<input type="checkbox" id="check_' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val ['name'];
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,9 +937,10 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$sql.= " u.login, u.rowid";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
||||
if (get_class($object) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id ";
|
||||
$sql.= " WHERE u.rowid = a.fk_user_author";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
|
||||
if (get_class($object) == 'Adherent') {
|
||||
@@ -949,7 +950,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
}
|
||||
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
if (! empty($objcon->id)) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
// $sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
@@ -1076,16 +1077,17 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$sql.= " u.login, u.rowid as user_id";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
||||
if (get_class($object) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id ";
|
||||
$sql.= " WHERE u.rowid = a.fk_user_author";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
|
||||
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
|
||||
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
// $sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
$sql.= " ORDER BY a.datep DESC, a.id DESC";
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -146,7 +147,7 @@ function getBrowserInfo()
|
||||
elseif (preg_match('/epiphany/i',$_SERVER["HTTP_USER_AGENT"])) { $name='epiphany'; $version=$reg[2]; }
|
||||
elseif ((empty($phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari(\/|\s)([\d\.]*)/i',$_SERVER["HTTP_USER_AGENT"], $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not.
|
||||
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='opera'; $version=$reg[2]; }
|
||||
elseif (preg_match('/msie(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='ie'; $version=$reg[2]; } // MS products at end
|
||||
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='ie'; $version= end($reg); } // MS products at end
|
||||
// Other
|
||||
$firefox=0;
|
||||
if (in_array($name,array('firefox','iceweasel'))) $firefox=1;
|
||||
@@ -1054,11 +1055,11 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
$default_timezone=@date_default_timezone_get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($localtz)) {
|
||||
$localtz = new DateTimeZone('UTC');
|
||||
}
|
||||
|
||||
|
||||
$dt = new DateTime(null,$localtz);
|
||||
$dt->setDate($year,$month,$day);
|
||||
$dt->setTime((int) $hour, (int) $minute, (int) $second);
|
||||
@@ -2540,7 +2541,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
|
||||
$return='';
|
||||
|
||||
if ($picto == 'setup') $picto='title.png';
|
||||
if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif';
|
||||
if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif';
|
||||
|
||||
$return.= "\n";
|
||||
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
|
||||
@@ -2578,7 +2579,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
global $conf,$langs;
|
||||
|
||||
if ($picto == 'setup') $picto='title.png';
|
||||
if (!empty($conf->browser->ie) && $picto=='title.png') $picto='title.gif';
|
||||
if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif';
|
||||
|
||||
if (($num > $conf->liste_limit) || ($num == -1))
|
||||
{
|
||||
@@ -2952,7 +2953,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
|
||||
$sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'";
|
||||
$sql .= " AND t.taux = ".$tva." AND t.active = 1";
|
||||
$sql .= " AND t.taux = ".((float) $tva)." AND t.active = 1";
|
||||
|
||||
dol_syslog("get_localtax sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
@@ -2988,7 +2989,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
|
||||
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
|
||||
$sql .= " AND t.taux = ".((float) $vatrate)." AND t.active = 1";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@@ -4305,6 +4306,8 @@ function picto_from_langcode($codelang)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (empty($codelang)) return '';
|
||||
|
||||
if ($codelang == 'auto')
|
||||
{
|
||||
return img_picto_common($langs->trans('AutoDetectLang'), 'flags/int.png');
|
||||
|
||||
@@ -52,7 +52,6 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
||||
exit;*/
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false));
|
||||
|
||||
@@ -416,7 +416,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0)
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<tr class="liste_total nodrag nodrop">';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
if ($showproject) print '<td></td><td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -86,26 +87,18 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
global $conf;
|
||||
|
||||
$list=array();
|
||||
//print "xx".$conf->global->MAIN_MODULE_ACCOUNTING;
|
||||
//print "xx".$conf->global->MAIN_MODULE_COMPTABILITE;
|
||||
|
||||
if ($direction == 'sell')
|
||||
{
|
||||
$invoicetable='facture';
|
||||
$invoicedettable='facturedet';
|
||||
$fk_facture='fk_facture';
|
||||
$total_tva='total_tva';
|
||||
$total_localtax1='total_localtax1';
|
||||
$total_localtax2='total_localtax2';
|
||||
$total_ht='total';
|
||||
$total_tva='tva';
|
||||
}
|
||||
if ($direction == 'buy')
|
||||
{
|
||||
$invoicetable='facture_fourn';
|
||||
$invoicedettable='facture_fourn_det';
|
||||
$fk_facture='fk_facture_fourn';
|
||||
$total_tva='tva';
|
||||
$total_localtax1='total_localtax1';
|
||||
$total_localtax2='total_localtax2';
|
||||
$total_ht='total_ht';
|
||||
$total_tva='total_tva';
|
||||
}
|
||||
|
||||
// Define sql request
|
||||
@@ -125,11 +118,10 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE))
|
||||
{
|
||||
$sql = "SELECT s.rowid as socid, s.nom as nom, s.siren as tva_intra, s.tva_assuj as assuj,";
|
||||
$sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva,";
|
||||
$sql.= " sum(fd.".$total_localtax1.") as localtax1,";
|
||||
$sql.= " sum(fd.".$total_localtax2.") as localtax2";
|
||||
$sql.= " sum(f.$total_ht) as amount, sum(f.".$total_tva.") as tva,";
|
||||
$sql.= " sum(f.localtax1) as localtax1,";
|
||||
$sql.= " sum(f.localtax2) as localtax2";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as fd,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE f.entity = " . $conf->entity;
|
||||
$sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
|
||||
@@ -146,7 +138,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
$sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||
}
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND s.rowid = f.fk_soc AND f.rowid = fd.".$fk_facture;
|
||||
$sql.= " AND s.rowid = f.fk_soc";
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.tva_intra, s.tva_assuj";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
|
||||
|
||||
-- Product - Categories
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -134,8 +134,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
}
|
||||
|
||||
// Financial
|
||||
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled)),
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read)),
|
||||
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->fournisseur->enabled)),
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire)),
|
||||
'module'=>'comptabilite|accounting|facture|don|tax|salaries');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
@@ -1000,8 +1000,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
|
||||
if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire);
|
||||
if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire);
|
||||
if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer);
|
||||
}
|
||||
|
||||
// Expeditions
|
||||
|
||||
@@ -748,6 +748,8 @@ abstract class DolibarrModules
|
||||
|
||||
$err=0;
|
||||
|
||||
if (empty($this->const)) return 0;
|
||||
|
||||
foreach ($this->const as $key => $value)
|
||||
{
|
||||
$name = $this->const[$key][0];
|
||||
@@ -816,6 +818,8 @@ abstract class DolibarrModules
|
||||
|
||||
$err=0;
|
||||
|
||||
if (empty($this->const)) return 0;
|
||||
|
||||
foreach ($this->const as $key => $value)
|
||||
{
|
||||
$name = $this->const[$key][0];
|
||||
|
||||
@@ -534,13 +534,18 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
// Date Expedition
|
||||
$Yoff = $Yoff+7;
|
||||
$pdf->SetXY($blSocX-80,$blSocY+20);
|
||||
$pdf->SetXY($blSocX-80,$blSocY+17);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L');
|
||||
|
||||
$pdf->SetXY($blSocX-80,$blSocY+20);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, '', 'L');
|
||||
|
||||
// Deliverer
|
||||
$pdf->SetXY($blSocX-80,$blSocY+23);
|
||||
$pdf->SetXY($blSocX-80,$blSocY+24);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
@@ -554,13 +559,8 @@ class pdf_merou extends ModelePdfExpedition
|
||||
// Get code using getLabelFromKey
|
||||
$code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
|
||||
$label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
|
||||
$pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L');
|
||||
}
|
||||
else
|
||||
{
|
||||
$label=$outputlangs->transnoentities("Deliverer");
|
||||
}
|
||||
|
||||
$pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -180,11 +180,17 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id)))
|
||||
if (! empty($object->note_public) || ! empty($object->tracking_number))
|
||||
{
|
||||
$tab_top = 88;
|
||||
$tab_top_alt = $tab_top;
|
||||
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L');
|
||||
|
||||
$tab_top_alt = $pdf->GetY();
|
||||
//$tab_top_alt += 1;
|
||||
|
||||
// Tracking number
|
||||
if (! empty($object->tracking_number))
|
||||
{
|
||||
@@ -198,14 +204,14 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$label=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
|
||||
$label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
|
||||
$pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top+6, $label." ".$object->tracking_url, 0, 1, false, true, 'L');
|
||||
|
||||
$tab_top_alt += 7;
|
||||
$tab_top_alt = $pdf->GetY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Affiche notes
|
||||
// Notes
|
||||
if (! empty($object->note_public))
|
||||
{
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
|
||||
|
||||
@@ -141,15 +141,18 @@ abstract class ModelNumRefExpedition
|
||||
}
|
||||
|
||||
/**
|
||||
* Cree un bon d'expedition sur disque
|
||||
* Cree un bon d'expedition sur disque
|
||||
*
|
||||
* @param DoliDB $db Objet base de donnee
|
||||
* @param Object $object Object expedition
|
||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
* @param DoliDB $db Objet base de donnee
|
||||
* @param Object $object Object expedition
|
||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||
* @param int $hidedetails Hide details of lines
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $hideref Hide ref
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||
function expedition_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -214,7 +217,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath) > 0)
|
||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
|
||||
|
||||
@@ -607,7 +607,7 @@ class ImportCsv extends ModeleImports
|
||||
//var_dump($objimport->array_import_convertvalue); exit;
|
||||
|
||||
// Build SQL request
|
||||
if (empty($tablewithentity[$tablename]))
|
||||
if (empty($tablewithentity_cache[$tablename]))
|
||||
{
|
||||
$sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key';
|
||||
if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias];
|
||||
|
||||
@@ -182,7 +182,7 @@ class modProjet extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("projet","export"));
|
||||
$this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid');
|
||||
$this->export_dependencies_array[$r]=array('task_time'=>'pt.rowid');
|
||||
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle',
|
||||
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
@@ -280,11 +280,9 @@ class modProjet extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task,";
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity;
|
||||
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
||||
function __construct()
|
||||
{
|
||||
global $conf;
|
||||
if (empty($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER)) $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
|
||||
if (empty($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER)) $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
|
||||
if (! isset($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) || trim($conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER) == '') $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER='411';
|
||||
if (! isset($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) || trim($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) == '') $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER='401';
|
||||
$this->prefixcustomeraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
|
||||
$this->prefixsupplieraccountancycode=$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,8 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->datef);
|
||||
//Supplier invoices take invoice date instead of creation date for the mask
|
||||
$numFinal=get_next_value($db,$mask,'facture_fourn','ref','',$objsoc->code_fournisseur,$object->date);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
|
||||
<?php if ($main_home)
|
||||
{
|
||||
?>
|
||||
<div class="center" class="login_main_home" style="max-width: 80%">
|
||||
<div class="login_main_home" style="max-width: 80%">
|
||||
<?php echo $main_home; ?>
|
||||
</div><br>
|
||||
<?php
|
||||
|
||||
@@ -201,9 +201,9 @@ else {
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td align="right"><input type="text" size="2" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>">
|
||||
<td align="right"><input type="text" size="2" id="qty" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>">
|
||||
</td>
|
||||
<td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_percent); ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
|
||||
<td align="right" class="nowrap"><input type="text" size="1" id="remise_percent" name="remise_percent" class="flat" value="<?php echo (isset($_POST["remise_percent"])?$_POST["remise_percent"]:$buyer->remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
|
||||
|
||||
<?php
|
||||
if (! empty($usemargins))
|
||||
|
||||
@@ -333,7 +333,7 @@ if (! empty($conf->margin->enabled))
|
||||
var rounding = main_rounding_unit;
|
||||
var pos = amount.indexOf(dec);
|
||||
var decpart = '';
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
|
||||
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Remove 0 for decimal part
|
||||
var nbdec = decpart.length;
|
||||
if (nbdec > rounding) rounding = nbdec;
|
||||
// If rounding higher than max shown
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<td><?php $coldisplay++; ?><div id="<?php echo $line->rowid; ?>"></div>
|
||||
<td><?php $coldisplay++; ?><div id="line_<?php echo $line->rowid; ?>"></div>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||
<?php
|
||||
@@ -142,7 +142,7 @@
|
||||
<td align="center"><?php $coldisplay++; ?>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -354,7 +354,7 @@ if (($action=="create") || ($action=="edit"))
|
||||
print $langs->trans('CronEvery')."</td>";
|
||||
print "<td><select name=\"nbfrequency\">";
|
||||
for($i=1; $i<=60; $i++){
|
||||
if(($object->frequency/$object->unitfrequency) == $i){
|
||||
if(!is_null($object->unitfrequency) && ($object->frequency/$object->unitfrequency) == $i){
|
||||
print "<option value='".$i."' selected='selected'>".$i."</option>";
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -119,21 +119,30 @@ class Expedition extends CommonObject
|
||||
global $db, $langs, $conf;
|
||||
$langs->load("sendings");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/expedition";
|
||||
|
||||
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||
if (!empty($conf->global->EXPEDITION_ADDON_NUMBER))
|
||||
{
|
||||
$conf->global->EXPEDITION_ADDON_NUMBER='mod_expedition_safor';
|
||||
}
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
||||
$file = $conf->global->EXPEDITION_ADDON_NUMBER.".php";
|
||||
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
$classname = $conf->global->EXPEDITION_ADDON_NUMBER;
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/expedition/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$result=include_once $dir.'/'.$file;
|
||||
if ($result)
|
||||
{
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
@@ -147,12 +156,12 @@ class Expedition extends CommonObject
|
||||
dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,8 +176,6 @@ class Expedition extends CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
if (empty($this->model_pdf)) $this->model_pdf=$conf->global->EXPEDITION_ADDON_PDF;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php';
|
||||
$error = 0;
|
||||
|
||||
@@ -1485,7 +1492,7 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tracking url status
|
||||
* Forge an set tracking url
|
||||
*
|
||||
* @param string $value Value
|
||||
* @return void
|
||||
@@ -1533,6 +1540,8 @@ class Expedition extends CommonObject
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
//TODO: Option to set order billed if 100% of order is shipped
|
||||
$this->billed=1;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -89,473 +89,474 @@ $hookmanager->initHooks(array('expeditioncard'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$error=0;
|
||||
if (empty($reshook)) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$object->note = GETPOST('note','alpha');
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $origin_id;
|
||||
$object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int');
|
||||
$object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int');
|
||||
$object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int');
|
||||
$object->sizeS = GETPOST('sizeS','int')==''?"NULL":GETPOST('sizeS','int');
|
||||
$object->size_units = GETPOST('size_units','int');
|
||||
$object->weight_units = GETPOST('weight_units','int');
|
||||
|
||||
$date_delivery = dol_mktime(GETPOST('date_deliveryhour','int'), GETPOST('date_deliverymin','int'), 0, GETPOST('date_deliverymonth','int'), GETPOST('date_deliveryday','int'), GETPOST('date_deliveryyear','int'));
|
||||
|
||||
// On va boucler sur chaque ligne du document d'origine pour completer objet expedition
|
||||
// avec info diverses + qte a livrer
|
||||
$classname = ucfirst($object->origin);
|
||||
$objectsrc = new $classname($db);
|
||||
$objectsrc->fetch($object->origin_id);
|
||||
|
||||
$object->socid = $objectsrc->socid;
|
||||
$object->ref_customer = $objectsrc->ref_client;
|
||||
$object->date_delivery = $date_delivery; // Date delivery planed
|
||||
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
$object->tracking_number = GETPOST('tracking_number','alpha');
|
||||
$object->ref_int = GETPOST('ref_int','alpha');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
|
||||
$num=count($objectsrc->lines);
|
||||
$totalqty=0;
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
if ($action == 'add')
|
||||
{
|
||||
$qty = "qtyl".$i;
|
||||
$j=0;
|
||||
$sub_qty=array();
|
||||
$subtotalqty=0;
|
||||
$idl="idl".$i;
|
||||
$batch="batchl".$i."_0";
|
||||
if (isset($_POST[$batch])) {
|
||||
//shipment line with batch-enable product
|
||||
$qty .= '_'.$j;
|
||||
while (isset($_POST[$batch])) {
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int');
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int');
|
||||
$subtotalqty+=$sub_qty[$j]['q'];
|
||||
$j++;
|
||||
$batch="batchl".$i."_".$j;
|
||||
$qty = "qtyl".$i.'_'.$j;
|
||||
$error=0;
|
||||
|
||||
}
|
||||
$batch_line[$i]['detail']=$sub_qty;
|
||||
$batch_line[$i]['qty']=$subtotalqty;
|
||||
$batch_line[$i]['ix_l']=GETPOST($idl,'int');
|
||||
$totalqty+=$subtotalqty;
|
||||
} else {
|
||||
//Standard product
|
||||
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
|
||||
}
|
||||
}
|
||||
$db->begin();
|
||||
|
||||
if ($totalqty > 0)
|
||||
{
|
||||
//var_dump($_POST);exit;
|
||||
$object->note = GETPOST('note','alpha');
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $origin_id;
|
||||
$object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int');
|
||||
$object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int');
|
||||
$object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int');
|
||||
$object->sizeS = GETPOST('sizeS','int')==''?"NULL":GETPOST('sizeS','int');
|
||||
$object->size_units = GETPOST('size_units','int');
|
||||
$object->weight_units = GETPOST('weight_units','int');
|
||||
|
||||
$date_delivery = dol_mktime(GETPOST('date_deliveryhour','int'), GETPOST('date_deliverymin','int'), 0, GETPOST('date_deliverymonth','int'), GETPOST('date_deliveryday','int'), GETPOST('date_deliveryyear','int'));
|
||||
|
||||
// On va boucler sur chaque ligne du document d'origine pour completer objet expedition
|
||||
// avec info diverses + qte a livrer
|
||||
$classname = ucfirst($object->origin);
|
||||
$objectsrc = new $classname($db);
|
||||
$objectsrc->fetch($object->origin_id);
|
||||
|
||||
$object->socid = $objectsrc->socid;
|
||||
$object->ref_customer = $objectsrc->ref_client;
|
||||
$object->date_delivery = $date_delivery; // Date delivery planed
|
||||
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
$object->tracking_number = GETPOST('tracking_number','alpha');
|
||||
$object->ref_int = GETPOST('ref_int','alpha');
|
||||
$object->note_private = GETPOST('note_private');
|
||||
$object->note_public = GETPOST('note_public');
|
||||
|
||||
$num=count($objectsrc->lines);
|
||||
$totalqty=0;
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$qty = "qtyl".$i;
|
||||
if (! isset($batch_line[$i])) {
|
||||
if (GETPOST($qty,'int') > 0)
|
||||
{
|
||||
$ent = "entl".$i;
|
||||
$idl = "idl".$i;
|
||||
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||
if ($entrepot_id < 0) $entrepot_id='';
|
||||
$j=0;
|
||||
$sub_qty=array();
|
||||
$subtotalqty=0;
|
||||
$idl="idl".$i;
|
||||
$batch="batchl".$i."_0";
|
||||
if (isset($_POST[$batch])) {
|
||||
//shipment line with batch-enable product
|
||||
$qty .= '_'.$j;
|
||||
while (isset($_POST[$batch])) {
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int');
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int');
|
||||
$subtotalqty+=$sub_qty[$j]['q'];
|
||||
$j++;
|
||||
$batch="batchl".$i."_".$j;
|
||||
$qty = "qtyl".$i.'_'.$j;
|
||||
|
||||
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
|
||||
if ($ret < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($batch_line[$i]['qty']>0) {
|
||||
$ret=$object->addline_batch($batch_line[$i]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$batch_line[$i]['detail']=$sub_qty;
|
||||
$batch_line[$i]['qty']=$subtotalqty;
|
||||
$batch_line[$i]['ix_l']=GETPOST($idl,'int');
|
||||
$totalqty+=$subtotalqty;
|
||||
} else {
|
||||
//Standard product
|
||||
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
|
||||
}
|
||||
}
|
||||
|
||||
if ($totalqty > 0)
|
||||
{
|
||||
//var_dump($_POST);exit;
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$qty = "qtyl".$i;
|
||||
if (! isset($batch_line[$i])) {
|
||||
if (GETPOST($qty,'int') > 0)
|
||||
{
|
||||
$ent = "entl".$i;
|
||||
$idl = "idl".$i;
|
||||
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||
if ($entrepot_id < 0) $entrepot_id='';
|
||||
|
||||
$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
|
||||
if ($ret < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($batch_line[$i]['qty']>0) {
|
||||
$ret=$object->addline_batch($batch_line[$i]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ret=$object->create($user);
|
||||
if ($ret <= 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ret=$object->create($user);
|
||||
if ($ret <= 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'</div>';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: fiche.php?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$_GET["commande_id"]=GETPOST('commande_id','int');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a receiving receipt
|
||||
*/
|
||||
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
||||
{
|
||||
$result = $object->create_delivery($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/livraison/fiche.php?id='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->valid($user);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
||||
{
|
||||
$result = $object->delete();
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($object->error),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
||||
{
|
||||
$result = $object->setStatut(0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg = $object->error;
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
|
||||
{
|
||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
|
||||
|
||||
$object->fetch($id);
|
||||
$result=$object->set_date_livraison($user,$datedelivery);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
||||
|| $action == 'settrueWeight'
|
||||
|| $action == 'settrueWidth'
|
||||
|| $action == 'settrueHeight'
|
||||
|| $action == 'settrueDepth'
|
||||
|| $action == 'setshipping_method_id')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
||||
if ($action == 'settrackingurl') $object->tracking_url = trim(GETPOST('trackingurl','int'));
|
||||
if ($action == 'settrueWeight') {
|
||||
$object->trueWeight = trim(GETPOST('trueWeight','int'));
|
||||
$object->weight_units = GETPOST('weight_units','int');
|
||||
}
|
||||
if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth','int'));
|
||||
if ($action == 'settrueHeight'){
|
||||
$object->trueHeight = trim(GETPOST('trueHeight','int'));
|
||||
$object->size_units = GETPOST('size_units','int');
|
||||
}
|
||||
if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth','int'));
|
||||
if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($object->update($user) >= 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: fiche.php?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
setEventMessage($object->error,'errors');
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$_GET["commande_id"]=GETPOST('commande_id','int');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
$action="";
|
||||
}
|
||||
|
||||
// Build document
|
||||
else if ($action == 'builddoc') // En get ou en post
|
||||
{
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
/*
|
||||
* Build a receiving receipt
|
||||
*/
|
||||
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$result = $object->create_delivery($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/livraison/fiche.php?id='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
}
|
||||
}
|
||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
||||
if ($result <= 0)
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->valid($user);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file in doc form
|
||||
elseif ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$upload_dir = $conf->expedition->dir_output . "/sending";
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (GETPOST('addfile','alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
|
||||
dol_add_file_process($upload_dir_tmp,0,0);
|
||||
$action ='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
if (GETPOST('removedfile','alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process(GETPOST('removedfile','int'),0);
|
||||
$action ='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile','alpha') && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
// $ref = dol_sanitizeFileName($object->ref);
|
||||
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
// if (is_readable($file))
|
||||
// {
|
||||
if (GETPOST('sendto','alpha'))
|
||||
{
|
||||
// Le destinataire a ete fourni via le champ libre
|
||||
$sendto = GETPOST('sendto','alpha');
|
||||
$sendtoid = 0;
|
||||
}
|
||||
elseif (GETPOST('receiver','alpha') != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $object->client->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $object->client->contact_get_property(GETPOST('receiver','alpha'),'email');
|
||||
$sendtoid = GETPOST('receiver','alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
$from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>';
|
||||
$replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>';
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sendtocc','alpha');
|
||||
$deliveryreceipt = GETPOST('deliveryreceipt','alpha');
|
||||
|
||||
if ($action == 'send')
|
||||
{
|
||||
if (dol_strlen(GETPOST('subject','alpha'))) $subject=GETPOST('subject','alpha');
|
||||
else $subject = $langs->transnoentities('Shipping').' '.$object->ref;
|
||||
$actiontypecode='AC_SHIP';
|
||||
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
|
||||
if ($message)
|
||||
{
|
||||
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
|
||||
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
|
||||
$actionmsg.=$message;
|
||||
}
|
||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||
}
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Send mail
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = $sendtoid;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg;
|
||||
$object->actionmsg2 = $actionmsg2;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('SHIPPING_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $object->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect here
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
setEventMessage($mesg);
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesg='<div class="error">';
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$mesg.='<br>'.$mailfile->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||
}
|
||||
$mesg.='</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||
$action='presend';
|
||||
dol_syslog('Recipient email is empty');
|
||||
}
|
||||
/* }
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
||||
{
|
||||
$result = $object->delete();
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||
dol_syslog('Failed to read file: '.$file);
|
||||
}*/
|
||||
}
|
||||
setEventMessage($langs->trans($object->error),'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'classifybilled')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->set_billed();
|
||||
}
|
||||
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
||||
{
|
||||
$result = $object->setStatut(0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg = $object->error;
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
|
||||
{
|
||||
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
|
||||
|
||||
$object->fetch($id);
|
||||
$result=$object->set_date_livraison($user,$datedelivery);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
||||
|| $action == 'settrueWeight'
|
||||
|| $action == 'settrueWidth'
|
||||
|| $action == 'settrueHeight'
|
||||
|| $action == 'settrueDepth'
|
||||
|| $action == 'setshipping_method_id')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
||||
if ($action == 'settrackingurl') $object->tracking_url = trim(GETPOST('trackingurl','int'));
|
||||
if ($action == 'settrueWeight') {
|
||||
$object->trueWeight = trim(GETPOST('trueWeight','int'));
|
||||
$object->weight_units = GETPOST('weight_units','int');
|
||||
}
|
||||
if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth','int'));
|
||||
if ($action == 'settrueHeight'){
|
||||
$object->trueHeight = trim(GETPOST('trueHeight','int'));
|
||||
$object->size_units = GETPOST('size_units','int');
|
||||
}
|
||||
if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth','int'));
|
||||
if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($object->update($user) >= 0)
|
||||
{
|
||||
header("Location: fiche.php?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
$action="";
|
||||
}
|
||||
|
||||
// Build document
|
||||
else if ($action == 'builddoc') // En get ou en post
|
||||
{
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file in doc form
|
||||
elseif ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$upload_dir = $conf->expedition->dir_output . "/sending";
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
}
|
||||
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (GETPOST('addfile','alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory TODO Use a dedicated directory for temp mails files
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
|
||||
dol_add_file_process($upload_dir_tmp,0,0);
|
||||
$action ='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove file in email form
|
||||
*/
|
||||
if (GETPOST('removedfile','alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp';
|
||||
|
||||
// TODO Delete only files that was uploaded from email form
|
||||
dol_remove_file_process(GETPOST('removedfile','int'),0);
|
||||
$action ='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile','alpha') && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
// $ref = dol_sanitizeFileName($object->ref);
|
||||
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
// if (is_readable($file))
|
||||
// {
|
||||
if (GETPOST('sendto','alpha'))
|
||||
{
|
||||
// Le destinataire a ete fourni via le champ libre
|
||||
$sendto = GETPOST('sendto','alpha');
|
||||
$sendtoid = 0;
|
||||
}
|
||||
elseif (GETPOST('receiver','alpha') != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $object->client->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $object->client->contact_get_property(GETPOST('receiver','alpha'),'email');
|
||||
$sendtoid = GETPOST('receiver','alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
$from = GETPOST('fromname','alpha') . ' <' . GETPOST('frommail','alpha') .'>';
|
||||
$replyto = GETPOST('replytoname','alpha'). ' <' . GETPOST('replytomail','alpha').'>';
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sendtocc','alpha');
|
||||
$deliveryreceipt = GETPOST('deliveryreceipt','alpha');
|
||||
|
||||
if ($action == 'send')
|
||||
{
|
||||
if (dol_strlen(GETPOST('subject','alpha'))) $subject=GETPOST('subject','alpha');
|
||||
else $subject = $langs->transnoentities('Shipping').' '.$object->ref;
|
||||
$actiontypecode='AC_SHIP';
|
||||
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
|
||||
if ($message)
|
||||
{
|
||||
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
|
||||
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
|
||||
$actionmsg.=$message;
|
||||
}
|
||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||
}
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$attachedfiles=$formmail->get_attached_files();
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Send mail
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = $sendtoid;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg;
|
||||
$object->actionmsg2 = $actionmsg2;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('SHIPPING_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $object->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect here
|
||||
// This avoid sending mail twice if going out and then back to page
|
||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
|
||||
setEventMessage($mesg);
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesg='<div class="error">';
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$mesg.='<br>'.$mailfile->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
|
||||
}
|
||||
$mesg.='</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||
$action='presend';
|
||||
dol_syslog('Recipient email is empty');
|
||||
}
|
||||
/* }
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||
dol_syslog('Failed to read file: '.$file);
|
||||
}*/
|
||||
}
|
||||
|
||||
else if ($action == 'classifybilled')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->set_billed();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -705,6 +706,14 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Document model
|
||||
print "<tr><td>".$langs->trans("Model")."</td>";
|
||||
print '<td colspan="3">';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
|
||||
$liste = ModelePdfExpedition::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
|
||||
@@ -328,7 +328,7 @@ class Export
|
||||
function conditionDate($Field, $Value, $Sens)
|
||||
{
|
||||
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
|
||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." ".$Value;
|
||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
|
||||
elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
|
||||
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
||||
return $Condition;
|
||||
|
||||
@@ -599,25 +599,33 @@ class Fichinter extends CommonObject
|
||||
global $conf, $db, $langs;
|
||||
$langs->load("interventions");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/fichinter/";
|
||||
|
||||
if (! empty($conf->global->FICHEINTER_ADDON))
|
||||
{
|
||||
$file = $conf->global->FICHEINTER_ADDON.".php";
|
||||
$classname = $conf->global->FICHEINTER_ADDON;
|
||||
if (! file_exists($dir.$file))
|
||||
{
|
||||
$file='mod_'.$file;
|
||||
$classname='mod_'.$classname;
|
||||
$mybool = false;
|
||||
|
||||
$file = "mod_".$conf->global->FICHEINTER_ADDON.".php";
|
||||
$classname = "mod_".$conf->global->FICHEINTER_ADDON;
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/fichinter/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
// Chargement de la classe de numerotation
|
||||
require_once $dir.$file;
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = "";
|
||||
$numref = $obj->getNumRef($soc,$this);
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
if ( $numref != "")
|
||||
{
|
||||
@@ -631,6 +639,7 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* \brief File that include conf.php file and commons lib like functions.lib.php
|
||||
*/
|
||||
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.2');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.4');
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
// Define syslog constants
|
||||
|
||||
@@ -551,44 +551,50 @@ class CommandeFournisseur extends CommonOrder
|
||||
global $db, $langs, $conf;
|
||||
$langs->load("orders");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT .'/core/modules/supplier_order/';
|
||||
|
||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER))
|
||||
{
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER.'.php';
|
||||
$classname=$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER;
|
||||
|
||||
if (is_readable($dir.'/'.$file))
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
// Definition du nom de modele de numerotation de commande fournisseur
|
||||
$modName=$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER;
|
||||
require_once $dir.'/'.$file;
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
// Recuperation de la nouvelle reference
|
||||
$objMod = new $modName($this->db);
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($soc,$this);
|
||||
|
||||
$numref = "";
|
||||
$numref = $objMod->commande_get_num($soc,$this);
|
||||
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return -1;
|
||||
}
|
||||
if ( $numref != "")
|
||||
{
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER);
|
||||
return -2;
|
||||
$this->error = $obj->error;
|
||||
dol_print_error($db, get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_NotDefined");
|
||||
return -3;
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1497,10 +1497,14 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
$file = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER.".php";
|
||||
$classname = $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER;
|
||||
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/supplier_invoice/";
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool|=@include_once $dir.$file;
|
||||
}
|
||||
|
||||
@@ -522,8 +522,16 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou
|
||||
$result = $object->approve($user, $idwarehouse);
|
||||
if ($result > 0)
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
if (GETPOST('lang_id'))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$ret=$object->fetch($object->id); // Reload to get new records
|
||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||
exit;
|
||||
@@ -554,8 +562,16 @@ else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fo
|
||||
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
|
||||
if ($result > 0)
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
if (GETPOST('lang_id'))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$ret=$object->fetch($object->id); // Reload to get new records
|
||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||
exit;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -521,6 +522,10 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer)
|
||||
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
||||
$remise_percent=GETPOST('remise_percent');
|
||||
|
||||
if (empty($remise_percent)) {
|
||||
$remise_percent = 0;
|
||||
}
|
||||
|
||||
$result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
|
||||
if ($result >= 0)
|
||||
{
|
||||
@@ -1500,12 +1505,7 @@ else
|
||||
if ($objectref == 'PROV')
|
||||
{
|
||||
$savdate=$object->date;
|
||||
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION))
|
||||
{
|
||||
$object->date=dol_now();
|
||||
//TODO: Possibly will have to control payment information into suppliers
|
||||
//$object->date_lim_reglement=$object->calculate_date_lim_reglement();
|
||||
}
|
||||
|
||||
$numref = $object->getNextNumRef($societe);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -27,9 +28,9 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('bills');
|
||||
@@ -68,164 +69,166 @@ $hookmanager->initHooks(array('paymentsupplier'));
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
{
|
||||
$error = 0;
|
||||
if (empty($reshook)) {
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$paiement_id = 0;
|
||||
$totalpayment = 0;
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
|
||||
$tmpinvoice=new FactureFournisseur($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
{
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
$error = 0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$paiement_id = 0;
|
||||
$totalpayment = 0;
|
||||
$atleastonepaymentnotnull = 0;
|
||||
|
||||
// Generate payment array and check if there is payment higher than invoice and payment date before invoice date
|
||||
$tmpinvoice=new FactureFournisseur($db);
|
||||
foreach ($_POST as $key => $value)
|
||||
{
|
||||
$cursorfacid = substr($key,7);
|
||||
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
|
||||
$totalpayment = $totalpayment + $amounts[$cursorfacid];
|
||||
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||
$result=$tmpinvoice->fetch($cursorfacid);
|
||||
if ($result <= 0) dol_print_error($db);
|
||||
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
|
||||
if ($amounts[$cursorfacid])
|
||||
if (substr($key,0,7) == 'amount_')
|
||||
{
|
||||
// Check amount
|
||||
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
|
||||
{
|
||||
$addwarning=1;
|
||||
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
|
||||
}
|
||||
// Check date
|
||||
if ($datepaye && ($datepaye < $tmpinvoice->date))
|
||||
{
|
||||
$langs->load("errors");
|
||||
//$error++;
|
||||
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
|
||||
}
|
||||
$cursorfacid = substr($key,7);
|
||||
$amounts[$cursorfacid] = price2num(trim(GETPOST($key)));
|
||||
$totalpayment = $totalpayment + $amounts[$cursorfacid];
|
||||
if (! empty($amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||
$result=$tmpinvoice->fetch($cursorfacid);
|
||||
if ($result <= 0) dol_print_error($db);
|
||||
$amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
|
||||
if ($amounts[$cursorfacid])
|
||||
{
|
||||
// Check amount
|
||||
if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid])))
|
||||
{
|
||||
$addwarning=1;
|
||||
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPaySupplier")).' '.$langs->trans("HelpPaymentHigherThanReminderToPaySupplier");
|
||||
}
|
||||
// Check date
|
||||
if ($datepaye && ($datepaye < $tmpinvoice->date))
|
||||
{
|
||||
$langs->load("errors");
|
||||
//$error++;
|
||||
setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
|
||||
}
|
||||
|
||||
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if ($_POST['paiementid'] <= 0)
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// If bank module is on, account is required to enter a payment
|
||||
if (GETPOST('accountid') <= 0)
|
||||
// Check parameters
|
||||
if ($_POST['paiementid'] <= 0)
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
// If bank module is on, account is required to enter a payment
|
||||
if (GETPOST('accountid') <= 0)
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($datepaye))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($totalpayment) && empty($atleastonepaymentnotnull))
|
||||
/*
|
||||
* Action add_paiement
|
||||
*/
|
||||
if ($action == 'add_paiement')
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($datepaye))
|
||||
{
|
||||
setEventMessage($langs->transnoentities('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Action add_paiement
|
||||
*/
|
||||
if ($action == 'add_paiement')
|
||||
{
|
||||
if ($error)
|
||||
{
|
||||
$action = 'create';
|
||||
}
|
||||
// Le reste propre a cette action s'affiche en bas de page.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action confirm_paiement
|
||||
*/
|
||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
// Creation de la ligne paiement
|
||||
$paiement = new PaiementFourn($db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array of amounts
|
||||
$paiement->paiementid = $_POST['paiementid'];
|
||||
$paiement->num_paiement = $_POST['num_paiement'];
|
||||
$paiement->note = $_POST['comment'];
|
||||
if (! $error)
|
||||
if ($error)
|
||||
{
|
||||
$paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
$action = 'create';
|
||||
}
|
||||
// Le reste propre a cette action s'affiche en bas de page.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action confirm_paiement
|
||||
*/
|
||||
if ($action == 'confirm_paiement' && $confirm == 'yes')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment_supplier','(SupplierInvoicePayment)',$_POST['accountid'],'','');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
$db->begin();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
|
||||
$invoiceid=0;
|
||||
foreach ($paiement->amounts as $key => $amount)
|
||||
// Creation de la ligne paiement
|
||||
$paiement = new PaiementFourn($db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array of amounts
|
||||
$paiement->paiementid = $_POST['paiementid'];
|
||||
$paiement->num_paiement = $_POST['num_paiement'];
|
||||
$paiement->note = $_POST['comment'];
|
||||
if (! $error)
|
||||
{
|
||||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0)
|
||||
$paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
|
||||
else $invoiceid=$facid;
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid;
|
||||
else $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$paiement->addPaymentToBank($user,'payment_supplier','(SupplierInvoicePayment)',$_POST['accountid'],'','');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card
|
||||
$invoiceid=0;
|
||||
foreach ($paiement->amounts as $key => $amount)
|
||||
{
|
||||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0)
|
||||
{
|
||||
if ($invoiceid != 0) $invoiceid=-1; // There is more than one invoice payed by this payment
|
||||
else $invoiceid=$facid;
|
||||
}
|
||||
}
|
||||
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid;
|
||||
else $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -445,7 +448,7 @@ if (empty($action))
|
||||
|
||||
$sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
|
||||
$sql.= ' s.rowid as socid, s.nom,';
|
||||
$sql.= ' c.libelle as paiement_type,';
|
||||
$sql.= ' c.code as paiement_type, c.libelle as paiement_libelle,';
|
||||
$sql.= ' ba.rowid as bid, ba.label,';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
|
||||
$sql.= ' SUM(f.amount)';
|
||||
@@ -484,7 +487,7 @@ if (empty($action))
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
|
||||
}
|
||||
$sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.libelle, ba.rowid, ba.label";
|
||||
$sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label";
|
||||
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
@@ -556,7 +559,9 @@ if (empty($action))
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.dol_trunc($objp->paiement_type.' '.$objp->num_paiement,32)."</td>\n";
|
||||
$payment_type = $langs->trans("PaymentType".$objp->paiement_type)!=("PaymentType".$objp->paiement_type)?$langs->trans("PaymentType".$objp->paiement_type):$objp->paiement_libelle;
|
||||
|
||||
print '<td>'.$payment_type.' '.dol_trunc($objp->num_paiement,32)."</td>\n";
|
||||
|
||||
print '<td>';
|
||||
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.dol_trunc($objp->label,24).'</a>';
|
||||
|
||||
@@ -54,40 +54,41 @@ $hookmanager->initHooks(array('suppliercard'));
|
||||
$parameters = array('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (empty($reshook)) {
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'setsupplieraccountancycode')
|
||||
{
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
if ($action == 'setsupplieraccountancycode')
|
||||
{
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
if (!$cancelbutton) {
|
||||
if (!$cancelbutton) {
|
||||
|
||||
$result = $object->fetch($id);
|
||||
$object->code_compta_fournisseur = $_POST["supplieraccountancycode"];
|
||||
$result = $object->update($object->id, $user, 1, 0, 1);
|
||||
if ($result < 0) {
|
||||
$mesg = join(',', $object->errors);
|
||||
$result = $object->fetch($id);
|
||||
$object->code_compta_fournisseur = $_POST["supplieraccountancycode"];
|
||||
$result = $object->update($object->id, $user, 1, 0, 1);
|
||||
if ($result < 0) {
|
||||
$mesg = join(',', $object->errors);
|
||||
}
|
||||
$action = "";
|
||||
}
|
||||
$action = "";
|
||||
}
|
||||
// conditions de reglement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
}
|
||||
// conditions de reglement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('banks');
|
||||
|
||||
@@ -115,7 +115,7 @@ ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseu
|
||||
-- Fix: deprecated tag to new one
|
||||
update llx_opensurvey_sondage set format = 'D' where format = 'D+';
|
||||
update llx_opensurvey_sondage set format = 'A' where format = 'A+';
|
||||
|
||||
update llx_opensurvey_sondage set tms = now();
|
||||
|
||||
-- ALTER TABLE llx_facture_fourn ALTER COLUMN fk_cond_reglement DROP NOT NULL;
|
||||
|
||||
|
||||
@@ -1014,7 +1014,7 @@ SendingMailSetup=Setup of sendings by email
|
||||
SendmailOptionNotComplete=Warning, on some Linux systems, to send email from your email, sendmail execution setup must contains option -ba (parameter mail.force_extra_parameters into your php.ini file). If some recipients never receive emails, try to edit this PHP parameter with mail.force_extra_parameters = -ba).
|
||||
PathToDocuments=Path to documents
|
||||
PathDirectory=Directory
|
||||
SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail direct" will generate a mail message that might be not correctly parsed by some receiving mail servers. Result is that some mails can't be read by people hosted by thoose bugged platforms. It's case for some Internet providers (Ex: Orange in France). This is not a problem into Dolibarr nor into PHP but onto receiving mail server. You can however add option MAIN_FIX_FOR_BUGGED_MTA to 1 into setup - other to modify Dolibarr to avoid this. However, you may experience problem with other servers that respect strictly the SMTP standard. The other solution (recommanded) is to use the method "SMTP socket library" that has no disadvantages.
|
||||
SendmailOptionMayHurtBuggedMTA=Feature to send mails using method "PHP mail direct" will generate a mail message that might be not correctly parsed by some receiving mail servers. Result is that some mails can't be read by people hosted by those bugged platforms. It's case for some Internet providers (Ex: Orange in France). This is not a problem into Dolibarr nor into PHP but onto receiving mail server. You can however add option MAIN_FIX_FOR_BUGGED_MTA to 1 into setup - other to modify Dolibarr to avoid this. However, you may experience problem with other servers that respect strictly the SMTP standard. The other solution (recommended) is to use the method "SMTP socket library" that has no disadvantages.
|
||||
TranslationSetup=Configuration de la traduction
|
||||
TranslationDesc=Choice of language visible on screen can be modified:<br>* Globally from menu <strong>Home - Setup - Display</strong><br>* For user only from tab <strong>User display</strong> of user card (click on login on top of screen).
|
||||
TotalNumberOfActivatedModules=Total number of activated feature modules: <b>%s</b>
|
||||
@@ -1374,9 +1374,9 @@ ListOfAvailableNotifications=List of available notifications (This list depends
|
||||
SendingsSetup=Sending module setup
|
||||
SendingsReceiptModel=Sending receipt model
|
||||
SendingsNumberingModules=Sendings numbering modules
|
||||
SendingsAbility=Support sendings sheets for customer deliveries
|
||||
SendingsAbility=Support shipment sheets for customer deliveries
|
||||
NoNeedForDeliveryReceipts=In most cases, sendings receipts are used both as sheets for customer deliveries (list of products to send) and sheets that is recevied and signed by customer. So product deliveries receipts is a duplicated feature and is rarely activated.
|
||||
FreeLegalTextOnShippings=Free text on shippings
|
||||
FreeLegalTextOnShippings=Free text on shipments
|
||||
##### Deliveries #####
|
||||
DeliveryOrderNumberingModules=Products deliveries receipt numbering module
|
||||
DeliveryOrderModel=Products deliveries receipt model
|
||||
@@ -1387,7 +1387,7 @@ AdvancedEditor=Advanced editor
|
||||
ActivateFCKeditor=Activate advanced editor for:
|
||||
FCKeditorForCompany=WYSIWIG creation/edition of elements description and note (except products/services)
|
||||
FCKeditorForProduct=WYSIWIG creation/edition of products/services description and note
|
||||
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommanded as it can create problems with special characters and page formating when building PDF files.</font>
|
||||
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <font class="warning">Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formating when building PDF files.</font>
|
||||
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
|
||||
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
|
||||
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Outils->eMailing)
|
||||
|
||||
@@ -52,8 +52,8 @@ OrderSentByEMail=Customer order %s sent by EMail
|
||||
InvoiceSentByEMail=Customer invoice %s sent by EMail
|
||||
SupplierOrderSentByEMail=Supplier order %s sent by EMail
|
||||
SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
|
||||
ShippingSentByEMail=Shipping %s sent by EMail
|
||||
ShippingValidated= Shipping %s validated
|
||||
ShippingSentByEMail=Shipment %s sent by EMail
|
||||
ShippingValidated= Shipment %s validated
|
||||
InterventionSentByEMail=Intervention %s sent by EMail
|
||||
NewCompanyToDolibarr= Third party created
|
||||
DateActionPlannedStart= Planned start date
|
||||
|
||||
@@ -158,3 +158,5 @@ LabelRIB=BAN Label
|
||||
NoBANRecord=No BAN record
|
||||
DeleteARib=Delete BAN record
|
||||
ConfirmDeleteRib=Are you sure you want to delete this BAN record ?
|
||||
StartDate=Start date
|
||||
EndDate=End date
|
||||
|
||||
@@ -258,6 +258,7 @@ days=days
|
||||
Hours=Hours
|
||||
Minutes=Minutes
|
||||
Seconds=Seconds
|
||||
Weeks=Weeks
|
||||
Today=Today
|
||||
Yesterday=Yesterday
|
||||
Tomorrow=Tomorrow
|
||||
|
||||
@@ -4,7 +4,7 @@ Sending=Shipment
|
||||
Sendings=Shipments
|
||||
Shipment=Shipment
|
||||
Shipments=Shipments
|
||||
Receivings=Receivings
|
||||
Receivings=Receipts
|
||||
SendingsArea=Shipments area
|
||||
ListOfSendings=List of shipments
|
||||
SendingMethod=Shipping method
|
||||
@@ -14,7 +14,7 @@ SearchASending=Search for shipment
|
||||
StatisticsOfSendings=Statistics for shipments
|
||||
NbOfSendings=Number of shipments
|
||||
NumberOfShipmentsByMonth=Number of shipments by month
|
||||
SendingCard=Shipping card
|
||||
SendingCard=Shipment card
|
||||
NewSending=New shipment
|
||||
CreateASending=Create a shipment
|
||||
CreateSending=Create shipment
|
||||
@@ -37,7 +37,7 @@ StatusSendingCanceledShort=Canceled
|
||||
StatusSendingDraftShort=Draft
|
||||
StatusSendingValidatedShort=Validated
|
||||
StatusSendingProcessedShort=Processed
|
||||
SendingSheet=Sending sheet
|
||||
SendingSheet=Shipment sheet
|
||||
Carriers=Carriers
|
||||
Carrier=Carrier
|
||||
CarriersArea=Carriers area
|
||||
@@ -58,7 +58,7 @@ SendShippingRef=Send shipment %s
|
||||
ActionsOnShipping=Events on shipment
|
||||
LinkToTrackYourPackage=Link to track your package
|
||||
ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card.
|
||||
RelatedShippings=Related shippings
|
||||
RelatedShippings=Related shipments
|
||||
ShipmentLine=Shipment line
|
||||
CarrierList=List of transporters
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ MassMovement=Mass movement
|
||||
MassStockMovement=Mass stock movement
|
||||
SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s".
|
||||
RecordMovement=Record transfert
|
||||
ReceivingForSameOrder=Receivings for this order
|
||||
ReceivingForSameOrder=Receipts for this order
|
||||
StockMovementRecorded=Stock movements recorded
|
||||
RuleForStockAvailability=Rules on stock requirements
|
||||
StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice
|
||||
|
||||
@@ -725,7 +725,7 @@ if (! empty($conf->browser->phone))
|
||||
// If we force to use jmobile, then we reenable javascript
|
||||
if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
|
||||
// Disabled bugged themes
|
||||
if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea','cameleo')))
|
||||
if (! empty($conf->dol_use_jmobile) && in_array($conf->theme,array('bureau2crea','cameleo','amarok')))
|
||||
{
|
||||
$conf->theme='eldy';
|
||||
$conf->css = "/theme/".$conf->theme."/style.css.php";
|
||||
@@ -1682,22 +1682,28 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
||||
}
|
||||
}
|
||||
|
||||
// Link to bugtrack
|
||||
if (! empty($conf->global->MAIN_BUGTRACK_ENABLELINK))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
// Link to bugtrack
|
||||
if (! empty($conf->global->MAIN_BUGTRACK_ENABLELINK))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$bugbaseurl='https://doliforge.org/tracker/?';
|
||||
$bugbaseurl.='func=add&group_id=144&atid=246';
|
||||
$bugbaseurl.="&details=";
|
||||
$bugbaseurl.=urlencode("\n\n\n\n\n-------------\n");
|
||||
$bugbaseurl.=urlencode($langs->trans("Version").": ".DOL_VERSION."\n");
|
||||
$bugbaseurl.=urlencode($langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."\n");
|
||||
$bugbaseurl.=urlencode($langs->trans("PHP").": ".version_php()."\n");
|
||||
$bugbaseurl.=urlencode($langs->trans("Url").": ".$_SERVER["REQUEST_URI"]."\n");
|
||||
print '<div id="blockvmenubugtracker" class="blockvmenuhelp"><a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a></div>';
|
||||
}
|
||||
print "\n";
|
||||
$bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
|
||||
$bugbaseurl.= '?title=';
|
||||
$bugbaseurl.= urlencode("Bug: ");
|
||||
$bugbaseurl.= '&body=';
|
||||
$bugbaseurl.= urlencode("# Environment\n");
|
||||
$bugbaseurl.= urlencode("- **Version**: " . DOL_VERSION . "\n");
|
||||
$bugbaseurl.= urlencode("- **OS**: " . php_uname('s') . "\n");
|
||||
$bugbaseurl.= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
|
||||
$bugbaseurl.= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
|
||||
$bugbaseurl.= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
|
||||
$bugbaseurl.= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
|
||||
$bugbaseurl.= urlencode("\n");
|
||||
$bugbaseurl.= urlencode("# Report\n");
|
||||
print '<p id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
|
||||
print '<a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
|
||||
print '</p>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<!-- End left menu -->\n";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,5 +22,15 @@
|
||||
* \brief Page d'index du module margin
|
||||
*/
|
||||
|
||||
require 'productMargins.php';
|
||||
require '../main.inc.php';
|
||||
|
||||
if ($user->rights->produit->lire) {
|
||||
$page = 'productMargins';
|
||||
} elseif ($user->rights->societe->lire) {
|
||||
$page = 'customerMargins';
|
||||
} else {
|
||||
$page = 'agentMargins';
|
||||
}
|
||||
|
||||
header('Location: '.dol_buildpath('/margin/'.$page.'.php', 1));
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -56,21 +57,25 @@ function marges_admin_prepare_head()
|
||||
*/
|
||||
function marges_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf, $user;
|
||||
$langs->load("marges@marges");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
|
||||
$head[$h][1] = $langs->trans("ProductMargins");
|
||||
$head[$h][2] = 'productMargins';
|
||||
$h++;
|
||||
if ($user->rights->produit->lire) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
|
||||
$head[$h][1] = $langs->trans("ProductMargins");
|
||||
$head[$h][2] = 'productMargins';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
|
||||
$head[$h][1] = $langs->trans("CustomerMargins");
|
||||
$head[$h][2] = 'customerMargins';
|
||||
$h++;
|
||||
if ($user->rights->societe->lire) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
|
||||
$head[$h][1] = $langs->trans("CustomerMargins");
|
||||
$head[$h][2] = 'customerMargins';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php";
|
||||
$head[$h][1] = $langs->trans("SalesRepresentativeMargins");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2007-2011 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@@ -1482,7 +1482,7 @@ class Product extends CommonObject
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->import_key = $obj->import_key;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
|
||||
$this->db->free($resql);
|
||||
@@ -3376,7 +3376,7 @@ class Product extends CommonObject
|
||||
$filename = preg_replace('/'.preg_quote($dir,'/').'/i','',$file); // Nom du fichier
|
||||
|
||||
// On efface l'image d'origine
|
||||
dol_delete_file($file);
|
||||
dol_delete_file($file, 0, 0, 0, $this); // For triggers
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
||||
|
||||
@@ -76,13 +76,13 @@ $modulepart='produit';
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
/*
|
||||
* Action envoie fichier
|
||||
*/
|
||||
|
||||
/*
|
||||
* Action envoie fichier
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@@ -64,10 +64,6 @@ $hookmanager->initHooks(array('pricesuppliercard'));
|
||||
$product = new ProductFournisseur($db);
|
||||
$product->fetch($id,$ref);
|
||||
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
|
||||
@@ -81,127 +77,130 @@ if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
$parameters=array('socid'=>$socid, 'id_prod'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
|
||||
|
||||
if ($action == 'remove_pf')
|
||||
{
|
||||
$product = new ProductFournisseur($db);
|
||||
if ($product->fetch($id) > 0)
|
||||
{
|
||||
if ($rowid)
|
||||
{
|
||||
$result=$product->remove_product_fournisseur_price($rowid);
|
||||
$action = '';
|
||||
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>';
|
||||
}
|
||||
}
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
||||
{
|
||||
$id_fourn=GETPOST("id_fourn");
|
||||
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
||||
$ref_fourn=GETPOST("ref_fourn");
|
||||
if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn");
|
||||
$quantity=GETPOST("qty");
|
||||
$remise_percent=price2num(GETPOST('remise_percent','alpha'));
|
||||
$npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ;
|
||||
$tva_tx = str_replace('*','', GETPOST('tva_tx','alpha'));
|
||||
$tva_tx = price2num($tva_tx);
|
||||
|
||||
if ($tva_tx == '')
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")).'</div>';
|
||||
}
|
||||
if (empty($quantity))
|
||||
if (empty($reshook)) {
|
||||
if ($action == 'remove_pf')
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")).'</div>';
|
||||
}
|
||||
if (empty($ref_fourn))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")).'</div>';
|
||||
}
|
||||
if ($id_fourn <= 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")).'</div>';
|
||||
}
|
||||
if ($_POST["price"] < 0 || $_POST["price"] == '')
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")).'</div>';
|
||||
}
|
||||
|
||||
$product = new ProductFournisseur($db);
|
||||
$result=$product->fetch($id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg=$product->error;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if (! $error)
|
||||
$product = new ProductFournisseur($db);
|
||||
if ($product->fetch($id) > 0)
|
||||
{
|
||||
$ret=$product->add_fournisseur($user, $id_fourn, $ref_fourn, $quantity); // This insert record with no value for price. Values are update later with update_buyprice
|
||||
if ($ret == -3)
|
||||
if ($rowid)
|
||||
{
|
||||
$error++;
|
||||
|
||||
$product->fetch($product->product_id_already_linked);
|
||||
$productLink = $product->getNomUrl(1,'supplier');
|
||||
|
||||
$mesg='<div class="error">'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink).'</div>';
|
||||
}
|
||||
else if ($ret < 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$product->error.'</div>';
|
||||
$result=$product->remove_product_fournisseur_price($rowid);
|
||||
$action = '';
|
||||
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
||||
{
|
||||
$id_fourn=GETPOST("id_fourn");
|
||||
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
||||
$ref_fourn=GETPOST("ref_fourn");
|
||||
if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn");
|
||||
$quantity=GETPOST("qty");
|
||||
$remise_percent=price2num(GETPOST('remise_percent','alpha'));
|
||||
$npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ;
|
||||
$tva_tx = str_replace('*','', GETPOST('tva_tx','alpha'));
|
||||
$tva_tx = price2num($tva_tx);
|
||||
|
||||
if ($tva_tx == '')
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")).'</div>';
|
||||
}
|
||||
if (empty($quantity))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")).'</div>';
|
||||
}
|
||||
if (empty($ref_fourn))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")).'</div>';
|
||||
}
|
||||
if ($id_fourn <= 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")).'</div>';
|
||||
}
|
||||
if ($_POST["price"] < 0 || $_POST["price"] == '')
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")).'</div>';
|
||||
}
|
||||
|
||||
$product = new ProductFournisseur($db);
|
||||
$result=$product->fetch($id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg=$product->error;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$supplier=new Fournisseur($db);
|
||||
$result=$supplier->fetch($id_fourn);
|
||||
if (isset($_POST['ref_fourn_price_id']))
|
||||
$product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr);
|
||||
if ($ret < 0)
|
||||
if (! $error)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$product->error.'</div>';
|
||||
$ret=$product->add_fournisseur($user, $id_fourn, $ref_fourn, $quantity); // This insert record with no value for price. Values are update later with update_buyprice
|
||||
if ($ret == -3)
|
||||
{
|
||||
$error++;
|
||||
|
||||
$product->fetch($product->product_id_already_linked);
|
||||
$productLink = $product->getNomUrl(1,'supplier');
|
||||
|
||||
$mesg='<div class="error">'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink).'</div>';
|
||||
}
|
||||
else if ($ret < 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$product->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$supplier=new Fournisseur($db);
|
||||
$result=$supplier->fetch($id_fourn);
|
||||
if (isset($_POST['ref_fourn_price_id']))
|
||||
$product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$product->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('cancel') == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
header("Location: fournisseurs.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('cancel') == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
header("Location: fournisseurs.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* view
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -387,7 +388,7 @@ if ($resql)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($user->rights->stock->creer)
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -343,7 +343,7 @@ if ($id > 0 || $ref)
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
if ($found) print '<br>'; else $found=1;
|
||||
print $langs->trans("CustomersOrdersRunning").': '.($product->stats_commande['qty']-$product->stats_sendings['qty']);
|
||||
print $langs->trans("CustomersOrdersRunning").': '.($product->stats_commande['qty']-$product->stats_expedition['qty']);
|
||||
$result=$product->load_stats_commande(0,'0');
|
||||
if ($result < 0) dol_print_error($db,$product->error);
|
||||
print ' ('.$langs->trans("Draft").': '.$product->stats_commande['qty'].')';
|
||||
@@ -543,7 +543,7 @@ if (empty($action) && $product->id)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($user->rights->stock->creer)
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ class Task extends CommonObject
|
||||
$sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").",";
|
||||
$sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").",";
|
||||
$sql.= " planned_workload=".(isset($this->planned_workload)?$this->planned_workload:"0").",";
|
||||
$sql.= " dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null').",";
|
||||
$sql.= " datee=".($this->date_end!=''?$this->db->idate($this->date_end):'null').",";
|
||||
$sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').",";
|
||||
$sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').",";
|
||||
$sql.= " progress=".$this->progress.",";
|
||||
$sql.= " rang=".((!empty($this->rang))?$this->rang:"0");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -130,12 +131,12 @@ print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print dol_print_date($object->date_start,'day');
|
||||
print dol_print_date($project->date_start,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print dol_print_date($object->date_end,'day');
|
||||
print dol_print_date($project->date_end,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@@ -314,7 +315,14 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
|
||||
// Status
|
||||
print '<td align="right">'.$element->getLibStatut(5).'</td>';
|
||||
print '<td align="right">';
|
||||
if ($element instanceof CommonInvoice) {
|
||||
//This applies for Facture and FactureFournisseur
|
||||
print $element->getLibStatut(5, $element->getSommePaiement());
|
||||
} else {
|
||||
print $element->getLibStatut(5);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@@ -360,11 +368,11 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||
}
|
||||
if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?socid='.$project->societe->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,8 +423,31 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
}
|
||||
|
||||
switch ($classname) {
|
||||
case 'FactureFournisseur':
|
||||
$newclassname = 'SupplierInvoice';
|
||||
break;
|
||||
case 'Facture':
|
||||
$newclassname = 'Bill';
|
||||
break;
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
break;
|
||||
case 'Commande':
|
||||
$newclassname = 'Order';
|
||||
break;
|
||||
case 'Expedition':
|
||||
$newclassname = 'Sending';
|
||||
break;
|
||||
case 'Contrat':
|
||||
$newclassname = 'Contract';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
}
|
||||
|
||||
print '<tr >';
|
||||
print '<td align="left" >'.$classname.'</td>';
|
||||
print '<td align="left" >'.$langs->trans($newclassname).'</td>';
|
||||
print '<td align="right">'.$i.'</td>';
|
||||
print '<td align="right">'.price($total_ht).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
|
||||
@@ -61,58 +61,59 @@ $hookmanager->initHooks(array('resource_card'));
|
||||
$parameters=array('resource_id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (empty($reshook)) {
|
||||
|
||||
/*******************************************************************
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
/*******************************************************************
|
||||
* ACTIONS
|
||||
*
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (empty($ref))
|
||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->resource->write )
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'</div>';
|
||||
}
|
||||
$error=0;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res = $object->fetch($id);
|
||||
if ( $res > 0 )
|
||||
if (empty($ref))
|
||||
{
|
||||
$object->ref = $ref;
|
||||
$object->description = $description;
|
||||
$object->fk_code_type_resource = $fk_code_type_resource;
|
||||
|
||||
$result=$object->update($user);
|
||||
if ($result > 0)
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")).'</div>';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res = $object->fetch($id);
|
||||
if ( $res > 0 )
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
$object->ref = $ref;
|
||||
$object->description = $description;
|
||||
$object->fk_code_type_resource = $fk_code_type_resource;
|
||||
|
||||
$result=$object->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage('<div class="error">'.$object->error.'</div>');
|
||||
$action='edit';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage('<div class="error">'.$object->error.'</div>');
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************
|
||||
* VIEW
|
||||
*
|
||||
|
||||
@@ -3091,7 +3091,7 @@ class Societe extends CommonObject
|
||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
|
||||
*/
|
||||
$sql = "SELECT sum(total) as amount FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql = "SELECT rowid, total_ttc FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE fk_soc = ". $this->id;
|
||||
$sql .= " AND paye = 0";
|
||||
$sql .= " AND fk_statut <> 0"; // Not a draft
|
||||
@@ -3102,8 +3102,18 @@ class Societe extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
return ($obj->amount);
|
||||
$outstandingBill = 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic=new Facture($this->db);
|
||||
while($obj=$this->db->fetch_object($resql)) {
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$paiement = $facturestatic->getSommePaiement();
|
||||
$creditnotes = $facturestatic->getSumCreditNotesUsed();
|
||||
$deposits = $facturestatic->getSumDepositsUsed();
|
||||
|
||||
$outstandingBill+= $obj->total_ttc - $paiement - $creditnotes - $deposits;
|
||||
}
|
||||
return $outstandingBill;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -382,7 +383,7 @@ if ($socid && $action != 'edit' && $action != "create")
|
||||
}
|
||||
|
||||
if (count($rib_list) == 0) {
|
||||
print '<tr><td colspan="5" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
|
||||
print '<tr><td colspan="7" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
BIN
htdocs/theme/amarok/img/object_margin.png
Normal file
BIN
htdocs/theme/amarok/img/object_margin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 579 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user