diff --git a/.travis.yml b/.travis.yml index 5bc5f49b2e530846c5a272598bdc4f332ec7ffc2..0d9859e7f86e141219bf976f409fe8d5ee30d2bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,146 +1,312 @@ # This script is used by Travis CI to run automatically Continuous test integration # from Dolibarr GitHub repository. -# Command run is phpunit # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ -notifications: - email: - on_success: never # [always|never|change] default: change - on_failure: change # [always|never|change] default: always - +sudo: required + +language: php + +php: +- '5.3' +- '5.4' +- '5.5' +- '5.6' +- '7.0' +- nightly + addons: - postgresql: "9.3" + mariadb: '10.0' + # FIXME: find a way to import a MySQL dump into PostgreSQL + #postgresql: '9.3' + apt: + packages: + # We need a webserver to test the webservices + # Let's install Apache with. + - apache2 + # mod_php is not supported by Travis. Add fcgi. We install FPM later on. + - libapache2-mod-fastcgi +# Start on every boot services: - - memcached # will start memcached +- memcached + +env: + global: + # Set to true for very verbose output + - DEBUG=true + matrix: + # MariaDB overrides MySQL installation so it's not possible to test both yet + #- DB=mysql + - DB=mariadb + # FIXME: find a way to import a MySQL dump into PostgreSQL + #- DB=postgresql + # TODO + #- DB=sqlite + # See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP + #- WS=apache + # See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test + #- WS=nginx -# This will tell travis to run phpunit -language: php -php: -# - "5.2" is not supported because pyrus to install PHP_Codesniffer is not available - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - matrix: + fast_finish: true allow_failures: - - php: 7.0 + - php: '7.0' + - php: nightly + # FIXME + #- env: DB=postgresql + # TODO + #- env: DB=sqlite -env: - - DB=mysql -# - DB=postgres - -before_script: - - echo Start travis - - echo Current dir is `pwd` - - echo Home dir is `echo ~` - - export PHPV=`phpenv version-name` - - echo PHP version $PHPV -# - 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; - - sudo touch $(pwd)/htdocs/documents/dolibarr.log; - - sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build; - - sudo chmod -R a+rwx $(pwd); - - sudo chown -R www-data:travis $(pwd)/htdocs/documents; - - find $(pwd)/htdocs/documents -type d -exec ls -alt {} \; - - echo Edit php.ini file - - echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini -# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'extension = apc.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - - sh -c "if [ '$PHPV' = '5.3' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - - sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi" - - cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo Mysql version - # INSTALL MYSQL 5.6 - # (https://github.com/piwik/piwik/commit/20bd2e1c24e5d673dce3feb256204ad48c29f160) - # TODO: Remove when mysql 5.6 is provided by travis. - # Otherwise, our migrations will raise a syntax error. - - "sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5" - - "sudo apt-get autoremove" - - "sudo apt-get install libaio1" - - "wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/" - - "sudo dpkg -i mysql-5.6.14.deb" - - "sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server" - - "sudo ln -s /opt/mysql/server-5.6/bin/* /usr/bin/" - - "sudo sed -i'' 's/table_cache/table_open_cache/' /etc/mysql/my.cnf" - - "sudo sed -i'' 's/log_slow_queries/slow_query_log/' /etc/mysql/my.cnf" - - "sudo sed -i'' 's/basedir[^=]\\+=.*$/basedir = \\/opt\\/mysql\\/server-5.6/' /etc/mysql/my.cnf" - - "sudo /etc/init.d/mysql.server start" - - mysql --version - - mysql -e "SELECT VERSION();" - # /END MYSQL 5.6- mysql --version - - echo Init database - - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi" - - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi" - - echo Create config file htdocs/conf/conf.php - - echo '<?php ' > htdocs/conf/conf.php - - sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi" - - sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi" - - echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php - - echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php - - echo '?>' >> htdocs/conf/conf.php - - echo Show conf.php content - - cat htdocs/conf/conf.php - - echo Install apache server - - sudo apt-get update - - sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl - - sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default - - echo Show default virtual host - - sudo cat /etc/apache2/sites-available/default - - sudo /etc/init.d/apache2 restart - - wget http://localhost/ - - sudo cat /etc/apache2/envvars - - sudo cat /var/log/apache2/error.log - - cat index.html - - - -script: - - cd htdocs/install - - date -# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log -# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log - - php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log - - php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log - - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log - - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log - - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log -# - cat upgrade370380.log - - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log -# - cat upgrade370380-2.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=/htdocs/conf/conf.php,/build/html/,/dev/vagrant/,/documents/,/includes/,/test/report/ . 2>&1 - - date +notifications: + email: + on_success: never # [always|never|change] default: change + on_failure: change # [always|never|change] default: always + irc: + channels: + - "chat.freenode.net#dolibarr" + on_success: change + on_failure: always + use_notice: true -after_script: -# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log - - echo Output apache log file; sudo cat /var/log/apache2/error.log - - echo End travis +before_install: +- | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo + +install: +- | + echo "Updating Composer" + composer self-update + echo + +- | + echo "Installing Parallel Lint" + composer -n require jakub-onderka/php-parallel-lint ^0 + composer -n require jakub-onderka/php-console-highlighter ^0 + echo + +- | + echo "Installing PHP Unit" + if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then + composer -n require phpunit/phpunit ^4 + fi + if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require phpunit/phpunit ^5 + fi + echo + +- | + echo "Installing PHP CodeSniffer" + composer require squizlabs/php_codesniffer ^2 + echo +- | + echo "Adding Composer binaries to the path" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo + +before_script: +- | + echo Start travis + echo Current dir is `pwd` + echo Home dir is `echo ~` + echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR + +- | + echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit" + phpenv config-add /tmp/xdebug.ini + echo + +- | + echo "Setting up PHP" + echo + echo "Set timezone" + echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then + echo + echo "Enabling APC for PHP <= 5.4" + # Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6! + echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + echo + echo "Enabling Memcached for PHP <= 5.4" + # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly! + echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + fi + phpenv rehash + echo + +- | + if [ "$DEBUG" = true ]; then + echo "Debugging informations" + # Check PHP + php -i + # Check PHP CodeSniffer installation + which phpcs + phpcs --version + phpcs -i + # Check PHPUnit installation + which phpunit + phpunit --version + # Check MySQL + mysql --version + mysql -e "SELECT VERSION();" + echo + fi + +- | + echo "Setting up database" + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo "MySQL" + mysql -e 'DROP DATABASE IF EXISTS travis;' + mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' + mysql -D travis < dev/initdata/mysqldump_dolibarr_3.5.0.sql + fi + # FIXME: find a way to import a MySQL dump into PostgreSQL + #if [ "$DB" = 'postgresql' ]; then + # pgsql travis < dev/initdata/mysqldump_dolibarr_3.5.0.sql + #fi + # TODO: SQLite + echo + +- | + echo "Setting up Dolibarr" + export CONF_FILE=htdocs/conf/conf.php + echo '<?php ' > $CONF_FILE + echo '$'dolibarr_main_url_root=\'http://127.0.0.1\'';' >> $CONF_FILE + echo '$'dolibarr_main_document_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $CONF_FILE + echo '$'dolibarr_main_data_root=\'$TRAVIS_BUILD_DIR/documents\'';' >> $CONF_FILE + echo '$'dolibarr_main_db_host=\'127.0.0.1\'';' >> $CONF_FILE + echo '$'dolibarr_main_db_name=\'travis\'';' >> $CONF_FILE + echo '$'dolibarr_main_db_user=\'travis\'';' >> $CONF_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'dolibarr_main_db_type=\'mysqli\'';' >> $CONF_FILE + fi + # FIXME + #if [ "$DB" = 'postgresql' ]; then + # echo '$'dolibarr_main_db_type=\'pgsql\'';' >> $CONF_FILE + #fi + # TODO: SQLite + echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> $CONF_FILE + echo + +- | + if [ "$DEBUG" = true ]; then + echo "Debugging informations" + cat $CONF_FILE + echo + fi + +- | + echo "Create documents directory and set permissions" + # and admin/temp subdirectory needed for unit tests + mkdir -p documents/admin/temp + echo + +- | + echo "Setting up Apache + FPM" + # enable php-fpm + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + # Copy the included pool + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.d/www.conf + fi + if [ "$DEBUG" = true ]; then + cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php-fpm.conf + fi + sudo a2enmod rewrite actions fastcgi alias + echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + if [ "$DEBUG" = true ]; then + cat ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini + fi + ~/.phpenv/versions/$PHP_VERSION_NAME/sbin/php-fpm + # configure apache virtual hosts + sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/default + sudo sed -e "s?%TRAVIS_BUILD_DIR%?$TRAVIS_BUILD_DIR?g" --in-place /etc/apache2/sites-available/default + if [ "$DEBUG" = true ]; then + sudo cat /etc/apache2/sites-available/default + fi + sudo service apache2 restart + echo + +script: +- | + echo "Checking webserver availability" + # Ensure we catch errors + set -e + wget http://127.0.0.1 + if [ "$DEBUG" = true ]; then + cat index.html + fi + set +e + echo + +- | + echo "Checking PHP syntax errors" + # Ensure we catch errors + set -e + parallel-lint --exclude htdocs/includes --blame . + set +e + echo + +# TODO: dev/* checks + +- | + echo "Checking coding style" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/codesniffer/ruleset.xml --encoding=utf-8 . + set +e + echo + +# TODO: Check Javascript (jshint?) + +# TODO: Check CSS (csslint?) + +# TODO: check SQL syntax (pgsanity?) + +- | + echo "Upgrading Dolibarr" + # Ensure we catch errors + set -e + cd htdocs/install + php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log + php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log + php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log + php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log + cd - + set +e + echo + +- | + echo "Unit testing" + # Ensure we catch errors + set -e + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + set +e + echo + +after_success: + +after_failure: +- | + if [ "$DEBUG" = true ]; then + echo "Debugging informations" + # Upgrade log files + cat *.log + # Dolibarr log file + cat documents/dolibarr.log + # Apache log file + sudo cat /var/log/apache2/error.log + # MariaDB log file + sudo cat /var/log/mysql/error.log + # TODO: PostgreSQL log file + echo + fi + +after_script: diff --git a/build/travis-ci/apache.conf b/build/travis-ci/apache.conf new file mode 100644 index 0000000000000000000000000000000000000000..5ba713924f23cdb04c8c7ad0a069e84a3b40f1af --- /dev/null +++ b/build/travis-ci/apache.conf @@ -0,0 +1,18 @@ +<VirtualHost *:80> + DocumentRoot %TRAVIS_BUILD_DIR%/htdocs + + <Directory "%TRAVIS_BUILD_DIR%/htdocs"> + Options FollowSymLinks MultiViews ExecCGI + AllowOverride All + Order deny,allow + Allow from all + </Directory> + + # Wire up Apache to use Travis CI's php-fpm. + <IfModule mod_fastcgi.c> + AddHandler php5-fcgi .php + Action php5-fcgi /php5-fcgi + Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi + FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization + </IfModule> +</VirtualHost> diff --git a/composer.json b/composer.json index ed75d3ca61dcff1a96dac0cd960dbb7b814e27b3..55506e5d7f766cfbe0c4bec1891750e008d8754f 100644 --- a/composer.json +++ b/composer.json @@ -6,9 +6,11 @@ "homepage": "http://www.dolibarr.org", "license": "GPL-3.0+", "support": { - "issues": "https://doliforge.org/projects/dolibarr", + "issues": "https://github.com/Dolibarr/dolibarr/issues", "forum": "http://www.dolibarr.org/forum", - "wiki": "http://wiki.dolibarr.org" + "wiki": "http://wiki.dolibarr.org", + "irc": "irc://chat.freenode.net/dolibarr", + "source": "https://github.com/Dolibarr/dolibarr" }, "require": { "php": ">=5.3.0", @@ -17,16 +19,23 @@ "restler/framework": "3.0.*" }, "suggest": { - "ext-mysqli": "*", - "ext-pgsql": "*", - "ext-mssql": "*", - "ext-pdo_sqlite": "*", - "ext-imagick": "*", - "ext-mcrypt": "*", - "ext-openssl": "*", - "ext-mbstring": "*", - "ext-soap": "*", - "ext-zip": "*", - "ext-xml": "*" + "ext-mysqlnd": "To use with MySQL or MariaDB", + "ext-mysqli": "To use with MySQL or MariaDB", + "ext-pgsql": "To use with PostgreSQL", + "ext-mssql": "To use with MSSQL (experimental)", + "ext-pdo_sqlite": "To use with SQLite (experimental)", + "ext-gd": "Image manipulation (Required but maybe built-in PHP)", + "ext-imagick": "Image manipulation (TCPDF)", + "ext-mcrypt": "(Required but maybe built-in PHP)", + "ext-openssl": "Secure connections (Emails, SOAP…)", + "ext-mbstring": "Handle non UTF-8 databases", + "ext-soap": "Native SOAP", + "ext-zip": "ODT and Excel support", + "ext-xml": "Excel support", + "firephp/firephp-core": "Logging to Firebug console support", + "raven/raven": "Sentry logging server support" + }, + "config": { + "vendor-dir": "htdocs/includes" } } diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 321560ff6f94b05213cf16aac26876db49b73d51..254e88036db2ad6f4e00bb2f0895142e8351bf8f 100644 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -124,7 +124,7 @@ <!-- Tweaks to metrics --> <rule ref="Generic.Metrics.CyclomaticComplexity"> <properties> - <property name="complexity" value="80" /> + <property name="complexity" value="120" /> <property name="absoluteComplexity" value="250" /> </properties> </rule> diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 99eb49949e7ff287486a980dfdb86537238e1705..5f774ed4536e4d952b1c869d4e565a6d9e53caca 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -148,14 +148,14 @@ if ($action == 'create') dol_fiche_head(); print '<table class="border" width="100%">'; - - print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; + + print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>'; - print '<tr><td>' . $langs->trans("Label") . '</td>'; + print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>'; print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<td>'; - print $htmlacc->select_account($accounting->account_parent, 'account_parent'); + print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1); print '</td></tr>'; print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<td>'; @@ -204,13 +204,13 @@ else if ($id) print '<table class="border" width="100%">'; - print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; + print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>'; - print '<tr><td>' . $langs->trans("Label") . '</td>'; + print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>'; print '<tr><td>' . $langs->trans("Accountparent") . '</td>'; print '<td>'; - print $htmlacc->select_account($accounting->account_parent, 'account_parent'); + print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1); print '</td></tr>'; print '<tr><td>' . $langs->trans("Pcgtype") . '</td>'; print '<td>'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e4953c9985399220f9675c6d5673d683c16cb56e..bb6ca1af9ff95c4f5111c73cbf22b328e1f0ad78 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> + * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1014,6 +1015,13 @@ class Contrat extends CommonObject } } + if (! $error) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + } + if (! $error) { // Delete contratdet_log diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d91f2418400f6f0bf2a78e601a4bce8d831c5787..c29054cde54a90b5a28643ead2d55a67bb9ad40a 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -484,7 +484,7 @@ class pdf_einstein extends ModelePDFCommandes $this->tva[$vatrate] += $tvaligne; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 603f151fbfdd2290efe66e6078b0e86cd8a059fd..7e5190dc5e6290d9cdf4e10acecb967062741f64 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -430,7 +430,7 @@ class pdf_proforma extends ModelePDFCommandes $this->tva[$vatrate] += $tvaligne; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 107dbb783b95382a5b093e4db8f0135e24d7090c..7d9b4428438322c59158a93ede85d81eec07efc1 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -277,7 +277,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0); // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index e90e11a952d6faeb6493e5ade5d4f782d917e0e7..73f7ee1b4a9a0b13b886fa9f295f94dd7cd8b4b3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -313,7 +313,7 @@ class pdf_rouget extends ModelePdfExpedition $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 57f845696febe947ef6210cba10672fbb5762d69..475c874ae5fec9afedb08bf202a2a0eff34a4f76 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -579,7 +579,7 @@ class pdf_crabe extends ModelePDFFactures if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 30ace6e38ea1a7fc8b0840602310795de0d3bf42..7c7fa2273d578a8ce4da14dfbbab49eaaf91b392 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -572,7 +572,7 @@ class pdf_azur extends ModelePDFPropales if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 265d43ca1fcfbcfadc14083b469fa1a871c02430..75319845f1a138a68f98bd4c611a03e81d5b49c0 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -448,7 +448,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->localtax2[$localtax2rate]+=$localtax2ligne; // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index b2ca0ee0a602210aaaa7fe978d1817ac23df3018..1d0a84b6a5beff01639a1b403691a5900d8428b3 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -470,7 +470,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Add line - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1)) { $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); diff --git a/htdocs/includes/adodbtime/adodb-time.inc.php b/htdocs/includes/adodbtime/adodb-time.inc.php index 1be5f4cd607300637b6510d9b37d7fb731dbff02..88d05d2f2b1f4e489d19a25be6c06ce45e4aa9db 100644 --- a/htdocs/includes/adodbtime/adodb-time.inc.php +++ b/htdocs/includes/adodbtime/adodb-time.inc.php @@ -1006,7 +1006,7 @@ function adodb_tz_offset($gmt,$isphp5) return sprintf('%s%02d%02d',($gmt<=0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); else return sprintf('%s%02d%02d',($gmt<0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60); - break; + //break; }