diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..143f0739505 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +[*.php] +indent_style = space +indent_size = 4 +[*.js] +indent_style = space +indent_size = 2 +[*.css] +indent_style = space +indent_size = 2 +[*.xml] +indent_style = space +indent_size = 4 diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 73b43e95f4b..1db2aa867ae 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -180,8 +180,38 @@ tools: - 'htdocs/includes/*' paths: { } + php_changetracking: + enabled: false + bug_patterns: + - '\bfix(?:es|ed)?\b' + feature_patterns: + - '\badd(?:s|ed)?\b' + - '\bimplement(?:s|ed)?\b' + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + # Coding-Style / Bug Detection - js_hint: false + js_hint: + enabled: false + use_native_config: true + extensions: + - js + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + config: { } + path_configs: { } before_commands: { } diff --git a/.travis.yml b/.travis.yml index 57781d47e44..98ebd9ceea3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,13 @@ before_script: # - echo Update composer # - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update - echo PHPUnit version + - which phpunit - phpunit --version - echo Install phpcs then show installed rules - pyrus install pear/PHP_CodeSniffer - phpenv rehash + - which phpcs + - phpcs --version - phpcs -i - echo Create dir $(pwd)/htdocs/documents - sudo mkdir -p $(pwd)/htdocs/documents/admin/temp; @@ -83,6 +86,8 @@ before_script: - sudo cat /etc/apache2/sites-available/default - sudo /etc/init.d/apache2 restart - wget http://localhost/ + - sudo cat /etc/apache2/envvars + - sudo cat /var/log/apache2/error.log - cat index.html @@ -97,13 +102,15 @@ script: - php upgrade.php 3.6.0 3.7.0 >> upgrade.log # - cat upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log + - php upgrade.php 3.7.0 3.8.0 >> upgrade.log + - php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log # - cat upgrade2.log - cd ../.. - date - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php - date # - phpcs -p --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php 2>&1 - - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 + - phpcs -p --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/htdocs/conf/conf.php,/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 - date after_script: diff --git a/.tx/config b/.tx/config index c20f75769ae..e4d1fc65732 100644 --- a/.tx/config +++ b/.tx/config @@ -218,12 +218,6 @@ source_file = htdocs/langs/en_US/orders.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.oscommerce] -file_filter = htdocs/langs//oscommerce.lang -source_file = htdocs/langs/en_US/oscommerce.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.other] file_filter = htdocs/langs//other.lang source_file = htdocs/langs/en_US/other.lang @@ -242,6 +236,18 @@ source_file = htdocs/langs/en_US/paypal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.printipp] +file_filter = htdocs/langs//printipp.lang +source_file = htdocs/langs/en_US/printipp.lang +source_lang = en_US +type = MOZILLAPROPERTIES + +[dolibarr.productbatch] +file_filter = htdocs/langs//productbatch.lang +source_file = htdocs/langs/en_US/productbatch.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.products] file_filter = htdocs/langs//products.lang source_file = htdocs/langs/en_US/products.lang @@ -260,6 +266,12 @@ source_file = htdocs/langs/en_US/propal.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.resource] +file_filter = htdocs/langs//resource.lang +source_file = htdocs/langs/en_US/resource.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.salaries] file_filter = htdocs/langs//salaries.lang source_file = htdocs/langs/en_US/salaries.lang @@ -313,4 +325,3 @@ file_filter = htdocs/langs//workflow.lang source_file = htdocs/langs/en_US/workflow.lang source_lang = en_US type = MOZILLAPROPERTIES - diff --git a/COPYRIGHT b/COPYRIGHT index fd54e10f354..2e1c6e921b9 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -26,7 +26,7 @@ TCPDF 6.0.093 LGPL-3+ Yes JS libraries: jQuery 1.8.2 MIT License Yes JS library jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI -jQuery multiple-select 1.1.0 MIT License Yes JS library plugin for sexier multiselect +jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors jQuery DataTables 1.9.4 BSD Yes JS library for tables output diff --git a/ChangeLog b/ChangeLog index 9f1ae0857a2..a5d67d88d7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Match other auth system: Login can be done entering login or user + email (this open the road for SSO). - New: Agenda export by project #1967. - New: Increase length of thirdparty to 128 chars. - New: "Is Order shippable" icon #1975. @@ -80,8 +82,9 @@ For users: - New: Add dunning into accountancy report. - New: Add favorite button into country dictionary to put value on top select list - Upgrade phpexcel lib to 1.7.8 -- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export -- New : Option on extrafields to have them always editable regardless of the document status +- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export. +- New : Option on extrafields to have them always editable regardless of the document status. +- New : New module PrintIPP to print without opening document is available as stable. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem @@ -160,7 +163,8 @@ Dolibarr better: creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. - A lot of pages called fiche.php were renamed into card.php - A lot of pages called liste.php were renamed into list.php - +- If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the + warehouse module and your Point Of Sale module if you use one. ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** @@ -172,7 +176,10 @@ Dolibarr better: - Fix: Civility & birthdate wasn't save into adherent module. - Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref - Fix: Chars - is no more allowed into value for code for extra fields. -( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache +- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache +- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state +- Fix: Show sender Country on PDF docs when sender Country <> receiver Country +- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: @@ -315,6 +322,14 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 +Fix: Can't update phone_pro from web service +Fix: Some security holes. +Fix: copy extrafields when creating order from proposal. +Fix: report on action was not filtering by environment. +Fix: Avoid missing class error. +Fix: Add function dolEscapeXML. +Fix: Bad days and month reported by function. +Fix: Bad margin calculation. ***** ChangeLog for 3.5.5 compared to 3.5.4 ***** Fix: Holiday module was broken. Initializaion of amount of holidays failed. diff --git a/build/debian/README.howto b/build/debian/README.howto index f9bb31c6fcf..6d5280e56c1 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -101,14 +101,38 @@ http://packages.qa.debian.org/package.html http://bugs.debian.org/package +##### Modify severity of a bug ticket + +- Send this email to control@bugs.debian.org and wait 10 minutes + +severity 123 xxx + + +##### Update but tracker system + +To set status of a bug to "pending" +> bts tag 999999 +pending + +or replay to email 999999@bugs.debian.org + submitter of bug +With a message starting with: + +Control: tag -1 +pending +Thanks. Fixed into git. + +or replay to email control@bugs.debian.org +With only message +tag 729538 +pending + + ##### Testing a package into unstable env -Check you have a mysql server available from another interface than localhost +Check you have a mysql server available from another interface than "localhost". Comment line in /etc/mysql/my.cnf if required and restart mysql #bind-address = 127.0.0.1 -Create a chroot called "unstable-amd64-sbuild" +Create a chroot called "unstable-amd64-sbuild". +Chroot env is stored into /srv/chroot directory. > sudo sbuild-createchroot --keyring= unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian Pour lister les env chroot @@ -116,6 +140,7 @@ Pour lister les env chroot Puis pour se connecter et préparer l'environnement > schroot -c name_of_chroot +> cat /etc/debian_chroot to check which debian branch we are into > vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok) > apt-get install links mysql-client @@ -129,7 +154,10 @@ Pour tester un package > dpkg -i dolibarr*.deb ou pour avoir des traces: dpkg -D77777 -i dolibarr*.deb > apt-get install -f -Puis http://localhost/dolibarr/ (cela peut etre appeler depuis le hote). +If there is a problem launching apache, because port is already used, change it into your chroot install with +> vi /etc/apache2/ports.conf +Then restart. +Then you can call/test dolibarr with http://localhost:port/dolibarr/ (It can be also called from host). @@ -196,23 +224,6 @@ http://packages.qa.debian.org/t/tcpdf.html * Package will be into release when test will be moved as stable. - -##### Update but tracker system -To set status of a bug to pending -> bts tag 999999 +pending - -or replay to email 999999@bugs.debian.org + submitter of bug -With a message starting with: -Control: tag -1 +pending -and then a text like: -Thanks. Fixed into git. - -or replay to email control@bugs.debian.org -With only message -tag 729538 +pending - - - ##### Create/Maintain dolibarr package To update dolibarr debian package @@ -251,7 +262,7 @@ x.y.z+dfsgw Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit * Add an entry into debian/changelog -> dch -v x.y.z+dfsg-w "My comment" will add entry. +> dch -v x.y.z+dfsgw-v "My comment" will add entry. For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Then check/modify also the user/date signature: diff --git a/build/debian/changelog b/build/debian/changelog index d3772a76785..e8ea7be4823 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -3,81 +3,4 @@ dolibarr (3.7.0-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Tue, 21 Oct 2014 12:00:00 +0100 - -dolibarr (3.6.1-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 23 Sep 2014 12:00:00 +0100 - -dolibarr (3.6.0-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 15 July 2014 12:00:00 +0100 - -dolibarr (3.5.5-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 8 July 2014 12:00:00 +0100 - -dolibarr (3.5.4-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 1 July 2014 12:00:00 +0100 - -dolibarr (3.5.3-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 2 May 2014 12:00:00 +0100 - -dolibarr (3.5.2-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 14 March 2014 12:00:00 +0100 - -dolibarr (3.5.1-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 7 Feb 2014 12:00:00 +0100 - -dolibarr (3.5.0-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Fri, 31 Jan 2014 12:00:00 +0100 - -dolibarr (3.4.2-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 30 Dec 2013 12:00:00 +0100 - -dolibarr (3.4.1-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 27 Apr 2013 12:00:00 +0100 - -dolibarr (3.4.0-3) UNRELEASED; urgency=low - - [ Laurent Destailleur (eldy) ] - * Maintenance release. - - -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Tue, 21 Oct 2014 12:00:00 +0100 \ No newline at end of file diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index 1f4cbd00215..e11df270ddc 100755 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -26,7 +26,7 @@ for $projectname by Doxygen $doxygenversio -
+
-
+
diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index 363d408d43c..0c2e189136b 100755 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -24,7 +24,7 @@ File added into doxygen generated documentation
-
+
@@ -54,7 +54,7 @@ File added into doxygen generated documentation
$projectname
- $projectnumber
-
+
diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 370c04591a9..7d34993c5fe 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -365,6 +365,7 @@ if ($nboftargetok) { print "Clean $BUILDROOT\n"; $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.editorconfig`; $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; @@ -373,7 +374,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; - $ret=`rm -f $BUILDROOT/$PROJECT/quickbuild.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; diff --git a/build/obs/README b/build/obs/README index 8fc4c27d9b2..fefe6dbd91d 100644 --- a/build/obs/README +++ b/build/obs/README @@ -29,12 +29,18 @@ To submit a snapshot for building, we should have a service file with content How to have such a service file created automatically ? -Click on "Add file", then select mode "Upload From: Remote URL" -Enter the Remote URL that should looks like this: http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-3.src.rpm -Then add into advanded - attributes +Go into project you want to update. It mught be: +- openSUSE Build Service > Projects > Application:ERP:Dolibarr > dolibarr +- or your private project + +Once logged, click on "Add file" in section "Source Files", then select mode "Upload From: Remote URL" +Keep empty for "Filename", choose "Remote URL" and enter into last field, URL that should looks like this: +http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.3.src.rpm + +Then add into Advanded - Attributes OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png -OBS:QualityCategory Testing +OBS:QualityCategory Stable|Testing|Development|Private # Move project into official directory diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 1007c84eb96..37bcdf8e96b 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -340,21 +340,3 @@ fi * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release - -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release - -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 5fd9a74f1a6..812e0d3a1c0 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -577,20 +577,3 @@ fi * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release - -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index c6fda416db0..5a81827f5fa 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -346,20 +346,3 @@ fi * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release - -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 935ebf2e6df..5d1e1e19765 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -357,20 +357,3 @@ fi * Wed Jul 15 2014 Laurent Destailleur 3.6.0-0.3 - Upstream release -* Tue Jul 8 2014 Laurent Destailleur 3.5.5-0.3 -- Upstream release - -* Tue Jul 1 2014 Laurent Destailleur 3.5.4-0.3 -- Upstream release - -* Fri May 2 2014 Laurent Destailleur 3.5.3-0.3 -- Upstream release - -* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 -- Upstream release - -* Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 -- Upstream release - -* Mon Dec 30 2013 Laurent Destailleur 3.5.0-0.3 -- Initial version (#723326) diff --git a/dev/codesniffer/README b/dev/codesniffer/README index b06a2b1e5f6..8a68d8a1140 100755 --- a/dev/codesniffer/README +++ b/dev/codesniffer/README @@ -1,9 +1,12 @@ README (English) -------------------------------- -This directory contains ruleset files to use to -develop Dolibarr EPR & CRM with Eclipse. +This directory contains ruleset files to use to develop Dolibarr EPR & CRM. -Note: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: +To install/upgrade phpcs: +> sudo pear upgrade PHP_CodeSniffer + +Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 -* path of code sniffer standard to dev/codesniffer \ No newline at end of file +* path of code sniffer standard to dev/codesniffer + diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 7e3057a6675..ffbc1bace39 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -6,6 +6,7 @@ */conf.php */includes/* */documents/* + */dev/vagrant/* */custom/* */nltechno* @@ -169,6 +170,40 @@ 0 + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + 0 + + + 0 + + + 0 + + + 0 +
-
+
@@ -46,7 +46,7 @@
-
+
'."\n"; print_titre($langs->trans("BoxesAvailable")); -print ''; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print '
'."\n"; print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=true; foreach($boxtoadd as $box) @@ -341,12 +349,10 @@ foreach($boxtoadd as $box) } print "\n".''."\n"; - print ''; - print ''; - print ''; + print ''."\n"; print ''; + print ''."\n"; print ''; - print ''; + print ''."\n"; + print ''."\n"; // Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position - print ''; - print ''; - print ''; + print ''."\n"; } -print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("SourceFile").''.$langs->trans("ActivateOn").''.$langs->trans("ActivateOn").'
'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; - print ''; if ($box->note == '(WarningUsingThisBoxSlowDown)') { @@ -354,22 +360,24 @@ foreach($boxtoadd as $box) print $langs->trans("WarningUsingThisBoxSlowDown"); } else print ($box->note?$box->note:' '); - print '' . $box->sourcefile . '' . $box->sourcefile . ''; - print $form->selectarray("pos",$pos_name,0,0,0,0,'',1); - print ''; - print ''; - print ' '; + print ''; + print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, 0, 1, 0, 0, '', 1)."\n"; + print ''."\n"; print '
'; +print ''."\n"; +print '
'; +print ''; +print '
'."\n"; +print ''; +print "\n".''."\n"; // Activated boxes @@ -421,8 +429,8 @@ foreach($boxactivated as $key => $box) $hasprevious=($key != 0); print ''.($key+1).''; print ''; - print ($hasnext?''.img_down().' ':''); - print ($hasprevious?''.img_up().'':''); + print ($hasnext?''.img_down().' ':''); + print ($hasprevious?''.img_up().'':''); print ''; print ''; print ''.img_delete().''; @@ -436,13 +444,14 @@ print '
'; // Other parameters +print "\n\n".''."\n"; print_titre($langs->trans("Other")); -print ''; - -$var=false; print ''; print ''; print ''; +print '
'; + +$var=false; print ''; print ''; print ''; @@ -459,9 +468,10 @@ print ''."\n"; print ''; -print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''; print ''; print '
'; +print ''; +print "\n".''."\n"; llxFooter(); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 3e85d377055..414e0ed1e99 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -94,7 +94,7 @@ print ''; print ''; -print '

'; +print '

'; print '

'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 89a78b5d6da..a0f535c2b7b 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -249,7 +249,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print '
'; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 96dff7755af..a349973b3dc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -668,11 +668,11 @@ if ($action == 'edit' || $action == 'updateedit') } - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print '
'; print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 48e637fb8a3..a64e3856dbc 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -260,7 +260,7 @@ if ($result) // Note print ''; - print ''; + print ''; print ''; // Entity limit to superadmin diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 274d1adc34e..b795f121234 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -177,7 +177,7 @@ if ($action == 'edit') print '
'; - print '
'; + print '
'; print '
'; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4d33723a947..05402898ee6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -192,7 +192,7 @@ $tabfield[3] = "code,libelle,country_id,country"; $tabfield[4] = "code,label"; $tabfield[5] = "code,label"; $tabfield[6] = "code,libelle,type,color,position"; -$tabfield[7] = "code,libelle,country_id,country,accountancy_code,deductible"; +$tabfield[7] = "code,libelle,country,accountancy_code,deductible"; $tabfield[8] = "code,libelle,country_id,country"; $tabfield[9] = "code,label,unicode"; $tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; @@ -453,8 +453,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { + if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'color' && empty($_POST['color'])) continue; @@ -1361,14 +1361,18 @@ function fieldList($fieldlist,$obj='',$tabname='') continue; } // For state page, we do not show the country input (we link to region, not country) print ''; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28); + $fieldname='country'; + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28); print ''; } elseif ($fieldlist[$field] == 'country_id') { - $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print ''; - print ''; - print ''; + if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) + { + $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); + print ''; + print ''; + print ''; + } } elseif ($fieldlist[$field] == 'region') { print ''; diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php index c81366bc5e9..ac0fe715c99 100644 --- a/htdocs/admin/dons.php +++ b/htdocs/admin/dons.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -37,6 +37,8 @@ $typeconst=array('yesno','texte','chaine'); $action = GETPOST('action','alpha'); +$type='donation'; + /* * Action @@ -135,7 +137,7 @@ else if ($action == 'setart200') { $res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -147,7 +149,7 @@ else if ($action == 'setart238') { $res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -159,7 +161,7 @@ else if ($action == 'setart885') { $res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - + if (! $error) { setEventMessage($langs->trans("SetupSaved"), 'mesgs'); } else { @@ -183,7 +185,7 @@ print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup'); * Params */ print_titre($langs->trans("Options")); - + print ''; print ''; print ''; @@ -207,11 +209,11 @@ print ''; /* * French params */ -if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR") +if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR") { print '
'; print_titre($langs->trans("FrenchOptions")); - + print '
'.$langs->trans("Parameter").'
'; print ''; print ''; @@ -377,7 +379,7 @@ if (is_resource($handle)) print ''; - + // Preview print ''; print '
' . $langs->trans('Parameters') . ''; print $form->textwithpicto('',$htmltooltip,-1,0); print ''; print ''.img_object($langs->trans("Preview"),'generic').''; diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 59205dcdbab..d5562248c55 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -78,15 +78,16 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("LogEventDesc")."
\n"; print "
\n"; -$head=security_prepare_head(); - -dol_fiche_head($head, 'audit', $langs->trans("Security")); - print '
'; print ''; print ''; +$head=security_prepare_head(); + +dol_fiche_head($head, 'audit', $langs->trans("Security")); + + $var=true; print ""; print ""; @@ -109,14 +110,14 @@ foreach ($eventstolog as $key => $arr) } print '
'; -print '
'; +dol_fiche_end(); + +print '
'; print "trans("Save")."\">"; -print "
"; +print ""; print "
\n"; -print ''; - -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f23e80f78ff..520193a81c3 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -214,11 +214,11 @@ print '
http://news.google.com/news?ned=us&topic=h&output=rss
http://www.d print '
'; -print '

'; +print '
'; print ''; print ''; print ''; -print '

'; +print '


'; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 3c251cf6c3b..a7692655a0a 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -296,7 +296,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice'); /* diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 2541a6265e7..a66c417923b 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -165,7 +165,7 @@ else $readonly=($mode=='dolibarr_readonly'?1:0); $editor=new DolEditor('formtestfield',isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test','',200,$mode,'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); - print '

'."\n"; + print '
'."\n"; print '
'; print ''."\n"; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 5cdb41cbe23..5c8009d2b13 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -119,7 +119,7 @@ if ($action == 'edit') // Edit print_fiche_titre($langs->trans("Language"),'','').'
'; print ''; - print ''; + print ''; print ''; print ''; @@ -142,7 +142,7 @@ if ($action == 'edit') // Edit print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 

'."\n"; // Themes - show_theme('',1); + show_theme(null,1); print '
'; // Liste des zone de recherche permanantes supportees @@ -161,7 +161,7 @@ if ($action == 'edit') // Edit // Other print ''; - print ''; + print ''; print ''; print ''; @@ -287,9 +287,9 @@ if ($action == 'edit') // Edit print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'."\n"; - print '
'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; @@ -301,7 +301,7 @@ else // Show // Language print_fiche_titre($langs->trans("Language"),'','').'
'; print ''; - print ''; + print ''; $var=!$var; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("DefaultLanguage").''; @@ -323,7 +323,7 @@ else // Show // Themes - show_theme('',0); + show_theme(null,0); print '
'; @@ -345,7 +345,7 @@ else // Show // Other $var=true; print ''; - print ''; + print ''; $var=!$var; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index bbedab346d1..6ec184d68ec 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -109,7 +109,7 @@ if (empty($reshook)) print "
"; // Show logo - print '
'; + print '
'; } diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index ef893031db1..e84a3abfffa 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -239,7 +239,7 @@ print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . 'secret
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 5896ffc5416..2281f83bdd1 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -126,9 +126,9 @@ if ($action == 'edit') print '
'; - print '
'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index f4d2010ca74..3e4a2c14a98 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -158,7 +158,8 @@ $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); -$var=!$var; +$var=true; + if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 61914d1a09c..b39760c6907 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -477,11 +477,11 @@ if ($action == 'edit') print '">'; print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 2e050a4bbe8..c5fb55cbce5 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -26,7 +26,6 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action=GETPOST('action'); @@ -204,11 +203,11 @@ if ($action == 'edit') print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; } diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index ff015884bbc..c8964d7bbaa 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -369,9 +369,11 @@ if ($action == 'create') print ''; // Boutons - print '

'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -453,9 +455,11 @@ elseif ($action == 'edit') print ''; // Bouton - print '

'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 215f2eae069..d7fce1c937d 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -326,6 +326,7 @@ if ($conf->use_javascript_ajax) '
'.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. ''.img_edit_add('default').' '. ''.img_delete('default').' '. + '     '. ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. '' ); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index fd3f74c06c2..9ce93a6bc26 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -534,7 +534,7 @@ dol_fiche_end(); // Show warning about external users -if ($mode != 'marketplace') print '
'.showModulesExludedForExternal($modules).'

'."\n"; +if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n"; llxFooter(); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 14aeba65c29..ce3c8d10f73 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -142,7 +142,7 @@ print ''; print '
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 90ceed434c2..81b7e74a479 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -73,7 +73,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index 8f1dfb80538..515714a51e4 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -74,7 +74,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup'); print "
\n"; -$head = order_admin_prepare_head(null); +$head = order_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), 0, 'order'); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index f21687eecf7..64a213467d4 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -250,9 +250,9 @@ if ($action == 'edit') // Edit print ''; - print '
'; + print '
'; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 74a9b8c8434..907ed389b38 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -116,7 +116,7 @@ foreach ($modulesdir as $dir) $db->commit(); // Show warning about external users -print showModulesExludedForExternal($modules).'
'."\n"; +print info_admin(showModulesExludedForExternal($modules)).'
'."\n"; print "
\n"; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6094bb7e4f1..c5e7ddfabf6 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -161,7 +161,7 @@ print ''; print ''; print '
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 328866eb964..01f32740036 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -163,6 +163,22 @@ if ($action == 'setdefaultduration') } } +if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') +{ + $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) if ($action == 'setModuleOptions') { @@ -247,7 +263,7 @@ $form=new Form($db); $linkback='
'.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal'); @@ -582,6 +598,35 @@ print '' print "\n"; print ''; +if ($conf->banque->enabled) +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + if (! empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print ''; +} +else +{ + $var=!$var; + print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').''; +} + print ''; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 050c92fd188..2e9d1f49169 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -86,6 +86,13 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("ProxyDesc")."
\n"; print "
\n"; + + +print '
'; +print ''; +print ''; + + $head=security_prepare_head(); dol_fiche_head($head, 'proxy', $langs->trans("Security")); @@ -118,10 +125,6 @@ if ($conf->use_javascript_ajax) // Timeout $var=true; -print ''; -print ''; -print ''; - print ''; print ''; @@ -196,14 +199,13 @@ print ''; print '
'; -print '
'; -print ''; -print '
'; - -print '
'; - dol_fiche_end(); +print '
'; +print ''; +print '
'; + +print ''; $db->close(); diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index d7027d8a1dd..99651a4f4f3 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -23,7 +23,7 @@ */ require '../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -45,7 +45,7 @@ $list = array ( /* * Actions */ - + if ($action == 'update') { $error = 0; @@ -72,12 +72,12 @@ if ($action == 'update') * View */ -llxHeader(); +llxHeader('',$langs->trans('SalariesSetup')); $form = new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans('ConfigSalaries'),$linkback,'setup'); +print_fiche_titre($langs->trans('SalariesSetup'),$linkback,'setup'); print '
'; print ''; @@ -98,7 +98,7 @@ foreach ($list as $key) print ''; // Param - $label = $langs->trans($key); + $label = $langs->trans($key); print ''; // Value diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 8c65d1f3359..064f7ad0cd9 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -80,35 +80,15 @@ else if (preg_match('/del_(.*)/',$action,$reg)) } } -else if ($action == 'MAIN_SESSION_TIMEOUT') +else if ($action == 'updateform') { - if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UPLOAD_DOC') -{ - if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_UMASK') -{ - if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_COMMAND') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_ANTIVIRUS_PARAM') -{ - if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); -} -else if ($action == 'MAIN_APPLICATION_TITLE') -{ - if (! dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else setEventMessage($langs->trans("RecordModifiedSuccessfully")); + $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); + $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); + $res3=dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity); + $res4=dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity); + $res5=dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity); + $res6=dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity); + if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) setEventMessage($langs->trans("RecordModifiedSuccessfully")); } @@ -138,59 +118,17 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("MiscellaneousDesc")."
\n"; print "
\n"; + + +print ''; +print ''; +print ''; + $head=security_prepare_head(); dol_fiche_head($head, 'misc', $langs->trans("Security")); -// Timeout -$var=true; - -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$var=!$var; -$sessiontimeout=ini_get("session.gc_maxlifetime"); -if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("SessionTimeOut").''; -print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); -print ''; -print ' '.strtolower($langs->trans("Seconds")); -print ''; -print ''; -print '
'.$langs->trans("HiddeNumVersion").''; -print $form->textwithpicto('',$langs->trans("HiddeNumVersionExample",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); -print ''; -print ' '; -print ''; -print ''; -print '
'; -print '
'; - - // Other Options $var=true; @@ -254,6 +192,44 @@ print ""; print ''; + +print '
'; + + +// Timeout +$var=true; + +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=!$var; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; +print ''; +print ''; +print ''; +print ''; + +$var=!$var; +$sessiontimeout=ini_get("session.gc_maxlifetime"); +if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; +print ''; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("SessionTimeOut").''; +print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); +print ''; +print ' '.strtolower($langs->trans("Seconds")); +print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; +print ''; +print ' '; +print '
'; + print '
'; // Upload options @@ -263,11 +239,8 @@ print ''; print ''; print ''; print ''; -print ''; print ''; -print ''; -print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; $var=!$var; -print ''; -print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; // Use anti virus $var=!$var; -print ''; -print ''; print ""; print '"; -print ''; print ''; -print ''; // Use anti virus $var=!$var; -print ''; -print ''; print ""; print ''; print '"; -print ''; print ''; -print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("MaxSizeForUploadedFiles").'.'; $max=@ini_get('upload_max_filesize'); @@ -277,14 +250,9 @@ print ''; print ' '.$langs->trans("Kb"); print ''; -print ''; -print '
'.$langs->trans("UMask").''; print $form->textwithpicto('',$langs->trans("UMaskExplanation")); @@ -292,15 +260,10 @@ print ''; print ''; print ''; -print ''; -print '
'.$langs->trans("AntiVirusCommand").'
'; print $langs->trans("AntiVirusCommandExample"); @@ -320,16 +283,10 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) } print ''; print "
'; -print ''; -print '
'.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); @@ -337,16 +294,18 @@ print '
'; print ''; print "'; -print ''; -print '
'; dol_fiche_end(); +print '
'; + +print ''; + + + // Form to test upload print '
'; $formfile=new FormFile($db); diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 0ba8427cca5..6213acec5b7 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -203,11 +203,11 @@ if ($action == 'edit') */ print ''; - print '
'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index af46c074bb9..9c81338562e 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -117,10 +117,11 @@ $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); +$var=true; + /* * Spip */ -$var=!$var; if (! empty($conf->global->ADHERENT_USE_SPIP)) { //$lien=img_picto($langs->trans("Active"),'tick').' '; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index d0582a91630..6b2c626da39 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -113,35 +113,20 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("StockSetup"),$linkback,'setup'); $form=new Form($db); -$var=true; -print ''; -print ''; -print " \n"; -print " \n"; -print ''."\n"; -/* - * Formulaire parametres divers - */ +$disabled=''; +if (! empty($conf->productbatch->enabled)) +{ + $langs->load("productbatch"); + $disabled=' disabled="disabled"'; + print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced")); +} -$var=!$var; - -print ""; -print ''; - -print '\n"; -print "\n"; -print '
'; -print '
".$langs->trans("Parameters")." 
'.$langs->trans("UserWarehouseAutoCreate").''; -print "
"; -print ''; -print ""; -print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); -print ''; -print '
'; -print "
'; -print '
'; +//if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) +//{ +print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule")); +//} // Title rule for stock decrease print ''; @@ -160,8 +145,8 @@ if (! empty($conf->facture->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); + print ''; print "\n\n\n"; } @@ -174,8 +159,8 @@ if (! empty($conf->commande->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); + print ''; print "\n\n\n"; } @@ -188,11 +173,12 @@ if (! empty($conf->expedition->enabled)) print ""; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); + print ''; print "\n\n\n"; } print '
'; + print '
'; // Title rule for stock increase @@ -212,8 +198,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); + print ''; print "
\n\n\n"; } @@ -226,8 +212,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); + print ''; print "
\n\n\n"; } if (! empty($conf->fournisseur->enabled)) @@ -239,8 +225,8 @@ if (! empty($conf->fournisseur->enabled)) print "
"; print ''; print ""; - print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1); - print ''; + print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); + print ''; print "
\n\n\n"; } @@ -329,6 +315,34 @@ if ($virtualdiffersfromphysical) print ''; } + +$var=true; +print ''; + +print ''; +print " \n"; +print " \n"; +print ''."\n"; + +$var=!$var; + +print ""; +print ''; + +print '\n"; +print "\n"; +print '
'; +print '
".$langs->trans("Other")." 
'.$langs->trans("UserWarehouseAutoCreate").''; +print "
"; +print ''; +print ""; +print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1); +print ''; +print '
'; +print "
'; +print '
'; + + llxFooter(); $db->close(); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 5745c5f82ba..2f48eb2be79 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -198,7 +198,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index ac2ab824233..2d4be98f34a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -199,7 +199,7 @@ print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index ba584bdae8c..e47c8738041 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -38,6 +38,7 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); $langs->load("bills"); +$langs->load("orders"); $langs->load("suppliers"); $extrafields = new ExtraFields($db); @@ -75,7 +76,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 4a2671942fa..96e20b92f17 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -73,7 +73,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup'); print "
\n"; -$head = supplierorder_admin_prepare_head(null); +$head = supplierorder_admin_prepare_head(); dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index b69e8a4cacf..18de8bf6bfc 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -183,8 +183,9 @@ foreach ($syslogModules as $moduleName) { $module = new $moduleName; - $moduleactive=$module->isActive(); - if ($moduleactive == -1 && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) + $moduleactive=(int) $module->isActive(); + //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."
\n"; + if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) $var=!$var; print ''; @@ -199,7 +200,7 @@ foreach ($syslogModules as $moduleName) { foreach ($setuparray as $option) { - if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']]; + if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']]; else if (defined($option['constant'])) $value = constant($option['constant']); else $value = (isset($option['default']) ? $option['default'] : ''); @@ -220,7 +221,7 @@ foreach ($syslogModules as $moduleName) print "\n"; print "\n"; -print '
'; +print '
'."\n\n"; print_titre($langs->trans("SyslogLevel")); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index ec72b30864f..abb9710cc03 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -53,7 +53,7 @@ print '

'; // Show logo -print '
'; +print '
'; llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 4f3f14302fd..a872c0676f2 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -151,7 +151,7 @@ print ''; if ($choice != 'confirm_allfiles') { print '
'; - print '
'; + print '
'; } print ''; diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index d862cb5da8f..0ce692674b1 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -121,8 +121,8 @@ if ($action == 'builddoc') if (! $error) { $code=$forbarcode; - $generator=$stdobject->barcode_type_coder; - $encoding=strtoupper($stdobject->barcode_type_code); + $generator=$stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine. + $encoding=strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ... $barcodeimage=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; $diroutput=$conf->barcode->dir_temp; diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 68adb30f7ab..95be1b5251a 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -80,7 +80,7 @@ print ''; print $langs->trans("NbOfBoomarkToShow").''; print ''; print ''; -print '
'; +print '
'; $db->close(); diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 640e7e72c57..a821cf8e94f 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2014 Marcos García * * 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 @@ -43,6 +44,8 @@ $userid=GETPOST("userid","int"); $position=GETPOST("position","int"); $backtopage=GETPOST('backtopage','alpha'); +$bookmark=new Bookmark($db); + /* * Actions @@ -50,6 +53,13 @@ $backtopage=GETPOST('backtopage','alpha'); if ($action == 'add' || $action == 'addproduct' || $action == 'update') { + + if ($action == 'update') { + $invertedaction = 'edit'; + } else { + $invertedaction = 'create'; + } + $error = 0; if (GETPOST("cancel")) @@ -59,7 +69,6 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') exit; } - $bookmark=new Bookmark($db); if ($action == 'update') $bookmark->fetch($_POST["id"]); $bookmark->fk_user=$userid; $bookmark->title=$title; @@ -69,12 +78,12 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if (! $title) { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("BookmarkTitle")), 'errors'); + setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("BookmarkTitle")), 'errors'); } if (! $url) { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("UrlOrLink")), 'errors'); + setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->trans("UrlOrLink")), 'errors'); } if (! $error) @@ -95,43 +104,21 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update') if ($bookmark->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - setEventMessage($langs->trans("WarningBookmarkAlreadyExists"), 'warnings'); + setEventMessage($langs->transnoentities("WarningBookmarkAlreadyExists"), 'warnings'); } else { setEventMessage($bookmark->error, 'errors'); } - $action='create'; + $action = $invertedaction; } } else { - $action='create'; + $action = $invertedaction; } } -if ($action == 'delete') -{ - $bookmark=new Bookmark($db); - $bookmark->id=$_GET["bid"]; - $bookmark->url=$user->id; - $bookmark->target=$user->id; - $bookmark->title='xxx'; - $bookmark->favicon='xxx'; - - $res=$bookmark->remove(); - if ($res > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - setEventMessage($bookmark->error, 'errors'); - } -} - - /* * View */ @@ -141,6 +128,17 @@ llxHeader(); $form=new Form($db); +$head = array(); +$h=1; + +$head[$h][0] = $_SERVER["PHP_SELF"].($bookmark->id?'id='.$bookmark->id:''); +$head[$h][1] = $langs->trans("Card"); +$head[$h][2] = 'card'; +$h++; + +$hselected='card'; + + if ($action == 'create') { /* @@ -150,11 +148,11 @@ if ($action == 'create') print '
'."\n"; print ''; print ''; - + print_fiche_titre($langs->trans("NewBookmark")); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); - + print ''; print ''; @@ -175,16 +173,16 @@ if ($action == 'create') print 'position).'">'; print ''; - print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
 

'; - + print ''; + + dol_fiche_end(); + print '
'; print '   '; print ''; print '
'; print '
'; - - dol_fiche_end(); } @@ -193,11 +191,15 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) /* * Fact bookmark mode or visually edition */ - $bookmark=new Bookmark($db); $bookmark->fetch($id); - - dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + $head = array( + array( + '', + $langs->trans('Card'), + 'card' + ) + ); if ($action == 'edit') { @@ -209,16 +211,37 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print ''; } + dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + print ''; print ''; - print ''; - print ''; @@ -267,12 +290,14 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print '
'.$langs->trans("Ref").''.$bookmark->ref.'
'.$langs->trans("BookmarkTitle").''; + print '
'; + if ($action == 'edit') { + print ''; + } + + print $langs->trans("BookmarkTitle"); + + if ($action == 'edit') { + print ''; + } + + print ''; if ($action == 'edit') print 'title).'">'; else print $bookmark->title; print '
'.$langs->trans("UrlOrLink").''; + print '
'; + if ($action == 'edit') { + print ''; + } + print $langs->trans("UrlOrLink"); + if ($action == 'edit') { + print ''; + } + print ''; if ($action == 'edit') print 'url).'">'; else print 'target?' target="_blank"':'').'>'.$bookmark->url.''; print '
'; - if ($action == 'edit') print '
   
'; - - if ($action == 'edit') print ''; - dol_fiche_end(); + if ($action == 'edit') + { + print '
   
'; + print ''; + } + print "
\n"; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 61dc0a91d7e..748a4d9b7fa 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -25,6 +25,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; $langs->load("bookmarks"); +$langs->load("admin"); // Security check if (! $user->rights->bookmark->lire) { @@ -58,7 +59,7 @@ if ($_GET["action"] == 'delete') } else { - $setEventMessage($bookmark->error, 'errors'); + setEventMessage($bookmark->error, 'errors'); } } diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 277dc81820b..861267b94f3 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -50,14 +50,13 @@ if (GETPOST('action','alpha') == 'set') $db->begin(); if (GETPOST('socid','int') < 0) $_POST["socid"]=''; - /*if (GETPOST("CASHDESK_ID_BANKACCOUNT") < 0) $_POST["CASHDESK_ID_BANKACCOUNT"]=''; - if (GETPOST("CASHDESK_ID_WAREHOUSE") < 0) $_POST["CASHDESK_ID_WAREHOUSE"]='';*/ - $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",GETPOST('socid','int'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha'),'chaine',0,'',$conf->entity); - $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",GETPOST('CASHDESK_ID_WAREHOUSE','alpha'),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",(GETPOST('socid','int') > 0 ? GETPOST('socid','int') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",(GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",(GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",(GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",(GETPOST('CASHDESK_ID_WAREHOUSE','alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE','alpha') : ''),'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",GETPOST('CASHDESK_NO_DECREASE_STOCK','alpha'),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES','alpha'),'chaine',0,'',$conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level','alpha')); @@ -129,9 +128,25 @@ if (! empty($conf->banque->enabled)) if (! empty($conf->stock->enabled)) { $var=!$var; - print ''.$langs->trans("CashDeskIdWareHouse").''; + print ''.$langs->trans("CashDeskDoNotDecreaseStock").''; // Force warehouse (this is not a default value) print ''; - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1); + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); + print ''; + + $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; + + $var=!$var; + print ''.$langs->trans("CashDeskIdWareHouse").''; // Force warehouse (this is not a default value) + print ''; + if (! $disabled) + { + print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1,$disabled); + print ' ('.$langs->trans("Create").')'; + } + else + { + print $langs->trans("StockDecreaseForPointOfSaleDisabled"); + } print ''; } @@ -148,7 +163,7 @@ if (! empty($conf->service->enabled)) print ''; print '
'; -print '
'; +print '
'; print "\n"; diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index 9940e70cc93..6d8f5ca83ee 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -45,7 +45,17 @@ else -// Left area with selected articles (shopping cart) +$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart'] + +$total_ttc = $obj_facturation->prixTotalTtc(); + +/*var_dump($obj_facturation); +var_dump($_SESSION['poscart']); +var_dump($total_ttc); +exit;*/ + + +// Left area with selected articles (area for article, amount and payments) print '
'; $page=GETPOST('menu','alpha'); @@ -72,13 +82,10 @@ print '
'; - // Right area with selected articles (shopping cart) print '
'; require ('tpl/liste_articles.tpl.php'); -$obj_facturation->prixTotalHt($lst_total_ht); -$obj_facturation->prixTotalTtc($lst_total_ttc); print '
'; diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index 0972527a73b..f62a9193830 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -222,6 +222,7 @@ p.titre { margin: 0 15px; padding: 0; max-width: 500px; + width: 100%; } .titre1 { @@ -308,7 +309,7 @@ p.titre { } .texte_ref { - width: 80px; + min-width: 150px; } .texte1,.texte1_off { @@ -321,8 +322,8 @@ p.titre { /* ------------------- */ .textarea_note { - width: 300px; - height: 150px; + width: 100%; + height: 50px; padding: 2px 2px; } @@ -362,7 +363,7 @@ p.titre { } .resume_label,.note_label { - width: 200px; + min-width: 200px; font-weight: bold; font-size: 1.1em; } diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 42e1c00f651..8953f7b0ccc 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -137,16 +137,17 @@ switch ( $_GET['action'] ) case 'ajout_article': // We have clicked on button "Add product" - //var_dump($obj_facturation); + //var_dump('ajout_article'); //exit; - if (! empty($obj_facturation->id)) // A product has been selected and stored in session + if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it { $obj_facturation->qte($_POST['txtQte']); $obj_facturation->tva($_POST['selTva']); $obj_facturation->remisePercent($_POST['txtRemise']); - $obj_facturation->ajoutArticle(); - + $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] + // We update prixTotalTtc + } $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; @@ -160,7 +161,7 @@ switch ( $_GET['action'] ) } - +// We saved object obj_facturation $_SESSION['serObjFacturation'] = serialize($obj_facturation); header('Location: '.$redirection); diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index f0545181ff0..3e6a88f252a 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -32,6 +32,7 @@ $conf_db_base = $dolibarr_main_db_name; $conf_fksoc = (! empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))?$_SESSION["CASHDESK_ID_THIRDPARTY"]:($conf->global->CASHDESK_ID_THIRDPARTY>0?$conf->global->CASHDESK_ID_THIRDPARTY:0); // Identifiant unique correspondant a l'entrepot a utiliser $conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0); +if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0. // Identifiant unique correspondant au compte caisse / liquide $conf_fkaccount_cash = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CASH>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:0); diff --git a/htdocs/cashdesk/include/keypad.php b/htdocs/cashdesk/include/keypad.php index 798c30c92fb..7560180396a 100644 --- a/htdocs/cashdesk/include/keypad.php +++ b/htdocs/cashdesk/include/keypad.php @@ -16,7 +16,7 @@ */ /** - * Return a string to outptu a keypad + * Return a string to output a keypad * * @param string $keypadname Key pad name * @param string $formname Form name @@ -24,6 +24,8 @@ */ function genkeypad($keypadname, $formname) { + global $conf; + if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) return ''; // défine the font size of button diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index a2eb40f2932..fa1c6723d20 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -99,16 +99,15 @@ print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf- print ''; print "\n"; -if (! empty($conf->stock->enabled)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { $langs->load("stocks"); print ""; print ''.$langs->trans("Warehouse").''; print ''; $disabled=0; - if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice - print $formproduct->selectWarehouses((GETPOST('warehouseid')?GETPOST('warehouseid'):(empty($conf->global->CASHDESK_ID_WAREHOUSE)?'ifone':$conf->global->CASHDESK_ID_WAREHOUSE)),'warehouseid','',!$disabled,$disabled); - //print ''; + if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled=1; // If a particular stock is defined, we disable choice + print $formproduct->selectWarehouses((GETPOST('warehouseid')?GETPOST('warehouseid','int'):(empty($conf->global->CASHDESK_ID_WAREHOUSE)?'ifone':$conf->global->CASHDESK_ID_WAREHOUSE)),'warehouseid','',!$disabled,$disabled); print ''; print "\n"; } diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index c96b4f2b6f1..db80866a77f 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -36,11 +36,11 @@ $langs->load("cashdesk"); $username = GETPOST("txtUsername"); $password = GETPOST("pwdPassword"); -$thirdpartyid = (GETPOST('socid','int')!='')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY; -$warehouseid = (GETPOST("warehouseid")!='')?GETPOST("warehouseid"):$conf->global->CASHDESK_ID_WAREHOUSE; -$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH"):$conf->global->CASHDESK_ID_BANKACCOUNT_CASH; -$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE"):$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; -$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB")!='')?GETPOST("CASHDESK_ID_BANKACCOUNT_CB"):$conf->global->CASHDESK_ID_BANKACCOUNT_CB; +$thirdpartyid = (GETPOST('socid','int') > 0)?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY; +$warehouseid = (GETPOST("warehouseid") > 0)?GETPOST("warehouseid",'int'):$conf->global->CASHDESK_ID_WAREHOUSE; +$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CASH; +$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; +$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0)?GETPOST("CASHDESK_ID_BANKACCOUNT_CB",'int'):$conf->global->CASHDESK_ID_BANKACCOUNT_CB; // Check username if (empty($username)) @@ -58,15 +58,15 @@ if (! ($thirdpartyid > 0)) } // If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished. -if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && ! ($warehouseid > 0)) { - $retour=$langs->trans("CashDeskSetupStock"); + $retour=$langs->trans("CashDeskYouDidNotDisableStockDecease"); header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); exit; } // If stock decrease on bill validation, check user has stock edit permissions -if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username)) +if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && ! empty($username)) { $testuser=new User($db); $testuser->fetch(0,$username); @@ -117,8 +117,9 @@ if ( $retour >= 0 ) $_SESSION['uname'] = $username; $_SESSION['lastname'] = $tab['lastname']; $_SESSION['firstname'] = $tab['firstname']; - $_SESSION['CASHDESK_ID_THIRDPARTY'] = $thirdpartyid; - $_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid; + $_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : ''); + $_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : ''); + $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); @@ -131,7 +132,6 @@ if ( $retour >= 0 ) { dol_print_error($db); } - } else { diff --git a/htdocs/cashdesk/javascript/dhtml.js b/htdocs/cashdesk/javascript/dhtml.js index eb0ef03f257..caf0cd94abd 100644 --- a/htdocs/cashdesk/javascript/dhtml.js +++ b/htdocs/cashdesk/javascript/dhtml.js @@ -16,7 +16,7 @@ */ // Instanciation et initialisation de l'objet xmlhttprequest -function file (fichier) { +function file(fichier) { // Instanciation de l'objet pour Mozilla, Konqueror, Opera, Safari, etc ... if (window.XMLHttpRequest) { @@ -51,7 +51,7 @@ function file (fichier) { // Affichage des donnees aTexte dans le bloc identifie par aId -function afficheDonnees (aId, aTexte) { +function afficheDonnees(aId, aTexte) { document.getElementById(aId).innerHTML = aTexte; @@ -59,7 +59,7 @@ function afficheDonnees (aId, aTexte) { // aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage -function verifResultat (aCible, aCode) { +function verifResultat(aCible, aCode) { if (aCode != '') { if (texte = file ('facturation_dhtml.php?code='+escape(aCode))) { @@ -76,21 +76,9 @@ function verifResultat (aCible, aCode) { // Change dynamiquement la classe de l'element ayant l'id aIdElement pour aClasse -function setStyle (aIdElement, aClasse) { +function setStyle(aIdElement, aClasse) { aIdElement.className = aClasse; } - - - - - - - - - - - - diff --git a/htdocs/cashdesk/javascript/facturation1.js b/htdocs/cashdesk/javascript/facturation1.js index 11f1739e937..b0b9a45a028 100644 --- a/htdocs/cashdesk/javascript/facturation1.js +++ b/htdocs/cashdesk/javascript/facturation1.js @@ -16,7 +16,7 @@ */ // Calcul et affichage en temps reel des informations sur le produit en cours -function modif () { +function modif() { var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value ); var qte = parseFloat ( document.getElementById('frmQte').txtQte.value ); @@ -71,7 +71,7 @@ function modif () { } // Affecte la source de la requete (liste deroulante ou champ texte 'ref') au champ cache -function setSource (aSrc) { +function setSource(aSrc) { document.getElementById('frmFacturation').hdnSource.value = aSrc; document.getElementById('frmFacturation').submit(); @@ -79,7 +79,7 @@ function setSource (aSrc) { } // Verification de la coherence des informations saisies dans le formulaire de choix du nombre d'articles -function verifSaisie () { +function verifSaisie() { if ( document.getElementById('frmQte').txtQte.value ) { @@ -95,17 +95,17 @@ function verifSaisie () { } // Verification de la coherence des informations saisies dans le formulaire de calcul de la difference -function verifDifference () { +function verifDifference() { var du = parseFloat ( document.getElementById('frmDifference').txtDu.value ); var encaisse = parseFloat ( document.getElementById('frmDifference').txtEncaisse.value ); - if ( encaisse > du ) { + if (encaisse > du) { resultat = Math.round ( (encaisse - du) * 100 ) / 100; document.getElementById('frmDifference').txtRendu.value = resultat.toFixed(2); - } else if ( encaisse == du ) { + } else if (encaisse == du) { document.getElementById('frmDifference').txtRendu.value = '0'; @@ -118,14 +118,14 @@ function verifDifference () { } // Affecte le moyen de paiement (ESP, CB ou CHQ) au champ cache en fonction du bouton clique -function verifClic (aChoix) { +function verifClic(aChoix) { document.getElementById('frmDifference').hdnChoix.value = aChoix; } // Determination du moyen de paiement, et validation du formulaire si les donnees sont coherentes -function verifReglement () { +function verifReglement() { var choix = document.getElementById('frmDifference').hdnChoix.value; var du = parseFloat (document.getElementById('frmDifference').txtDu.value); @@ -172,5 +172,4 @@ function verifReglement () { return false; } - } diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index f2258c6473e..47116705320 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -43,6 +43,7 @@ $langs->load("cashdesk"); @@ -147,7 +148,7 @@ $langs->load("cashdesk"); - +
diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 2fac2e2a16a..e4b6bc14436 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -42,7 +42,7 @@ $tab=array(); $tab = $_SESSION['poscart']; $tab_size=count($tab); -if ($tab_size <= 0) print '
'.$langs->trans("NoArticle").'

'; +if ($tab_size <= 0) print '
'.$langs->trans("NoArticle").'

'; else { for ($i=0;$i < $tab_size;$i++) @@ -67,8 +67,6 @@ else } } -$obj_facturation->calculTotaux(); -$total_ttc = $obj_facturation->prixTotalTtc(); echo ('

'.$langs->trans("Total").' : '.price(price2num($total_ttc, 'MT'),0,$langs,0,0,-1,$conf->currency).'

'."\n"); ?>
diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 4ee52ce0da6..ce38bb7d7e8 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -72,7 +72,7 @@ print $langs->trans("CashDeskThirdParty").': '.$companyLink.'
'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'
'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'
'; print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'
';*/ -if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled)) +if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { print $langs->trans("CashDeskWarehouse").': '.$warehouseLink; } diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index 15762ecf494..1aa1c0c4723 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -17,6 +17,7 @@ */ $langs->load("main"); +$langs->load("bills"); // Object $form must de defined @@ -111,8 +112,9 @@ $langs->load("main");

trans("Notes"); ?>

- " /> -

trans("RestartSelling"); ?>

+ diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index 9ebab951eb9..b00268d7b0a 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -18,10 +18,11 @@ */ $langs->load("main"); +$langs->load("bills"); ?> -

trans("SellFinished"); ?>

+

trans("SellFinished"); ?>


diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 173c1894555..27ce3380dd4 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -218,7 +218,33 @@ switch ($action) $resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiementLe())); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); + $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); + if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice + + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); + + if ($warehouseidtodecrease > 0) + { + // Decrease + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); + // Loop on each line + $cpt=count($invoice->lines); + for ($i = 0; $i < $cpt; $i++) + { + if ($invoice->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($db); + $mouvP->origin = &$invoice; + // We decrease stock for product + if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + if ($result < 0) { + $error++; + } + } + } + } } else { @@ -232,7 +258,33 @@ switch ($action) $resultcreate=$invoice->create($user,0,0); if ($resultcreate > 0) { - $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), (isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0)); + $warehouseidtodecrease=(isset($_SESSION["CASHDESK_ID_WAREHOUSE"])?$_SESSION["CASHDESK_ID_WAREHOUSE"]:0); + if (! empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease=0; // If a particular stock is defined, we disable choice + + $resultvalid=$invoice->validate($user, $obj_facturation->numInvoice(), 0); + + if ($warehouseidtodecrease > 0) + { + // Decrease + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; + $langs->load("agenda"); + // Loop on each line + $cpt=count($invoice->lines); + for ($i = 0; $i < $cpt; $i++) + { + if ($invoice->lines[$i]->fk_product > 0) + { + $mouvP = new MouvementStock($db); + $mouvP->origin = &$invoice; + // We decrease stock for product + if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); + if ($result < 0) { + $error++; + } + } + } + } $id = $invoice->id; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 672c92b9508..98eaa053635 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -256,11 +256,11 @@ if ($user->rights->categorie->creer) print ''; - print '

'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print '
'; print ''; } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f7de102d96d..de8d494f9fc 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -107,7 +107,7 @@ class Categorie extends CommonObject $this->type = $res['type']; $this->entity = $res['entity']; - $this->fetch_optionals($this->id,$extralabels); + $this->fetch_optionals($this->id,null); $this->db->free($resql); @@ -198,6 +198,8 @@ class Categorie extends CommonObject { $this->id = $id; + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookModuleNamedao')); @@ -289,11 +291,13 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + $action='update'; // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookCategorydao')); $parameters=array(); + $action='update'; $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -408,6 +412,17 @@ class Categorie extends CommonObject $error++; } } + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql .= " WHERE fk_category = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } // Delete category if (! $error) @@ -430,7 +445,7 @@ class Categorie extends CommonObject if ($result < 0) { $error++; - dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR); } } } @@ -788,7 +803,7 @@ class Categorie extends CommonObject */ function get_full_arbo($type,$markafterid=0) { - global $langs; + global $conf, $langs; $this->cats = array(); @@ -798,11 +813,9 @@ class Categorie extends CommonObject // Init $this->cats array $sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates - if (! empty($conf->global->MAIN_MULTILANGS)) - $sql.= ", t.label as label_trans, t.description as description_trans"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; - if (! empty($conf->global->MAIN_MULTILANGS)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; + if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql.= " AND c.type = ".$type; @@ -1263,7 +1276,7 @@ class Categorie extends CommonObject $result=''; $lien = ''; - $label=$langs->trans("ShowCategory").': '.$this->label; + $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); $lienfin=''; $picto='category'; @@ -1271,7 +1284,7 @@ class Categorie extends CommonObject if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$lien.dol_trunc($this->ref,$maxlength).$lienfin; + if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin; return $result; } @@ -1369,7 +1382,7 @@ class Categorie extends CommonObject // Objet $obj=array(); $obj['photo']=$photo; - if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette; + if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']='thumbs/' . $photo_vignette; else $obj['photo_vignette']=""; $tabobj[$nbphoto-1]=$obj; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index aa82fdb455d..245509578d0 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -163,8 +163,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print ''; print '
'; -print '
'; -print '
'; +print '
'; print ''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 69a8bb97eab..c54d7d889b2 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -241,7 +241,7 @@ if ($object->id) // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine if ($obj['photo_vignette']) { - $filename='thumbs/'.$obj['photo_vignette']; + $filename=$obj['photo_vignette']; } else { diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 0c154a0b72f..98d4fb2b930 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -190,9 +190,11 @@ if ($action == 'edit') } } - print '
'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; @@ -266,9 +268,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; - print '
'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 96db3133cf9..9d98823289c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -74,6 +76,7 @@ $cactioncomm = new CActionComm($db); $object = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); +$formfile = new FormFile($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -710,9 +713,9 @@ if ($action == 'create') $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->societe_id)) { - print $form->select_company($user->societe_id,'socid','',1,1,0,$events); + print $form->select_thirdparty_list($user->societe_id,'socid','',1,1,0,$events); } else { - print $form->select_company('','socid','',1,1,0,$events); + print $form->select_thirdparty_list('','socid','',1,1,0,$events); } } @@ -776,11 +779,11 @@ if ($action == 'create') print ''; - print '

'; + print '
'; print ''; - print '     '; + print '     '; print ''; - print '
'; + print ''; print ""; } @@ -1010,9 +1013,11 @@ if ($id > 0) dol_fiche_end(); - print '
'; - print '     '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -1282,6 +1287,33 @@ if ($id > 0) print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' '; print ''."\n"; print ''; + + if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) + { + print '
 
'; + print ''; // ancre + + /* + * Documents generes + */ + + $filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + + $genallowed=$user->rights->agenda->myactions->create; + $delallowed=$user->rights->agenda->myactions->delete; + + $var=true; + + $somethingshown=$formfile->show_documents('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); + + print '
'; + + + print '
'; + + print '
 
'; + } } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b4a5fdeed60..34e88dd893e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -241,8 +241,11 @@ class ActionComm extends CommonObject if (! $error) { + $action='create'; + // Actions on extra fields (by external module or standard code) - $hookmanager->initHooks(array('actioncommdao')); + // FIXME le hook fait double emploi avec le trigger !! + $hookmanager->initHooks(array('actioncommdao')); $parameters=array('actcomm'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) @@ -560,8 +563,10 @@ class ActionComm extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { + $action='update'; // Actions on extra fields (by external module or standard code) + // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('actioncommdao')); $parameters=array('actcomm'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 065f01d2091..77dfea739e1 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -103,7 +103,7 @@ class CActionComm * @param string $idorcode 'id' or 'code' * @param string $excludetype Type to exclude * @param string $onlyautoornot Group list by auto events or not - * @return array Array of all event types if OK, <0 if KO + * @return mixed Array of all event types if OK, <0 if KO */ function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0) { diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 53243d0c165..245902013a1 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -100,7 +100,7 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi } // Purge search criteria -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $datestart=''; $dateend=''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index da34983779a..dcebefbcbb7 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -201,6 +201,7 @@ if ($filter) $param.="&filter=".$filter; if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; if ($filterd) $param.="&filterd=".$filterd; +if ($usergroup) $param.="&usergroup=".$usergroup; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; @@ -242,6 +243,20 @@ $nav.="   ('; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; + $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); $nav.=' '; $nav.=''; @@ -659,10 +674,12 @@ while ($obj = $db->fetch_object($resql)) $todayarray=dol_getdate($now,'fast'); $sav = $tmpday; $showheader = true; +$var = false; foreach ($usernames as $username) { + $var = ! $var; echo ""; - echo '' . $username->getNomUrl(1). ''; + echo '' . $username->getNomUrl(1). ''; $tmpday = $sav; // Lopp on each day of week @@ -688,7 +705,7 @@ foreach ($usernames as $username) if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; if ($today) $style='cal_today_peruser'; - show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype); + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -785,9 +802,10 @@ $db->close(); * @param int $minheight Minimum height for each event. 60px by default. * @param boolean $showheader Show header * @param array $colorsbytype Array with colors by type + * @param string $var true or false for alternat style on tr/td * @return void */ -function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array()) +function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) { global $db; global $user, $conf, $langs, $hookmanager, $action; @@ -989,8 +1007,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } - if ($h == $begin_h) echo ''; - else echo ''; + if ($h == $begin_h) echo ''; + else echo ''; if (count($cases1[$h]) == 1) // 1 seul evenement { $ids=array_keys($cases1[$h]); @@ -1008,8 +1026,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($output[0]['color']) $color2 = $output[0]['color']; } else if (count($cases2[$h]) > 1) $color2='222222'; - $ids1=join(',',array_keys($cases1[$h])); - $ids2=join(',',array_keys($cases2[$h])); + $ids1='';$ids2=''; + if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h])); + if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h])); //var_dump($cases1[$h]); print ''; print '
'; diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index 0ffcb351500..963847aee18 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -281,14 +281,14 @@ if ($action == 'create') print '
'."\n"; - print '
'; + print '
'; print ''; if (! empty($backtopage)) { - print '     '; + print '     '; print ''; } - print '
'."\n"; + print ''."\n"; print ''."\n"; @@ -381,11 +381,11 @@ elseif ($action == 'edit') print '
'; - print '
'; + print '
'; print ''; - print '   '; + print '     '; print ''; - print '
'; + print ''; print ''; } diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index d41dd27b362..2a1a2286db5 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -69,7 +69,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal'); diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index e83f31e993f..40dbad4ef94 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -74,7 +74,7 @@ llxHeader('',$langs->trans("PropalSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(null); +$head = propal_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal'); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index d0dd842cd7c..8a4df52748c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -530,6 +530,7 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); + $var=!$var; print ""; print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) @@ -539,7 +540,6 @@ if ($id > 0) print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; print ''.price($objp->total_ht).''; print ''.$propal_static->LibStatut($objp->fk_statut,5).''; - $var=!$var; $i++; } $db->free($resql); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 4129b561ed1..fd25287c029 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -90,15 +90,15 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $var=false; - print ''; print ''; print ''; + print '
'; print ''; print ''; print ''; print ''; - print "
'.$langs->trans("SearchACustomerOrder").'
'; print ':
:

\n"; + print "
\n"; } // Search contract diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index ac354d4d08d..b35e4fab7cc 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -48,13 +48,12 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -$search_nom=GETPOST("search_nom"); +$search_company=GETPOST("search_company"); $search_zipcode=GETPOST("search_zipcode"); $search_town=GETPOST("search_town"); $search_code=GETPOST("search_code"); $search_compta=GETPOST("search_compta"); $search_status = GETPOST("search_status",'int'); -if ($search_status=='') $search_status=1; // always display activ customer first // Load sale and categ filters $search_sale = GETPOST("search_sale"); @@ -76,23 +75,20 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $a if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_categ=''; - $catid=''; - $search_sale=''; - $socname=""; - $search_nom=""; + $search_sale=""; + $search_categ=""; + $catid=""; + $search_company=""; $search_zipcode=""; $search_town=""; - $search_idprof1=''; - $search_idprof2=''; - $search_idprof3=''; - $search_idprof4=''; - $seach_status=1; + $search_code=''; + $search_compta=''; + $search_status=''; } - +if ($search_status=='') $search_status=1; // always display activ customer first /* * view @@ -122,8 +118,8 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_company) { + $sql .= natural_search('s.nom', $search_company); } if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { @@ -156,7 +152,7 @@ if ($result) { $num = $db->num_rows($result); - $param = "&search_nom=".$search_nom."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; + $param = "&search_company=".$search_company."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; if ($search_sale != '') $param.='&search_sale='.$search_sale; if ($search_status != '') $param.='&search_status='.$search_status; @@ -207,7 +203,7 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -235,7 +231,6 @@ if ($result) print ''; print ''; - print '  '; print ''; print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 678ea8f622d..ca4c27bfdbc 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -94,6 +94,13 @@ $object->substitutionarrayfortest=array( //,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet ); +// List of sending methods +$listofmethods=array(); +$listofmethods['mail']='PHP mail function'; +//$listofmethods['simplemail']='Simplemail class'; +$listofmethods['smtps']='SMTP/SMTPS socket library'; + + /* * Actions @@ -701,7 +708,7 @@ if ($action == 'create') print ''; print ''; - print '
'; + print '
'; print ''; } @@ -741,10 +748,21 @@ else { // Define message to recommand from command line - // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message + $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; + if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function - if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + { + // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. + // You ensure that every user is using its own SMTP server. + $linktoadminemailbefore=''; + $linktoadminemailend=''; + setEventMessage($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), 'warnings'); + setEventMessage($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), 'warnings'); + if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessage($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), 'warnings'); + $_GET["action"]=''; + } + else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message @@ -764,7 +782,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270); } } @@ -1139,11 +1157,11 @@ else print ''; - print '
'; + print '
'; print ''; - print '   '; + print '     '; print ''; - print '
'; + print ''; print ''; print '
'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 49d2f1befa2..75f2399017b 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -276,7 +276,8 @@ if ($object->fetch($id) >= 0) $obj = new $classname($db); - $qualified=1; + // Check dependencies + $qualified=(isset($obj->enabled)?$obj->enabled:1); foreach ($obj->require_module as $key) { if (! $conf->$key->enabled || (! $user->admin && $obj->require_admin)) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 3eeef6916eb..aa75945f0ea 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -553,6 +553,8 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST( } } +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; + /* * Send mail @@ -1310,9 +1312,11 @@ if ($action == 'create') print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } // What trigger creation print '' . $langs->trans('Source') . ''; @@ -1514,10 +1518,11 @@ if ($action == 'create') $langs->load("bills"); - print '
'; + print '
'; print ''; - print ' '; - print '
'; + print '     '; + print ''; + print ''; print ""; @@ -1892,7 +1897,7 @@ if ($action == 'create') print ''; } - if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { // Bank Account print ''; @@ -2000,7 +2005,7 @@ if ($action == 'create') { $var = true; - // Add free products/services + // Add products/services form $object->formAddObjectLine(1, $mysoc, $soc); $parameters = array(); diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index e575c8f27fc..87281e7ea63 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Frederic France * * 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 @@ -22,14 +23,13 @@ /** * \file htdocs/comm/propal/apercu.php * \ingroup propal - * \brief Page de l'onglet apercu d'une propal + * \brief Preview tab of propal */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('propal'); $langs->load("bills"); @@ -44,18 +44,11 @@ $result = restrictedArea($user, 'propal', $id); /* - * View + * View Mode */ llxHeader(); -$form = new Form($db); - -/* *************************************************************************** */ -/* */ -/* Mode fiche */ -/* */ -/* *************************************************************************** */ if ($id > 0 || ! empty($ref)) { @@ -73,29 +66,30 @@ if ($id > 0 || ! empty($ref)) /* * Propal */ - print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; + print ''; + print ''; - // Ref client - print ''; - print ''; + // Ref client + print ''; + print ''; + print ''; - $rowspan=2; - // Tiers - print ''; - print ''; + // Thirdparty + print ''; + print ''; + print ''; - // Ligne info remises tiers + // Status + print ''; + print ''; + print ''; + + // Discount print ''; + print '.'; + print ''; - // ligne - // partie Gauche - print ''; + // Date + print ''; + print ''; - // partie Droite sur $rowspan lignes - print ''; + print ''; + print ''; + + // Total VAT - left part + print ''; + print ''; + print ''; + + // Total TTC - left part + print ''; + print ''; + print ''; + + print '
'.$langs->trans('Ref').''.$object->ref.'
'.$langs->trans('Ref').''.$object->ref.'
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); @@ -103,44 +97,43 @@ if ($id > 0 || ! empty($ref)) print '. '; if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print '
'.$langs->trans('Date').''; - print dol_print_date($object->date,'daytext'); - print '
'.$langs->trans('Date').''.dol_print_date($object->date,'daytext').''; + // Right part with $rowspan lines + $rowspan=4; + print ''; - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->propal->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; + /* + * Documents + */ + $objectref = dol_sanitizeFileName($object->ref); + $dir_output = $conf->propal->dir_output . "/"; + $filepath = $dir_output . $objectref . "/"; + $file = $filepath . $objectref . ".pdf"; + $filedetail = $filepath . $objectref . "-detail.pdf"; $relativepath = $objectref.'/'.$objectref.'.pdf'; $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page + $fileimage = $file.'_preview.png'; // If PDF has 1 page $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page $relativepathimage = $relativepath.'_preview.png'; - $var=true; + $var=true; // Si fichier PDF existe if (file_exists($file)) { $encfile = urlencode($file); - print_titre($langs->trans("Documents")); - print ''; + print '
'; + print ''; - print ""; + print ''; print ''; @@ -166,13 +159,25 @@ if ($id > 0 || ! empty($ref)) } } - print ""; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Documents").'
".$langs->trans("Propal")." PDF
'.$langs->trans("Proposal").' PDF'.$object->ref.'.pdf
'.$langs->trans('AmountHT').''.price($object->price).''.$langs->trans("Currency".$conf->currency).'
'; + // Total HT - left part + print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; dol_fiche_end(); } @@ -183,10 +188,13 @@ if ($id > 0 || ! empty($ref)) } } +print ''; +print ''; +print '
'; +print '
'; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -199,10 +207,13 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

'; + print '

'; } } } +print '

'; +print '
'; llxFooter(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 15d85afec07..fb9d5257d49 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -416,7 +416,15 @@ class Propal extends CommonObject // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // Mise en option de la ligne @@ -567,7 +575,15 @@ class Propal extends CommonObject $this->line->skip_update_total = $skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; $this->line->date_start=$date_start; @@ -651,7 +667,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >=0 if OK */ - function create($user='', $notrigger=0) + function create($user, $notrigger=0) { global $langs,$conf,$mysoc,$hookmanager; $error=0; @@ -846,6 +862,8 @@ class Propal extends CommonObject $resql=$this->update_price(1); if ($resql) { + $action='update'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -917,7 +935,7 @@ class Propal extends CommonObject { $this->products=$this->lines; - return $this->create(); + return $this->create($user); } /** @@ -1264,6 +1282,8 @@ class Propal extends CommonObject */ function update_extrafields($user) { + $action='update'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -2118,7 +2138,7 @@ class Propal extends CommonObject if (! $error) { - dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG); + dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG); $this->db->commit(); return 1; } @@ -2879,7 +2899,7 @@ class PropaleLigne extends CommonObject $error=0; - dol_syslog("PropaleLigne::insert rang=".$this->rang); + dol_syslog(get_class($this)."::insert rang=".$this->rang); // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 96d633bd834..66b36e0320f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -56,6 +56,8 @@ $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_author=GETPOST('search_author','alpha'); $search_town=GETPOST('search_town','alpha'); +$viewstatut=$db->escape(GETPOST('viewstatut')); +$object_statut=$db->escape(GETPOST('propal_statut')); $sall=GETPOST("sall"); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); @@ -78,6 +80,26 @@ if (! empty($socid)) } $result = restrictedArea($user, $module, $objectid, $dbtable); +if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers +{ + $search_categ=''; + $search_user=''; + $search_sale=''; + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_montant_ht=''; + $search_author=''; + $search_town=''; + $year=''; + $month=''; + $viewstatut=''; + $object_statut=''; +} + +if($object_statut != '') +$viewstatut=$object_statut; + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('propallist')); @@ -93,21 +115,6 @@ $parameters=array('socid'=>$socid); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -// Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) -{ - $search_categ=''; - $search_user=''; - $search_sale=''; - $search_ref=''; - $search_refcustomer=''; - $search_societe=''; - $search_montant_ht=''; - $search_author=''; - $search_town=''; - $year=''; - $month=''; -} /* @@ -132,11 +139,6 @@ $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$viewstatut=$db->escape(GETPOST('viewstatut')); -$object_statut = $db->escape(GETPOST('propal_statut')); -if($object_statut != '') -$viewstatut=$object_statut; - if (! $sortfield) $sortfield='p.datep'; if (! $sortorder) $sortorder='DESC'; $limit = $conf->liste_limit; @@ -322,10 +324,12 @@ if ($result) print ''; $formpropal->selectProposalStatus($viewstatut,1); print ''; + print ''; - print ''; - print ''; + print ''; + print ''; print ''; + print "\n"; $var=true; @@ -391,7 +395,7 @@ if ($result) // Date proposal print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); + print dol_print_date($db->jdate($objp->dp), 'day'); print "\n"; // Date end validity diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 113618ffae8..3501d94aafd 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -154,7 +154,7 @@ $sts = array(-1,0,1,2,3); $hookmanager->initHooks(array('prospectlist')); // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $socname=""; $stcomm=""; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index fe3e39d266d..b2d92dd55dc 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -136,14 +136,14 @@ if ($socid > 0) print ""; - print '
'; + print '
'; print ''; if (! empty($backtopage)) { - print '    '; + print '     '; print ''; } - print '
'; + print ''; print ""; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 79f952fe7fd..b0475871458 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -278,14 +278,14 @@ if ($socid > 0) print ""; - print '
'; + print '
'; print ''; if (! empty($backtopage)) { - print '    '; + print '     '; print ''; } - print '
'; + print ''; print ''; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 839ca73d5b9..e6878eef179 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Frederic France * * 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 @@ -22,21 +23,17 @@ /** * \file htdocs/commande/apercu.php * \ingroup commande - * \brief Page de l'onglet apercu d'une commande + * \brief Preview tab of order */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load('orders'); -$langs->load('propal'); $langs->load("bills"); $langs->load('compta'); -$langs->load('sendings'); // Security check $socid=0; @@ -47,19 +44,11 @@ $result=restrictedArea($user,'commande',$id,''); /* - * View + * View Mode */ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); -$form = new Form($db); - -/* *************************************************************************** */ -/* */ -/* Mode fiche */ -/* */ -/* *************************************************************************** */ - if ($id > 0 || ! empty($ref)) { $object = new Commande($db); @@ -70,40 +59,46 @@ if ($id > 0 || ! empty($ref)) $soc->fetch($object->socid); - $head = commande_prepare_head($object); + $head = commande_prepare_head($object); dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order'); - print ''; + print '
'; // Ref - print '"; - print ''; - print '"; + print '"; + print ''; // Ref cde client - print ''; - print ''; - $nbrow=6; - print ''; + print ''; + print ''; - /* - * Documents - */ + // Client + print ''; + print ''; + print ''; + + // Statut + print ''; + print ''; + print ''; + + // Discount - left part + print ''; + print ''; + print ''; + + // Date - left part + print ''; + print ''; + + // Right part with $rowspan lines + $rowspan=4; + print '
'.$langs->trans("Ref")."'.$object->ref.''.$langs->trans("Source").' : '.$object->getLabelSource(); - if ($object->source == 0) - { - // Propale - $propal = new Propal($db); - $propal->fetch($object->propale_id); - print ' -> '.$propal->ref.''; - } - print "
'.$langs->trans("Ref")."'.$object->ref.'
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print ''; + print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''.$object->remise_percent.'%
'.$langs->trans("Date").''.dol_print_date($object->date,"daytext").''; + + /* + * Documents + */ $objectref = dol_sanitizeFileName($object->ref); $dir_output = $conf->commande->dir_output . "/"; $filepath = $dir_output . $objectref . "/"; @@ -119,16 +114,16 @@ if ($id > 0 || ! empty($ref)) $var=true; - // Si fichier PDF existe + // if PDF file exist if (file_exists($file)) { $encfile = urlencode($file); - print_titre($langs->trans("Documents")); - print ''; + print '
'; + print ''; print ""; - print ''; + print ''; print ''; print ''; print ''; @@ -139,7 +134,7 @@ if ($id > 0 || ! empty($ref)) { print ""; - print ''; + print ''; print ''; print ''; print ''; @@ -162,37 +157,24 @@ if ($id > 0 || ! empty($ref)) } } - print ""; + print ''; - // Client - print ""; - print ''; + // Total HT - left part + print ''; + print ''; print ''; - // Statut - print ''; - print "\n"; + // Total VAT - left part + print ''; + print ''; print ''; - // Date - print ''; - print "\n"; - print ''; + // Total TTC - left part + print ''; + print ''; + print ''; - // ligne 6 - // partie Gauche - print ''; - print ''; - print ''; - - // ligne 7 - // partie Gauche - print ''; - print ''; - print ''; - print '
'.$langs->trans("Documents").'
".$langs->trans("Order")." PDF'.$object->ref.'.pdf'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
Commande detaillee'.$object->ref.'-detail.pdf'.$object->ref.'-detail.pdf'.dol_print_size(dol_filesize($filedetail)).''.dol_print_date(dol_filemtime($filedetail),'dayhour').'
".$langs->trans("Customer")."'; - print ''.$soc->getNomUrl(1).''; - print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans("Status").'".$object->getLibStatut(4)."
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans("Date").'".dol_print_date($object->date,"daytext")."
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('GlobalDiscount').''.$object->remise_percent.'%
'.$langs->trans('AmountHT').''.price($object->total_ht).''.$langs->trans("Currency".$conf->currency).'
'; + print '
'; dol_fiche_end(); } @@ -203,10 +185,13 @@ if ($id > 0 || ! empty($ref)) } } +print ''; +print ''; +print '
'; +print '
'; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -219,10 +204,13 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

'; + print '

'; } } } +print '

'; +print '
'; llxFooter(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4bf1eceb6dc..309b0c35e1a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1115,15 +1115,6 @@ else if ($action == 'remove_file') { } } -// Print file -else if ($action == 'print_file' and $user->rights->printipp->read) { - require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; - $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); - $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); - setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); - $action = ''; -} - else if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); @@ -1151,6 +1142,9 @@ else if ($action == 'update_extras') { $action = 'edit_extras'; } +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; + + /* * Send mail */ @@ -1391,10 +1385,13 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; // Bank Account - print '' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) + { + print '' . $langs->trans('BankAccount') . ''; + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print ''; + } + // Delivery delay print '' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); @@ -1530,7 +1527,7 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; // Button "Create Draft" - print '
'; + print '
'; print ''; @@ -1995,22 +1992,25 @@ if ($action == 'create' && $user->rights->commande->creer) { $rowspan ++; // Bank Account - print ''; - print ''; - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; - print ''; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print ''; - print ''; - + if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) + { + print ''; + print ''; + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->commande->creer) + print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print ''; + print ''; + } + // Total HT print '' . $langs->trans('AmountHT') . ''; print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ce3ec431180..49ba2536bfa 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -801,6 +801,8 @@ class Commande extends CommonOrder if (! $error) { + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('orderdao')); @@ -998,7 +1000,12 @@ class Commande extends CommonOrder $line->marge_tx = $marginInfos[1]; $line->marque_tx = $marginInfos[2]; - $this->lines[$i] = $line; + // get extrafields from original line + $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid); + foreach($object->lines[$i]->array_options as $options_key => $value) + $line->array_options[$options_key] = $value; + + $this->lines[$i] = $line; } $this->socid = $object->socid; @@ -1019,6 +1026,11 @@ class Commande extends CommonOrder $this->origin = $object->element; $this->origin_id = $object->id; + // get extrafields from original line + $object->fetch_optionals($object->id); + foreach($object->array_options as $options_key => $value) + $this->array_options[$options_key] = $value; + // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) @@ -1212,7 +1224,15 @@ class Commande extends CommonOrder $this->line->date_end=$date_end; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // TODO Ne plus utiliser @@ -2409,7 +2429,15 @@ class Commande extends CommonOrder $this->line->skip_update_total=$skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + //by external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; // TODO deprecated @@ -2928,6 +2956,8 @@ class Commande extends CommonOrder */ function update_extrafields($user) { + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('orderdao')); @@ -3280,7 +3310,7 @@ class OrderLine extends CommonOrderLine $error=0; - dol_syslog("OrderLine::insert rang=".$this->rang); + dol_syslog(get_class($this)."::insert rang=".$this->rang); // Clean parameters if (empty($this->tva_tx)) $this->tva_tx=0; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ea17d895b95..2c30f4128c6 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -70,7 +70,7 @@ $limit = $conf->liste_limit; $viewstatut=GETPOST('viewstatut'); // Purge search criteria -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_categ=''; $search_user=''; @@ -229,7 +229,7 @@ if ($resql) if ($viewstatut == 1) $title.=' - '.$langs->trans('StatusOrderValidatedShort'); if ($viewstatut == 2) - $title.=' - '.$langs->trans('StatusOrderOnProcessShort'); + $title.=' - '.$langs->trans('StatusOrderSentShort'); if ($viewstatut == 3) $title.=' - '.$langs->trans('StatusOrderToBillShort'); if ($viewstatut == 4) @@ -295,7 +295,7 @@ if ($resql) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print ''; - + print ''; print ''; print ''; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 1009b030210..99458e3aea0 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -496,7 +496,7 @@ if ($action == 'create' && !$error) } // Button "Create Draft" - print '
'; + print '
'; print "\n"; print ''; @@ -683,7 +683,7 @@ if (($action != 'create' && $action != 'add') || !$error) /* * Boutons actions */ - print '

'.$langs->trans("CloseProcessedOrdersAutomatically"); + print '
'.$langs->trans("CloseProcessedOrdersAutomatically"); print '
'; print ''; print ''; @@ -691,6 +691,7 @@ if (($action != 'create' && $action != 'add') || !$error) //print ''.$langs->trans("GoBack").''; print ''; print '
'; + print '
'; print ''; $db->free($resql); } diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 30cf5b9c5ac..e5bafe8fed6 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -496,11 +496,11 @@ else unset($tblyear[1]); unset($tblyear[2]); - print '
'; + print '
'; print $show1; - print '
'; + print '
'; print $show2; - print '
'; + print ''; print '
'; } diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index b92aa1eb34a..03f0babe75d 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -63,8 +63,7 @@ if ($action == 'update' && ! $_POST["cancel"]) $account->number = trim($_POST["number"]); $account->cle_rib = trim($_POST["cle_rib"]); $account->bic = trim($_POST["bic"]); - $account->iban = trim($_POST["iban_prefix"]); - $account->iban_prefix = trim($_POST["iban_prefix"]); // deprecated + $account->iban = trim($_POST["iban"]); $account->domiciliation = trim($_POST["domiciliation"]); $account->proprio = trim($_POST["proprio"]); $account->owner_address = trim($_POST["owner_address"]); @@ -246,7 +245,7 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') if ($account->getCountryCode() == 'IN') $bickey="SWIFT"; print ''.$langs->trans($ibankey).''; - print ''.$account->iban_prefix.''; + print ''.$account->iban.''; print ''.$langs->trans($bickey).''; print ''.$account->bic.''; @@ -423,7 +422,7 @@ if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer) // IBAN print ''.$langs->trans($ibankey).''; - print ''; + print ''; print ''.$langs->trans($bickey).''; print ''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 81596540489..fd1f3f9ee8e 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -135,7 +135,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->number = trim($_POST["number"]); $account->cle_rib = trim($_POST["cle_rib"]); $account->bic = trim($_POST["bic"]); - $account->iban_prefix = trim($_POST["iban_prefix"]); + $account->iban = trim($_POST["iban"]); $account->domiciliation = trim($_POST["domiciliation"]); $account->proprio = trim($_POST["proprio"]); @@ -346,12 +346,15 @@ if ($action == 'create') } // Accountancy journal - print ''.$langs->trans("AccountancyJournal").''; - print ''; + if (! empty($conf->accounting->enabled)) + { + print ''.$langs->trans("AccountancyJournal").''; + print ''; + } print ''; - print '

'; + print '
'; print ''; } @@ -470,8 +473,11 @@ else print ''.$account->account_number.''; // Accountancy journal - print ''.$langs->trans("AccountancyJournal").''; - print ''.$account->accountancy_journal.''; + if (! empty($conf->accounting->enabled)) + { + print ''.$langs->trans("AccountancyJournal").''; + print ''.$account->accountancy_journal.''; + } print ''; @@ -633,13 +639,19 @@ else } // Accountancy journal - print ''.$langs->trans("AccountancyJournal").''; - print 'accountancy_journal).'">'; + if (! empty($conf->accounting->enabled)) + { + print ''.$langs->trans("AccountancyJournal").''; + print 'accountancy_journal).'">'; + } print ''; - print '

'; - print '  
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e2a039cf2d8..4343e2cb921 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -59,7 +59,7 @@ class Account extends CommonObject //! BIC/SWIFT number var $bic; //! IBAN number (International Bank Account Number) - var $iban_prefix; + var $iban; // stored into iban_prefix field into database var $proprio; var $owner_address; @@ -220,7 +220,7 @@ class Account extends CommonObject /** * Add an entry into table ".MAIN_DB_PREFIX."bank * - * @param timsestmap $date Date operation + * @param timestamp $date Date operation * @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ... * @param string $label Descripton * @param float $amount Amount @@ -642,7 +642,6 @@ class Account extends CommonObject $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->iban_prefix = $obj->iban; // deprecated $this->domiciliation = $obj->domiciliation; $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; @@ -1011,7 +1010,6 @@ class Account extends CommonObject $this->cle_rib = 50; $this->bic = 'AA12'; $this->iban = 'FR999999999'; - $this->iban_prefix = 'FR'; // deprecated $this->domiciliation = 'The bank addresse'; $this->proprio = 'Owner'; $this->owner_address = 'Owner address'; @@ -1145,7 +1143,7 @@ class AccountLine extends CommonObject * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - function delete($user=0) + function delete($user=null) { $nbko=0; @@ -1194,7 +1192,7 @@ class AccountLine extends CommonObject * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - function delete_urls($user=0) + function delete_urls($user=null) { $nbko=0; diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index a1bc0191175..8811ad7c878 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -172,7 +172,7 @@ class BankCateg // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 1e8196481e6..eba7ea9d67b 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -73,7 +73,7 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='b.dateo'; -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $description=""; $type=""; @@ -175,7 +175,8 @@ if ($resql) print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); } - print '
'; + print ''."\n"; + print ''."\n"; $moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': '; $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1); @@ -185,10 +186,10 @@ if ($resql) if ($moreforfilter) { print '
'; print $moreforfilter; - print '
'; + print ''."\n"; } - print ''; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); @@ -202,7 +203,6 @@ if ($resql) print ''; print "\n"; - print ''; print ''; print ''; print ''; @@ -330,7 +330,7 @@ if ($resql) } print "
  '.$langs->trans("Account").'
  
"; - + print '
'; $db->free($resql); } else diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 7ac510525be..1cb00e3ba51 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -157,7 +157,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql.= " ORDER BY dlr ASC"; // Supplier invoices - $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; + $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2.= " s.rowid as socid, s.nom as name, s.fournisseur"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; @@ -254,12 +254,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($obj->family == 'invoice_supplier') { - // TODO This code is to avoid to count suppliers credit note (ff.type = 2) - // Ajouter gestion des avoirs fournisseurs, champ - if (($obj->total_ttc < 0 && $obj->type != 2) - || ($obj->total_ttc > 0 && $obj->type == 2)) + $showline=1; + // Uncomment this line to avoid to count suppliers credit note (ff.type = 2) + //$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2)) + if ($showline) { - $facturefournstatic->ref=$obj->ref; + $ref=$obj->ref; + $facturefournstatic->ref=$ref; $facturefournstatic->id=$obj->objid; $facturefournstatic->type=$obj->type; $ref = $facturefournstatic->getNomUrl(1,''); @@ -298,7 +299,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($paiement) $total_ttc = $obj->total_ttc - $paiement; $solde += $total_ttc; - // We discard with a remain to pay to 0 + // We discard lines with a remainder to pay to 0 if (price2num($total_ttc) != 0) { $var=!$var; diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 601db34c964..0672104ff60 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -182,7 +182,7 @@ print '"; -print '
'; +print '
'; print ""; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 20433118bbf..bcef3512c33 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -303,8 +303,11 @@ if ($action == 'create') print ''; - print '
    '; - print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } @@ -396,9 +399,11 @@ else if ($id) print ''; - print '
  '; + print '
'; + print ''; + print '     '; print ''; - print '
'; + print ''; print ''; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 42a6713c1ce..e34e7c2b3a6 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -57,7 +57,7 @@ $limit = $conf->liste_limit; $year=GETPOST("year"); $month=GETPOST("month"); -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_name=""; diff --git a/htdocs/compta/dons/card.php b/htdocs/compta/dons/card.php index e453ef623c3..c365aa0928a 100644 --- a/htdocs/compta/dons/card.php +++ b/htdocs/compta/dons/card.php @@ -76,7 +76,7 @@ if ($action == 'update') if (empty($amount)) { - $setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors'); $action = "create"; $error++; } @@ -329,7 +329,7 @@ if ($action == 'create') $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook print "\n"; - print '
   
'; + print '
   
'; print "\n"; } @@ -429,7 +429,7 @@ if (! empty($id) && $action == 'edit') print "\n"; - print '
   
'; + print '
   
'; print "\n"; diff --git a/htdocs/compta/dons/list.php b/htdocs/compta/dons/list.php index 174b5357bb2..95011ca0b74 100644 --- a/htdocs/compta/dons/list.php +++ b/htdocs/compta/dons/list.php @@ -50,7 +50,7 @@ $search_amount = GETPOST('search_amount','alpha'); if (!$user->rights->don->lire) accessforbidden(); -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_company=""; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9d003ae0aa7..be6ad58764a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1615,14 +1615,7 @@ else if ($action == 'remove_file') { } } -// Print file -else if ($action == 'print_file' and $user->rights->printipp->read) { - require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; - $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); - $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); - setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); - $action = ''; -} +include DOL_DOCUMENT_ROOT.'/core/actions_printipp.inc.php'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) { @@ -2275,10 +2268,11 @@ if ($action == 'create') print "\n"; // Button "Create Draft" - print '
'; + print '
'; print ''; - print ' '; - print '
'; + print '     '; + print ''; + print ''; print "\n"; @@ -3486,7 +3480,7 @@ if ($action == 'create') $i ++; } print ''; - print '
 
'; + print '
 
'; print ''; $db->free($resqlorderlist); } else { diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 4f5d2ba1bcf..6d60180593a 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -70,7 +70,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 9c1240a28c9..fd4284a01dd 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -71,7 +71,7 @@ $linkback='
'.$langs->trans("BackToM print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print '
'; -$head = invoice_admin_prepare_head(null); +$head = invoice_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), 0, 'invoice'); diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 211d9241a8f..8f03e33bb03 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -3,7 +3,8 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2014 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,9 +22,9 @@ */ /** - * \file htdocs/compta/facture/apercu.php - * \ingroup facture - * \brief Page de l'onglet apercu d'une facture + * \file htdocs/compta/facture/apercu.php + * \ingroup facture + * \brief Preview Tab of invoice */ require '../../main.inc.php'; @@ -67,12 +68,6 @@ if ($id > 0 || ! empty($ref)) $soc = new Societe($db); $soc->fetch($object->socid); - $author = new User($db); - if ($object->user_author) - { - $author->fetch($object->user_author); - } - $head = facture_prepare_head($object); dol_fiche_head($head, 'preview', $langs->trans("InvoiceCustomer"), 0, 'bill'); @@ -80,32 +75,28 @@ if ($id > 0 || ! empty($ref)) $totalpaye = $object->getSommePaiement(); /* - * Facture + * Invoice */ print ''; - $rowspan=3; // Ref - print ''; + print ''; + print ''; + print ''; // Ref customer - print ''; - print ''; + print ''; + print ''; + print ''; - // Societe + // Thirdparty print ''; print ''; print ''; // Type - print ''; + print ''; + print ''; + print ''; // Relative and absolute discounts $addabsolutediscount=' '.$langs->trans("AddGlobalDiscount").''; $addcreditnote=' '.$langs->trans("AddCreditNote").''; - print ''; + print ''; + print ''; + print ''; // Dates print ''; - print ''; - print ""; + print ''; - // Date payment term - print ''; - - // Conditions reglement - print ''; - print ''; - - // Mode de reglement - print ''; - - $nbrows=5; - if (! empty($conf->projet->enabled)) $nbrows++; - print '
'.$langs->trans('Ref').''.$object->ref.'
'.$langs->trans('Ref').''.$object->ref.'
'; - print ''; - print '
'; - print $langs->trans('RefCustomer'); - print '
'; - print '
'; - print $object->ref_client; - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Company").''.$soc->getNomUrl(1,'compta').'
'.$langs->trans('Type').''; + print '
'.$langs->trans('Type').''; print $object->getLibType(); if ($object->type == Facture::TYPE_REPLACEMENT) { @@ -141,14 +132,15 @@ if ($id > 0 || ! empty($ref)) $facthatreplace->fetch($objectidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; } - print '
'.$langs->trans('Discounts'); - print ''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); @@ -187,7 +179,7 @@ if ($id > 0 || ! empty($ref)) } else { - if ($absolute_creditnote > 0) // If not linke will be added later + if ($absolute_creditnote > 0) // If not linked will be added later { if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT) print ' - '.$addabsolutediscount.'
'; else print '.'; @@ -230,66 +222,17 @@ if ($id > 0 || ! empty($ref)) print $addabsolutediscount; //print '   -   '.$addcreditnote; // We disbale link to credit note }*/ - print '
'.$langs->trans("Date").''.dol_print_date($object->date,"daytext").'
'.dol_print_date($object->date,"daytext").'
'; - print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $object->brouillon && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('DateMaxPayment'); - print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; - print '
'; - if ($object->type != Facture::TYPE_CREDIT_NOTE) - { - if ($action == 'editpaymentterm') - { - $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date_lim_reglement,'paymentterm'); - } - else - { - print dol_print_date($object->date_lim_reglement,'daytext'); - if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! $object->am) print img_warning($langs->trans('Late')); - } - } - else - { - print ' '; - } - print '
'.$langs->trans("PaymentConditionsShort").''; - $form->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$object->id",$object->cond_reglement_id,"none"); - print '
'; - print ''; - if ($action != 'editmode' && $object->brouillon && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; - print '
'; - if ($action == 'editmode') - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); - } - else - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none'); - } - print ''; + // Right part with $rowspan lines + $rowspan=5; + if (! empty($conf->projet->enabled)) $rowspan++; + print ''; /* * Documents @@ -303,7 +246,7 @@ if ($id > 0 || ! empty($ref)) $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page + $fileimage = $file.'_preview.png'; // If PDF has 1 page $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page $relativepathimage = $relativepath.'_preview.png'; @@ -313,8 +256,8 @@ if ($id > 0 || ! empty($ref)) if (file_exists($file)) { $encfile = urlencode($file); - print_titre($langs->trans("Documents")); - print ''; + print '
'; + print ''; print ""; @@ -353,24 +296,32 @@ if ($id > 0 || ! empty($ref)) } print ""; + // Total HT print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print ''; + // Total VAT + print ''; + print ''; + print ''; + + // Total TTC + print ''; + print ''; + print ''; // Statut - print ''; + print ''; + print ''; + print ''; // Projet if (! empty($conf->projet->enabled)) { $langs->load("projects"); - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; @@ -777,7 +777,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $societestatic->name=$obj->name; $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); - print ''; + print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 1b16064ed9e..308bcac6dc9 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -190,8 +190,11 @@ if ($_GET["action"] == 'create') print "
"; - print '
  '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 4174d693da3..e2c9c94595a 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -127,7 +127,7 @@ class Localtax extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 56278f15c5d..0ccf0dee6bf 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -626,7 +626,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $buttontitle=$langs->trans('ToMakePayment'); if ($facture->type == 2) $buttontitle=$langs->trans('ToMakePaymentBack'); - print '

'; + print '
'; print ' '.$checkboxlabel; /*if (! empty($conf->prelevement->enabled)) { @@ -634,7 +634,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (! empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '
'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed"); }*/ print '


'; - print '
'; + print ''; } // Form to confirm payment diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 0c5eeca3689..fbf9512e438 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -358,14 +358,14 @@ if ($action == 'new') print $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); print ''; print '
'.$langs->trans("Documents").'
".$langs->trans("Bill")." PDF
'.$langs->trans("AmountHT").''.price($object->total_ht).''.$langs->trans("Currency".$conf->currency).'
' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').''.price($object->total_tva).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc).''.$langs->trans('Currency'.$conf->currency).'
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; if ($object->fk_project > 0) { $project = New Project($db); @@ -391,14 +342,17 @@ if ($id > 0 || ! empty($ref)) else { // Facture non trouvee - print $langs->trans("ErrorBillNotFound",$_GET["facid"]); + print $langs->trans("ErrorBillNotFound",$id); } } +print ''; +print ''; +print '
'; +print '
'; // Si fichier png PDF d'1 page trouve if (file_exists($fileimage)) { - print ''; + print ''; } // Si fichier png PDF de plus d'1 page trouve elseif (file_exists($fileimagebis)) @@ -411,11 +365,13 @@ elseif (file_exists($fileimagebis)) if (file_exists($dir_output.$preview)) { - print '

'; + print '

'; } } } - +print '

'; +print '
'; llxFooter(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 605d4920669..b924b059bfd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -464,6 +464,8 @@ class Facture extends CommonInvoice $result=$this->update_price(1); if ($result > 0) { + $action='create'; + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('invoicedao')); @@ -733,6 +735,11 @@ class Facture extends CommonInvoice $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $line->pa_ht = $marginInfos[0]; + // get extrafields from original line + $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid); + foreach($object->lines[$i]->array_options as $options_key => $value) + $line->array_options[$options_key] = $value; + $this->lines[$i] = $line; } @@ -752,6 +759,11 @@ class Facture extends CommonInvoice $this->origin = $object->element; $this->origin_id = $object->id; + // get extrafields from original line + $object->fetch_optionals($object->id); + foreach($object->array_options as $options_key => $value) + $this->array_options[$options_key] = $value; + // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; if (! empty($object->other_linked_objects) && is_array($object->other_linked_objects)) @@ -1040,7 +1052,7 @@ class Facture extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -1588,7 +1600,7 @@ class Facture extends CommonInvoice * * @param User $user Object user that validate * @param string $force_number Reference to force on invoice - * @param int $idwarehouse Id of warehouse to use for stock decrease + * @param int $idwarehouse Id of warehouse to use for stock decrease if option to decreasenon stock is on (0=no decrease) * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @return int <0 if KO, >0 if OK */ @@ -1716,7 +1728,7 @@ class Facture extends CommonInvoice $result=$this->client->set_as_client(); // Si active on decremente le produit principal et ses composants a la validation de facture - if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $langs->load("agenda"); @@ -2191,7 +2203,15 @@ class Facture extends CommonInvoice $this->line->skip_update_total = $skip_update_total; // infos marge - $this->line->fk_fournprice = $fk_fournprice; + if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { + // POS or external module, take lowest buying price + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($fk_product); + $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id; + } else { + $this->line->fk_fournprice = $fk_fournprice; + } $this->line->pa_ht = $pa_ht; if (is_array($array_option) && count($array_option)>0) { @@ -3486,6 +3506,14 @@ class FactureLigne extends CommonInvoiceLine return -1; } } + + // POS or by external module, take lowest buying price + if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + $productFournisseur->find_min_price_product_fournisseur($this->fk_product); + $this->fk_fournprice = $productFournisseur->product_fourn_price_id; + } $this->db->begin(); diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index cdc935cde01..b75bb056e03 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -261,7 +261,7 @@ class PaymentTerm // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 320d86f3377..a010e7d7401 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -374,7 +374,7 @@ $search_montant_ttc = GETPOST("search_montant_ttc"); $late = GETPOST("late"); // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=''; $search_refcustomer=''; @@ -429,7 +429,8 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_payme if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; -$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp, f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type "; +$sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,"; +$sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " ORDER BY "; $listfield=explode(',',$sortfield); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ba27f5659a9..56bd57c725a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -111,7 +111,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_categ=''; $search_user=''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index fc2943f05e0..2359d70d07b 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -678,7 +678,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $societestatic->name=$obj->name; $societestatic->client=1; print $societestatic->getNomUrl(1,'customer',44); - print '
'.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->total_ttc-$obj->tot_fttc).''.price($obj->total).''.price($obj->total_ttc).''.price($obj->am).'
'; - print '
'; + print '
'; print ''; if ($filterdate || $filteraccountid > 0) { print '   '; print ''; } - print '
'; + print ''; //print ''; print ''; print '
'; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 27782259333..362493b7f19 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $langs->load("banks"); $langs->load("categories"); +$langs->load("compta"); +$langs->load("bills"); // Security check if ($user->societe_id) $socid=$user->societe_id; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 47a6ee8ba74..fdfe86ec178 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -61,7 +61,7 @@ $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); // If click on purge search criteria ? -if (GETPOST("button_removefilter_x")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=''; $search_amount=''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 65615b9bbf3..c7fd426babf 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -58,7 +58,7 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_account=""; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 7e26fa5789f..1c452bc0b02 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -312,13 +312,11 @@ if ($_GET["action"] == 'create') print "
"; - print '
'; - + print '
'; print ''; - print '   '; + print '     '; print ''; - - print '
'; + print ''; print "\n"; } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index e2a5e846b0a..9875c8df906 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -218,7 +218,7 @@ if ($id > 0) print '
'; print '';*/ print '
'; - print '
'; + print '
'; print ''; } @@ -235,7 +235,7 @@ if ($id > 0) print ''; print ''; print '
'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice"); - print '
'; + print '
'; print ''; } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 66a1c81e8e9..47ac4d1a390 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -755,6 +755,8 @@ class BonPrelevement extends CommonObject $factures = array(); $factures_prev = array(); $factures_result = array(); + $factures_prev_id=array(); + $factures_errors=array(); if (! $error) { diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index f1617979645..2af8a25b003 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -216,7 +216,7 @@ if ($id) print '
'; //Confirm Button - print '
'; + print '
'; print ''; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 0a68aa686ae..921736faedf 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -53,7 +53,7 @@ $ligne=new LignePrelevement($db,$user); $offset = $conf->liste_limit * $page ; -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_line=""; $search_bon=""; diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 3ee796c6134..16ef809f713 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -274,8 +274,11 @@ if ($action == 'create') print "
"; - print '
  '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 0644a5ae4fe..5e60b76ee13 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -73,7 +73,7 @@ class PaymentSalary extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -127,7 +127,7 @@ class PaymentSalary extends CommonObject { // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers //FIXME: Add rollback if trigger fail @@ -144,7 +144,7 @@ class PaymentSalary extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; $sql = "SELECT"; @@ -223,12 +223,12 @@ class PaymentSalary extends CommonObject global $conf, $langs; $error=0; - + // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_DELETE',$user); if ($result < 0) return -1; // End call triggers - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary"; $sql.= " WHERE rowid=".$this->id; @@ -279,7 +279,7 @@ class PaymentSalary extends CommonObject function create($user) { global $conf,$langs; - + $error=0; // Clean parameters @@ -414,7 +414,6 @@ class PaymentSalary extends CommonObject $this->fk_user, DOL_URL_ROOT.'/user/card.php?id=', $langs->trans("SalaryPayment").' '.$fuser->getFullName($langs).' '.dol_print_date($this->datesp,'dayrfc').' '.dol_print_date($this->dateep,'dayrfc'), - '(User)', 'user' ); @@ -427,9 +426,9 @@ class PaymentSalary extends CommonObject // Call trigger $result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers - + } else $error++; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 17c3efdbfaa..678b3bfaa2e 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -64,7 +64,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 44e62ad0f10..fb8bc162c83 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -62,17 +62,19 @@ class ChargeSociales extends CommonObject /** * Retrouve et charge une charge sociale * - * @param int $id 1 si trouve, 0 sinon + * @param int $id Id + * @param string $ref Ref * @return void */ - function fetch($id) + function fetch($id, $ref='') { $sql = "SELECT cs.rowid, cs.date_ech,"; $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,"; $sql.= " c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " WHERE cs.fk_type = c.id"; - $sql.= " AND cs.rowid = ".$id; + if ($ref) $sql.= " AND cs.rowid = ".$ref; + else $sql.= " AND cs.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index fe2062e1ad7..395932de69f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -220,7 +220,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index db4bef2abe6..31e98370003 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -68,7 +68,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index e995ee45d54..8263dc76cb8 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -132,6 +132,8 @@ $tableparams = array_merge($commonparams, $tableparams); foreach($allparams as $key => $value) { $paramslink .= '&' . $key . '=' . $value; } + + /* * View */ @@ -174,12 +176,12 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl // SQL request $catotal=0; -if ($modecompta == 'CREANCES-DETTES') +if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } @@ -198,7 +200,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) // Without any category + if ($selected_cat === -2) // Without any category { $sql.=" AND cp.fk_product is null"; } @@ -209,7 +211,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY p.rowid"; + $sql.= " GROUP BY p.rowid, p.ref, p.label"; $sql.= " ORDER BY p.ref"; dol_syslog("cabyprodserv", LOG_DEBUG); @@ -390,7 +392,7 @@ if ($modecompta == 'CREANCES-DETTES') // $modecompta != 'CREANCES-DETTES' // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? - // Because there is no way to know this, this report is not relevant. + // Because there is no way to know this, this report is not relevant. print '
'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '
'; } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 268a1af8e66..b612a9b6459 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -230,8 +230,11 @@ if ($action == 'create') print "
"; - print '
  '; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; print ''; } diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 5d0762d3e35..a86af28cace 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -143,7 +143,7 @@ class Tva extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -205,7 +205,7 @@ class Tva extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; $sql = "SELECT"; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 8babbd58f7d..45a69076492 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -66,7 +66,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_ref=""; $search_label=""; @@ -97,7 +97,6 @@ if ($filtre) { if ($typeid) { $sql .= " AND t.fk_typepayment=".$typeid; } -$sql.= " GROUP BY t.rowid, t.fk_typepayment, t.amount, t.datev, t.label"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); @@ -111,7 +110,7 @@ if ($result) $param=''; if ($typeid) $param.='&typeid='.$typeid; - + print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines); print '
'; @@ -125,7 +124,7 @@ if ($result) print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(""); print "\n"; - + print ''; print ''; print ''; @@ -138,21 +137,21 @@ if ($result) print ''; print ''; print "\n"; - + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); $var=!$var; - + if ($obj->payment_code <> '') { - $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; } else { $type = ' '; } - + print ""; $tva_static->id=$obj->rowid; @@ -172,12 +171,12 @@ if ($result) } print ''.$langs->trans("Total").''; print "".price($total).""; - print " "; + print " "; print ""; - + print '
'; - + $db->free($result); } else @@ -186,6 +185,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index db83554c7ae..bcdea083c3f 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -614,14 +614,14 @@ else print "

"; - print '
'; + print '
'; print ''; if (! empty($backtopage)) { print '     '; print ''; } - print '
'; + print ''; print ""; } @@ -858,11 +858,11 @@ else print '
'; - print '
'; + print '
'; print ''; - print '   '; + print '     '; print ''; - print '
'; + print ''; print ""; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3f81608c415..6a7776b27bd 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -220,7 +220,7 @@ class Contact extends CommonObject * @param string $action Current action for hookmanager * @return int <0 if KO, >0 if OK */ - function update($id, $user=0, $notrigger=0, $action='update') + function update($id, $user=null, $notrigger=0, $action='update') { global $conf, $langs, $hookmanager; @@ -283,6 +283,8 @@ class Contact extends CommonObject unset($this->state_code); unset($this->state); + $action='update'; + // Actions on extra fields (by external module or standard code) $hookmanager->initHooks(array('contactdao')); $parameters=array('socid'=>$this->id); @@ -427,7 +429,7 @@ class Contact extends CommonObject * @param User $user User asking to change alert or birthday * @return int <0 if KO, >=0 if OK */ - function update_perso($id, $user=0) + function update_perso($id, $user=null) { $error=0; $result=false; @@ -492,7 +494,7 @@ class Contact extends CommonObject * @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact * @return int -1 if KO, 0 if OK but not found, 1 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; @@ -910,7 +912,7 @@ class Contact extends CommonObject global $langs; $langs->load("dict"); - $code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civility_id)?$this->civility_id:'')); + $code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civilite_id)?$this->civilite_id:'')); if (empty($code)) return ''; return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 2e28328085a..eab4369ac21 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -53,7 +53,7 @@ $search_email=GETPOST("search_email"); $search_skype=GETPOST("search_skype"); $search_priv=GETPOST("search_priv"); $search_categ=GETPOST("search_categ",'int'); -$search_statu=GETPOST("search_status",'int'); +$search_status=GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first @@ -96,9 +96,9 @@ else if ($type == "o") $urlfiche=""; } -if (GETPOST('button_removefilter')) +if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers { - $search_firstlast_only=""; + $search_firstlast_only=""; $search_lastname=""; $search_firstname=""; $search_societe=""; @@ -302,7 +302,7 @@ if ($result) print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder); if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder); if (! empty($conf->skype->enabled)) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); } @@ -356,8 +356,8 @@ if ($result) print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 92ba03e9861..19644fe5bf5 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -145,11 +145,11 @@ if ($action == 'edit') print "
"; - print '
'; + print '
'; print ''; - print '   '; + print '     '; print ''; - print '
'; + print ''; print ""; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 836070f970b..cea29c96793 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -536,10 +536,10 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; - if (empty($model)) { $tmp=getListOfModels($db, 'contract'); $keys=array_keys($tmp); $model=$keys[0]; } + $ret = $object->fetch($id); // Reload to get new records - $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } unset($_POST ['prod_entry_mode']); @@ -935,8 +935,8 @@ if ($action == 'create') } print ''.$langs->trans('Ref').''.$tmpcode.''; - // Ref Int - print ''.$langs->trans('RefCustomer').''; + // Ref supplier + print ''.$langs->trans('RefSupplier').''; print ''; // Customer @@ -1026,7 +1026,7 @@ if ($action == 'create') print ''; } - print '
'; + print '
'; print "\n"; @@ -1134,9 +1134,9 @@ else print ''; print ''; - print $form->editfieldkey("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); + print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; - print $form->editfieldval("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); + print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); print ''; print ''; @@ -1290,7 +1290,8 @@ else $productstatic->ref=$objp->label; print $productstatic->getNomUrl(0,'',16); } - if ($objp->description) print '
'.dol_nl2br($objp->description); + if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description) + print '
'.dol_nl2br($objp->description); print ''; } else diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5626719d96d..1399ae40215 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -989,7 +989,7 @@ class Contrat extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -2385,39 +2385,4 @@ class ContratLigne extends CommonObject } } - /** - * Create a contract document on disk using template defined into CONTRACT_ADDON_PDF - * - * @param string $modele force le modele a utiliser ('' par defaut) - * @param Translate $outputlangs objet lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @return int 0 if KO, 1 if OK - */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) - { - global $conf,$langs,$user,$hookmanager; - - $langs->load("contracts"); - - // Positionne modele sur le nom du modele de contrat a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->CONTRACT_ADDON_PDF)) - { - $modele = $conf->global->CONTRACT_ADDON_PDF; - } - else - { - $modele = 'strato'; - } - } - - $modelpath = "core/modules/contract/doc/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); - } } - - diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index cf57e97933b..b83ecc329b7 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -58,7 +58,7 @@ $result = restrictedArea($user, 'contrat', $id); $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_name=""; $search_contract=""; @@ -79,14 +79,13 @@ $now=dol_now(); llxHeader(); $sql = 'SELECT'; +$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,"; +$sql.= " s.nom as name, s.rowid as socid,"; $sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,'; $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,'; -$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; -$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; -$sql.= " s.nom as name, s.rowid as socid"; -$sql.= " ,c.ref_supplier"; +$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed'; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; @@ -107,7 +106,7 @@ if (!empty($search_ref_supplier)) { if ($sall) { $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); } -$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, s.nom, s.rowid"; +$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit + 1, $offset); @@ -119,6 +118,7 @@ if ($resql) print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num); + print '
'; print ''; print ''; @@ -137,7 +137,6 @@ if ($resql) print ''; print "\n"; - print ''; print ''; print ''; print '\n"; - print ''; $var=true; while ($i < min($num,$limit)) @@ -180,7 +178,8 @@ if ($resql) } $db->free($resql); - print "
'.$staticcontratligne->LibStatut(5,3).'
'; @@ -154,7 +153,6 @@ if ($resql) print ''; print ''; print "
"; + print ''; + print ''; } else { diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index b0fb4ed5edb..22ae64ef9cd 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -69,7 +69,7 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); -if (GETPOST("button_removefilter")) +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_name=""; $search_contract=""; diff --git a/htdocs/core/actions_printipp.inc.php b/htdocs/core/actions_printipp.inc.php new file mode 100644 index 00000000000..3c18faa813b --- /dev/null +++ b/htdocs/core/actions_printipp.inc.php @@ -0,0 +1,45 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_printipp.inc.php + * \brief Code for actions print_file to print file using ipp + */ + + +// $action must be defined +// $db, $user, $conf, $langs must be defined +// Filename to print must be provided into 'file' parameter + +// Print file +if ($action == 'print_file' and $user->rights->printipp->read) +{ + $langs->load("printipp"); + require_once DOL_DOCUMENT_ROOT . '/core/class/dolprintipp.class.php'; + $printer = new dolPrintIPP($db, $conf->global->PRINTIPP_HOST, $conf->global->PRINTIPP_PORT, $user->login, $conf->global->PRINTIPP_USER, $conf->global->PRINTIPP_PASSWORD); + $result = $printer->print_file(GETPOST('file', 'alpha'), GETPOST('printer', 'alpha')); + if ($result) + { + setEventMessage($result,'warnings'); + } + else + { + setEventMessage($langs->trans("FileWasSentToPrinter", basename(GETPOST('file')))); + } + $action = ''; +} diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 51744775d9f..40e177404f9 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -146,10 +146,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($message) { $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 738582ad931..89d05b92b79 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -159,6 +159,7 @@ class box_actions extends ModeleBoxes $actioncejour=false; $contents=$this->info_box_contents; $nblines=count($contents); + $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo")) diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index c66326b27fb..45c8f1a4819 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -79,7 +79,7 @@ class box_comptes extends ModeleBoxes if ($user->rights->banque->lire) { $sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,"; - $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix,"; + $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,"; $sql.= " domiciliation, proprio, owner_address,"; $sql.= " account_number, currency_code,"; $sql.= " min_allowed, min_desired, comment"; diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index b272f350717..9b2a5437b8a 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -215,9 +215,9 @@ class box_graph_invoices_permonth extends ModeleBoxes $stringtoshow.='
'; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index c882acd40c1..7c2aa53da97 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 5084691d321..75f0f60660f 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -215,9 +215,9 @@ class box_graph_orders_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index f398ae9dcb1..70d62cac348 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -214,9 +214,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 974ccaed446..fd866f5df89 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -218,9 +218,9 @@ class box_graph_propales_permonth extends ModeleBoxes $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); + $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); $stringtoshow.='   '; - $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); + $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index c15bc9831ce..14ca4448a7c 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -40,10 +40,8 @@ class box_task extends ModeleBoxes var $info_box_contents = array(); /** - * \brief Constructeur de la classe - * - * @return void - */ + * Constructor + */ function box_task() { global $langs; @@ -126,7 +124,7 @@ class box_task extends ModeleBoxes $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); $this->info_box_contents[$i][5] = array('td' => '', 'text' => ""); - + } /** diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 275154cd80e..c6b6dad7acb 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -181,6 +181,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" global $langs,$conf; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite + $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; @@ -227,7 +228,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" print ''; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); $label=$head['text']; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; print ''; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 7d0bf5fad0c..5620e641df0 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -54,7 +54,6 @@ class CSMSFile * @param int $deferred Deferred or not * @param int $priority Priority * @param int $class Class - * @return int */ function __construct($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1) { diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index 68241cb4d62..d7f765fa510 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -40,7 +40,6 @@ class AntiVir * Constructor * * @param DoliDB $db Database handler - * @return AntiVir */ function __construct($db) { diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 088dfaf327b..59980cea7a9 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -191,7 +191,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; @@ -256,10 +256,10 @@ class Ccountry // extends CommonObject /** - * Delete object in database + * Delete object in database * - * @param User $user User that delete - * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @param User $user User that delete + * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ function delete($user, $notrigger=0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e85d3dbed71..4cc8cd23672 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2014 Philippe Grand * Copyright (C) 2012 Marcos García @@ -34,7 +34,7 @@ */ abstract class CommonObject { - protected $db; + public $db; public $error; public $errors; public $canvas; // Contains canvas name if it is @@ -601,18 +601,22 @@ abstract class CommonObject /** * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * - * @return int <0 if KO, >0 if OK + * @param int $force_thirdparty_id Force thirdparty id + * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty() + function fetch_thirdparty($force_thirdparty_id=0) { global $conf; - if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty)) return 0; + if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty); + if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id; + $thirdparty = new Societe($this->db); - $result=$thirdparty->fetch(isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty)); + $result=$thirdparty->fetch($idtofetch); $this->client = $thirdparty; // deprecated $this->thirdparty = $thirdparty; @@ -629,7 +633,7 @@ abstract class CommonObject /** * Load data for barcode into properties ->barcode_type* - * Properties ->barcode_type that is id of barcode type is used to find other properties, but + * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but * if it is not defined, ->element must be defined to know default barcode type. * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) @@ -3012,30 +3016,33 @@ abstract class CommonObject $marginInfo = $this->getMarginInfos($force_price); - print $langs->trans('ShowMarginInfos').' : '; - $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']; - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // FIXME Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better + { + print $langs->trans('ShowMarginInfos').' : '; + $hidemargininfos = $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; - print ''; - if (!empty($hidemargininfos)) print ''; + print ''; + if (!empty($hidemargininfos)) print ''; + } - print ''; + print '
'; print ''; - print ''; - print ''; + print ''; + print ''; if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; if (! empty($conf->product->enabled)) @@ -3596,7 +3603,7 @@ abstract class CommonObject break; } - $out .= ''."\n"; + $out .= ''; if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; else $out .= ''; @@ -3604,7 +3611,6 @@ abstract class CommonObject } } $out .= "\n"; - $out .= ' '; $out .= ' '; + '."\n"; + $out .= ' '."\n"; } return $out; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 8a17273435e..3cbee0d97d7 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -72,8 +72,6 @@ class Conf /** * Constructor - * - * @return Conf */ function __construct() { @@ -364,6 +362,27 @@ class Conf unset($this->global->PRODUIT_USE_SEARCH_TO_SELECT); unset($this->global->COMPANY_USE_SEARCH_TO_SELECT); unset($this->global->CONTACT_USE_SEARCH_TO_SELECT); + unset($this->global->PROJECT_USE_SEARCH_TO_SELECT); + } + + if (! empty($conf->productbatch->enabled)) + { + $this->global->STOCK_CALCULATE_ON_BILL=0; + $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SHIPMENT=1; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1; + } + + if (! empty($conf->productbatch->enabled)) + { + $this->global->STOCK_CALCULATE_ON_BILL=0; + $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SHIPMENT=1; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0; + $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1; } // conf->currency @@ -373,6 +392,9 @@ class Conf // conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' + // By default, suppliers ojbects can be linked to all projects + $conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1; + // conf->liste_limit = constante de taille maximale des listes if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index eea64ed10ac..027dda53dd3 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -198,7 +198,7 @@ class Ctypent // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 9844e6b74c9..7cddd4c16f5 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -40,7 +40,6 @@ class DolGeoIP * * @param string $type 'country' or 'city' * @param string $datfile Data file - * @return GeoIP */ function __construct($type,$datfile) { diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 33888b057b7..c400dc151d3 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -253,7 +253,7 @@ class DolGraph /** * Set legend * - * @param string $legend Legend + * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ function SetLegend($legend) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 942ee3da3c3..b6e09547743 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -45,7 +45,6 @@ class dolprintIPP * @param string $userid userid * @param string $user user * @param string $password password - * @return printIPP */ function __construct($db,$host,$port,$userid,$user,$password) { @@ -83,19 +82,22 @@ class dolprintIPP * @param string $file file * @param string $module module * - * @return void + * @return string '' if OK, Error message if KO */ - function print_file($file,$module) + function print_file($file, $module) { global $conf,$db; + include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; + $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose + $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose $ipp->setHost($this->host); $ipp->setPort($this->port); $ipp->setJobName($file,true); $ipp->setUserName($this->userid); if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); + // select printer uri for module order, propal,... $sql = 'SELECT rowid,printer_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"'; $result = $this->db->query($sql); @@ -108,13 +110,23 @@ class dolprintIPP } else { - $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + if (! empty($conf->global->PRINTIPP_URI_DEFAULT)) + { + $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); + } + else + { + return 'NoDefaultPrinterDefined'; + } } } + // Set number of copy $ipp->setCopies($obj->copy); $ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file); $ipp->printJob(); + + return ''; } /** diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index e191773517b..299026a84bb 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -154,7 +154,7 @@ class Events // extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=0, $notrigger=0) + function update($user=null, $notrigger=0) { global $conf, $langs; @@ -191,7 +191,7 @@ class Events // extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=null) { global $langs; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 94898ec5452..30c97e9f1ef 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -56,7 +56,7 @@ class ExtraFields var $error; var $errno; - static $type2label=array( + public static $type2label=array( 'varchar'=>'String', 'text'=>'TextLong', 'int'=>'Int', @@ -510,17 +510,6 @@ class ExtraFields } - /** - * Load array of labels - * - * @return void - */ - function fetch_optionals() - { - $this->fetch_name_optionals_label(); - } - - /** * Load array this->attribute_xxx like attribute_label, attribute_type, ... * @@ -528,15 +517,14 @@ class ExtraFields * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @return array Array of attributes for all extra fields */ - function fetch_name_optionals_label($elementtype='adherent',$forceload=false) + function fetch_name_optionals_label($elementtype,$forceload=false) { global $conf; $array_name_label=array(); // For avoid conflicts with external modules - if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) - return $array_name_label; + if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; @@ -569,13 +557,13 @@ class ExtraFields $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; } } - - return $array_name_label; } else { print dol_print_error($this->db); } + + return $array_name_label; } diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php index 7f36c6f0d99..b0649f575fc 100644 --- a/htdocs/core/class/google.class.php +++ b/htdocs/core/class/google.class.php @@ -36,7 +36,6 @@ class GoogleAPI * * @param DoliDB $db Database handler * @param string $key Google key - * @return GoogleAPI */ function __construct($db,$key) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php old mode 100644 new mode 100755 index 03defa19129..14b7c78cc7d --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -746,7 +746,7 @@ class Form * @param int $showempty Add an empty field * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box - * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $limit Maximum number of elements * @return string HTML string with * @deprecated Use select_thirdparty instead @@ -816,10 +816,67 @@ class Form $resql=$this->db->query($sql); if ($resql) { - if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) + if (! empty($conf->use_javascript_ajax)) { - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + } + else + { + if (count($events)) // Add management of event + { + print ''; + } + } } // Construct $out and $outarray @@ -1849,7 +1906,7 @@ class Form $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; - $sql.= " s.nom as name"; + $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; if ($socid) $sql.= " AND pfp.fk_soc = ".$socid; @@ -1886,6 +1943,7 @@ class Form $result=$this->db->query($sql); if ($result) { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $num = $this->db->num_rows($result); @@ -1930,6 +1988,17 @@ class Form { $outqty=$objp->quantity; $outdiscount=$objp->remise_percent; + if (!empty($objp->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx); + if ($price_result >= 0) { + $objp->fprice = $price_result; + if ($objp->quantity >= 1) + { + $objp->unitprice = $objp->fprice / $objp->quantity; + } + } + } if ($objp->quantity == 1) { $opt.= price($objp->fprice,1,$langs,0,0,-1,$conf->currency)."/"; @@ -2018,7 +2087,7 @@ class Form $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,"; $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,"; - $sql.= " s.nom as name"; + $sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; @@ -2043,6 +2112,7 @@ class Form } else { + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $form.= ''; $i = 0; @@ -2057,6 +2127,17 @@ class Form } $opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; + if (!empty($objp->fk_price_expression)) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx); + if ($price_result >= 0) { + $objp->fprice = $price_result; + if ($objp->quantity >= 1) + { + $objp->unitprice = $objp->fprice / $objp->quantity; + } + } + } if ($objp->quantity == 1) { $opt.= price($objp->fprice,1,$langs,0,0,-1,$conf->currency)."/"; @@ -2565,7 +2646,7 @@ class Form $i++; } print ""; - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } else { print $langs->trans("NoShippingMethodDefined"); } @@ -2921,12 +3002,13 @@ class Form // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template $formconfirm.= ''; + $formconfirm.= ''."\n"; - $formconfirm.= ''; + $formconfirm.= "\n"; } else { $formconfirm.= "\n\n"; $formconfirm.= ''."\n"; - $formconfirm.= ''; + $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; $formconfirm.= '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
'."\n"; @@ -3039,13 +3122,14 @@ class Form /** * Show a form to select a project * - * @param int $page Page - * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) - * @param int $selected Id pre-selected project - * @param string $htmlname Name of select field + * @param int $page Page + * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) + * @param int $selected Id pre-selected project + * @param string $htmlname Name of select field + * @param int $discard_closed Hide all closed projects * @return void */ - function form_project($page, $socid, $selected='', $htmlname='projectid') + function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0) { global $langs; @@ -3062,8 +3146,7 @@ class Form print ''; print '
'; print ''; print ''; print '
'; - //print "$socid,$selected,$htmlname"; - $formproject->select_projects($socid,$selected,$htmlname); + $formproject->select_projects($socid,$selected,$htmlname,20,0,1,$discard_closed); print '
'; @@ -4045,7 +4128,22 @@ class Form if ($value_as_key) $array=array_combine($array, $array); - $out=''; if ($show_empty) { @@ -4109,46 +4207,22 @@ class Form global $conf, $langs; // Add code for jquery to use multiselect - // Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it. - if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiselect')) - || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT'))) + if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { - print ' - '; - } - - // Add code for jquery to use multiple-select - // Note: Plugin "multiselect" is no more provided by Dolibarr. You must include it and load it into your module to use it. - if ((! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ($conf->global->MAIN_USE_JQUERY_MULTISELECT == 'multiple-select')) - || (defined('REQUIRE_JQUERY_MULTISELECT') && constant('REQUIRE_JQUERY_MULTISELECT'))) - { - print ' - - '; + $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; + print ' + '; } // Try also magic suggest - $out = ''."\n"; if (is_array($array) && ! empty($array)) { if ($value_as_key) $array=array_combine($array, $array); diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 042474781d7..30ecadedb55 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -53,9 +53,10 @@ class FormAdmin * @param array $filter Array of keys to exclude in list * @param int $showempty Add empty value * @param int $showwarning Show a warning if language is not complete + * @param int $disabled Disable edit of select * @return string Return HTML select string with list of languages */ - function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0) + function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0,$disabled=0) { global $langs; @@ -63,7 +64,7 @@ class FormAdmin $out=''; - $out.= ''; if ($showempty) { $out.= '