Compare commits

...

131 Commits
3.2.2 ... 3.2

Author SHA1 Message Date
Laurent Destailleur
268a4b67e9 Fix: 3.2 was ok with PHP 5.3 only, not 5.4 2013-12-09 02:11:39 +01:00
Laurent Destailleur
206ded3f2b Backport travis script into 3.2 2013-12-09 02:05:52 +01:00
Laurent Destailleur
94c2b504cb Update ignore files 2013-12-09 01:44:00 +01:00
Laurent Destailleur
0e7b861086 Merge pull request #1044 from FHenry/3.2
Fix [ bug #934 ] Impossible de créer une facture prédéfinie (pgsql)
2013-06-13 15:25:28 -07:00
Florian Henry
e4e27a0071 Fix [ bug #934 ] Impossible de créer une facture prédéfinie (pgsql) 2013-06-13 15:03:20 +02:00
Laurent Destailleur
29841f2606 Fix: param lang not provided to price function 2013-06-08 15:20:06 +02:00
Laurent Destailleur
6c5517b757 Fix: CSS 2013-06-05 20:11:07 +02:00
Laurent Destailleur
0cac22376a Merge pull request #981 from FHenry/3.2
Fix search product with multilangue
2013-05-25 01:59:38 -07:00
Florian Henry
cd68538d2d Fix search product with multilangue 2013-05-24 22:43:07 +02:00
Laurent Destailleur
8bd5327d02 Update nl 2013-04-24 13:56:05 +02:00
Laurent Destailleur
9bf77eac4c Fix: Korting 2013-04-22 13:57:16 +02:00
Laurent Destailleur
ffe47141ff Merge pull request #799 from FHenry/3.2
Fix Dutch (nl_NL) translation
2013-04-04 02:34:37 -07:00
fhenry
b0eec3ef3a Fix Dutch (nl_NL) translation 2013-04-03 11:51:40 +02:00
Laurent Destailleur
c74f68d14a Fix: dol_is_dir may not be loaded, so call fails 2013-03-08 01:52:56 +01:00
Laurent Destailleur
970b332bd8 Merge pull request #695 from FHenry/3.2
Fix [ bug #737 ]
2013-02-26 11:03:05 -08:00
fhenry
d7485f5823 Fix [ bug #737 ] 2013-02-26 12:11:34 +01:00
Laurent Destailleur
24b002fbe6 Revert "Fix: only once superadmin and an admin can not delete/modify a superadmin"
This reverts commit 0216bdd311.
2013-02-11 22:52:26 +01:00
Laurent Destailleur
5cd329a320 Merge pull request #643 from FHenry/3.2
Fix bug [ bug #709 ]
2013-02-10 17:42:24 -08:00
fhenry
63c5f3433a Fix bug [ bug #709 ] 2013-02-10 20:49:52 +01:00
Regis Houssin
93dc6b5fc0 Fix: use the users entity 2013-01-23 15:47:26 +01:00
Regis Houssin
0216bdd311 Fix: only once superadmin and an admin can not delete/modify a
superadmin
2013-01-23 15:24:41 +01:00
Regis Houssin
ac6049f0b3 Fix: only once superadmin if no multicompany setup 2013-01-23 14:58:14 +01:00
Regis Houssin
8b129f1af0 Fix: missing files library 2013-01-23 11:23:38 +01:00
Regis Houssin
2cabd97da8 Fix: prepare maintenance release 3.2.4 2013-01-22 22:21:28 +01:00
Regis Houssin
27a1e11ea5 Fix: prepare 3.2.4 2013-01-22 21:33:03 +01:00
Regis Houssin
9ecd566580 Fix: broken features with special_code and externals modules 2013-01-22 21:32:06 +01:00
Laurent Destailleur
ac1cfd3d23 Fix: [ bug #666 ] Fatal error when sending intervention card 2013-01-19 15:12:18 +01:00
Laurent Destailleur
72dbeadc49 Merge branch '3.2' of https://github.com/Dolibarr/dolibarr.git into 3.2 2013-01-17 17:45:41 +01:00
Laurent Destailleur
8fec37d5ad Fix: error set on non object 2013-01-17 14:36:08 +01:00
Laurent Destailleur
b826a6b559 Merge pull request #612 from FHenry/3.2
Fix Bug [ bug #681 ] Can't modify a line a business proposal
2013-01-15 14:13:19 -08:00
fhenry
085dee1ab1 Fix Bug [ bug #692 ] Can't search for suppliers invoice 2013-01-15 23:00:17 +01:00
fhenry
5e9a9a48f3 Fix Bug [ bug #681 ] Can't modify a line a business proposal 2013-01-15 22:45:18 +01:00
Laurent Destailleur
ec17511e01 Fix: not object error with option SERVICE_ARE_ECOMMERCE_200238EC 2013-01-13 18:53:52 +01:00
Laurent Destailleur
99c461b9d1 Merge branch '3.2' of git@github.com:Dolibarr/dolibarr.git into 3.2 2013-01-06 13:17:17 +01:00
Laurent Destailleur
4a2c38a1c1 Fix: Lost button 2013-01-06 13:16:25 +01:00
Laurent Destailleur
585d1b0587 Merge pull request #571 from KreizIT/3.2
Security fix emailing read and unsubscribe
2013-01-04 08:16:11 -08:00
Cedric GROSS
b4ad2887a0 Security fix emailing read and unsubscribe
unsubscribe can lead to email disclosure
2013-01-04 13:01:48 +01:00
Laurent Destailleur
6aebf470f6 Merge pull request #558 from FHenry/3.2
Fix [ bug #658 ] Seacrh on bank do not work for description
2012-12-29 08:32:37 -08:00
fhenry
24721eb3e8 Fix [ bug #658 ] Seacrh on bank do not work for description 2012-12-29 15:59:14 +01:00
Laurent Destailleur
4a74ebc1f9 Fix: [ bug #651 ] FusionPDF created files cannot be deleted 2012-12-27 14:46:50 +01:00
Laurent Destailleur
80bbeaa9b5 Fix: Migration of payment id not complete 2012-12-27 01:22:31 +01:00
Laurent Destailleur
1038e86616 Fix: Correct recipient into rouget template. 2012-12-13 01:21:37 +01:00
Laurent Destailleur
217b4ea15f Fix: Update changelog 2012-12-13 01:20:24 +01:00
Laurent Destailleur
0b0a30d362 Fix: Bad position of field with non A4 pages 2012-12-12 20:59:40 +01:00
Laurent Destailleur
19e0c66efc Fix: Using bad root url. 2012-12-12 14:48:31 +01:00
Laurent Destailleur
48eec88cba Fix: force redirect to https could not work for some environments
Conflicts:
	htdocs/main.inc.php
2012-12-12 02:40:01 +01:00
Laurent Destailleur
f8f3b2dc39 Fix: Bad url forging 2012-12-12 00:54:36 +01:00
Laurent Destailleur
d8aa8051dc Fix: Personalizing css fails when multicompany is on. Cache must differ
between each environment.
2012-12-08 18:42:29 +01:00
Laurent Destailleur
a7e1a45571 Fix: Use different css cache file for each user. This fix problem when
using personalised constants that change style.
2012-12-08 18:40:41 +01:00
Laurent Destailleur
60486417c3 Test. Try to create a backport branch. 2012-12-02 19:55:42 +01:00
Laurent Destailleur
c9ee9c7a38 Fix: pdf_getPDFFontSize must be after pdf_getInstance
Conflicts:
	htdocs/core/modules/commande/doc/pdf_einstein.modules.php
2012-11-28 19:26:08 +01:00
Laurent Destailleur
8f3f28c28f Fix: language translation for araby saudia 2012-11-27 14:19:04 +01:00
Laurent Destailleur
ac8a21a3d9 Added english (arabi saudia) 2012-11-27 11:34:15 +01:00
Laurent Destailleur
769c30de9d Fix: [ bug #607 ] Nom de société avec guillemets 2012-11-26 16:12:30 +01:00
Laurent Destailleur
2b926978ae Fix: Correct vat 2012-11-14 20:50:00 +01:00
Laurent Destailleur
6540451078 Fix: firstname was missing 2012-11-14 19:04:34 +01:00
Laurent Destailleur
3ea1345a5b Fix: Option MAIN_MAIL_SENDMAIL_FORCE_BA and MAIN_FIX_BUGGED_MTA was not
complete.
2012-11-14 01:22:48 +01:00
Laurent Destailleur
0d35892003 Fix: typo error 2012-11-13 11:14:44 +01:00
Regis Houssin
8a8c2170cc Fix: remove unused code 2012-11-12 09:44:41 +01:00
Laurent Destailleur
599300dfec Fix: Regression 2012-11-11 15:44:23 +01:00
Regis Houssin
1e6e7af9f7 Fix: wrong access rights 2012-11-10 08:21:56 +01:00
Laurent Destailleur
56cd154258 Fix: New vat for switzerland 2012-11-08 12:14:44 +01:00
Regis Houssin
2f476aa0a0 Fix: compatibility with multicompany 2012-11-06 14:54:17 +01:00
Laurent Destailleur
47d7ea1813 Removed tables of module 2012-11-06 12:29:45 +01:00
Laurent Destailleur
47d5c5baad Fix: Bad label when validating/paying an invoice from POS module 2012-11-03 17:01:05 +01:00
Laurent Destailleur
91fdb6a569 Fix: Not enought space for free text. To avoid to edit again and again
value for all templates, I added an option to be able to fix template
onto production when space is not enough.

Conflicts:
	htdocs/core/modules/action/rapport.pdf.php
	htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
	htdocs/core/modules/commande/doc/pdf_einstein.modules.php
	htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
	htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
	htdocs/core/modules/facture/doc/pdf_crabe.modules.php
	htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
	htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
	htdocs/core/modules/project/pdf/pdf_baleine.modules.php
	htdocs/core/modules/propale/doc/pdf_azur.modules.php
	htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
	htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
2012-11-03 13:41:33 +01:00
Laurent Destailleur
1997b029c7 Fix: [ bug #592 ] stock sold value is wrong 2012-11-03 12:38:16 +01:00
Laurent Destailleur
753400ccf5 Fix: Label for payment by cheque using the wrong translation key
Fix: Option to overwrite translation did not work as expected
Fix: Bad translation for greece
2012-11-02 15:46:46 +01:00
Laurent Destailleur
b83a4d4815 Fix: crazy pagebreak when warterwark is higher than free space. 2012-11-02 15:44:34 +01:00
Laurent Destailleur
8127ced19b Fix: Trick to solve easily problem of font for some foreign users. 2012-10-31 19:42:16 +01:00
Laurent Destailleur
8bd2f9cfb5 Fix: Fix pagebreak. Fix also position for non A4 format. 2012-10-31 17:14:11 +01:00
Laurent Destailleur
0b3a2b744e Fix: Preview of delivery receipts 2012-10-31 16:57:48 +01:00
Laurent Destailleur
cd992d553e Fix: The bottom margin is already included into heightforfooter
This provide 1cm more for product description.
Fix: Some code was not merged from previous fix (must not show free text
on all pages)

Conflicts:
	htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
	htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php
	htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
2012-10-30 18:52:55 +01:00
Laurent Destailleur
db00ca9dd7 Fix: Free text overlap data when not on last page.
Conflicts:
	htdocs/core/lib/pdf.lib.php
	htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
	htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
	htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
	htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php
	htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
	htdocs/core/modules/project/pdf/pdf_baleine.modules.php
2012-10-30 14:15:35 +01:00
Laurent Destailleur
542dc8f98f Fix: Bad code for specimen 2012-10-30 11:58:38 +01:00
Laurent Destailleur
497aa9c453 Fix: Using a more precise function to calculate free texts height avoid
having few pixels offset on free texts.
2012-10-30 11:15:37 +01:00
Laurent Destailleur
c80badafe0 Fix: Revert direction of option (this information is a legal issue for
most countries). Also, i removed the mandatory test, this is required
for invoices, not proposals.
So now, there is no need to hide by default because test on invoice
setup has been removed, so we can show by default (if defined) and use
option to force to hide if we want.
2012-10-29 11:38:58 +01:00
Regis Houssin
3aebd50d39 Fix: better for show signature 2012-10-29 10:10:05 +01:00
Regis Houssin
85f03913fe Merge pull request #460 from FHenry/3.2
3.2
2012-10-24 13:57:36 -07:00
fhenry
a3260f3e14 Correct bug 583 2012-10-24 22:45:28 +02:00
Laurent Destailleur
825130d633 Fix: ldap errors 2012-10-24 16:30:10 +02:00
fhenry
1d66d97032 Task 581 : Implement DDLInfoTable for postgreSQL 2012-10-24 11:20:40 +02:00
Laurent Destailleur
df4bfc77a4 Fix: Line at bottom of PDF was too long 2012-10-21 16:11:46 +02:00
Laurent Destailleur
8fe8a1a6fd Fix: Bad alignement of fields with some page format. 2012-10-21 15:58:01 +02:00
Regis Houssin
6fe9a8ee0d Fix: wrong method 2012-10-20 11:13:22 +02:00
Regis Houssin
7e94d8ae52 Fix: minor vulnerabilities 2012-10-20 09:05:24 +02:00
Laurent Destailleur
878d5612a1 Fix: [ bug #260 ] Page breaks on PDF export of supplier order when you
have a service with 40 lines
2012-10-18 12:36:20 +02:00
Laurent Destailleur
377d6dc290 Fix: Bad date format 2012-10-17 20:12:45 +02:00
Laurent Destailleur
2b9f4fed8d Merge branch '3.2' of https://github.com/Dolibarr/dolibarr.git into 3.2 2012-10-16 19:49:11 +02:00
Laurent Destailleur
890579d13d Fix: [ bug #565 ] Display error bills have suppliers. 2012-10-16 19:14:47 +02:00
Laurent Destailleur
3dab78afb7 [ bug #552 ] l'option "Adhérents non à jour" ne fonctionne pas 2012-10-16 18:34:07 +02:00
Regis Houssin
d9ebc43cb6 Fix: compatibility with multicompany sharings 2012-10-16 17:53:37 +02:00
Regis Houssin
6d85629495 Fix: possibility to disable ajax 2012-10-16 16:15:00 +02:00
Laurent Destailleur
0e12931d0f Fix: error management 2012-10-15 21:43:42 +02:00
Laurent Destailleur
9690a0bc69 Fix: special_code=3 2012-10-12 22:18:02 +02:00
Laurent Destailleur
8b02d9e912 Fix: Can edit qty of an option 2012-10-12 21:37:06 +02:00
Laurent Destailleur
399aaf1459 Fix: warning 2012-10-05 09:33:01 +02:00
Laurent Destailleur
e707f73067 Fix: getTrad 2012-10-04 10:04:08 +02:00
Laurent Destailleur
8506df28d7 Fix: Try another fix on getTrad bug. 2012-10-04 09:44:55 +02:00
Laurent Destailleur
2868961661 Fix: TZ 2012-10-03 18:36:22 +02:00
Laurent Destailleur
ae945732be Fix: getTradFromKey 2012-10-03 17:48:56 +02:00
Laurent Destailleur
10e72d70ae Merge branch '3.2' of https://github.com/Dolibarr/dolibarr.git into 3.2 2012-10-01 20:52:50 +02:00
Laurent Destailleur
fa1d8a3f34 Fi: Uninstall not complete 2012-10-01 20:50:07 +02:00
Laurent Destailleur
6600993796 Prepare 3.3 2012-10-01 20:49:19 +02:00
Laurent Destailleur
bcc92dbd62 Fix: Correct request with data structure 2012-10-01 20:48:51 +02:00
Regis Houssin
ad3fd83478 Merge pull request #427 from simnandez/3.2
Fix: [ bug #553 ] Pagination dans liste des interventions
2012-10-01 02:26:55 -07:00
simnandez
2763374ff1 Fix: [ bug #553 ] Pagination dans liste des interventions 2012-10-01 11:23:16 +02:00
Regis Houssin
a2fecc2616 Fix: remove errors in php 5.4 2012-09-30 14:10:12 +02:00
Laurent Destailleur
4ecf7d9493 Merge branch '3.2' of https://github.com/Dolibarr/dolibarr.git into 3.2 2012-09-27 18:33:29 +02:00
Laurent Destailleur
f9dfe1bcfb Fix: No error when hour not provided
Conflicts:
	htdocs/core/lib/functions.lib.php
2012-09-27 18:31:47 +02:00
Regis Houssin
a119cd3f36 Fix: remove warning 2012-09-27 15:20:23 +02:00
Laurent Destailleur
c019857bda Merge branch '3.2' of git@github.com:Dolibarr/dolibarr.git into 3.2 2012-09-26 13:38:10 +02:00
Laurent Destailleur
b020dbf96f Prepare 3.3.3 2012-09-26 13:35:18 +02:00
Regis Houssin
1185e0f731 Fix: multicompany transverse mode compatibility 2012-09-26 12:14:08 +02:00
Regis Houssin
d6243a33af Fix: hide menu if empty 2012-09-26 12:12:01 +02:00
Regis Houssin
e9128db1aa Fix: add todo for free tag treatment 2012-09-25 18:37:37 +02:00
Regis Houssin
e8c9a9c87d Merge pull request #416 from cbattarel/3.2
add ability to remove a product tab if it's defined in a module description
2012-09-25 07:04:13 -07:00
Christophe Battarel
80c6716581 add ability to remove a product tab if it's defined in a module description 2012-09-25 14:46:40 +02:00
Laurent Destailleur
9de912ba12 Fix: doxygen 2012-09-24 21:40:26 +02:00
Regis Houssin
930f492a14 Fix: use company name if lastname and firstname not exists 2012-09-24 12:05:12 +02:00
Regis Houssin
665526a6e7 Fix: dol_trunk is too restrictive !!! change the resolution of your
screen !
2012-09-24 11:32:29 +02:00
Regis Houssin
0ac5f38e02 Fix: increase length, is too restrictive
Fix: show company name if lastname and firstname not exists
2012-09-24 10:53:35 +02:00
Spangaro Alexandre
4a9bf30bd1 Minor fix
Conflicts:
	htdocs/install/mysql/data/llx_accounting.sql
2012-09-23 16:34:30 +02:00
Laurent Destailleur
89908052c0 Add PHPUnit to help to detect bugs. 2012-09-23 16:21:37 +02:00
Laurent Destailleur
53c1672b9f Fix: Blank page when renaming product ref 2012-09-19 14:16:39 +02:00
Laurent Destailleur
8b13f2ab81 Fix: no way to change the payment term date 2012-09-18 12:11:16 +02:00
Laurent Destailleur
f1870ae37d Fix: syntax error with postgresql 2012-09-18 11:24:54 +02:00
Laurent Destailleur
592d70d4ea Fix: use https if https is used 2012-09-18 11:15:40 +02:00
Laurent Destailleur
218ae3dbd5 Merge branch '3.2' of git@github.com:Dolibarr/dolibarr.git into 3.2 2012-09-15 15:13:10 +02:00
Laurent Destailleur
b7163bea5d Fix: avoid syntax error 2012-09-15 15:12:43 +02:00
Regis Houssin
01b361a98b Fix: bad element 2012-09-15 09:07:06 +02:00
124 changed files with 3337 additions and 2333 deletions

83
.travis.yml Normal file
View File

@@ -0,0 +1,83 @@
# This script is used by Travis CI to run automatically Continuous test integration
# from Dolibarr GitHub repository.
# Command run is phpunit
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
services:
- memcached # will start memcached
# This will tell travis to run phpunit
language: php
php:
- "5.3"
env:
- DB=mysql
# - DB=postgres
before_script:
- echo Start travis
- echo Current dir is `pwd`
- echo Home dir is `echo ~`
- echo Update composer
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
- echo Create dir $(pwd)/htdocs/documents
- sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
- sudo touch $(pwd)/htdocs/documents/dolibarr.log;
- sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build;
- sudo chmod -R a+rwx $(pwd);
- sudo chown -R www-data:travis $(pwd)/htdocs/documents;
- find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
- echo Edit php.ini file
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "zend_extension_ts = xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo Init database
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.2.0.sql; fi"
- echo Create config file htdocs/conf/conf.php
- echo '<?php ' > htdocs/conf/conf.php
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
- echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
- echo '?>' >> htdocs/conf/conf.php
- echo Show conf.php content
- cat htdocs/conf/conf.php
- echo Install apache server
- sudo apt-get update > /dev/null
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl
- sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default
- echo Show default virtual host
- sudo cat /etc/apache2/sites-available/default
- sudo /etc/init.d/apache2 restart
- wget http://localhost/
- cat index.html
# Omitting "script:" will default to phpunit
# use the $DB env variable to determine the phpunit.xml to use
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
#script: phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
script:
# - phpcs -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
after_script:
# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
- echo Output apache log file; sudo cat /var/log/apache2/error.log
- echo End travis

View File

@@ -3,6 +3,24 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.2.3 compared to 3.2.2 *****
- Fix: Some permission into agenda module.
- Fix: Generation of PDF was not using correct font for some languages.
- Fix some translations.
- Fix: [ bug #607 ] Nom de société avec guillemets.
- Fix: Option MAIN_MAIL_SENDMAIL_FORCE_BA and MAIN_FIX_BUGGED_MTA was not
complete.
- Fix: comaptiblity with multicompany module.
- Fix: Bad label when validating/paying an invoice from POS module.
- Fix: Correct recipient into rouget template.
- Fix: A lot of fix into PDF pagebreak management.
- Update VAT for some countries.
- Firstname was missing when sending email from file list.
- Added en_SA language.
***** ChangeLog for 3.2.2 compared to 3.2.1 *****
- Fix: Modify spanish VAT to new rates.

View File

@@ -1,4 +1,4 @@
dolibarr (3.2.2+nmu1) unstable; urgency=low
dolibarr (3.2.3+nmu1) unstable; urgency=low
* Non-maintainer upload.
* New upstream release.

View File

@@ -180,11 +180,17 @@ case "$1" in
# Now run the drop user
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then
echo postrm Database login $dbuser removed
echo postrm Database login $dbuser@localhost removed
else
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'localhost';\""
echo postrm $error
fi
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then
echo postrm Database login $dbuser@% removed
else
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'%';\""
echo postrm $error
fi
# Now run the drop commands
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 3.2.0
PROJECT_NUMBER = 3.2.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@@ -17,9 +17,9 @@
; ----- Change this -----
AppName=DoliWamp
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
AppVerName=DoliWamp-3.2.2
AppVerName=DoliWamp-3.2.3
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
OutputBaseFilename=DoliWamp-3.2.2
OutputBaseFilename=DoliWamp-3.2.3
; Define full path from wich all relative path are defined
; You must modify this to put here your dolibarr root directory
;SourceDir=C:\Documents and Settings\ldestail\git\dolibarr_old

View File

@@ -10,7 +10,7 @@ use Cwd;
$PROJECT="dolibarr";
$MAJOR="3";
$MINOR="2";
$BUILD="2"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
$BUILD="4"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
$RPMSUBVERSION="auto"; # auto use value found into BUILD
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages

View File

@@ -34,7 +34,7 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in /ChangeLog and /filefunc.inc.php
- Update version/info in /ChangeLog
- Update version number with x.x.x-y in build/makepack-dolibarr.pl
- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss
- Update version number with x.x.x-y in htdocs/filefunc.inc.php

View File

@@ -34,9 +34,9 @@
</Company_Info>
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>3.2.2</Program_Version>
<Program_Version>3.2.3</Program_Version>
<Program_Release_Month>09</Program_Release_Month>
<Program_Release_Day>10</Program_Release_Day>
<Program_Release_Day>24</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />

View File

@@ -34,9 +34,9 @@
</Company_Info>
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>3.2.2</Program_Version>
<Program_Version>3.2.3</Program_Version>
<Program_Release_Month>09</Program_Release_Month>
<Program_Release_Day>10</Program_Release_Day>
<Program_Release_Day>24</Program_Release_Day>
<Program_Release_Year>2012</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />

View File

@@ -312,5 +312,5 @@ fi
%changelog
* Mon Jul 23 2012 Laurent Destailleur 3.2.2-0.3
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
- Initial version (#723326)

View File

@@ -368,5 +368,5 @@ fi
%changelog
* Mon Jul 23 2012 Laurent Destailleur 3.2.2-0.3
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
- Initial version (#723326)

View File

@@ -301,5 +301,5 @@ fi
%changelog
* Mon Jul 23 2012 Laurent Destailleur 3.2.2-0.3
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
- Initial version (#723326)

View File

@@ -306,5 +306,5 @@ fi
%changelog
* Mon Jul 23 2012 Laurent Destailleur 3.2.2-0.3
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
- Initial version (#723326)

View File

@@ -1763,290 +1763,6 @@ LOCK TABLES `llx_c_ziptown` WRITE;
/*!40000 ALTER TABLE `llx_c_ziptown` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_c_banques`
--
DROP TABLE IF EXISTS `llx_cabinetmed_c_banques`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_c_banques` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(8) NOT NULL,
`label` varchar(64) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_c_banques`
--
LOCK TABLES `llx_cabinetmed_c_banques` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_c_banques` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_c_banques` (`rowid`, `code`, `label`, `active`) VALUES (1,'HSBC','HSBC',1);
/*!40000 ALTER TABLE `llx_cabinetmed_c_banques` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_c_examconclusion`
--
DROP TABLE IF EXISTS `llx_cabinetmed_c_examconclusion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_c_examconclusion` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(8) NOT NULL,
`label` varchar(64) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_c_examconclusion`
--
LOCK TABLES `llx_cabinetmed_c_examconclusion` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_c_examconclusion` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_c_examconclusion` (`rowid`, `code`, `label`, `active`) VALUES (1,'AUTRE','Autre',1);
/*!40000 ALTER TABLE `llx_cabinetmed_c_examconclusion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_cons`
--
DROP TABLE IF EXISTS `llx_cabinetmed_cons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_cons` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`fk_soc` int(11) DEFAULT NULL,
`fk_user_creation` int(11) NOT NULL,
`datecons` date NOT NULL,
`typepriseencharge` varchar(8) DEFAULT NULL,
`motifconsprinc` varchar(64) DEFAULT NULL,
`diaglesprinc` varchar(64) DEFAULT NULL,
`motifconssec` text,
`diaglessec` text,
`hdm` text,
`examenclinique` text,
`examenprescrit` text,
`traitementprescrit` text,
`comment` text,
`typevisit` varchar(8) NOT NULL,
`infiltration` varchar(256) DEFAULT NULL,
`codageccam` varchar(16) DEFAULT NULL,
`montant_cheque` double(24,8) DEFAULT NULL,
`montant_espece` double(24,8) DEFAULT NULL,
`montant_carte` double(24,8) DEFAULT NULL,
`montant_tiers` double(24,8) DEFAULT NULL,
`banque` varchar(128) DEFAULT NULL,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`rowid`),
KEY `idx_cabinetmed_cons_fk_soc` (`fk_soc`),
KEY `idx_cabinetmed_cons_datecons` (`datecons`),
CONSTRAINT `fk_cabinetmed_cons_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_cons`
--
LOCK TABLES `llx_cabinetmed_cons` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_cons` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_cons` (`rowid`, `fk_soc`, `fk_user_creation`, `datecons`, `typepriseencharge`, `motifconsprinc`, `diaglesprinc`, `motifconssec`, `diaglessec`, `hdm`, `examenclinique`, `examenprescrit`, `traitementprescrit`, `comment`, `typevisit`, `infiltration`, `codageccam`, `montant_cheque`, `montant_espece`, `montant_carte`, `montant_tiers`, `banque`, `tms`) VALUES (2,2,1,'2011-04-17',NULL,'Cervicalgies Inflammatoires','Arthrite Microcristalline','','','','rrrr','','','','CS','','',NULL,55.00000000,NULL,NULL,'','2011-05-25 13:59:03'),(3,2,1,'2011-05-01',NULL,'Cervicalgies Mécaniques','Arthrite Goutteuse','yyyykk\r\nDorsalgie\r\nDorsalgies Inflammatoires\r\nDouleur Chevillep\r\nDouleur Genou\r\nDouleur Genou','','lll','','','','','CS','','',NULL,NULL,NULL,50.00000000,'','2011-05-25 13:59:03'),(4,4,1,'2011-05-02',NULL,'Autre','Arthrite Goutteuse','','','','','','','','CCAM','inf','ccam',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(5,5,1,'2011-05-02',NULL,'Cervicalgies Inflammatoires','Arthrite Microcristalline','','dgdfg','','','','','','CCAM','ingg','pp',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:22:22'),(6,5,1,'2011-05-02',NULL,'Cervicalgies Inflammatoires','Arthrose FémoroPatellaire','','','','','','kk','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(7,4,1,'2011-05-03',NULL,'Cervicalgies Mécaniques','Arthrite Goutteuse','Douleur Cheville','Arthrite Microcristalline','fd','fd','Bilan Phosphocalcique','fdf','fdfd','CCAM','lllll','kkk',NULL,NULL,NULL,0.00000000,'','2011-06-14 23:13:42'),(8,5,1,'2011-05-03',NULL,'Cervicalgies Mécaniques','gggg','','','pppljklj','','','','','CS','kmlkmlkml mlmlkmkm mk ml mlk','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:00:27'),(10,3,1,'2011-05-07',NULL,'dfgdf','gfdgd','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(11,9,1,'2011-05-25',NULL,'Dérobement Membres Inférieurs','Arthrite Goutteuse','Dorsalgie\r\nDorsalgies Mécaniques','Lomboradiculalgie Discale\r\nLombosciatique L5 gauche','','','ArthroScanner Genou\r\nIRM Genou\r\nIRM Rachis Lombaire','1\r\n2\r\n3\r\n4\r\n5\r\n6','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:58:29'),(12,32,1,'2011-06-08',NULL,'Cervicalgies Inflammatoires','Arthrite Goutteuse','','','','','','','','CS','','',NULL,NULL,NULL,50.00000000,'','2011-06-08 14:38:10'),(13,26,1,'2011-06-13',NULL,'Cervicalgies Mécaniques','Arthrite Microcristalline','','','','','ArthroScanner Hanche','Traitement prescrit.','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 15:25:39'),(14,26,1,'2011-06-13',NULL,'Douleur Membre inférieur Gauche','Lombosciatique L5 gauche','','Lombalgie Discale','','','','AINS (biprohénide), murolaxan\r\ndoliprane\r\n+ rééduction','','CCAM','infiltr épidurale','AHLB001',90.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 16:16:43'),(15,1,1,'2011-06-13',NULL,'Cervicalgies Mécaniques','Arthrite Microcristalline','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 18:07:26'),(16,36,1,'2011-06-15',NULL,'gdfgfd','gdfgdfgdf','','','','','ArthroScanner Epaule','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-15 00:28:43'),(17,36,1,'2011-06-15',NULL,'hfghfg','hgfhfghf','','','','','','','','CS','','',NULL,10.00000000,NULL,NULL,'','2011-06-15 00:31:57'),(18,65,1,'2011-07-06',NULL,'Cervicalgies Inflammatoires','aaaaa','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-06 20:17:20'),(19,67,1,'2011-07-11',NULL,'Cervicalgies Inflammatoires','Canal Carpien','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-10 21:23:30'),(20,68,1,'2011-07-13',NULL,'Cervicalgies Mécaniques','Autre','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-13 16:26:21'),(21,68,1,'2011-07-13',NULL,'aaaa','bbbb','','','','','','','','CS','','',NULL,NULL,50.00000000,NULL,'','2011-07-13 18:18:29'),(22,68,1,'2011-07-13',NULL,'lll','llll','','','','','','','','CS','','',NULL,NULL,10.00000000,NULL,'','2011-07-13 18:21:57'),(23,68,1,'2011-07-13',NULL,'oo','oo','','','','','','','','CS','','',NULL,NULL,NULL,5.00000000,'','2011-07-13 18:26:18');
/*!40000 ALTER TABLE `llx_cabinetmed_cons` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_diaglec`
--
DROP TABLE IF EXISTS `llx_cabinetmed_diaglec`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_diaglec` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(8) NOT NULL,
`label` varchar(64) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_diaglec`
--
LOCK TABLES `llx_cabinetmed_diaglec` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_diaglec` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_diaglec` (`rowid`, `code`, `label`, `active`) VALUES (1,'AUTRE','Autre',1),(2,'LOMBL5D','Lombosciatique L5 droite',1),(3,'LOMBL5G','Lombosciatique L5 gauche',1),(4,'LOMBS1D','Lombosciatique S1 droite',1),(5,'LOMBS1G','Lombosciatique S1 gauche',1),(6,'NCB','Névralgie cervico-brachiale',1),(7,'PR','Polyarthrite rhumatoide',1),(8,'SA','Spondylarthrite ankylosante',1),(9,'GFTI','Gonarthrose fémoro-tibaile interne',1),(10,'GFTE','Gonarthrose fémoro-tibiale externe',1),(11,'COX','Coxarthrose',1),(12,'CC','Canal Carpien',1),(16,'CLER','Canal Lombaire Etroit et/ou Rétréci',1),(22,'RH PSO','Rhumatisme Psoriasique',1),(23,'LEAD','Lupus',1),(24,'LBDISC','Lombalgie Discale',1),(25,'LBRADD','Lomboradiculalgie Discale',1),(26,'LBRADND','Lomboradiculalgie Non Discale',1),(27,'CH ROT','Chondropathie Rotulienne',1),(28,'AFP','Arthrose FémoroPatellaire',1),(29,'PPR','Pseudo Polyarthrite Rhizomélique',1),(30,'SHARP','Maladie de Sharp',1),(31,'SAPHO','SAPHO',1),(32,'OMARTHC','Omarthrose Centrée',1),(33,'RH CCA','Rhumatisme Chondro Calcinosique',1),(34,'GOUTTE','Arthrite Goutteuse',1),(35,'CCA','Arthrite Chondro Calcinosique',1),(36,'ARTH MCR','Arthrite Microcristalline',1),(37,'CSA','Conflit Sous Acromial',1),(38,'TDCALCE','Tendinopathie Calcifiante d\'Epaule',1),(39,'TDCALCH','Tendinopathie Calcifiante de Hanche',1),(40,'TBT','TendinoBursite Trochantérienne',1),(41,'OMARTHE','Omarthrose Excentrée',1);
/*!40000 ALTER TABLE `llx_cabinetmed_diaglec` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_examaut`
--
DROP TABLE IF EXISTS `llx_cabinetmed_examaut`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_examaut` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`fk_soc` int(11) DEFAULT NULL,
`dateexam` date NOT NULL,
`examprinc` varchar(64) DEFAULT NULL,
`examsec` text,
`concprinc` varchar(64) DEFAULT NULL,
`concsec` text,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_examaut`
--
LOCK TABLES `llx_cabinetmed_examaut` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_examaut` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_examaut` (`rowid`, `fk_soc`, `dateexam`, `examprinc`, `examsec`, `concprinc`, `concsec`, `tms`) VALUES (1,2,'2011-05-08','ArthroScanner Genou','ArthroScanner EpauleeeeArthroScanner HancheIRM EpauleggggBilan Radio ScolioseuuuuqqqqlIRM Rachis Cervical','Autre','','2011-05-01 14:47:57'),(2,2,'2011-05-02','dd','ArthroScanner Hanche\r\nBilan Radio Scoliose\r\neeee\r\nElectromiogramme','dd','','2011-05-01 23:49:59'),(3,32,'2011-06-08','ArthroScanner Genou','gdfgdfgdfgdfgdfgdfgd','Autre','','2011-06-08 14:54:45'),(4,32,'2011-06-08','IRM SacroIliaques','','fsdfsdfsdfsd','','2011-06-08 14:57:01'),(5,26,'2011-06-13','Bilan Radio Rhumatisme Inflammatoire','','Autre','','2011-06-13 15:27:39'),(6,26,'2011-06-13','ArthroScanner Genou','Autre','Autre','','2011-06-13 15:29:31'),(7,26,'2011-06-13','Scanner Lombaire','','Hernie discale L4-L5 gauche','','2011-06-13 16:20:47'),(8,65,'2011-07-06','ArthroScanner Hanche','','Autre','','2011-07-06 20:17:54');
/*!40000 ALTER TABLE `llx_cabinetmed_examaut` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_exambio`
--
DROP TABLE IF EXISTS `llx_cabinetmed_exambio`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_exambio` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`fk_soc` int(11) DEFAULT NULL,
`dateexam` date NOT NULL,
`resultat` text,
`conclusion` text,
`comment` text,
`suivipr_ad` int(11) DEFAULT NULL,
`suivipr_ag` int(11) DEFAULT NULL,
`suivipr_vs` int(11) DEFAULT NULL,
`suivipr_eva` int(11) DEFAULT NULL,
`suivipr_err` int(11) DEFAULT NULL,
`suivisa_fat` int(11) DEFAULT NULL,
`suivisa_dax` int(11) DEFAULT NULL,
`suivisa_dpe` int(11) DEFAULT NULL,
`suivisa_dpa` int(11) DEFAULT NULL,
`suivisa_rno` int(11) DEFAULT NULL,
`suivisa_dma` int(11) DEFAULT NULL,
`suivisa_basdai` double DEFAULT NULL,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`suivisa_das28` double DEFAULT NULL,
`suivipr_das28` double DEFAULT NULL,
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_exambio`
--
LOCK TABLES `llx_cabinetmed_exambio` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_exambio` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_exambio` (`rowid`, `fk_soc`, `dateexam`, `resultat`, `conclusion`, `comment`, `suivipr_ad`, `suivipr_ag`, `suivipr_vs`, `suivipr_eva`, `suivipr_err`, `suivisa_fat`, `suivisa_dax`, `suivisa_dpe`, `suivisa_dpa`, `suivisa_rno`, `suivisa_dma`, `suivisa_basdai`, `tms`, `suivisa_das28`, `suivipr_das28`) VALUES (1,2,'2011-05-01','aaajhkh','bbb','ccc',NULL,NULL,NULL,NULL,NULL,1,2,3,4,5,6,NULL,'2011-05-01 14:45:54',NULL,NULL),(3,2,'2011-05-01','dd','hfghfg','',1,2,6,9,NULL,2,2,2,2,2,2,NULL,'2011-05-01 15:24:06',NULL,NULL),(4,2,'2011-05-01','gdfgdf','1111','',NULL,NULL,NULL,NULL,NULL,1,7,8,9,10,11,NULL,'2011-05-01 15:25:17',NULL,NULL),(5,2,'2011-05-01','fdsfsdfsdfsd','ccccc','fsdfsdfs',1,2,4,3,NULL,1,2,3,4,5,6,NULL,'2011-05-01 16:37:51',NULL,NULL),(6,2,'2011-05-01','gfdgdfgdf','gdfgdf','',5,NULL,NULL,NULL,NULL,1,NULL,1,1,NULL,NULL,NULL,'2011-05-01 16:43:49',NULL,NULL),(8,1,'2011-05-01','lkjljkl','','',1,2,4,3,NULL,5,10,5,6,5,5,6.2,'2011-05-01 16:46:00',NULL,1.97),(9,32,'2011-06-08','retert','trete','',1,2,4,1,NULL,2,5,2,5,4,6,NULL,'2011-06-08 14:47:30',NULL,NULL),(10,32,'2011-06-08','fgdfgdfg','gfgdfgdf','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-08 14:54:23',NULL,NULL),(11,26,'2011-06-13','result bio 1','conclusion bio 1','',1,2,4,4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 15:27:15',NULL,NULL),(12,26,'2011-06-13','result bio 2','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 15:27:25',NULL,NULL),(13,26,'2011-06-13','VS8\r\nCRP inférieur ) 5','Pas de syndrome inflammatoire.','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 16:19:08',NULL,NULL),(14,26,'2011-06-13','','','',NULL,NULL,NULL,NULL,NULL,1,2,2,4,5,6,NULL,'2011-06-13 16:19:38',NULL,NULL),(15,26,'2011-06-13','','','',1,2,4,3,NULL,1,2,3,4,5,6,0.31,'2011-06-13 17:50:25',NULL,1.97),(16,36,'2011-06-15','gdfgddfhghghhfghf','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-15 08:02:03',NULL,NULL),(17,65,'2011-07-06','hfghfghgf','Zob','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-06 20:17:33',NULL,NULL),(18,67,'2011-07-11','gfdg','gfdg','gfd',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-10 22:23:21',NULL,NULL),(19,62,'2011-07-13','dfgdf','gdfd','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-13 15:56:27',NULL,NULL);
/*!40000 ALTER TABLE `llx_cabinetmed_exambio` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_examenprescrit`
--
DROP TABLE IF EXISTS `llx_cabinetmed_examenprescrit`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_examenprescrit` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(8) NOT NULL,
`label` varchar(64) NOT NULL,
`biorad` varchar(8) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_examenprescrit`
--
LOCK TABLES `llx_cabinetmed_examenprescrit` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_examenprescrit` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_examenprescrit` (`rowid`, `code`, `label`, `biorad`, `active`) VALUES (1,'AUTRE','Autre','AUTRE',1),(2,'IRMLOMB','IRM lombaire','RADIO',1),(5,'TDMLOMB','TDM lombaires','RADIO',1),(6,'RX BRL','Radios Bassin-Rachis Lombaire','RADIO',1),(7,'RX RL','Radios Rachis Lombaire','RADIO',1),(8,'RX BASS','Radios Bassin','RADIO',1),(9,'RX BH','Radios Bassin et Hanches','RADIO',1),(10,'RX GEN','Radios Genoux','RADIO',1),(11,'RX CHEV','Radios Chevilles','RADIO',1),(12,'RX AVPD','Radios Avants-Pieds','RADIO',1),(13,'RX EP','Radio Epaule','RADIO',1),(14,'RX MAINS','Radios Mains','RADIO',1),(15,'RX COUDE','Radios Coude','RADIO',1),(16,'RX RC','Radios Rachis Cervical','RADIO',1),(17,'RX RD','Radios Rachis Dorsal','RADIO',1),(18,'RX RCD','Radios Rachis CervicoDorsal','RADIO',1),(19,'RX RDL','Radios DorsoLombaire','RADIO',1),(20,'RX SCO','Bilan Radio Scoliose','RADIO',1),(21,'RX RIC','Bilan Radio Rhumatisme Inflammatoire','RADIO',1),(22,'TDM LOMB','Scanner Lombaire','RADIO',1),(23,'TDM DORS','Scanner Dorsal','RADIO',1),(24,'TDM CERV','Scanner Cervical','RADIO',1),(25,'TDM HANC','Scanner Hanche','RADIO',1),(26,'TDM GEN','Scanner Genou','RADIO',1),(27,'RX RDL','Radios Rachis DorsoLombaire','RADIO',1),(28,'ARTTDMG','ArthroScanner Genou','RADIO',1),(29,'ARTTDME','ArthroScanner Epaule','RADIO',1),(30,'ARTTDMH','ArthroScanner Hanche','RADIO',1),(31,'IRM GEN','IRM Genou','RADIO',1),(32,'IRM HANC','IRM Hanche','RADIO',1),(33,'IRM EP','IRM Epaule','RADIO',1),(34,'IRM SIL','IRM SacroIliaques','RADIO',1),(35,'IRM RL','IRM Rachis Lombaire','RADIO',1),(36,'IRM RD','IRM Rachis Dorsal','RADIO',1),(37,'IRM RC','IRM Rachis Cervical','RADIO',1),(38,'ELECMI','Electromiogramme','RADIO',1),(39,'NFS','NFS','BIO',1),(40,'BILPHO','Bilan Phosphocalcique','BIO',1),(41,'VSCRP','VS/CRP','BIO',1),(42,'EPP','Electrophorèse Protéine Plasmatique','BIO',1);
/*!40000 ALTER TABLE `llx_cabinetmed_examenprescrit` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_motifcons`
--
DROP TABLE IF EXISTS `llx_cabinetmed_motifcons`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_motifcons` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(8) NOT NULL,
`label` varchar(64) NOT NULL,
`active` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_motifcons`
--
LOCK TABLES `llx_cabinetmed_motifcons` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_motifcons` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_motifcons` (`rowid`, `code`, `label`, `active`) VALUES (5,'AUTRE','Autre',1),(6,'DORS','Dorsalgie',1),(7,'DOLMSD','Douleur Membre supérieur Droit',1),(8,'DOLMSG','Douleur Membre supérieur Gauche',1),(9,'DOLMID','Douleur Membre inférieur Droit',1),(10,'DOLMIG','Douleur Membre inférieur Gauche',1),(11,'PARESM','Paresthésie des mains',1),(12,'DOLEPG','Douleur épaule gauche',1),(13,'DOLEPD','Douleur épaule droite',1),(14,'GONAD','Gonaglie droite',1),(15,'GONAG','Gonalgie gauche',1),(16,'DOLPD','Douleur Pied Droit',1),(17,'DOUL MIN','Douleur Membre Inférieur',1),(18,'POLYAR','Polyarthralgie',1),(19,'SUIVIPR','Suivi PR',1),(20,'SUIVISPA','Suivi SPA',1),(21,'SUIVIRIC','Suivi RI',1),(22,'SUIVIPPR','Suivi PPR',1),(23,'DOLINGD','Douleur inguinale Droit',1),(24,'DOLINGG','Douleur inguinale Gauche',1),(25,'DOLCOUDD','Douleur coude Droit',1),(26,'DOLCOUDG','Douleur coude Gauche',1),(27,'TALAL','Talalgie',1),(28,'DOLTENDC','Douleur tandous Calcanien',1),(29,'DEROB','Dérobement Membres Inférieurs',1),(30,'LOMB MEC','Lombalgies Mécaniques',1),(31,'LOMB INF','Lombalgies Inflammatoires',1),(32,'DORS MEC','Dorsalgies Mécaniques',1),(33,'DORS INF','Dorsalgies Inflammatoires',1),(34,'CERV MEC','Cervicalgies Mécaniques',1),(35,'SCIAT','LomboSciatique ',1),(36,'CRUR','LomboCruralgie',1),(37,'DOUL SUP','Douleur Membre Supérieur',1),(38,'INGUINAL','Inguinalgie',1),(39,'CERV INF','Cervicalgies Inflammatoires',1),(40,'DOUL EP','Douleur Epaule',1),(41,'DOUL POI','Douleur Poignet',1),(42,'DOUL GEN','Douleur Genou',1),(43,'DOUL COU','Douleur Coude',1),(44,'DOUL HAN','Douleur Hanche',1),(45,'PAR MBRS','Paresthésies Membres Inférieurs',1),(46,'PAR MBRI','Paresthésies Membres Supérieurs',1),(47,'TR RACHI','Traumatisme Rachis',1),(48,'TR MBRS','Traumatisme Membres Supérieurs',1),(49,'TR MBRI','Traumatisme Membres Inférieurs',1),(50,'FAT MBRI','Fatiguabilité Membres Inférieurs',1),(51,'DOUL CHE','Douleur Cheville',1),(52,'DOUL PD','Douleur Pied',1),(53,'DOUL MA','Douleur Main',1);
/*!40000 ALTER TABLE `llx_cabinetmed_motifcons` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_cabinetmed_patient`
--
DROP TABLE IF EXISTS `llx_cabinetmed_patient`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `llx_cabinetmed_patient` (
`rowid` int(11) NOT NULL AUTO_INCREMENT,
`note_antemed` text,
`note_antechirgen` text,
`note_antechirortho` text,
`note_anterhum` text,
`note_other` text,
`note_traitclass` text,
`note_traitallergie` text,
`note_traitintol` text,
`note_traitspec` text,
PRIMARY KEY (`rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `llx_cabinetmed_patient`
--
LOCK TABLES `llx_cabinetmed_patient` WRITE;
/*!40000 ALTER TABLE `llx_cabinetmed_patient` DISABLE KEYS */;
INSERT INTO `llx_cabinetmed_patient` (`rowid`, `note_antemed`, `note_antechirgen`, `note_antechirortho`, `note_anterhum`, `note_other`, `note_traitclass`, `note_traitallergie`, `note_traitintol`, `note_traitspec`) VALUES (2,'fffgfgfgf','','','','jjj','aaaagggggggg','','',''),(5,'a','b','c','d','','','','i','u'),(8,NULL,NULL,NULL,NULL,NULL,'','','','tr<span style=\"color: rgb(178, 34, 34);\"><strong>e tre tert</strong></span>er<br />\r\nt<br />\r\nter tert'),(26,NULL,NULL,NULL,NULL,NULL,'','','intol','spec pharma'),(46,'hfhf','dddd','','hfghfg','',NULL,'',NULL,NULL);
/*!40000 ALTER TABLE `llx_cabinetmed_patient` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `llx_categorie`
--

11
htdocs/.gitignore vendored
View File

@@ -1,2 +1,11 @@
/test.php
/custom*
/custom*
/extensions*
/nltechno*
/bootstrap*
/google*
/multicompany*
/numberingpack*
/ovh*
/pos
/ultimatepdf*

View File

@@ -400,12 +400,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! $error)
{
$bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque);
if (! $bank_line_id > 0)
if (! ($bank_line_id > 0))
{
$errmsg=$paiement->error;
$errmsgs=$paiement->errors;
$error++;
}
}
if (! $error)
{
// Update fk_bank for subscriptions
$sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id;
$sql.= ' WHERE rowid='.$crowid;

View File

@@ -213,7 +213,7 @@ $var=true;
*/
$max=5;
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " a.tms as datem, datefin as date_end_subscription,";
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
@@ -242,11 +242,18 @@ if ($resql)
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
if (! empty($obj->fk_soc)) {
$staticmember->socid = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name;
} else {
$staticmember->name=$obj->company;
}
$staticmember->ref=$staticmember->getFullName($langs);
$statictype->id=$obj->typeid;
$statictype->libelle=$obj->libelle;
print '<td>'.$staticmember->getNomUrl(1,24).'</td>';
print '<td>'.$statictype->getNomUrl(1,16).'</td>';
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '</tr>';
@@ -266,7 +273,7 @@ else
*/
$max=5;
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " datefin as date_end_subscription,";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
@@ -297,9 +304,16 @@ if ($resql)
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
if (! empty($obj->fk_soc)) {
$staticmember->socid = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name;
} else {
$staticmember->name=$obj->company;
}
$staticmember->ref=$staticmember->getFullName($langs);
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td>'.$staticmember->getNomUrl(1,24,'subscription').'</td>';
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
print '<td align="right">'.price($obj->cotisation).'</td>';
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
@@ -330,7 +344,7 @@ foreach ($AdherentType as $key => $adhtype)
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';

View File

@@ -82,7 +82,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute
$now=dol_now();
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, ";
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
@@ -130,7 +130,7 @@ if ($filter == 'uptodate')
}
if ($filter == 'outofdate')
{
$sql.=" AND datefin < '".$db->idate($now)."'";
$sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
}
// Insert categ filter
if ($search_categ)
@@ -237,7 +237,7 @@ if ($resql)
print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array();
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
@@ -267,6 +267,14 @@ if ($resql)
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$companyname=$memberstatic->thirdparty->name;
} else {
$companyname=$objp->company;
}
$var=!$var;
print "<tr ".$bc[$var].">";
@@ -276,14 +284,11 @@ if ($resql)
print "</td>\n";
// Lastname
if ($objp->societe != '')
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n";
}
else
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))."</a></td>\n";
}
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">";
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
print "</a></td>\n";
// Login
print "<td>".$objp->login."</td>\n";
@@ -292,7 +297,7 @@ if ($resql)
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
print '<td nowrap="nowrap">';
print $membertypestatic->getNomUrl(1,12);
print $membertypestatic->getNomUrl(1,32);
print '</td>';
// Moral/Physique

View File

@@ -126,15 +126,22 @@ clearstatcache();
//if ($mesg) print "<br>$mesg<br>";
print "<br>";
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Show message
$message='';
$urlvcal='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$urlvcal='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal);
$message.='<br>';
$urlical='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$urlical='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'ical/ics',$urlical);
$message.='<br>';
$urlrss='<a href="'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.DOL_MAIN_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$urlrss='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('','object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport",'rss',$urlrss);
$message.='<br>';
$message.='<br>';

View File

@@ -355,7 +355,6 @@ foreach ($dirmodels as $reldir)
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0;
$nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{

View File

@@ -31,9 +31,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
$langs->load("errors");
$langs->load("admin");
$mode=isset($_GET["mode"])?GETPOST("mode"):(isset($_SESSION['mode'])?$_SESSION['mode']:0);
$mode=GETPOST('mode', 'alpha');
if (!isset($mode)) {
if (isset($_SESSION['mode'])) { $mode=$_SESSION['mode'];}
else {$mode=0;}
}
$mesg=GETPOST("mesg");
$action=GETPOST('action');
$action=GETPOST('action', 'alpha');
$value=GETPOST('value', 'alpha');
if (!$user->admin) accessforbidden();
@@ -44,7 +49,7 @@ if (!$user->admin) accessforbidden();
if ($action == 'set' && $user->admin)
{
$result=activateModule($_GET["value"]);
$result=activateModule($value);
$mesg='';
if ($result) $mesg=$result;
Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
@@ -53,7 +58,7 @@ if ($action == 'set' && $user->admin)
if ($action == 'reset' && $user->admin)
{
$result=unActivateModule($_GET["value"]);
$result=unActivateModule($value);
$mesg='';
if ($result) $mesg=$result;
Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
@@ -128,9 +133,9 @@ foreach ($modulesdir as $dir)
{
$mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
dol_syslog($mesg, LOG_ERR);
continue;
continue;
}
try
{
$res=include_once($dir.$file);

View File

@@ -61,6 +61,7 @@ if ($id || $ref)
$elementtype = 'fournisseur';
$objecttype = 'societe&categorie';
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
$dbtablename = '&societe';
$fieldid = 'rowid';
}
if ($type == 2) {

View File

@@ -878,8 +878,11 @@ class ActionComm extends CommonObject
$event['location']=$obj->location;
$event['transparency']='TRANSPARENT'; // OPAQUE (busy) or TRANSPARENT (not busy)
$event['category']=$obj->libelle; // libelle type action
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
$url=$urlwithouturlroot.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithroot.'/comm/action/fiche.php?id='.$obj->id;
$event['url']=$url;
$event['created']=$this->db->jdate($obj->datec);
$event['modified']=$this->db->jdate($obj->datem);

View File

@@ -142,6 +142,7 @@ if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid;
if ($_GET["type"]) $param.="&type=".$_REQUEST["type"];
if ($actioncode) $param.="&actioncode=".$actioncode;
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,";

View File

@@ -2163,7 +2163,7 @@ class Propal extends CommonObject
$this->mode_reglement_id = 7;
$this->mode_reglement_code = 'CHQ';
$this->availability_id = 1;
$this->availability_code = 'DSP';
$this->availability_code = 'AV_NOW';
$this->demand_reason_id = 1;
$this->demand_reason_code = 'SRC_00';
$this->note_public='This is a comment (public)';
@@ -2710,7 +2710,6 @@ class PropaleLigne
}
$sql.= " , marge_tx='".$this->marge_tx."'";
$sql.= " , marque_tx='".$this->marque_tx."'";
$sql.= " , info_bits=".$this->info_bits;
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code;
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;

View File

@@ -193,7 +193,7 @@ if ($conf->propal->enabled)
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
print '</tr>';
$i++;
}
@@ -260,7 +260,7 @@ if ($resql)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@@ -270,7 +270,7 @@ if ($resql)
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,5).'</td>';
print '</tr>';
@@ -339,7 +339,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
print '</td></tr></table>';
print "</td>";
$companystatic->id=$obj->socid;
$companystatic->name=$obj->socname;
$companystatic->client=$obj->client;
@@ -419,7 +419,7 @@ if ($conf->propal->enabled)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';
@@ -491,7 +491,7 @@ if ($conf->propal->enabled)
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
print '</td>';

View File

@@ -2108,9 +2108,10 @@ class Commande extends CommonObject
* @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line Parent line id
* @param int $skip_update_total Skip update of total
* @param int $special_code Special code
* @return int < 0 if KO, > 0 if OK
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $special_code=0)
{
global $conf;
@@ -2129,6 +2130,7 @@ class Commande extends CommonObject
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($remise)) $remise=0;
if (empty($remise_percent)) $remise_percent=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu = price2num($pu);
@@ -2181,6 +2183,7 @@ class Commande extends CommonObject
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$subprice;
$this->line->info_bits=$info_bits;
$this->line->special_code=$special_code;
$this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva;
$this->line->total_localtax1=$total_localtax1;
@@ -3035,6 +3038,7 @@ class OrderLine
if (empty($this->remise)) $this->remise=0;
if (empty($this->remise_percent)) $this->remise_percent=0;
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->product_type)) $this->product_type=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
@@ -3060,6 +3064,7 @@ class OrderLine
$sql.= " , total_localtax1=".price2num($this->total_localtax1);
$sql.= " , total_localtax2=".price2num($this->total_localtax2);
$sql.= " , info_bits=".$this->info_bits;
$sql.= " , special_code=".$this->special_code;
if ($this->date_start) { $sql.= " , date_start='".$this->db->idate($this->date_start)."'"; }
else { $sql.=' , date_start=null'; }
if ($this->date_end) { $sql.= " , date_end='".$this->db->idate($this->date_end)."'"; }

View File

@@ -738,6 +738,11 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ;
}
// Define special_code for special lines
$special_code=0;
if (empty($_POST['qty'])) $special_code=3;
// Check minimum price
if(! empty($_POST['productid']))
{

View File

@@ -509,7 +509,6 @@ if ($id > 0 || ! empty($ref))
// Payment type
print "<td nowrap>";
$label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
// $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type);
if ($objp->fk_type == 'SOLD') $label='&nbsp;';
print $label;

View File

@@ -117,11 +117,6 @@ if (is_numeric($credit)) {
$si++;
$sqlw[$si] .= " b.amount = " . $credit;
}
// Search criteria description
if ($description) {
$si++;
$sqlw[$si] .= " b.label like '%" . $description . "%'";
}
// Other search criteria
for ($i = 1 ; $i <= $si; $i++) {
$sql .= " AND " . $sqlw[$i];
@@ -195,75 +190,87 @@ if ($resql)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
// Ref
print '<td align="left" nowrap="nowrap">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."</a> &nbsp; ";
print '</td>';
// Date ope
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
// Date value
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
// Payment type
print "<td align=\"center\">";
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;
print "</td>\n";
// Num
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
// Description
print "<td>";
print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
print "</a>&nbsp;";
print '</td>';
// Third party
print "<td>";
if ($objp->url_id)
{
$companystatic->id=$objp->url_id;
$companystatic->nom=$objp->labelurl;
print $companystatic->getNomUrl(1);
$printline=false;
//Search Description
if ($description) {
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1]) {
if ($langs->transnoentities($reg[1])==$description) {
$printline=true;
}
}elseif ($objp->label==$description) {$printline=true;}
}else {$printline=true;}
if ($printline) {
$var=!$var;
print "<tr $bc[$var]>";
// Ref
print '<td align="left" nowrap="nowrap">';
print "<a href=\"ligne.php?rowid=".$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid."</a> &nbsp; ";
print '</td>';
// Date ope
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
// Date value
print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day")."</td>\n";
// Payment type
print "<td align=\"center\">";
$labeltype=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$langs->getLabelFromKey($db,$objp->fk_type,'c_paiement','code','libelle');
if ($labeltype == 'SOLD') print '&nbsp;'; //$langs->trans("InitialBankBalance");
else print $labeltype;
print "</td>\n";
// Num
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
// Description
print "<td>";
print "<a href=\"ligne.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthee on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
else print dol_trunc($objp->label,40);
print "</a>&nbsp;";
print '</td>';
// Third party
print "<td>";
if ($objp->url_id)
{
$companystatic->id=$objp->url_id;
$companystatic->nom=$objp->labelurl;
print $companystatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Debit/Credit
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
}
// Bank account
print '<td align="left" nowrap="nowrap">';
$bankaccountstatic->id=$objp->bankid;
$bankaccountstatic->label=$objp->bankref;
print $bankaccountstatic->getNomUrl(1);
print "</td>\n";
print "</tr>";
}
else
{
print '&nbsp;';
}
print '</td>';
// Debit/Credit
if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
}
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</td>\n";
}
// Bank account
print '<td align="left" nowrap="nowrap">';
$bankaccountstatic->id=$objp->bankid;
$bankaccountstatic->label=$objp->bankref;
print $bankaccountstatic->getNomUrl(1);
print "</td>\n";
print "</tr>";
$i++;
}

View File

@@ -265,6 +265,15 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
{
$object->fetch($id);
$object->date_lim_reglement=dol_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']);
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date;
$result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setconditions' && $user->rights->facture->creer)
{
$object->fetch($id);
@@ -971,7 +980,11 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$price_base_type = 'HT';
// Ecrase $pu par celui du produit
// Define special_code for special lines
$special_code=0;
//if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit
@@ -1090,7 +1103,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$pu_ttc,
$type,
-1,
0,
$special_code,
'',
0,
GETPOST('fk_parent_line')
@@ -1162,6 +1175,11 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
$result = -1 ;
}
// Define special_code for special lines
$special_code=0;
//if (empty($_POST['qty'])) $special_code=3; // Option should not exists onto invoices
// Check minimum price
if (GETPOST('productid'))
{
@@ -2893,7 +2911,7 @@ else
{
print '<div class="tabsAction">';
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
// Modify a validated invoice with no payments and not already exported into accountancy
if ($object->statut == 1)
{
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees

View File

@@ -126,8 +126,8 @@ class FactureRec extends Facture
$sql.= ", '".$facsrc->socid."'";
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->db->idate(mktime());
$sql.= ", '".$facsrc->amount."'";
$sql.= ", '".$facsrc->remise."'";
$sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0');
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
$sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$user->id."'";
$sql.= ", ".($facsrc->fk_project?"'".$facsrc->fk_project."'":"null");

View File

@@ -1802,7 +1802,7 @@ class Facture extends CommonObject
$mouvP = new MouvementStock($this->db);
// We decrease stock for product
if ($this->type == 2) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref)); // we use 0 for price, to not change the weighted average value
}
}
}
@@ -2017,9 +2017,10 @@ class Facture extends CommonObject
* @param int $type Type of line (0=product, 1=service)
* @param int $fk_parent_line ???
* @param int $skip_update_total ???
* @param int $special_code Special code
* @return int < 0 if KO, > 0 if OK
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $special_code=0)
{
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
@@ -2032,6 +2033,7 @@ class Facture extends CommonObject
// Clean parameters
if (empty($qty)) $qty=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
@@ -2100,6 +2102,7 @@ class Facture extends CommonObject
$this->line->product_type = $type;
$this->line->fk_parent_line = $fk_parent_line;
$this->line->skip_update_total = $skip_update_total;
$this->line->special_code = $special_code;
// A ne plus utiliser
//$this->line->price=$price;
@@ -3632,6 +3635,7 @@ class FactureLigne
//if (empty($this->remise)) $this->remise=0;
if (empty($this->remise_percent)) $this->remise_percent=0;
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->product_type)) $this->product_type=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
@@ -3659,6 +3663,7 @@ class FactureLigne
else { $sql.=',date_end=null'; }
$sql.= ",product_type=".$this->product_type;
$sql.= ",info_bits='".$this->info_bits."'";
$sql.= ",special_code='".$this->special_code."'";
if (empty($this->skip_update_total))
{
$sql.= ",total_ht=".price2num($this->total_ht)."";

View File

@@ -128,6 +128,20 @@ if ($action == "builddoc" && $user->rights->facture->lire)
}
}
// Remove file
if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $diroutputpdf;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,'');
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action='';
}
/*

View File

@@ -148,7 +148,7 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Date")."</td>";
print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
print "<td>".$langs->trans("Account")."</td>";
print "<t><td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
print "</tr>\n";
$var=true;
@@ -202,7 +202,7 @@ foreach ($tabfac as $key => $val)
foreach ($tabttc[$key] as $k => $mt)
{
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td>";
print '<td align="right">'.($mt<0?-price(-$mt):'')."</td>";
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
}
print "</tr>";

View File

@@ -156,7 +156,7 @@ print "<tr class=\"liste_titre\">";
//print "<td>".$langs->trans("JournalNum")."</td>";
print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
print "<td>".$langs->trans("Account")."</td>";
print "<t><td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
print "</tr>\n";
$var=true;

View File

@@ -442,12 +442,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
$sql.= ' f.datef as df';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.fk_soc = '.$facture->socid;
$sql.= ' WHERE f.entity = '.$conf->entity;
$sql.= ' AND f.fk_soc = '.$facture->socid;
$sql.= ' AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
if ($facture->type != 2)
{
$sql .= ' AND type in (0,1,3)'; // Standard invoice, replacement, deposit
$sql .= ' AND type IN (0,1,3)'; // Standard invoice, replacement, deposit
}
else
{

View File

@@ -140,7 +140,7 @@ if ($action == 'setnum' && ! empty($_POST['num_paiement']))
}
}
if ($action == 'setdate' && ! empty($_POST['datepday']))
if ($action == 'setdatep' && ! empty($_POST['datepday']))
{
$object->fetch($id);
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']);

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,8 +36,7 @@ $action=GETPOST("action");
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');

View File

@@ -262,8 +262,12 @@ class ChargeSociales extends CommonObject
*/
function solde($year = 0)
{
$sql = "SELECT sum(f.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f WHERE paye = 0";
global $conf;
$sql = "SELECT SUM(f.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND paye = 0";
if ($year) {
$sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
@@ -300,8 +304,8 @@ class ChargeSociales extends CommonObject
*/
function set_paid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
$sql.= " set paye=1";
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql.= " paye = 1";
$sql.= " WHERE rowid = ".$this->id;
$return = $this->db->query($sql);
if ($return) return 1;

View File

@@ -35,7 +35,7 @@ $action=GETPOST("action");
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
/*

View File

@@ -205,11 +205,14 @@ $dolibarr_main_authentication='dolibarr';
//##################
// dolibarr_main_force_https
// This parameter allows to force the HTTPS mode.
// This parameter allows to force the HTTPS mode.
// 0 = No forced redirect
// 1 = Force redirect to https until SCRIPT_URI start with https
// 2 = Force redirect to https until SERVER["HTTPS"] is 'on'
// Warning: If you enable this parameter, your web server must be configured
// to respond URL with https protocol.
// Default value: 0
// Possible values: 0 or 1
// Possible values: 0, 1 or 2
// Examples:
// $dolibarr_main_force_https='0';
//
@@ -292,4 +295,4 @@ $dolibarr_main_prod='0';
// Examples:
// $multicompany_transverse_mode='1';
?>
?>

View File

@@ -50,11 +50,11 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
if (! empty($value)) $newroworder[] = $value;
}
dol_syslog("AjaxRow roworder=".GETPOST('roworder','alpha',2)." fk_element=".GETPOST('fk_element','int',2), LOG_DEBUG);
dol_syslog("AjaxRow roworder=".GETPOST('roworder','alpha',2)." fk_element=".GETPOST('fk_element','alpha',2), LOG_DEBUG);
$row=new GenericObject($db);
$row->table_element_line = GETPOST('table_element_line','alpha',2);
$row->fk_element = GETPOST('fk_element','int',2);
$row->fk_element = GETPOST('fk_element','alpha',2);
$row->id = GETPOST('element_id','int',2);
$result=$row->line_ajaxorder($newroworder);
$result=$row->line_order(true);

View File

@@ -73,7 +73,8 @@ class box_members extends ModeleBoxes
if ($user->rights->societe->lire)
{
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE a.entity = ".$conf->entity;
@@ -97,6 +98,14 @@ class box_members extends ModeleBoxes
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$memberstatic->name=$memberstatic->thirdparty->name;
} else {
$memberstatic->name=$objp->company;
}
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid);

View File

@@ -103,11 +103,15 @@ class CMailFile
{
global $conf;
// We define end of line (RFC 822bis section 2.3)
// We define end of line (RFC 821).
$this->eol="\r\n";
// eol2 is for header fields to manage bugged MTA with option MAIN_FIX_FOR_BUGGED_MTA
$this->eol2=$this->eol;
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) $this->eol2="\n";
// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
$this->eol2="\r\n";
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
$this->eol="\n";
$this->eol2="\n";
}
// On defini mixed_boundary
$this->mixed_boundary = "multipart_x." . time() . ".x_boundary";
@@ -494,6 +498,7 @@ class CMailFile
/**
* Write content of a SMTP request into a dump file (mode = all)
* Used for debugging.
* Note that to see full SMTP protocol, you can use tcpdump -w /tmp/smtp -s 2000 port 25"
*
* @return void
*/
@@ -593,7 +598,11 @@ class CMailFile
// Sender
//$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2;
$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol2;
$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol2;
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA))
{
$out.= "To: ".$this->getValidAddress($this->addr_to,0,1).$this->eol2;
}
$out.= "Return-Path: ".$this->getValidAddress($this->addr_from,0,1).$this->eol2;
if (isset($this->reply_to) && $this->reply_to) $out.= "Reply-To: ".$this->getValidAddress($this->reply_to,2).$this->eol2;
if (isset($this->errors_to) && $this->errors_to) $out.= "Errors-To: ".$this->getValidAddress($this->errors_to,2).$this->eol2;
@@ -688,7 +697,11 @@ class CMailFile
// Make RFC821 Compliant, replace bare linefeeds
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
}
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
$strContent = rtrim(wordwrap($strContent));
@@ -1013,4 +1026,4 @@ class CMailFile
}
}
?>
?>

View File

@@ -140,6 +140,26 @@ abstract class CommonDocGenerator
);
}
/**
* Rect pdf
*
* @param PDF $pdf Object PDF
* @param float $x Abscissa of first point
* @param float $y Ordinate of first point
* @param float $l ??
* @param float $h ??
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int $hidebottom Hide bottom
* @return void
*/
function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
{
if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
$pdf->line($x+$l, $y, $x+$l, $y+$h);
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
$pdf->line($x, $y+$h, $x, $y);
}
}
?>

View File

@@ -2991,19 +2991,19 @@ class Form
//print "name=$name, selectedrate=$selectedrate, seller=".$societe_vendeuse->country_code." buyer=".$societe_acheteuse->country_code." buyer is company=".$societe_acheteuse->isACompany()." idprod=$idprod, info_bits=$info_bits type=$type";
//exit;
// Get list of all VAT rates to show
// Define list of countries to use to search VAT rates to show
// First we defined code_pays to use to find list
if (is_object($societe_vendeuse))
{
$code_pays="'".$societe_vendeuse->country_code."'";
}
else
{
{
$code_pays="'".$mysoc->country_code."'"; // Pour compatibilite ascendente
}
if (! empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on
{
if (! $societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany())
if (! $societe_vendeuse->isInEEC() && (! is_object($societe_acheteuse) || ($societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany())))
{
// We also add the buyer
if (is_numeric($type))

View File

@@ -59,13 +59,14 @@ class FormFile
* @param int $size Length of input file area
* @param Object $object Object to use (when attachment is done on an element)
* @param string $options Options
* @param boolean $useajax Use ajax if enabled
* @return int <0 if KO, >0 if OK
*/
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='')
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true)
{
global $conf,$langs;
if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax)
{
return $this->_formAjaxFileUpload($object);
}
@@ -596,7 +597,7 @@ class FormFile
print '</a>';
print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
print '<td align="center">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
// Preview
if (empty($useinecm))
{
@@ -804,7 +805,7 @@ class FormFile
$upload_max_filesize = $mul_upload_max_filesize * (int) $upload_max_filesize;
// Max file size
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
// Include main
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');

View File

@@ -954,7 +954,9 @@ class Ldap
if (is_array($attributeArray))
{
// Return list with required fields
$attributeArray=array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails)
dol_syslog("Ldap::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter. " attributeArray=(".join(',',$attributeArray).")");
//var_dump($attributeArray);
$this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
}
else

View File

@@ -114,9 +114,12 @@ class Menubase
$obj=$this->db->fetch_object($resqlrowid);
$maxrowid=$obj->maxrowid;
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
$resqlrowidset=$this->db->query($sql);
if (! $resqlrowidset) dol_print_error($this->db);
// Max rowid can be empty if there is no record yet
if(empty($maxrowid)) $maxrowid=1;
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
$resqlrowidset=$this->db->query($sql);
if (! $resqlrowidset) dol_print_error($this->db);
}
else dol_print_error($this->db);
}

View File

@@ -172,26 +172,30 @@ class Notify
$message.= "\n";
$message.= $texte;
// Add link
$link='';
switch($objet_type)
{
case 'ficheinter':
$link=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$objet_id;
$link='/fichinter/fiche.php?id='.$objet_id;
break;
case 'propal':
$link=DOL_URL_ROOT.'/comm/propal.php?id='.$objet_id;
$link='/comm/propal.php?id='.$objet_id;
break;
case 'facture':
$link=DOL_URL_ROOT.'/compta/facture.php?facid='.$objet_id;
$link='/compta/facture.php?facid='.$objet_id;
break;
case 'order':
$link=DOL_URL_ROOT.'/commande/fiche.php?facid='.$objet_id;
$link='/commande/fiche.php?facid='.$objet_id;
break;
case 'order_supplier':
$link=DOL_URL_ROOT.'/fourn/commande/fiche.php?facid='.$objet_id;
$link='/fourn/commande/fiche.php?facid='.$objet_id;
break;
}
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
if ($link) $message.="\n".$urlwithouturlroot.$link;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
if ($link) $message.="\n".$urlwithroot.$link;
$filename = basename($file);

View File

@@ -327,6 +327,7 @@ class Translate
/**
* Return translated value of key. Search in lang file, then into database.
* Key must be any complete entry into lang file: CurrencyEUR, ...
* If not found, return key.
* WARNING: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), getLabelFromKey must
* not be called with same value than input.
@@ -334,9 +335,11 @@ class Translate
* @param string $key Key to translate
* @return string Translated string
*/
function getTradFromKey($key)
private function getTradFromKey($key)
{
global $db;
//print 'xx'.$key;
$newstr=$key;
if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg))
{
@@ -385,6 +388,18 @@ class Translate
{
$str=$this->tab_translate[$key];
// Overwrite translation
$overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2
{
$tmparray=explode(',', $conf->global->$overwritekey);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
}
}
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
if ($maxsize) $str=dol_trunc($str,$maxsize);
@@ -398,17 +413,6 @@ class Translate
// Restore HTML tags
$str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str);
// Overwrite translation
if (! empty($conf->global->MAIN_OVERWRITE_TRANS)) // Overwrite translation with string1:newstring1,string2:newstring2
{
$tmparray=explode(',', $conf->global->MAIN_OVERWRITE_TRANS);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
if ($tmparray2[0]==$str) { $str=$tmparray2[1]; break; }
}
}
return $str;
}
else // Translation is not available
@@ -455,10 +459,24 @@ class Translate
*/
function transnoentitiesnoconv($key, $param1='', $param2='', $param3='', $param4='')
{
global $conf;
if (! empty($this->tab_translate[$key])) // Translation is available
{
$str=$this->tab_translate[$key];
// Overwrite translation
$overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2
{
$tmparray=explode(',', $conf->global->$overwritekey);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
}
}
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
}
else
@@ -598,7 +616,7 @@ class Translate
$newdir=dol_osencode($dir);
// Check if directory exists
if (! dol_is_dir($dir)) continue;
if (! is_dir($newdir)) continue; // We must not use dol_is_dir here, function may not be loaded
$fonc='numberwords';
if (file_exists($newdir.'/functions_'.$fonc.'.lib.php'))
@@ -614,25 +632,28 @@ class Translate
/**
* Return a label for a key. Store key-label into cache variable $this->cache_labels to save SQL requests to get labels.
* This function can be used to get label in database but more often to get code from key id.
* Return a label for a key.
* Search into translation array, then into cache, then if still not found, search into database.
* Store key-label found into cache variable $this->cache_labels to save SQL requests to get labels.
*
* @param DoliBD $db Database handler
* @param string $key Key to get label (key in language file)
* @param string $tablename Table name without prefix
* @param string $fieldkey Field for key
* @param string $fieldlabel Field for label
* @return string Label in UTF8 (but without entities)
* @param DoliBD $db Database handler
* @param string $key Key to get label (key in language file)
* @param string $tablename Table name without prefix
* @param string $fieldkey Field for key
* @param string $fieldlabel Field for label
* @return string Label in UTF8 (but without entities)
*/
function getLabelFromKey($db,$key,$tablename,$fieldkey,$fieldlabel)
{
// If key empty
if ($key == '') return '';
// Check in language array
if ($this->transnoentities($key) != $key)
//print 'param: '.$key.'-'.$keydatabase.'-'.$this->trans($key); exit;
// Check if in language array (this can call getTradFromKey)
if ($this->transnoentitiesnoconv($key) != $key)
{
return $this->transnoentities($key); // Found in language array
return $this->transnoentitiesnoconv($key); // Found in language array
}
// Check in cache
@@ -665,4 +686,4 @@ class Translate
}
?>
?>

View File

@@ -1025,23 +1025,35 @@ class DoliDBPgsql
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
* TODO modify for postgresql
*
*/
function DDLInfoTable($table)
{
/*
$infotables=array();
$sql="SHOW FULL COLUMNS FROM ".$table.";";
$sql="SELECT ";
$sql.=" infcol.column_name as \"Column\",";
$sql.=" CASE WHEN infcol.character_maximum_length IS NOT NULL THEN infcol.udt_name || '('||infcol.character_maximum_length||')'";
$sql.=" ELSE infcol.udt_name";
$sql.=" END as \"Type\",";
$sql.=" infcol.collation_name as \"Collation\",";
$sql.=" infcol.is_nullable as \"Null\",";
$sql.=" '' as \"Key\",";
$sql.=" infcol.column_default as \"Default\",";
$sql.=" '' as \"Extra\",";
$sql.=" '' as \"Privileges\"";
$sql.=" FROM information_schema.columns infcol";
$sql.=" WHERE table_schema='public' ";
$sql.=" AND table_name='".$table."'";
$sql.=" ORDER BY ordinal_position;";
dol_syslog($sql,LOG_DEBUG);
$result = $this->pg_query($this->db,$sql);
$result = $this->query($sql);
while($row = $this->fetch_row($result))
{
$infotables[] = $row;
}
return $infotables;
*/
}
return $infotables;
}

View File

@@ -51,7 +51,7 @@ function societe_prepare_head($object)
$head[$h][2] = 'prospect';
$h++;
}
if ($object->client==1 || $object->client==3 || (is_object($object->object) && $object->object->client==1) || (is_object($object->object) && $object->object->client==3))
if ($object->client==1 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3))
{
$head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Customer");

View File

@@ -944,10 +944,10 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
global $conf;
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
// Clean parameters
if ($hour == -1) $hour=0;
if ($minute == -1) $minute=0;
if ($second == -1) $second=0;
// Clean parameters
if ($hour == -1 || empty($hour)) $hour=0;
if ($minute == -1 || empty($minute)) $minute=0;
if ($second == -1 || empty($second)) $second=0;
// Check parameters
if ($check)
@@ -3332,6 +3332,28 @@ function dol_textishtml($msg,$option=0)
}
}
/**
* Concat 2 descriptions (second one after first one)
* text1 html + text2 html => text1 + '<br>' + text2
* text1 html + text2 txt => text1 + '<br>' + dol_nl2br(text2)
* text1 txt + text2 html => dol_nl2br(text1) + '<br>' + text2
* text1 txt + text2 txt => text1 + '\n' + text2
*
* @param string $text1 Text 1
* @param string $text2 Text 2
* @param string $forxml false=Use <br>, true=Use <br />
* @return string Text 1 + new line + Text2
* @see dol_textishtml
*/
function dol_concatdesc($text1,$text2,$forxml=false)
{
$ret='';
$ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1;
$ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"<br \>\n":"<br>\n") : "\n") : "";
$ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2;
return $ret;
}
/**
* Make substition into a string
* There is two type of substitions:

View File

@@ -137,7 +137,11 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
*/
function pdf_getPDFFont($outputlangs)
{
$font='Helvetica'; // By default, for FPDI or ISO language on TCPDF
global $conf;
if (! empty($conf->global->MAIN_PDF_FORCE_FONT)) return $conf->global->MAIN_PDF_FORCE_FONT;
$font='Helvetica'; // By default, for FPDI, or ISO language on TCPDF
if (class_exists('TCPDF')) // If TCPDF on, we can use an UTF8 one like DejaVuSans if required (slower)
{
if ($outputlangs->trans('FONTFORPDF')!='FONTFORPDF')
@@ -355,7 +359,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
$watermark_angle=atan($h/$w);
$watermark_x=5;
$watermark_y=$h-25; //Set to $this->page_hauteur-50 or less if problems
$watermark_y=$h-50; // We must be sure to not print into margins
$watermark_width=$h;
$pdf->SetFont('','B',50);
$pdf->SetTextColor(255,192,203);
@@ -524,22 +528,25 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
* @param Translate $outputlangs Object lang for output
* @param string $paramfreetext Constant name of free text
* @param Societe $fromcompany Object company
* @param int $marge_basse Margin bottom
* @param int $marge_gauche Margin left
* @param int $page_hauteur Page height
* @param int $marge_basse Margin bottom we use for the autobreak
* @param int $marge_gauche Margin left (no more used)
* @param int $page_hauteur Page height (no more used)
* @param Object $object Object shown in PDF
* @param int $showdetails Show company details
* @return void
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version.
* @param int $hidefreetext 1=Hide free text, 0=Show free text
* @return int Return height of bottom margin including footer text
*/
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object,$showdetails=0)
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object,$showdetails=0,$hidefreetext=0)
{
global $conf,$user;
$outputlangs->load("dict");
$line='';
$dims=$pdf->getPageDimensions();
// Line of free text
if (! empty($conf->global->$paramfreetext))
if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext))
{
// Make substitution
$substitutionarray=array(
@@ -656,64 +663,73 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
//print 'nbofline='.$nbofline; exit;
//print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy=$marge_basse + ($nbofline*3) + ($line1?3:0) + ($line2?3:0) + ($line3?3:0) + ($line4?3:0);
$freetextheight=0;
if ($line) // Free text
{
$pdf->SetXY($marge_gauche,-$posy);
$width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; }
$pdf->MultiCell($width, 3, $line, 0, $align, 0);
$posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell
if (! empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) {
$width=200; $align='C';
}
$freetextheight=$pdf->getStringHeight($width,$line);
}
$pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--;
$marginwithfooter=$marge_basse + $freetextheight + (! empty($line1)?3:0) + (! empty($line2)?3:0) + (! empty($line3)?3:0) + (! empty($line4)?3:0);
$posy=$marginwithfooter+0;
if ($line1)
{
$pdf->SetFont('','B',7);
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
if ($line2)
{
$pdf->SetFont('','B',7);
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
if ($line3)
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line3, 0, 'C', 0);
}
if ($line4)
{
$posy-=3;
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line4, 0, 'C', 0);
}
// Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
{
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
}
if ($line) // Free text
{
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell($width, 3, $line, 0, $align, 0);
$posy-=$freetextheight;
}
$pdf->SetY(-$posy);
$pdf->line($dims['lm'], $dims['hk']-$posy, $dims['wk']-$dims['rm'], $dims['hk']-$posy);
$posy--;
if (! empty($line1))
{
$pdf->SetFont('','B',7);
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
if (! empty($line2))
{
$pdf->SetFont('','B',7);
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
}
if (! empty($line3))
{
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line3, 0, 'C', 0);
}
if (! empty($line4))
{
$posy-=3;
$pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line4, 0, 'C', 0);
}
// Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
{
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
}
return $marginwithfooter;
}
/**
* Show linked objects for PDF generation
*
@@ -1053,7 +1069,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice);
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->subprice, 0, $outputlangs);
}
}
@@ -1079,7 +1095,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100);
if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
}
@@ -1263,7 +1279,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
}
else
{
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht);
if (empty($hidedetails) || $hidedetails > 1) return price($sign * $object->lines[$i]->total_ht, 0, $outputlangs);
}
}
}
@@ -1297,7 +1313,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
else
{
if (empty($hidedetails) || $hidedetails > 1) return
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100);
price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
}
}
}

View File

@@ -132,6 +132,8 @@ function product_prepare_head($object, $user)
}
}
complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove');
return $head;
}

View File

@@ -322,8 +322,11 @@ function build_rssfile($format,$title,$desc,$events_array,$outputfile,$filter=''
'<lastBuildDate>'.$date.'</lastBuildDate>'."\n".
'<generator>Dolibarr</generator>'."\n";
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
$url=$urlwithouturlroot.DOL_URL_ROOT.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
$form.='<link><![CDATA['.$url.']]></link>'."\n";
//print $form;
@@ -517,4 +520,4 @@ function quotedPrintDecode($str)
return trim($out);
}
?>
?>

View File

@@ -1373,8 +1373,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$num=count($menu_array);
for ($i = 0; $i < $num; $i++)
{
$showmenu=true;
if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) {
$showmenu=false;
}
$alt++;
if (empty($menu_array[$i]['level']))
if (empty($menu_array[$i]['level']) && $showmenu)
{
if (($alt%2==0))
{
@@ -1409,11 +1414,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
{
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>'."\n";
}
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
else if ($showmenu)
{
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
}
print '<div class="menu_top"></div>'."\n";
if ($showmenu)
print '<div class="menu_top"></div>'."\n";
}
// Menu niveau > 0
if ($menu_array[$i]['level'] > 0)
@@ -1428,7 +1434,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
if (! strstr($menu_array[$i]['titre'],'<table')) print '<br>';
print '</div>'."\n";
}
else if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
else if ($showmenu)
{
print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
}
@@ -1437,7 +1443,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
// If next is a new block or end
if (empty($menu_array[$i+1]['level']))
{
print '<div class="menu_end"></div>'."\n";
if ($showmenu)
print '<div class="menu_end"></div>'."\n";
print "</div>\n";
}
}

View File

@@ -114,6 +114,11 @@ class CommActionRapport
{
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);

View File

@@ -119,6 +119,11 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
// Create PDF instance
$pdf=pdf_getInstance($this->format);
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
@@ -344,9 +349,10 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,17 +24,16 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
*/
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php";
require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
* \class pdf_expedition_merou
* \brief Classe permettant de generer les borderaux envoi au modele Merou
* Classe permettant de generer les borderaux envoi au modele Merou
*/
Class pdf_expedition_merou extends ModelePdfExpedition
class pdf_expedition_merou extends ModelePdfExpedition
{
var $emetteur; // Objet societe qui emet
@@ -50,7 +49,6 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$this->db = $db;
$this->name = "merou";
//$this->description = "Modele Merou A5";
$this->description = $langs->trans("DocumentModelMerou");
$this->type = 'pdf';
@@ -58,12 +56,12 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = round($formatarray['height']/2);
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_logo = 1;
// Recupere emmetteur
$this->emetteur=$mysoc;
@@ -72,16 +70,20 @@ Class pdf_expedition_merou extends ModelePdfExpedition
/**
* Fonction generant le document sur le disque
* Function to build pdf onto disk
*
* @param Object &$object Objet expedition a generer (ou id si ancienne methode)
* @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
* @param Object &$object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file(&$object, $outputlangs)
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$conf,$langs,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
@@ -95,13 +97,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->load("sendings");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");
//Generation de la fiche
$this->expe = $object;
//Verification de la configuration
if ($conf->expedition->dir_output)
{
$object->fetch_thirdparty();
@@ -114,13 +112,12 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Creation du destinataire
$idcontact = $object->$origin->getIdContact('external','SHIPPING');
$this->destinataire = new Contact($this->db);
if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]);
if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
//Creation du livreur
$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db);
if ($idcontact[0]) $this->livreur->fetch($idcontact[0]);
if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
// Definition de $dir et $file
if ($object->specimen)
@@ -139,15 +136,21 @@ Class pdf_expedition_merou extends ModelePdfExpedition
{
if (dol_mkdir($dir) < 0)
{
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
//Si le dossier existe
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format,'mm','l');
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format,'mm','l');
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 0; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -166,91 +169,130 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
//Generation de l entete du fichier
$pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
$pdf->SetFont('','', $default_font_size - 3);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, 1, $outputlangs);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
//Initialisation des coordonnees
$tab_top = 53;
$tab_height = $this->page_hauteur - 78;
$tab_top = 52;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
$pdf->SetFillColor(240,240,240);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(10, $tab_top + 5);
$iniY = $pdf->GetY();
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
//Generation du tableau
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$nblignes = count($object->lines);
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
for ($i = 0 ; $i < $nblignes ; $i++)
$num=count($object->lines);
// Loop on each lines
for ($i = 0; $i < $num; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description de la ligne produit
$libelleproduitservice = pdf_writelinedesc($pdf,$object,$i,$outputlangs,90,3,50,$curY,0,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 3);
//Creation des cases a cocher
$pdf->Rect(10+3, $curY+1, 3, 3);
$pdf->Rect(20+3, $curY+1, 3, 3);
$pdf->Rect(10+3, $curY, 3, 3);
$pdf->Rect(20+3, $curY, 3, 3);
//Insertion de la reference du produit
$pdf->SetXY(30, $curY+1);
$pdf->SetXY(30, $curY);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);
//Insertion du libelle
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(50, $curY+1);
//$libelleproduitservice=pdf_getlinedesc($object->$origin,$i,$outputlangs);
$libelleproduitservice = pdf_writelinedesc($pdf,$object->$origin,$i,$outputlangs,90,3,50,$curY+1,1);
//$pdf->writeHTMLCell(90, 3, 50, $curY+1, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'L', 0);
//Insertion de la quantite commandee
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(140, $curY+1);
$pdf->SetXY(140, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked, 0, 'C', 0);
//Insertion de la quantite a envoyer
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(170, $curY+1);
$pdf->SetXY(170, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
//Generation de la page 2
$curY += (dol_nboflines_bis($libelleproduitservice,0,$outputlangs->charset_output)*3+1);
$nexY = $curY;
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1)
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
$curY = $iniY;
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, 0, $outputlangs);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 3);
}
}
//Insertion du pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();
$pdf->Close();
@@ -285,9 +327,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -295,21 +339,24 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$langs->load("main");
$langs->load("bills");
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY(10,$tab_top);
$pdf->MultiCell(10,5,"LS",0,'C',1);
$pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
$pdf->SetXY(20,$tab_top);
$pdf->MultiCell(10,5,"LR",0,'C',1);
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
$pdf->SetXY(30,$tab_top);
$pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(50,$tab_top);
$pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
$pdf->SetXY(140,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
$pdf->SetXY(170,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
if (empty($hidetop))
{
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY(10,$tab_top);
$pdf->MultiCell(10,5,"LS",0,'C',1);
$pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
$pdf->SetXY(20,$tab_top);
$pdf->MultiCell(10,5,"LR",0,'C',1);
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
$pdf->SetXY(30,$tab_top);
$pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(50,$tab_top);
$pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
$pdf->SetXY(140,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
$pdf->SetXY(170,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
}
$pdf->Rect(10, $tab_top, 190, $tab_height);
}
@@ -319,9 +366,10 @@ Class pdf_expedition_merou extends ModelePdfExpedition
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf, $object, $outputlangs)
function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 2);
@@ -534,7 +582,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,16 +24,15 @@
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
*/
require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/modules_expedition.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
* \class pdf_expedition_dorade
* \brief Classe permettant de generer les borderaux envoi au modele Rouget
* Classe permettant de generer les borderaux envoi au modele Rouget
*/
Class pdf_expedition_rouget extends ModelePdfExpedition
class pdf_expedition_rouget extends ModelePdfExpedition
{
var $emetteur; // Objet societe qui emet
@@ -56,10 +55,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1;
@@ -69,21 +68,25 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
$this->posxqtyordered=120;
$this->posxqtytoship=160;
$this->posxqtyordered=$this->page_largeur - $this->marge_droite - 70;
$this->posxqtytoship=$this->page_largeur - $this->marge_droite - 35;
}
/**
* Fonction generant le document sur le disque
* Function to build pdf onto disk
*
* @param Object &$object Objet expedition a generer (ou id si ancienne methode)
* @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
* @param Object &$object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file(&$object, $outputlangs)
function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
@@ -119,14 +122,21 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
{
if (dol_mkdir($dir) < 0)
{
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 0; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -151,23 +161,24 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_height = 170;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
if (! empty($object->note_public) || ! empty($object->tracking_number))
{
@@ -213,32 +224,92 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$height_note=0;
}
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$num=count($object->lines);
// Loop on each lines
for ($i = 0; $i < $num; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description de la ligne produit
pdf_writelinedesc($pdf,$object,$i,$outputlangs,150,3,$this->posxdesc,$curY,0,1);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->SetXY($this->posxqtyordered+5, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked,'','C');
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetXY($this->posxqtytoship+5, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped,'','C');
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetXY($this->posxqtyordered, $curY);
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C');
$pdf->SetXY($this->posxqtytoship, $curY);
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext - $heightforinfotot, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfreetext - $heightforinfotot + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext - $heightforinfotot, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfreetext - $heightforinfotot + 1;
}
// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
@@ -275,34 +346,51 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
$pdf->SetFont('','',$default_font_size - 1);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108, 2, $outputlangs->transnoentities("Description"), '', 'L');
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
$pdf->SetDrawColor(128,128,128);
$pdf->SetFont('','',$default_font_size - 1);
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities("Description"), '', 'L');
}
$pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqtyordered-1, $tab_top+1);
$pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyOrdered"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxqtyordered, $tab_top+1);
$pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities("QtyOrdered"),'','C');
}
$pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqtytoship-1, $tab_top+1);
$pdf->MultiCell(40,2, $outputlangs->transnoentities("QtyToShip"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxqtytoship, $tab_top+1);
$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C');
}
}
/**
@@ -361,7 +449,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
}
// Show barcode
if ($conf->barcode->enabled)
if (! empty($conf->barcode->enabled))
{
$posx=105;
}
@@ -370,7 +458,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$posx=$this->marge_gauche+3;
}
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
if ($conf->barcode->enabled)
if (! empty($conf->barcode->enabled))
{
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
@@ -378,7 +466,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
}
$pdf->SetDrawColor(128,128,128);
if ($conf->barcode->enabled)
if (! empty($conf->barcode->enabled))
{
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
@@ -386,7 +474,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
}
$posx=100;
$posx=$this->page_largeur - 100 - $this->marge_droite;
$posy=$this->marge_haute;
$pdf->SetFont('','B', $default_font_size + 2);
@@ -442,8 +530,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$text=$linkedobject->ref;
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
$Yoff = $Yoff+8;
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
$pdf->SetXY($this->page_largeur - $this->marge_droite - 100,$Yoff);
$pdf->MultiCell(100, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
$Yoff = $Yoff+4;
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"daytext",false,$outputlangs,true), 0, 'R');
@@ -454,8 +542,9 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
{
// Sender properties
$carac_emetteur='';
// Add internal contact of proposal if defined
$arrayidcontact=$object->getIdContact('internal','SALESREPFOLL');
// Add internal contact of origin element if defined
$arrayidcontact=array();
if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL');
if (count($arrayidcontact) > 0)
{
$object->fetch_user($arrayidcontact[0]);
@@ -468,7 +557,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$posx=$this->marge_gauche;
$posy=42;
$hautcadre=40;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur - 80 - $this->marge_droite;
// Show sender frame
$pdf->SetTextColor(0,0,0);
@@ -493,7 +582,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
// If SHIPPING contact defined, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external','SHIPPING');
$arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
@@ -504,7 +593,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -516,27 +605,29 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=100;
$posx=$this->page_largeur - $this->marge_droite - $widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80, 4, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 4, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0,0,0);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -547,11 +638,12 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2012 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
@@ -25,11 +25,11 @@
* \brief File of class to generate customers invoices from crabe model
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
@@ -78,10 +78,10 @@ class pdf_crabe extends ModelePDFFactures
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@@ -98,15 +98,23 @@ class pdf_crabe extends ModelePDFFactures
// Get source company
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
$this->posxtva=111;
$this->posxup=126;
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@@ -119,14 +127,14 @@ class pdf_crabe extends ModelePDFFactures
/**
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
@@ -142,8 +150,6 @@ class pdf_crabe extends ModelePDFFactures
$outputlangs->load("bills");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->facture->dir_output)
{
$object->fetch_thirdparty();
@@ -168,7 +174,7 @@ class pdf_crabe extends ModelePDFFactures
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
@@ -178,6 +184,11 @@ class pdf_crabe extends ModelePDFFactures
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -185,6 +196,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
@@ -201,10 +213,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -219,13 +230,14 @@ class pdf_crabe extends ModelePDFFactures
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
@@ -241,8 +253,6 @@ class pdf_crabe extends ModelePDFFactures
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
//print $pdf->getStringHeight(200,'SPECIMEN',false,false);
//print "$this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1";exit;
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note;
@@ -258,17 +268,67 @@ class pdf_crabe extends ModelePDFFactures
$nexY = $tab_top + 7;
// Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++)
for ($i = 0; $i < $nblignes; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
$showpricebeforepagebreak=1;
$pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
$pdf->setPage($pagenb+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
}
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
@@ -288,7 +348,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars
// Discount
// Discount on line
if ($object->lines[$i]->remise_percent)
{
$pdf->SetXY($this->posxdiscount-2, $curY);
@@ -315,78 +375,71 @@ class pdf_crabe extends ModelePDFFactures
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
$this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
// Et si on affiche dates de validite, on ajoute encore une ligne
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$nblineFollowDesc += 4;
}
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
// Test if a new page is required
if ($pagenb == 1)
{
$tab_top_in_current_page=$tab_top;
$tab_height_in_current_page=$tab_height;
}
else
{
$tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_newpage;
}
if ((($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height + 40, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
// Affiche zone infos
@@ -412,7 +465,7 @@ class pdf_crabe extends ModelePDFFactures
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
@@ -456,14 +509,18 @@ class pdf_crabe extends ModelePDFFactures
$tab3_top = $posy + 8;
$tab3_width = 80;
$tab3_height = 4;
if ($this->page_largeur < 210) // To work with US executive format
{
$tab3_posx -= 20;
}
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($tab3_posx, $tab3_top - 5);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($tab3_posx, $tab3_top - 4);
$pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
$pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top);
@@ -475,6 +532,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx+58, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$y=0;
$pdf->SetFont('','', $default_font_size - 4);
@@ -544,7 +603,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->getTradFromKey("PaymentTypeShort" . $row->code);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
$pdf->MultiCell(20, 3, $oper, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y);
@@ -592,6 +651,8 @@ class pdf_crabe extends ModelePDFFactures
$posy=$pdf->GetY()+4;
}
$posxval=52;
// Show payments conditions
if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement))
{
@@ -601,7 +662,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY(52, $posy);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L');
@@ -619,7 +680,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->MultiCell(80, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->SetTextColor(0,0,0);
$posy=$pdf->GetY()+1;
@@ -636,7 +697,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY(50, $posy);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg,0,'L');
@@ -647,7 +708,7 @@ class pdf_crabe extends ModelePDFFactures
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
// Si mode reglement non force ou si force a CHQ
if ($conf->global->FACTURE_CHQ_NUMBER)
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
{
@@ -656,25 +717,31 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0);
$posy=$pdf->GetY()+2;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
}
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$posy=$pdf->GetY()+2;
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
}
}
}
@@ -725,7 +792,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0;
$index = 0;
@@ -735,7 +807,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + $object->remise)), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($object->total_ht + (! empty($object->remise)?$object->remise:0))), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
@@ -743,129 +815,135 @@ class pdf_crabe extends ModelePDFFactures
$this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
foreach( $this->tva as $tvakey => $tvaval )
$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
{
if ($tvakey > 0) // On affiche pas taux 0
{
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If no vat at all
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
// Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1);
}
// Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1);
}
// Nothing to do
}
else
{
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
foreach($this->tva as $tvakey => $tvaval)
{
//Local tax 1
foreach( $this->localtax1 as $tvakey => $tvaval )
if ($tvakey > 0) // On affiche pas taux 0
{
if ($tvakey>0) // On affiche pas taux 0
$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
//$this->atleastoneratenotnull++;
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
}
}
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
if (! $this->atleastoneratenotnull) // If no vat at all
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
// Total LocalTax1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1);
}
// Total LocalTax2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0)
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1);
}
}
else
{
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//Local tax 1
foreach($this->localtax1 as $tvakey => $tvaval)
{
if ($tvakey!=0) // On affiche pas taux 0
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
//$this->atleastoneratenotnull++;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
}
}
}
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach($this->localtax2 as $tvakey => $tvaval)
{
if ($tvakey!=0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
}
}
}
}
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach( $this->localtax2 as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
{
//$this->atleastoneratenotnull++;
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$tvacompl='';
if (preg_match('/\*/',$tvakey))
{
$tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
}
$totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1);
}
}
}
// Total TTC
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
$text=$outputlangs->transnoentities("TotalTTC");
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
}
}
// Total TTC
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
$text=$outputlangs->transnoentities("TotalTTC");
if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit");
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1);
}
$pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSumCreditNotesUsed();
@@ -930,64 +1008,89 @@ class pdf_crabe extends ModelePDFFactures
* @param PDF &$pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param int $nexY Y (not used)
* @param Translate $outputlangs Langs object
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param et 4eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 2eme param et 4eme param
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
}
}
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if ($this->atleastonediscount)
if (empty($hidetop))
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if (empty($hidetop))
{
if ($this->atleastonediscount)
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
}
$pdf->SetXY($this->postotalht-1, $tab_top+1);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->postotalht-1, $tab_top+1);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
}
}
/**
@@ -1013,7 +1116,8 @@ class pdf_crabe extends ModelePDFFactures
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
// Show Draft Watermark
if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK);
}
@@ -1067,7 +1171,15 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
$posy+=1;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetFont('','', $default_font_size - 2);
if ($object->ref_client)
{
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R');
}
$objectidnext=$object->getIdReplacingInvoice('validated');
if ($object->type == 0 && $objectidnext)
@@ -1075,7 +1187,7 @@ class pdf_crabe extends ModelePDFFactures
$objectreplacing=new Facture($this->db);
$objectreplacing->fetch($objectidnext);
$posy+=4;
$posy+=3;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R');
@@ -1095,7 +1207,7 @@ class pdf_crabe extends ModelePDFFactures
$objectreplaced=new Facture($this->db);
$objectreplaced->fetch($object->fk_facture_source);
$posy+=4;
$posy+=3;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R');
@@ -1108,7 +1220,7 @@ class pdf_crabe extends ModelePDFFactures
if ($object->type != 2)
{
$posy+=4;
$posy+=3;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R');
@@ -1116,13 +1228,13 @@ class pdf_crabe extends ModelePDFFactures
if ($object->client->code_client)
{
$posy+=4;
$posy+=3;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
}
$posy+=2;
$posy+=1;
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
@@ -1173,7 +1285,7 @@ class pdf_crabe extends ModelePDFFactures
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -1182,29 +1294,31 @@ class pdf_crabe extends ModelePDFFactures
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
}
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -1214,11 +1328,12 @@ class pdf_crabe extends ModelePDFFactures
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @return void
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -434,7 +434,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->getTradFromKey("PaymentTypeShort" . $row->code);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
$pdf->MultiCell(20, 3, $oper, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y);

View File

@@ -25,10 +25,10 @@
* \ingroup ficheinter
* \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/fichinter/modules_fichinter.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
@@ -84,25 +84,29 @@ class pdf_soleil extends ModelePDFFicheinter
$this->option_multilang = 0; // Dispo en plusieurs langues
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
// Recupere emmetteur
// Get source company
$this->emetteur=$mysoc;
if (! $this->emetteur->code_pays) $this->emetteur->code_pays=substr($langs->defaultlang,-2); // By default, if not defined
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined
// Defini position des colonnes
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
}
/**
* Function to build pdf onto disk
*
* @param object $object Object to generate
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @return int 1=ok, 0=ko
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs)
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false)
{
global $user,$langs,$conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@@ -134,6 +138,11 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:25); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -157,34 +166,30 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetTextColor(0,0,0);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 100;
$tab_top_middlepage = 50;
$tab_top_newpage = 50;
$tab_height = 120;
$tab_top = 90;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
$tab_height_middlepage = 200;
$tab_height_endpage = 170;
// Affiche notes
if (! empty($object->note_public))
{
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@@ -240,81 +245,64 @@ class pdf_soleil extends ModelePDFFicheinter
if ($valide > 0 || $object->specimen)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','B', $default_font_size - 1);
$pdf->SetXY($this->marge_gauche, $curY);
$txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
$curYold=$nexYold=$nexY;
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0);
$curY = $pdf->GetY();
$nexY+=3;
// Description of product line
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).'</strong>';
$desc=dol_htmlentitiesbr($objectligne->desc,1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
$pdf->SetXY($this->marge_gauche, $nexY);
$desc = dol_htmlentitiesbr($objectligne->desc,1);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$curYold = $pdf->GetY();
$nexYold = $curYold;
$pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $desc, 0, 1, 0);
$stringheight=$pdf->getStringHeight('A', $txt);
$curY = $pdf->GetY();
$nexY+=(dol_nboflines_bis($objectligne->desc,0,$outputlangs->charset_output)*$stringheight);
//print $curYold."-".$nexYold." +".dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)."*".$stringheight."= ".$curY."-".$nexY."<br>";
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblines - 1) && empty($hidedesc)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $objectligne->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*3);
}
else // If it's last line
{
$nblineFollowDesc = 0;
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
// Test if a new page is required
if ($pagenb == 1)
{
$tab_top_in_current_page=$tab_top;
$tab_height_in_current_page=$tab_height;
}
else
{
$tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_middlepage;
}
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7;
}
}
}
@@ -322,17 +310,15 @@ class pdf_soleil extends ModelePDFFicheinter
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$this->_pagefoot($pdf,$object,$outputlangs);
$pdf->AliasNbPages();
@@ -367,11 +353,18 @@ class pdf_soleil extends ModelePDFFicheinter
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
/*
$pdf->SetXY($this->marge_gauche, $tab_top);
@@ -398,21 +391,24 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
*/
$pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3);
$pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20);
$pdf->MultiCell(60, 5, '', 0, 'J', 0);
$pdf->SetXY(20,230);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
$pdf->SetXY(20,235);
$pdf->MultiCell(80,30, '', 1);
if (empty($hidebottom))
{
$pdf->SetXY(20,230);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(20,235);
$pdf->MultiCell(80,25, '', 1);
$pdf->SetXY(110,235);
$pdf->MultiCell(80,30, '', 1);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(110,235);
$pdf->MultiCell(80,25, '', 1);
}
}
/**
@@ -556,7 +552,7 @@ class pdf_soleil extends ModelePDFFicheinter
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -565,29 +561,31 @@ class pdf_soleil extends ModelePDFFicheinter
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
}
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5);
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->SetXY($posx+2,$posy-5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0,0,0);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(100,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(100,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -597,11 +595,12 @@ class pdf_soleil extends ModelePDFFicheinter
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -464,11 +464,12 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2008 Chiptronik
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.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
@@ -26,17 +27,15 @@
* \author Laurent Destailleur
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/livraison/modules_livraison.php");
require_once(DOL_DOCUMENT_ROOT."/livraison/class/livraison.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
* \class pdf_typhon
* \brief Classe permettant de generer les bons de livraison au modele Typho
* Classe permettant de generer les bons de livraison au modele Typho
*/
class pdf_typhon extends ModelePDFDeliveryOrder
{
var $emetteur; // Objet societe qui emet
@@ -65,10 +64,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@@ -88,6 +87,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->posxqty=168;
$this->posxdiscount=162;
$this->postotalht=177;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxcomm-=20;
//$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->atleastoneratenotnull=0;
@@ -105,7 +113,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
function write_file($object,$outputlangs)
{
global $user,$langs,$conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@@ -142,6 +149,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -177,10 +189,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
/*
// Positionne $this->atleastonediscount si on a au moins une remise
@@ -203,8 +214,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
@@ -233,20 +244,35 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Boucle sur les lignes
// Loop on each lines
for ($i = 0 ; $i < $nblines ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description de la ligne produit
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY);
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$curX,$curY);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
$nexY = $pdf->GetY()+4;
/*
// TVA
@@ -281,68 +307,53 @@ class pdf_typhon extends ModelePDFDeliveryOrder
*/
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblines - 1) && empty($hidedesc)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
// Test if a new page is required
if ($pagenb == 1)
{
$tab_top_in_current_page=$tab_top;
$tab_height_in_current_page=$tab_height;
}
else
{
$tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_newpage;
}
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object, $outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7;
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
}
/*
* Pied de page
*/
@@ -384,7 +395,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if ($pdf->GetY() > 250)
{
$this->_pagefoot($pdf,$object,$outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pdf->AddPage('P', 'A4');
@@ -415,7 +426,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return 1; // Pas d'erreur
return 1;
}
else
{
@@ -437,9 +448,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -624,9 +637,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetXY(102,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
// Cadre client destinataire
$pdf->Rect(100, $posy, 100, $hautcadre);
// If SHIPPING contact defined on invoice, we use it
$usecontact=false;
$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
@@ -640,7 +650,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -651,14 +661,29 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show customer/recipient
$pdf->SetXY(102,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(106,4, $carac_client_name, 0, 'L');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
//if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
//$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY(102,$posy+8);
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->SetXY($posx+2,$posy+8);
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -669,11 +694,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -61,9 +61,8 @@ class mailing_framboise extends MailingTargets
$cibles = array();
// CHANGE THIS
// Select the members from category
$sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, null as firstname,";
$sql = "SELECT a.rowid as id, a.email as email, a.nom as name, null as fk_contact, a.prenom as firstname,";
if ($_POST['filter']) $sql.= " c.label";
else $sql.=" null as label";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";

View File

@@ -23,11 +23,11 @@
* \author Regis Houssin
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/project/modules_project.php");
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
@@ -62,10 +62,10 @@ class pdf_baleine extends ModelePDFProjects
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@@ -108,8 +108,6 @@ class pdf_baleine extends ModelePDFProjects
{
$nblignes = count($object->lines);
$default_font_size = pdf_getPDFFontsize($outputlangs);
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
@@ -127,6 +125,11 @@ class pdf_baleine extends ModelePDFProjects
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -151,10 +154,9 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -225,43 +227,52 @@ class pdf_baleine extends ModelePDFProjects
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
else // If it's last line
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
$nblineFollowDesc = 0;
}
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
{
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_pagefoot($pdf, $object, $outputlangs);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top=$tab_top_newpage;
$tab_height=$tab_height_newpage;
$nexY = $tab_top + 7;
}
}
// Show square
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
/*
* Pied de page
@@ -297,9 +308,11 @@ class pdf_baleine extends ModelePDFProjects
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
@@ -412,11 +425,12 @@ class pdf_baleine extends ModelePDFProjects
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs)
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -62,6 +62,19 @@ class pdf_paiement
$this->line_per_page = 25;
$this->tab_height = 230; //$this->line_height * $this->line_per_page;
$this->posxdate=$this->marge_gauche+2;
$this->posxpaymenttype=42;
$this->posxinvoice=82;
$this->posxinvoiceamount=122;
$this->posxpaymentamount=162;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxpaymenttype-=10;
$this->posxinvoice-=0;
$this->posxinvoiceamount-=10;
$this->posxpaymentamount-=20;
}
}
@@ -104,6 +117,7 @@ class pdf_paiement
$file = $dir . "/payments-".$year."-".$month.".pdf";
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
if (class_exists('TCPDF'))
{
@@ -143,7 +157,7 @@ class pdf_paiement
$var=!$var;
$lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"%d %B %Y",false,$outputlangs,true);
$lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"day",false,$outputlangs,true);
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount);
@@ -223,44 +237,46 @@ class pdf_paiement
// Do not add the BACKGROUND as this is a report
//pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$outputlangs->transnoentities("ListOfCustomerPayments");
$title.=' - '.dol_print_date(dol_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs,true);
$pdf->SetFont('','B',12);
$pdf->SetXY(10,10);
$pdf->MultiCell(200, 2, $title, 0, 'C');
$pdf->SetFont('','B',$default_font_size + 1);
$pdf->SetXY($this->marge_gauche,10);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->marge_gauche, 2, $title, 0, 'C');
$pdf->SetFont('','',10);
$pdf->SetFont('','',$default_font_size);
$pdf->SetXY(11, 16);
$pdf->SetXY($this->posxdate, 16);
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true), 0, 'L');
$pdf->SetXY(11, 22);
$pdf->SetXY($this->posxdate, 22);
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("Page")." : ".$page, 0, 'L');
// Title line
$pdf->SetXY($this->posxdate, $this->tab_top+2);
$pdf->MultiCell($this->posxpaymenttype - $this->posxdate, 2, 'Date');
$pdf->SetXY(11, $this->tab_top+2);
$pdf->MultiCell(30, 2, 'Date');
$pdf->line($this->posxpaymenttype - 1, $this->tab_top, $this->posxpaymenttype - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxpaymenttype, $this->tab_top+2);
$pdf->MultiCell($this->posxinvoice - $this->posxpaymenttype, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY(42, $this->tab_top+2);
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
$pdf->line($this->posxinvoice - 1, $this->tab_top, $this->posxinvoice - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxinvoice, $this->tab_top+2);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxinvoice, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY(82, $this->tab_top+2);
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
$pdf->line($this->posxinvoiceamount - 1, $this->tab_top, $this->posxinvoiceamount - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top+2);
$pdf->MultiCell($this->posxpaymentamount - $this->posxinvoiceamount - 1, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'R');
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY(122, $this->tab_top+2);
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'L');
$pdf->line($this->posxpaymentamount - 1, $this->tab_top, $this->posxpaymentamount - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxpaymentamount, $this->tab_top+2);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount - 1, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY(162, $this->tab_top+2);
$pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'L');
$pdf->line($this->marge_gauche, $this->tab_top + 10, $this->page_largeur - $this->marge_droite, $this->tab_top + 10);
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10);
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
$pdf->Rect($this->marge_gauche, $this->tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $this->tab_height + 10);
}
@@ -275,7 +291,9 @@ class pdf_paiement
*/
function Body(&$pdf, $page, $lines, $outputlangs)
{
$pdf->SetFont('','', 9);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$oldprowid = 0;
$pdf->SetFillColor(220,220,220);
$yp = 0;
@@ -290,33 +308,35 @@ class pdf_paiement
$page++;
$pdf->AddPage();
$this->_pagehead($pdf, $page, 0, $outputlangs);
$pdf->SetFont('','', 9);
$pdf->SetFont('','', $default_font_size - 1);
$yp = 0;
}
$pdf->SetXY(10, $this->tab_top + 10 + $yp);
$pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'L', 1);
$pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymenttype - $this->posxdate + 1, $this->line_height, $lines[$j][1], 0, 'L', 1);
$pdf->SetXY(40, $this->tab_top + 10 + $yp);
$pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'L', 1);
$pdf->SetXY($this->posxpaymenttype, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxpaymenttype, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'L', 1);
$pdf->SetXY(120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, '', 0, 'R', 1);
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymentamount- $this->posxinvoiceamount, $this->line_height, '', 0, 'R', 1);
$pdf->SetXY(160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1);
$pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp = $yp + 5;
}
// Invoice number
$pdf->SetXY(80, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'L', 0);
$pdf->SetXY($this->posxinvoice, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxdate, $this->line_height, $lines[$j][0], 0, 'L', 0);
$pdf->SetXY(120, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'R', 0);
// Invoice amount
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymentamount- $this->posxinvoiceamount - 1, $this->line_height, $lines[$j][5], 0, 'R', 0);
$pdf->SetXY(160, $this->tab_top + 10 + $yp);
$pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0);
// Payment amount
$pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][6], 0, 'R', 0);
$yp = $yp + 5;
if ($oldprowid <> $lines[$j][7])

View File

@@ -23,11 +23,11 @@
* \brief Class file to generate the supplier invoices with the canelle model
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/supplier_invoice/modules_facturefournisseur.php");
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
@@ -58,7 +58,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* Constructor
*
* @param DoliDB $db Database handler
* @param Societe $object Third party providing invoice
* @param Societe $object Supplier invoice
*/
function __construct($db,$object)
{
@@ -77,10 +77,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@@ -103,6 +103,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@@ -113,13 +121,18 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Build document onto disk
* Function to build pdf onto disk
*
* @param Object $object Object invoice to build (or id if old method)
* @param Translate $outputlangs Lang object for output language
* @return int 1=OK, 0=KO
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $hookmanager Hookmanager object
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs='')
function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{
global $user,$langs,$conf,$mysoc;
@@ -133,8 +146,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$outputlangs->load("bills");
$outputlangs->load("products");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->fournisseur->dir_output.'/facture')
{
$object->fetch_thirdparty();
@@ -143,7 +154,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
//$amount_credit_notes_included = $object->getSumCreditNotesUsed();
//$amount_deposits_included = $object->getSumDepositsUsed();
// Definition de $dir et $file
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->fournisseur->facture->dir_output;
@@ -160,7 +171,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
@@ -171,6 +182,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -194,10 +210,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -212,14 +227,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
@@ -227,7 +242,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@@ -248,25 +263,38 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Boucle sur les lignes
// Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1);
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1,$hookmanager);
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
// VAT rate
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
@@ -308,74 +336,62 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
// Et si on affiche dates de validite, on ajoute encore une ligne
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{
$nblineFollowDesc += 4;
}
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
// Test if a new page is required
if ($pagenb == 1)
{
$tab_top_in_current_page=$tab_top;
$tab_height_in_current_page=$tab_height;
}
else
{
$tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_newpage;
}
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object, $outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7;
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
// Affiche zone totaux
@@ -397,10 +413,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->Output($file,'F');
// Actions on extra fields (by external module or standard code)
// Add pdfgeneration hook
if (!is_object($hookmanager))
{
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
@@ -441,6 +457,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab2_top = $posy;
@@ -455,7 +472,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$index=0;
// Total HT
$pdf->SetFillColor(255,255,255);
@@ -464,10 +488,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
// Affichage des totaux de TVA par taux (conformement a reglementation)
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
$index=0;
foreach( $this->tva as $tvakey => $tvaval )
{
if ($tvakey > 0) // On affiche pas taux 0
@@ -493,7 +516,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
}
}
if (! $this->atleastoneratenotnull) // If not vat at all
if (! $this->atleastoneratenotnull) // If no vat at all
{
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
@@ -523,9 +546,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
else
{
//Local tax 1
if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
{
//Local tax 1
foreach( $this->localtax1 as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
@@ -551,9 +574,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
}
//Local tax 2
if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
{
//Local tax 2
foreach( $this->localtax2 as $tvakey => $tvaval )
{
if ($tvakey>0) // On affiche pas taux 0
@@ -590,8 +613,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetTextColor(0,0,0);
if ($deja_regle > 0)
{
@@ -605,7 +626,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$index++;
$pdf->SetTextColor(0,0,60);
//$pdf->SetFont('','B', $default_font_size - 1);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
@@ -625,64 +645,90 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param PDF &$pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param int $nexY Y (not used)
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','',$default_font_size - 2);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdesc-1, $tab_top+2);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-3, $tab_top+2);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
}
}
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+2);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+2);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if ($this->atleastonediscount)
if (empty($hidetop))
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+2);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
if ($this->atleastonediscount)
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
}
$pdf->SetXY($this->postotalht-1, $tab_top+2);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHTShort"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->postotalht-1, $tab_top+1);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHTShort"),'','C');
}
}
@@ -701,14 +747,18 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$tab3_top = $posy + 8;
$tab3_width = 80;
$tab3_height = 4;
if ($this->page_largeur < 210) // To work with US executive format
{
$tab3_posx -= 20;
}
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($tab3_posx, $tab3_top - 5);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($tab3_posx, $tab3_top - 4);
$pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$pdf->line($tab3_posx, $tab3_top, $tab3_posx+$tab3_width, $tab3_top);
$pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top);
@@ -720,6 +770,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($tab3_posx+58, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$y=0;
$pdf->SetFont('','', $default_font_size - 4);
@@ -745,7 +797,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
$oper = $outputlangs->getTradFromKey("PaymentTypeShort" . $row->code);
$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $row->code);
$pdf->MultiCell(20, 3, $oper, 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top+$y);
@@ -772,9 +824,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
{
global $langs,$conf,$mysoc;
@@ -782,7 +835,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$outputlangs->load("bills");
$outputlangs->load("orders");
$outputlangs->load("companies");
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Do not add the BACKGROUND as this is for suppliers
@@ -791,8 +843,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$posx=$this->page_largeur-$this->marge_droite-100;
$posy=$this->marge_haute;
$posx=$this->page_largeur-$this->marge_droite-100;
$pdf->SetXY($this->marge_gauche,$posy);
@@ -823,17 +875,22 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("SupplierInvoice")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('','', $default_font_size + 2);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierInvoice")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('','B', $default_font_size);
if ($object->ref_supplier)
{
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : " . $object->ref_supplier, '', 'R');
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : " . $object->ref_supplier, '', 'R');
}
$posy+=6;
$posy+=1;
$pdf->SetFont('','', $default_font_size - 1);
$posy+=5;
$pdf->SetXY($posx,$posy);
if ($object->date)
{
@@ -846,6 +903,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
}
$posy+=2;
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
if ($showaddress)
{
// Sender properties
@@ -892,7 +955,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $mysoc->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -904,26 +967,28 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,$object->contact,$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -933,11 +998,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @return void
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
function _pagefoot(&$pdf, $object, $outputlangs)
function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -25,12 +25,12 @@
* \brief File of class to generate suppliers orders from muscadet model
*/
require_once(DOL_DOCUMENT_ROOT."/core/modules/supplier_order/modules_commandefournisseur.php");
require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
@@ -61,7 +61,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* Constructor
*
* @param DoliDB $db Database handler
* @param Societe $object Third party providing order
* @param Object $object Supplier order
*/
function __construct($db,$object)
{
@@ -80,10 +80,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@@ -99,7 +99,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->franchise=!$mysoc->tva_assuj;
// Get source company
$this->emetteur=$mysoc;
//if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
//$this->emetteur=$object->thirdparty;
//if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
// Defini position des colonnes
@@ -109,6 +112,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->posxqty=145;
$this->posxdiscount=162;
$this->postotalht=174;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}
$this->tva=array();
$this->localtax1=array();
@@ -119,7 +130,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Build document onto disk
* Function to build pdf onto disk
*
* @param int $object Id of object to generate
* @param object $outputlangs Lang output object
@@ -145,8 +156,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->load("products");
$outputlangs->load("orders");
$default_font_size = pdf_getPDFFontSize($outputlangs);
if ($conf->fournisseur->dir_output.'/commande')
{
$object->fetch_thirdparty();
@@ -157,7 +166,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
//$amount_credit_notes_included = $object->getSumCreditNotesUsed();
//$amount_deposits_included = $object->getSumDepositsUsed();
// Definition de $dir et $file
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->fournisseur->commande->dir_output;
@@ -185,6 +194,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -208,10 +222,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -232,8 +245,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
@@ -241,7 +254,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
$tab_top = 88;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to manage multipages
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@@ -266,15 +279,29 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$curX = $this->posxdesc-1;
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1,$hookmanager);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
@@ -310,87 +337,78 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
if (! empty($object->remise_percent)) $tvaligne-=($tvaligne*$object->remise_percent)/100;
if (! empty($object->remise_percent)) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100;
if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100;
$vatrate=(string) $object->lines[$i]->tva_tx;
$localtax1rate=(string) $object->lines[$i]->localtax1_tx;
$localtax2rate=(string) $object->lines[$i]->localtax2_tx;
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]='';
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]='';
$this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne;
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
// Et si on affiche dates de validite, on ajoute encore une ligne
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{
$nblineFollowDesc += 4;
}
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
// Test if a new page is required
if ($pagenb == 1)
{
$tab_top_in_current_page=$tab_top;
$tab_height_in_current_page=$tab_height;
}
else
{
$tab_top_in_current_page=$tab_top_newpage;
$tab_height_in_current_page=$tab_height_newpage;
}
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf, $object, $outputlangs);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7;
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$bottomlasttab=$tab_top + $tab_height + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
// Affiche zone infos
@@ -417,7 +435,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
@@ -447,7 +465,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Affiche tableau des versement
* Show payments table
*
* @param PDF &$pdf Object PDF
* @param Object $object Object order
@@ -545,7 +563,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
{
// Si mode reglement non force ou si force a CHQ
if ($conf->global->FACTURE_CHQ_NUMBER)
if (! empty($conf->global->FACTURE_CHQ_NUMBER))
{
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
{
@@ -553,24 +571,24 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio).':',0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->adresse_proprio), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(90, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedToShort').' '.$outputlangs->convToOutputCharset($this->emetteur->name).' '.$outputlangs->transnoentities('SendTo').':',0,'L',0);
$posy=$pdf->GetY()+1;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
$posy=$pdf->GetY()+2;
}
}
@@ -587,7 +605,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$curx=$this->marge_gauche;
$cury=$posy;
$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account);
$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size);
$posy+=2;
}
@@ -618,7 +636,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetFont('','', $default_font_size - 1);
// Tableau total
$col1x = 120; $col2x = 170; $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$col1x = 120; $col2x = 170;
if ($this->page_largeur < 210) // To work with US executive format
{
$col2x-=20;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
$useborder=0;
$index = 0;
@@ -629,7 +652,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1);
// Show VAT by rates and total
$pdf->SetFillColor(248,248,248);
@@ -766,7 +789,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
//$depositsamount=$object->getSumDepositsUsed();
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0;
if (! empty($object->paye)) $resteapayer=0;
if ($deja_regle > 0)
{
@@ -778,8 +801,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
$resteapayer = $object->total_ttc - $deja_regle;
$index++;
$pdf->SetTextColor(0,0,60);
$pdf->SetFillColor(224,224,224);
@@ -803,64 +824,90 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param PDF &$pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param int $nexY Y (not used)
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
if (empty($hidetop))
{
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
}
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param et 4eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 2eme param et 4eme param
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
// Output Rect
$this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxtva-3, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
}
}
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
$pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
if ($this->atleastonediscount)
if (empty($hidetop))
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
if ($this->atleastonediscount)
{
$pdf->SetXY($this->posxdiscount-1, $tab_top+1);
$pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
}
}
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
}
$pdf->SetXY($this->postotalht-1, $tab_top+1);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHTShort"),'','C');
if (empty($hidetop))
{
$pdf->SetXY($this->postotalht-1, $tab_top+1);
$pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHTShort"),'','C');
}
}
/**
@@ -870,9 +917,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param object $hookmanager Hookmanager object
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $hookmanager)
{
global $langs,$conf,$mysoc;
@@ -930,7 +978,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$title=$outputlangs->transnoentities("SupplierOrder");
$pdf->MultiCell(100, 3, $title, '', 'R');
$pdf->SetFont('', 'B', $default_font_size + 2);
$pdf->SetFont('','B',$default_font_size);
$posy+=6;
$pdf->SetXY($posx,$posy);
@@ -945,15 +993,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($object->date_commande)
{
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R');
}
else
{
$pdf->SetTextColor(255,0,0);
$pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
$pdf->MultiCell(100, 3, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
}
$posy+=2;
$pdf->SetTextColor(0,0,60);
// Show list of linked objects
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size, $hookmanager);
if ($showaddress)
{
@@ -1001,7 +1053,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
@@ -1010,29 +1062,31 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$carac_client_name=$outputlangs->convToOutputCharset($object->client->name);
}
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
// Show recipient
$widthrecbox=100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
$posx=$this->page_largeur-$this->marge_droite-$widthrecbox;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, 100, $hautcadre);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
}
}
@@ -1042,11 +1096,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @return void
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
function _pagefoot(&$pdf, $object, $outputlangs)
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
}
}

View File

@@ -102,47 +102,54 @@ class InterfacePaypalWorkflow
if ($action == 'PAYPAL_PAYMENT_OK')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref);
if ($object->source == 'membersubscription')
if (! empty($object->source))
{
//require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherents.class.php");
// TODO add subscription treatment
if ($object->source == 'membersubscription')
{
//require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherents.class.php';
// TODO add subscription treatment
}
else
{
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$soc = new Societe($this->db);
// Parse element/subelement (ex: project_task)
$element = $path = $filename = $object->source;
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
{
$element = $path = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'order') {
$path = $filename = 'commande';
}
if ($element == 'invoice') {
$path = 'compta/facture'; $filename = 'facture';
}
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename);
$obj = new $classname($this->db);
$ret = $obj->fetch('',$object->ref);
if ($ret < 0) return -1;
// Add payer id
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
// Add transaction id
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
}
}
else
{
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
$soc = new Societe($this->db);
// Parse element/subelement (ex: project_task)
$element = $path = $filename = $object->source;
if (preg_match('/^([^_]+)_([^_]+)/i',$object->source,$regs))
{
$element = $path = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'order') {
$path = $filename = 'commande';
}
if ($element == 'invoice') {
$path = 'compta/facture'; $filename = 'facture';
}
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename);
$obj = new $classname($this->db);
$ret = $obj->fetch('',$object->ref);
if ($ret < 0) return -1;
// Add payer id
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
// Add transaction id
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
// TODO add free tag treatment
}
}

View File

@@ -287,8 +287,9 @@ class InterfaceActionsAuto
$langs->load("bills");
$langs->load("agenda");
// Values for this action can't be defined by caller.
$object->actiontypecode='AC_OTH';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
$object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

View File

@@ -34,11 +34,11 @@ if (empty($conf->global->EXTERNALSITE_URL))
llxFooter();
}
$mainmenu=GETPOST('mainmenu');
$leftmenu=GETPOST('leftmenu');
$idmenu=GETPOST('idmenu');
$theme=GETPOST('theme');
$codelang=GETPOST('lang');
$mainmenu=GETPOST('mainmenu', 'alpha');
$leftmenu=GETPOST('leftmenu', 'alpha');
$idmenu=GETPOST('idmenu', 'int');
$theme=GETPOST('theme', 'alpha');
$codelang=GETPOST('lang', 'alpha');
print "
<html>

View File

@@ -516,8 +516,8 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
}
else // Id du contact
{
$sendto = $object->client->contact_get_email(GETPOST('receiver','alpha'));
$sendtoid = GETPOST('receiver','alpha');
$sendto = $object->client->contact_get_property(GETPOST('receiver'),'email');
$sendtoid = GETPOST('receiver','alpha');
}
}

View File

@@ -96,7 +96,7 @@ if ($result)
$interventionstatic=new Fichinter($db);
$urlparam="&amp;socid=$socid";
print_barre_liste($langs->trans("ListOfInterventions"), $page, "index.php",$urlparam,$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER["PHP_SELF"],$urlparam,$sortfield,$sortorder,'',$num);
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">';

View File

@@ -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.2.2'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z)
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.2.4'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z)
if (! defined('EURO')) define('EURO',chr(128));
// Define syslog constants
@@ -53,10 +53,8 @@ if (! defined('LOG_DEBUG'))
}
}
// Force PHP error_reporting setup (Dolibarr may report warning without this)
if (! defined('E_DEPRECATED')) define('E_DEPRECATED',0); // For PHP < 5.3.0 compatibility
error_reporting(E_ALL & ~(E_STRICT|E_NOTICE|E_DEPRECATED));
//error_reporting(E_ALL | E_STRICT);
// End of common declaration part
if (defined('DOL_INC_FOR_VERSION_ERROR')) return;
// Define vars
@@ -77,12 +75,19 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do
exit;
}
// Force PHP error_reporting setup (Dolibarr may report warning without this)
if (! empty($dolibarr_strict_mode))
{
error_reporting(E_ALL | E_STRICT);
}
else
{
if (! defined('E_DEPRECATED')) define('E_DEPRECATED',0); // For PHP < 5.3.0 compatibility
error_reporting(E_ALL & ~(E_STRICT|E_NOTICE|E_DEPRECATED));
}
// Disable php display errors
if (! empty($dolibarr_main_prod))
{
ini_set('display_errors','Off');
}
if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off');
// Clean parameters
$dolibarr_main_data_root=trim($dolibarr_main_data_root);
@@ -165,7 +170,7 @@ if (! $found) // If autodetect fails (Ie: when using apache alias that point out
{
$tmp=$dolibarr_main_url_root;
}
else $tmp='http'.((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on')?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:'');
else $tmp='http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]!=443))?'':'s').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"])||$_SERVER["SERVER_PORT"]==80||$_SERVER["SERVER_PORT"]==443)?'':':'.$_SERVER["SERVER_PORT"]).($tmp3?(preg_match('/^\//',$tmp3)?'':'/').$tmp3:'');
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp;
if (! empty($dolibarr_main_force_https)) $tmp=preg_replace('/^http:/i','https:',$tmp);

View File

@@ -405,27 +405,29 @@ class FactureFournisseur extends Facture
while ($i < $num_rows)
{
$obj = $this->db->fetch_object($resql_rows);
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->ref = $obj->product_ref; // TODO deprecated
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
//$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit
$this->lines[$i]->libelle = $obj->label; // Label du produit
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->pu_ht = $obj->pu_ht;
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
$this->lines[$i]->tva_tx = $obj->tva_tx;
$this->lines[$i]->localtax1_tx = $obj->localtax1_tx;
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
$this->lines[$i]->qty = $obj->qty;
$this->lines[$i]->tva = $obj->tva;
$this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_localtax1 = $obj->total_localtax1;
$this->lines[$i]->total_localtax2 = $obj->total_localtax2;
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->product_type = $obj->product_type;
$this->lines[$i] = (object) array();
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description;
$this->lines[$i]->ref = $obj->product_ref; // TODO deprecated
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
//$this->lines[$i]->ref_fourn = $obj->ref_fourn; // Reference fournisseur du produit
$this->lines[$i]->libelle = $obj->label; // Label du produit
$this->lines[$i]->product_desc = $obj->product_desc; // Description du produit
$this->lines[$i]->pu_ht = $obj->pu_ht;
$this->lines[$i]->pu_ttc = $obj->pu_ttc;
$this->lines[$i]->tva_tx = $obj->tva_tx;
$this->lines[$i]->localtax1_tx = $obj->localtax1_tx;
$this->lines[$i]->localtax2_tx = $obj->localtax2_tx;
$this->lines[$i]->qty = $obj->qty;
$this->lines[$i]->tva = $obj->tva;
$this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_localtax1 = $obj->total_localtax1;
$this->lines[$i]->total_localtax2 = $obj->total_localtax2;
$this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->product_type = $obj->product_type;
$i++;
}

View File

@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php";
require_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.product.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/fourn.lib.php";
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
if ($conf->produit->enabled) require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
@@ -551,7 +552,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) /
// Sauvegarde le dernier module choisi pour generer un document
$object->fetch($id);
$object->fetch_thirdparty();
if ($_REQUEST['model'])
{
$object->setDocModel($user, $_REQUEST['model']);
@@ -584,7 +585,7 @@ else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$langs->load("other");
$upload_dir = $conf->fournisseur->commande->dir_output;
$file = $upload_dir . '/' . GETPOST('file');

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2013 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@ require_once(DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo
require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
require_once(DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
require_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
@@ -581,6 +582,8 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer)
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs);
$action='';
}
}
@@ -1749,7 +1752,7 @@ else
$form->select_produits_fournisseurs($object->socid,'','idprodfournprice','',$filtre);
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
if (is_object($hookmanager))
{
$parameters=array('filtre'=>$filtre,'htmlname'=>'idprodfournprice');
@@ -1760,7 +1763,7 @@ else
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create();
print '</td>';
print '<td align="right"><input type="text" name="qty" value="1" size="1"></td>';
print '<td>&nbsp;</td>';
@@ -1777,14 +1780,19 @@ else
if ($action != 'presend')
{
/*
* Boutons actions
*/
*/
print '<div class="tabsAction">';
// Reopen a standard paid invoice
// Modify a validated invoice with no payments
if ($object->statut == 1 && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
}
// Reopen a standard paid invoice
if (($object->type == 0 || $object->type == 1) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
{
if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice

View File

@@ -126,7 +126,7 @@ if ($_GET["filtre"])
if (GETPOST("search_ref"))
{
$sql .= " AND fac.rowid like '%".$db->escape(GETPOST("search_ref"))."%'";
$sql .= " AND fac.rowid = ".$db->escape(GETPOST("search_ref"));
}
if (GETPOST("search_ref_supplier"))
{

View File

@@ -44,7 +44,7 @@ $action = GETPOST('action');
// Security check
$id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe&fournisseur', $id, '');
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe');
$object = new Fournisseur($db);
@@ -403,7 +403,7 @@ if ($object->fetch($id))
// List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?id='.$object->id);
}
// Addresses list
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
{

View File

@@ -30,7 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
// If not defined, we select menu "home"
if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home";
$_GET['mainmenu']=GETPOST('mainmenu', 'alpha')?GETPOST('mainmenu', 'alpha'):'home';
$action=GETPOST('action');

View File

@@ -24,7 +24,7 @@
* \brief File that define environment for support pages
*/
define('DOL_VERSION','3.2.2'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z)
define('DOL_VERSION','3.2.4'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z)
// Define DOL_DOCUMENT_ROOT an ADODB_PATH used for install/upgrade process
if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..');

View File

@@ -155,10 +155,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (18
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1844, 184, '0','0','VAT Rate 0', 1);
-- PORTUGAL (id country=25)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251, 25, '20','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252, 25, '12','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (251, 25, '23','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (252, 25, '13','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (253, 25, '0','0','VAT Rate 0', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (254, 25, '5','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (254, 25, '6','0','VAT reduced rate',1);
-- ROMANIA (id country=188)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1881,188, '24','0','VAT standard rate',1);
@@ -193,9 +193,9 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (20
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (204,20, '0','0','VAT Rate 0', 1);
-- SWITZERLAND (id country=6)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '7.6','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.6','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.4','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '8','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.8','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.5','0','VAT super-reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '0','0','VAT Rate 0', 1);
-- TUNISIA (id country=10)

View File

@@ -3304,15 +3304,21 @@ function migrate_mode_reglement($db,$langs,$conf)
$db->begin();
$sqla = "UPDATE ".MAIN_DB_PREFIX."paiement SET ";
$sqla.= "fk_paiement = ".$elements['new_id'][$key];
$sqla.= " WHERE fk_paiement = ".$old_id;
$sqla.= " AND fk_paiement IN (SELECT id FROM ".MAIN_DB_PREFIX."c_paiement WHERE id = ".$old_id." AND code = '".$elements['code'][$key]."')";
$resqla = $db->query($sqla);
$sql = "UPDATE ".MAIN_DB_PREFIX."c_paiement SET ";
$sql.= "id = ".$elements['new_id'][$key];
$sql.= " WHERE id = ".$old_id;
$sql.= " AND code = '".$elements['code'][$key]."'";
$resql = $db->query($sql);
if ($resql)
if ($resqla && $resql)
{
foreach($elements['tables'] as $table)
foreach($elements['tables'] as $table) // FIXME We must not update tables if oldid is not renamed
{
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
$sql.= "fk_mode_reglement = ".$elements['new_id'][$key];
@@ -3681,4 +3687,4 @@ update llx_facture set paye=1, fk_statut=2 where close_code is null
and rowid in (...)
*/
?>
?>

View File

@@ -322,18 +322,9 @@ NetToBePaid=Φόρος που πρέπει να πληρωθεί
PhoneNumber=Τηλ
FullPhoneNumber=Τηλέφωνο
TeleFax=Φαξ
PrettyLittleSentence=Accept the amount of payments due by checks issued in my name as a Member of an accounting association approved by the Fiscal Administration.
IntracommunityVATNumber=Intracommunity number of VAT
PaymentByChequeOrderedTo=Check payment (including tax) are payable to %s send to
PaymentByChequeOrderedToShort=Check payment (including tax) are payable to
SendTo=Αποστολή σε
PaymentByTransferOnThisBankAccount=Πληρωμή με έμβασμα στον ακόλουθο λογαριασμό
VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI
LawApplicationPart1=By application of the law 80.335 of 12/05/80
LawApplicationPart2=the goods remain the property of
LawApplicationPart3=the seller until the complete cashing of
LawApplicationPart4=their price.
LimitedLiabilityCompanyCapital=SARL with Capital of
UseDiscount=Χρήση έκπτωσης
UseCredit=Χρήση πίστωσης
UseCreditNoteInInvoicePayment=Μείωση ποσού πληρωμής με αυτή την πίστωση

View File

@@ -0,0 +1,17 @@
# Dolibarr language file - en_SA - main
CHARSET=UTF-8
DIRECTION=ltr
FONTFORPDF=DejaVuSans
FONTSIZEFORPDF=9
SeparatorDecimal=.
SeparatorThousand=,
FormatDateShort=%d/%m/%Y
FormatDateShortJava=dd/MM/yyyy
FormatDateShortJQuery=dd/mm/yy
FormatHourShort=%I:%M %p
FormatHourShortDuration=%H:%M
FormatDateTextShort=%d %b %Y
FormatDateText=%d %B %Y
FormatDateHourShort=%d/%m/%Y %I:%M %p
FormatDateHourTextShort=%d %b %Y, %I:%M %p
FormatDateHourText=%d %B %Y, %I:%M %p

View File

@@ -0,0 +1,8 @@
# Dolibarr language file - en_SA - propal
CHARSET=UTF-8
Proposals=Commercial Proposals
Proposal=Commercial Proposal
Prop=Commercial Proposals
CommercialProposal=Commercial Proposal
CommercialProposals=Commercial Proposals
DateEndPropal=Validity Ending Date

View File

@@ -13,6 +13,7 @@ Language_en_AU=English (Australia)
Language_en_GB=English (United Kingdom)
Language_en_IN=English (India)
Language_en_NZ=English (New Zealand)
Language_en_SA=English (Saudi Arabia)
Language_en_US=English (United States)
Language_es_ES=Spanish
Language_es_AR=Spanish (Argentina)

View File

@@ -50,7 +50,7 @@ PredefinedMailTest=This is a test mail.\nThe two lines are separated by a carria
PredefinedMailTestHtml=This is a <b>test</b> mail (the word test must be in bold).<br>The two lines are separated by a carriage return.
PredefinedMailContentSendInvoice=You will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendInvoiceReminder=We would like to warn you that the invoice __FACREF__ seems to not being payed. So this is the invoice in attachment again, as a reminder.\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendProposal=You will find here the commercial propoal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendProposal=You will find here the commercial proposal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendOrder=You will find here the order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendSupplierOrder=You will find here our order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendSupplierInvoice=You will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
@@ -197,4 +197,4 @@ NoExportableData=No exportable data (no modules with exportable data loaded, or
ToExport=Export
NewExport=New export
##### External sites #####
ExternalSites=External sites
ExternalSites=External sites

View File

@@ -61,7 +61,7 @@ FileUploaded=The file was successfully uploaded
AssociatedDocuments=Documents associated with the proposal:
ErrorCantOpenDir=Can't open directory
DatePropal=Date of proposal
DateEndPropal=Date end validity
DateEndPropal=Validity ending date
DateEndPropalShort=Date end
ValidityDuration=Validity duration
CloseAs=Close with status

View File

@@ -13,6 +13,7 @@ Language_en_AU=Anglais (Australie)
Language_en_GB=Anglais (Royaume-Uni)
Language_en_IN=Anglais (Inde)
Language_en_NZ=Anglais (Nouvelle Zeland)
Language_en_SA=Anglais (Arabie Saoudite)
Language_en_US=Anglais (Etats-Unis)
Language_es_ES=Espagnol
Language_es_AR=Espagnol (Argentine)

View File

@@ -259,8 +259,8 @@ LastStableVersion = Laatste stabiele versie
GenericMaskCodes = U kunt elk gewenst maskernummer invoeren. In dit masker, kunnen de volgende tags worden gebruikt:<br><b>{000000}</b> correspondeert met een nummer welke vermeerderd zal worden op elke %s. Voer zoveel nullen in als de gewenste lengte van de teller. De teller wordt aangevuld met nullen vanaf links zodat er zoveel nullen zijn als in het masker.<br><b>{000000+000}</b> hetzelfde als voorgaand maar een offset corresponderend met het nummer aan de rechterkant van het + teken is toegevoegd startend op de eerste %s. <br><b>{000000@x}</b> hetzelfde als voorgaande maar de teller wordt gereset naar nul, wanneer maand x is bereikt (x tussen 1 en 12). Als deze optie is gebruikt en x is 2 of hoger, dan is de volgorde {yy}{mm} of {yyyy}{mm} ook vereist. <br><b>{dd}</b> dag (01 t/m 31).<br><b>{mm}</b> maand (01 t/m 12).<br><b>{yy}</b>, <b>{yyyy}</b> of <b>{y}</b> jaat over 2, 4 of 1 nummer(s). <br>
GenericMaskCodes2 = <b>{cccc}</b> de afnermerscode<br><b>{cccc000}</b> de afnermerscode en n karakters wordt opgevolgd door een afnermersreferentieteller zonder offset en gereset met de globale teller.<br><b>{tttt}</b> De code van bedrijfstype op n karakters (Zie het menu 'constantent' voor de bedrijfstypes<br>
GenericMaskCodes3 = Alle andere karakters in het masker zullen intact blijven.<br>Spaties zijn niet toegestaan.<br>
GenericMaskCodes4a = <u>Voorbeeld van de 99e %s van de derde partij 'HetBedrijf' gedaan op 2007-01-31:</u><br>
GenericMaskCodes4b = <u>Voorbeeld van een derde partij gecreëerd op 2007-03-01:</u><br>
GenericMaskCodes4a = <u>Voorbeeld van de 99e %s van de Klant 'HetBedrijf' gedaan op 2007-01-31:</u><br>
GenericMaskCodes4b = <u>Voorbeeld van een Klant gecreëerd op 2007-03-01:</u><br>
GenericMaskCodes5 = <b>ABC{jj}{mm}-{000000}</b> zal <b>ABC0701-000099</b> geven<br><b>{0000+100}-ZZZ/{dd}/XXX</b> zal <b>0199-ZZZ/31/XXX</b> geven
GenericNumRefModelDesc = Geeft een aanpasbaar nummer volgens een gedefinieerd masker.
ServerAvailableOnIPOrPort = Server is beschikbaar op het IP-adres <b>%s</b> met poort <b>%s</b>
@@ -296,7 +296,7 @@ TestSubmitForm = Invoer testformulier
Module0Name = Gebruikers & groepen
Module0Desc = Beheer gebruikers en groepen
Module1Name = Beheer derde partijen
Module1Desc = Beheer van derde partijen (afnemers, leveranciers en contactpersonen). Ook kunt u hier sjabloondocumenten uploaden.
Module1Desc = Beheer van derde partijen (klanten, leveranciers en contactpersonen). Ook kunt u hier sjabloondocumenten uploaden.
Module2Name = Commercieel
Module2Desc = Commercieel beheer
Module10Name = Boekhouding
@@ -307,10 +307,10 @@ Module22Name = EMailings
Module22Desc = Administratie en verzending van bulk-e-mails
Module23Name = Energie
Module23Desc = Monitoring van het verbruik van energie
Module25Name = Afnemersopdrachten
Module25Desc = Verkoopopdrachten
Module25Name = Bestellingen klanten
Module25Desc = Beheer van de bestellingen door klanten
Module30Name = Facturen
Module30Desc = Factuur- en creditnotabeheer voor afnemers. Factuurbeheer voor leveranciers
Module30Desc = Factuur- en creditnotabeheer voor klanten. Factuurbeheer voor leveranciers
Module40Name = Leveranciers
Module40Desc = Leveranciersbeheer (inkoopopdrachten en -facturen)
Module42Name = Syslog
@@ -341,7 +341,7 @@ Module70Name = Interventies
Module70Desc = Interventiesbeheer
Module75Name = Reisnotities en -kosten
Module75Desc = Beheer van reisnotities en -kosten
Module80Name = Expedities
Module80Name = Verzendingen
Module80Desc = Beheer afnemersverzending en -ontvangst
Module85Name = Bank en Contant
Module85Desc = Beheer van bank- en / of kasrekeningen
@@ -529,7 +529,7 @@ PermissionAdvanced253 = Creëer / wijzig de rechten van internet / externe gebru
Permission254 = Verwijderen of uitschakelen van andere gebruikers
Permission255 = Creëren / wijzigen eigen gebruikersgegevens
Permission256 = Wijzigen eigen wachtwoord
Permission262 = Uitbreiden van de toegang tot iedereen die verbonden is aan de derde partij (niet alleen die welke verband houden met de gebruiker). Niet functioneel voor externe gebruikers (altijd beperkt tot zichzelf).
Permission262 = Uitbreiden van de toegang tot iedereen die verbonden is aan de Klant (niet alleen die welke verband houden met de gebruiker). Niet functioneel voor externe gebruikers (altijd beperkt tot zichzelf).
Permission271 = Lees CA
Permission272 = Facturen inzien
Permission273 = Facturen uitgeven
@@ -836,7 +836,7 @@ UserMailRequired = E-mail verplicht om een nieuwe gebruiker creëren
CompanySetup = Derde partijenmoduleinstellingen
CompanyCodeChecker = Module voor de generatie en toetsing van codes voor derde partijen (afnemer of leverancier)
AccountCodeManager = Module voor de generatie van boekhoudkundige codes (afnemer of leverancier)
ModuleCompanyCodeAquarium = Geef een boekhoudkundige code terug opgebouwd uit "401", gevolgd door de de leverancierscode(Wanneer het een leverancier betreft) of een afnemerscode van de derde partij (Wanneer het een afnemer betreft).
ModuleCompanyCodeAquarium = Geef een boekhoudkundige code terug opgebouwd uit "401", gevolgd door de de leverancierscode(Wanneer het een leverancier betreft) of een afnemerscode van de Klant (Wanneer het een afnemer betreft).
ModuleCompanyCodePanicum = Geef een lege boekhoudkundige code terug.
ModuleCompanyCodeDigitaria = Boekhoudkundige-code is afhankelijk van derden code. De code bestaat uit het teken "C" in de eerste positie, gevolgd door de eerste 5 tekens van de derden code.
UseNotifications = Gebruik kennisgevingen
@@ -1201,7 +1201,7 @@ ClickToDialDesc = Deze module maakt het mogelijk om een icoontje te tonen achter
##### Point Of Sales (CashDesk) ##### =
CashDesk = Verkooppunten
CashDeskSetup = Verkooppuntenmoduleinstellingen
CashDeskThirdPartyForSell = Algemene derde partij te gebruiken bij verkopen
CashDeskThirdPartyForSell = Algemene Klant te gebruiken bij verkopen
CashDeskBankAccountForSell = Te gebruiken rekening voor ontvangst van contacte betalingen
CashDeskBankAccountForCheque = Te gebruiken rekening voor ontvangst van betalingen per cheque
CashDeskBankAccountForCB = Te gebruiken rekening voor ontvangst van betalingen per CreditCard

View File

@@ -223,9 +223,9 @@ ExportDataset_invoice_1 = Afnemersfacturen en factuurregels
ExportDataset_invoice_2 = Afnemersfacturen en -betalingen
ProformaBill = Proforma factuur:
Reduction = Vermindering
ReductionShort = Minder
ReductionShort = Korting
Reductions = Verminderingen
ReductionsShort = Minder
ReductionsShort = Korting
Discount = Korting
Discounts = Kortingen
ShowDiscount = Toon korting

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