diff --git a/.travis.yml b/.travis.yml index 98dcca4cf20..5e3f1511266 100644 --- a/.travis.yml +++ b/.travis.yml @@ -207,8 +207,7 @@ before_script: mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql fi if [ "$DB" = 'postgresql' ]; then - #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr + #pgloader mysql://root:pass@127.0.0.1/dolibarr_35 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev pgloader mysql://root@127.0.0.1/travis postgresql:///travis fi # TODO: SQLite @@ -238,8 +237,9 @@ before_script: - | echo "Create documents directory and set permissions" # and admin/temp subdirectory needed for unit tests - mkdir -p documents/admin/temp - echo "first line" > documents/dolibarr.log + mkdir -p $TRAVIS_BUILD_DIR/documents/admin/temp + sudo chmod -R a+rwx $TRAVIS_BUILD_DIR/documents + echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo @@ -334,33 +334,28 @@ script: php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log php upgrade2.php 7.0.0 8.0.0 MAIN_MODULE_TICKETSUP > $TRAVIS_BUILD_DIR/upgrade700800-2.log php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log + php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log + php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log + php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log cd - set +e echo - #cat $TRAVIS_BUILD_DIR/upgrade400500-2.log - #cat $TRAVIS_BUILD_DIR/upgrade500600.log - #cat $TRAVIS_BUILD_DIR/upgrade500600-2.log - #cat $TRAVIS_BUILD_DIR/upgrade500600-3.log - #cat $TRAVIS_BUILD_DIR/upgrade600700-2.log - cat /tmp/dolibarr_install.log - + #cat /tmp/dolibarr_install.log + - | echo "Unit testing" # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. set -e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + phpunitresult=$? + echo "Phpunit return code = $phpunitresult" set +e -- | - #echo "Output dolibarr.log" - #cat documents/dolibarr.log - after_script: - | - # Dolibarr log file - #echo "After script" - #cat documents/dolibarr.log - + echo "After script - Output 50 latest lines of dolibarr.log" + ls $TRAVIS_BUILD_DIR/documents + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log after_success: - | @@ -368,19 +363,24 @@ after_success: after_failure: - | - echo Failure - # This part of code seems to be never executed, error or not ??? - echo "Debugging informations" + echo Failure detected, so we show samples of log to help diagnose + # This part of code is executed only if previous commande that fails are enclosed with set +e # Upgrade log files - cat *.log - echo "Debugging informations" + for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` + do + echo "Debugging informations for file $ficlog" + #cat $ficlog + done # Apache log file + echo "Debugging informations for file apache error.log" sudo cat /var/log/apache2/error.log - # Dolibarr log file - cat documents/dolibarr.log if [ "$DEBUG" = true ]; then + # Dolibarr log file + echo "Debugging informations for file dolibarr.log (latest 50 lines)" + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log # MariaDB log file - sudo cat /var/log/mysql/error.log + echo "Debugging informations for file mysql error.log" + sudo tail -n 50 /var/log/mysql/error.log # TODO: PostgreSQL log file echo fi diff --git a/ChangeLog b/ChangeLog index ceb1d847ddb..402bb45423b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ English Dolibarr ChangeLog For Users: NEW: Experimental module: Ticket NEW: Experimental module: WebDAV -NEW: Accept anonmymous events (no user assigned) +NEW: Accept anonymous events (no user assigned) NEW: Accountancy - Add import on general ledger NEW: Accountancy - Show journal name on journal page and hide button draft export (Add an option in admin) NEW: Can create event from record card of a company and member @@ -19,7 +19,7 @@ NEW: Add a tab to specify accountant/auditor of the company NEW: Add Date delivery and Availability on Propals List NEW: Add date in goods reception supplier order table NEW: Add delivery_time_days of suppliers in export profile -NEW: Add Docments'tab to expedition module +NEW: Add Documents'tab to expedition module NEW: Use dol_print_phone in thirdparty list page to format phone NEW: Add entry for the GDPR contact NEW: Add extrafield type "html" @@ -101,7 +101,7 @@ NEW: Filter export model is now by user NEW: Finish implementation of option PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES NEW: generalize use of button to create new element from list NEW: hidden conf AGENDA_NB_WEEKS_IN_VIEW_PER_USER to set nb weeks to show into per user view -NEW: hidden conf to assign category to thirparty that are not customer nor prospect nor supplier +NEW: hidden conf to assign category to thirparty that are neither customer nor prospect or supplier NEW: hidden conf to set nb weeks to show into user view NEW: hidden option MAIN_DISABLE_FREE_LINES NEW: improve way of adding users/sales representative to thirdparty diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 0764d64b491..ec9ded557ff 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } -require_once($path."../htdocs/master.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); +require_once $path."../htdocs/master.inc.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; /* diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index cdbc2e2bb40..6303eaafaae 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -48,6 +48,23 @@ into // initialize subsetchars $subsetchars = array_fill(0, 256, true); +* Replace the continue into switch with a break: + +case 're': { + // justify block + if (!TCPDF_STATIC::empty_string($this->lispacer)) { + $this->lispacer = ''; + continue; + } + +into +case 're': { + // justify block + if (!TCPDF_STATIC::empty_string($this->lispacer)) { + $this->lispacer = ''; + break; + } + * Optionnaly, removed all fonts except dejavusans* (used by greek, arab, persan, romanian, turkish), freemono* (russian), diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index bd82d38d306..e519c62a436 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -40,7 +40,7 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- // Include Dolibarr environment -require_once($path."../../htdocs/master.inc.php"); +require_once $path."../../htdocs/master.inc.php"; // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. //$langs->setDefaultLang('en_US'); // To change default language of $langs @@ -58,7 +58,7 @@ print "***** ".$script_file." (".$version.") *****\n"; // Start of transaction $db->begin(); -require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); +require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; // Create invoice object $obj = new Facture($db); diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index 4575e9e28f3..95b047705fa 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -40,7 +40,7 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- // Include Dolibarr environment -require_once($path."../../htdocs/master.inc.php"); +require_once $path."../../htdocs/master.inc.php"; // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. //$langs->setDefaultLang('en_US'); // To change default language of $langs @@ -59,7 +59,7 @@ print "***** ".$script_file." (".$version.") *****\n"; // Start of transaction $db->begin(); -require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); +require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"; // Create order object $com = new Commande($db); diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php index 61598ff59d9..8cbc07a1b63 100755 --- a/dev/examples/code/create_product.php +++ b/dev/examples/code/create_product.php @@ -40,7 +40,7 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- // Include Dolibarr environment -require_once($path."../../htdocs/master.inc.php"); +require_once $path."../../htdocs/master.inc.php"; // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. //$langs->setDefaultLang('en_US'); // To change default language of $langs @@ -59,7 +59,7 @@ print "***** ".$script_file." (".$version.") *****\n"; // Start of transaction $db->begin(); -require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; // Create instance of object $myproduct=new Product($db); diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index 20173eb914a..f8e0ba23011 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -40,7 +40,7 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- // Include Dolibarr environment -require_once($path."../../htdocs/master.inc.php"); +require_once $path."../../htdocs/master.inc.php"; // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. //$langs->setDefaultLang('en_US'); // To change default language of $langs @@ -58,7 +58,7 @@ print "***** ".$script_file." (".$version.") *****\n"; // Start of transaction $db->begin(); -require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php"); +require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; // Create user object $obj = new User($db); diff --git a/dev/examples/code/get_contracts.php b/dev/examples/code/get_contracts.php index fbe512300e8..daff0e43e6f 100755 --- a/dev/examples/code/get_contracts.php +++ b/dev/examples/code/get_contracts.php @@ -40,7 +40,7 @@ $error=0; // -------------------- START OF YOUR CODE HERE -------------------- // Include Dolibarr environment -require_once($path."../../htdocs/master.inc.php"); +require_once $path."../../htdocs/master.inc.php"; // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. //$langs->setDefaultLang('en_US'); // To change default language of $langs @@ -65,7 +65,7 @@ print 'Argument id_thirdparty='.$argv[1]."\n"; // Start of transaction $db->begin(); -require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); +require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; // Create contract object $obj = new Contrat($db); diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index e313aa44d1f..4064336cbab 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -32,9 +32,9 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); -require (__DIR__. '/../../htdocs/master.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); -require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); +require __DIR__. '/../../htdocs/master.inc.php'; +require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; +require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; /* diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index c73b15b620d..5e53fa752a2 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -33,14 +33,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr //$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]); -require (__DIR__. '/../../htdocs/master.inc.php'); +require __DIR__. '/../../htdocs/master.inc.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); +require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"; /* diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 3ae44b00b3a..393d5c5ce3d 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -33,7 +33,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); -require (__DIR__. '/../../htdocs/master.inc.php'); +require __DIR__. '/../../htdocs/master.inc.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 6f1dc293a68..631b734fc9e 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -33,11 +33,11 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr //$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]); -require (__DIR__. '/../../htdocs/master.inc.php'); -require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); -require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); -require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); -require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); +require __DIR__. '/../../htdocs/master.inc.php'; +require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; +require_once DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"; +require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"; +require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; /* * Parameters @@ -157,7 +157,7 @@ $user->rights->propal->propal_advance->validate=1; if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"); + require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"; } $i=0; diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 992ab61f4ef..7f2c3e2055d 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -33,7 +33,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr //$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); -require (__DIR__. '/../../htdocs/master.inc.php'); +require __DIR__. '/../../htdocs/master.inc.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index a08e3b6066e..942e6f8f5d7 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -36,7 +36,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr $path=preg_replace('/import-products.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 0c32c7ea6a3..63c6856e5ec 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -36,7 +36,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr $path=preg_replace('/import-thirdparties.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 3aaa9c11a4a..72a006bbe29 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -36,7 +36,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr $path=preg_replace('/import-users.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index f992dcb2dc6..5a1e7b3afc3 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -36,7 +36,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { // Recupere root dolibarr $path=preg_replace('/purge-data.php/i','',$_SERVER["PHP_SELF"]); -require ($path."../../htdocs/master.inc.php"); +require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 981ff964b8e..98cb6189935 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -41,15 +41,15 @@ $passwordbase=isset($argv[6])?$argv[6]:''; // Include Dolibarr environment $res=0; -if (! $res && file_exists($path."../../master.inc.php")) $res=@include($path."../../master.inc.php"); -if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include($path."../../htdocs/master.inc.php"); -if (! $res && file_exists("../master.inc.php")) $res=@include("../master.inc.php"); -if (! $res && file_exists("../../master.inc.php")) $res=@include("../../master.inc.php"); -if (! $res && file_exists("../../../master.inc.php")) $res=@include("../../../master.inc.php"); -if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include($path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only -if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include("../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php"; +if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php"; +if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php"; +if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php"; +if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res) die ("Failed to include master.inc.php file\n"); -include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); +include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; /* diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 9c453096904..ef37e25c04f 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -36,15 +36,15 @@ $confirm=isset($argv[1])?$argv[1]:''; // Include Dolibarr environment $res=0; -if (! $res && file_exists($path."../../master.inc.php")) $res=@include($path."../../master.inc.php"); -if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include($path."../../htdocs/master.inc.php"); -if (! $res && file_exists("../master.inc.php")) $res=@include("../master.inc.php"); -if (! $res && file_exists("../../master.inc.php")) $res=@include("../../master.inc.php"); -if (! $res && file_exists("../../../master.inc.php")) $res=@include("../../../master.inc.php"); -if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include($path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only -if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include("../../../dolibarr".$reg[1]."/htdocs/master.inc.php"); // Used on dev env only +if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php"; +if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php"; +if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php"; +if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php"; +if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res) die ("Failed to include master.inc.php file\n"); -include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); +include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; /* diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index a43e4dde82b..6619cf83754 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -285,7 +285,20 @@ - + + + + 0 + + + 0 + + + 0 + + + 0 + diff --git a/dev/tools/test/testtcpdf.php b/dev/tools/test/testtcpdf.php index e14dae9c2a3..ce962dce3d9 100755 --- a/dev/tools/test/testtcpdf.php +++ b/dev/tools/test/testtcpdf.php @@ -27,8 +27,8 @@ * @since 2008-03-04 */ -require_once('../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php'); -require_once('../../htdocs/includes/tecnickcom/tcpdf/tcpdf.php'); +require_once '../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php'; +require_once '../../htdocs/includes/tecnickcom/tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); diff --git a/dev/tools/test/testutf.php b/dev/tools/test/testutf.php index c626a92a57d..ffa746bcab5 100644 --- a/dev/tools/test/testutf.php +++ b/dev/tools/test/testutf.php @@ -47,8 +47,8 @@ print 'Files has been created. Check its name from your explorer'."\n"; * @since 2008-09-15 */ -require_once('../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php'); -require_once('../../htdocs/includes/tecnickcom/tcpdf/tcpdf.php'); +require_once '../../htdocs/includes/tecnickcom/tcpdf/config/tcpdf_config.php'; +require_once '../../htdocs/includes/tecnickcom/tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); diff --git a/dev/translation/autotranslator.php b/dev/translation/autotranslator.php index 58314a23b9e..c7897810a72 100755 --- a/dev/translation/autotranslator.php +++ b/dev/translation/autotranslator.php @@ -37,8 +37,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Include Dolibarr environment -require_once($path.'../../htdocs/master.inc.php'); -require_once($path.'../../htdocs/core/lib/files.lib.php'); +require_once $path.'../../htdocs/master.inc.php'; +require_once $path.'../../htdocs/core/lib/files.lib.php'; // After this $db is an opened handler to database. We close it at end of file. // Load main language strings @@ -88,7 +88,7 @@ if ($argv[2] != 'all') } } -require_once(DOL_DOCUMENT_ROOT."/../dev/translation/autotranslator.class.php"); +require_once DOL_DOCUMENT_ROOT."/../dev/translation/autotranslator.class.php"; $langParser = new autoTranslator($argv[2],$argv[1],$dir,$file,$argv[3]); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 493c9e62717..2587a58aef6 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -406,5 +406,6 @@ if ($resql) dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index f024f54c41c..2c7d92f3735 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -1004,7 +1004,7 @@ if ($id) print '
'; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 9643227da64..6a92a3f6080 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -397,6 +397,6 @@ else if ($id > 0 || $ref) { } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index aec34469559..735c5595ddc 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -184,6 +184,6 @@ if ($action == 'display' || $action == 'delete') { print ""; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 15a50e7b8e8..900205b7588 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -800,7 +800,7 @@ if ($id) print '
'; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index c33d4326836..8cd45c1cfda 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -190,5 +190,6 @@ print '
"; print ''; - llxFooter(); } +// End of page +llxFooter(); $db->close(); diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 03265e434f6..3a0a1f73308 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -140,5 +140,6 @@ if ($resql) { } print "\n"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 92c5713880c..e17cefd77bb 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -714,5 +714,6 @@ if ($action == 'create') dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index b0a91f7ce36..ee44b52ab7d 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -748,6 +748,6 @@ print '
'; print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 80a4f0db5e8..55e9c8ab7ad 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -421,5 +421,6 @@ print ''; print ""; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index 9bf287bf3c9..c4084b600eb 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ */ /** - * \file accounting/bookkeeping/thirdparty_lettrage.php + * \file accountancy/bookkeeping/thirdparty_lettrage.php * \ingroup Advanced accountancy * \brief Onglet de gestion de parametrages des ventilations */ @@ -82,8 +82,9 @@ $socid = GETPOST("socid", 'int'); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result < 0) { - setEventMessage($object->error, 'errors'); +if ($result < 0) +{ + setEventMessages($object->error, $object->errors, 'errors'); } $form = new Form($db); @@ -252,7 +253,6 @@ if ($resql) { print ''; print ''; - $var = false; $solde = 0; $tmp = ''; while ( $obj = $db->fetch_object($resql) ) { @@ -261,11 +261,10 @@ if ($resql) { $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($obj->lettering_code)) - $var = ! $var; $solde += ($obj->credit - $obj->debit); - print ""; + print ''; if (empty($obj->lettering_code)) { print ''; @@ -293,14 +292,13 @@ if ($resql) { } print ''; - print 'Mouvement totaux' . "\n"; print '' . price($debit) . ''; print '' . price($credit) . ''; print ''; print "\n"; - print ""; + print ''; print 'Solde Comptable' . "\n"; print '' . price($credit - $debit) . ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index cf278c26903..61452230902 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ */ /** - * \file accounting/bookkeeping/thirdparty_lettrage.php + * \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php * \ingroup Advanced accountancy * \brief Tab to setup lettering */ @@ -86,8 +86,9 @@ $socid = GETPOST("socid", 'int'); $object = new Societe($db); $object->id = $socid; $result = $object->fetch($socid); -if ($result<0) { - setEventMessage($object->error,'errors'); +if ($result<0) +{ + setEventMessages($object->error, $object->errors, 'errors'); } $form = new Form($db); @@ -133,7 +134,7 @@ if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref; /* - * Affichage onglets + * Display tabs */ $head = societe_prepare_head($object); @@ -272,7 +273,6 @@ if ($resql) { print ''; print ''; - $var = false; $solde = 0; $tmp = ''; while ($obj = $db->fetch_object($resql)) { @@ -281,11 +281,10 @@ if ($resql) { $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($obj->lettering_code)) - $var = ! $var; $solde += ($obj->credit - $obj->debit); - print ""; + print ''; if (empty($obj->lettering_code)) { print ''; @@ -320,7 +319,7 @@ if ($resql) { print ''; print "\n"; - print ""; + print ''; print 'Solde Comptable' . "\n"; print '' . price($credit - $debit) . ''; print ''; diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 7e1387db951..677bc627c80 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -159,5 +159,6 @@ if (! empty($id)) { print "Error ID incorrect"; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 18e23826314..45387722719 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -89,7 +89,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } @@ -415,6 +415,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. } } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index cc0ced6b067..83ddd1bd888 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -400,6 +400,6 @@ if ($result) { print $db->lasterror(); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 69396131b02..b5fec4a0e7c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -201,8 +201,9 @@ llxHeader('', $langs->trans("Ventilation")); if (empty($chartaccountcode)) { print $langs->trans("ErrorChartOfAccountSystemNotSelected"); - llxFooter(); - $db->close(); + // End of page + llxFooter(); + $db->close(); exit; } @@ -524,5 +525,6 @@ jQuery(document).ready(function() { }); '; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index d9b2137157d..b245e2539a7 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -167,5 +167,6 @@ if (! empty($id)) { print "Error ID incorrect"; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 49b20730eef..7f906e93879 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -86,7 +86,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } @@ -345,5 +345,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print ''; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 473bc379057..ae368a20de1 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -349,6 +349,6 @@ if ($result) { print $db->lasterror(); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index a20f88f1c30..8057c9809f2 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -180,8 +180,9 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation")); if (empty($chartaccountcode)) { print $langs->trans("ErrorChartOfAccountSystemNotSelected"); - llxFooter(); - $db->close(); + // End of page + llxFooter(); + $db->close(); exit; } @@ -422,5 +423,6 @@ jQuery(document).ready(function() { }); '; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 2881de98132..53ba48ff9d9 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -163,5 +163,6 @@ else print $langs->trans("Module10Desc")."
\n"; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index f126d00f2e9..439b8625342 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -162,5 +162,6 @@ if (! empty($id)) { print "Error ID incorrect"; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 334fd347a58..3e6a6991f6c 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -87,7 +87,7 @@ if ($action == 'clean' || $action == 'validatehistory') if (! $resql1) { $error ++; $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); + setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); } @@ -342,6 +342,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print ''; } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ef54dec564d..326d249f86d 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -406,7 +406,6 @@ if ($result) { print $db->lasterror(); } - - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 57fdf0ace48..18c9fa11a3c 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -202,8 +202,9 @@ llxHeader('', $langs->trans("SuppliersVentilation")); if (empty($chartaccountcode)) { print $langs->trans("ErrorChartOfAccountSystemNotSelected"); - llxFooter(); - $db->close(); + // End of page + llxFooter(); + $db->close(); exit; } @@ -532,5 +533,6 @@ jQuery(document).ready(function() { }); '; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 4511ee0e8a7..2abc3b10841 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -265,7 +265,6 @@ form_constantes($constantes, 0, $helptext); dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index 88514d83da3..76d40e57c17 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -160,7 +160,6 @@ form_constantes($constantes, 0, $helptext); dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index cfdea50538f..f47f92faa4c 100644 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -113,6 +113,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php index 2c849628ab9..e78c4ef29e5 100644 --- a/htdocs/adherents/admin/adherent_type_extrafields.php +++ b/htdocs/adherents/admin/adherent_type_extrafields.php @@ -116,6 +116,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index b35df5f0083..31d9c43afbb 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -250,7 +250,6 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC)) print '
'.$urlwithroot.'/public/members/new.php'.$entity_qr.''; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 2b663ecf2bc..8fb1851e021 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -175,8 +175,6 @@ if ($object->id > 0) } } - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 990c8349e33..bc09ac2c250 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1896,6 +1896,6 @@ else } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index be3a13d8771..ff7e9c3be2e 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -310,6 +310,6 @@ print '
'; print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 8e12dec056e..4c91efc265c 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -170,6 +170,6 @@ else print $langs->trans("ErrorRecordNotFound"); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index 5814ed3bf70..adc3d32eea4 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -86,7 +86,6 @@ else dol_print_error($db); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index c9e3d1936c6..030700bb0f6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -435,6 +435,6 @@ print ""; print ''; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index ff0bad063bd..b6bffd3d1bd 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -221,5 +221,6 @@ else print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 3a1dd04443f..db017d71f61 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -827,6 +827,6 @@ print ''; if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1); - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 1b887406df3..ae278b5dbb5 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -120,6 +120,6 @@ if ($id) } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index ded3dec120e..7ae29a7eeb9 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -143,7 +143,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 1c6944c2a0a..9de537ed39a 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -309,8 +309,6 @@ if ($mode) dol_fiche_end(); - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 083d81d6db6..902c2d35359 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -229,7 +229,6 @@ print '
'; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 3e4af5438c6..7e3dfe28b0e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -1108,7 +1108,6 @@ else print $langs->trans("ErrorRecordNotFound"); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index f905225a396..34b58c5b04d 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -417,7 +417,6 @@ if ($rowid && $action != 'edit') print ''; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/subscription/info.php b/htdocs/adherents/subscription/info.php index 05856c35f75..649a1e22996 100644 --- a/htdocs/adherents/subscription/info.php +++ b/htdocs/adherents/subscription/info.php @@ -76,5 +76,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 21ba01088e4..91e5b2f8837 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -381,6 +381,6 @@ else dol_print_error($db); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 56363599c10..e9ad0b91498 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -787,7 +787,6 @@ if ($rowid > 0) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index 7edb42e6c76..5d60beb2a4d 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -187,5 +187,6 @@ else print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 6fedfa6d2cb..7f41927b478 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -202,6 +202,6 @@ print "\n"; print "
"; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index fadb144b883..887fba847e4 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -85,7 +85,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -117,6 +117,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 906ecd8d092..236483f5ed4 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -238,7 +238,6 @@ print ''; print "\n"; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 2d20d285720..842c8d01470 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -399,6 +399,6 @@ print ''; print "
"; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index e78a8e089ed..269880236cb 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -247,6 +247,6 @@ print ''; print "
"; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 481a850790e..d76d95da47a 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -198,6 +198,6 @@ if (! empty($conf->use_javascript_ajax)) print ''; } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index a4e9e4bb210..1e9acde2665 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -432,6 +432,6 @@ print "\n"; print ''; dol_fiche_end(); +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/bank_extrafields.php b/htdocs/admin/bank_extrafields.php index 19446092923..3b95c158f27 100644 --- a/htdocs/admin/bank_extrafields.php +++ b/htdocs/admin/bank_extrafields.php @@ -82,7 +82,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -95,7 +95,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -114,6 +114,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index a7a863c4725..4e0c683a73f 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -405,5 +405,6 @@ if ($conf->produit->enabled) print "
"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 04fd76e96fc..9f3453f7587 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -488,7 +488,6 @@ print '
'."\n"; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index df628ecc87f..82b0ed3848c 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -280,6 +280,6 @@ dol_fiche_end(); print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index c2cfaf9f72a..34a641137dc 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -140,6 +140,6 @@ if (! empty($conf->global->CLICKTODIAL_URL)) } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index cee12e4b08e..64df9194197 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -679,7 +679,6 @@ print "\n"; print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 949038b4413..4a006c56268 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -1153,7 +1153,6 @@ else print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 8e17541bfef..214c30dc544 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -164,5 +164,6 @@ print "\n"; print '

'; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index e4691a42e78..9e6745e6c29 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -147,5 +147,6 @@ print ''; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 9dd68c16326..be5f785f9e4 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -314,7 +314,6 @@ if ($conf->use_javascript_ajax) print "\n"; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 74f7acb04f3..60be9e062ba 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -509,7 +509,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index ea4bbf97af0..e882a56e2b8 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -143,6 +143,6 @@ $message.=img_picto('','object_globe.png').' '.$langs->trans("WebDavServer",'Web $message.='
'; print $message; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 84271cff38f..984ddfbefd7 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -412,7 +412,6 @@ dol_fiche_end(); print "\n"; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index ae3c43c5b24..14dfb9922f6 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -415,5 +415,6 @@ if($action == 'edit') { } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 32995bce38f..0c25f3a5bd8 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1735,7 +1735,7 @@ else print '
'; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index 14d05a036e8..043d24e8376 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -20,22 +20,11 @@ if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); /** - * \file htdocs/commande/info.php - * \ingroup commande - * \brief Page des informations d'une commande + * \file htdocs/admin/dolistore/ajax.php + * \ingroup admin + * \brief Page des informations dolistore */ -$res = 0; -if (!$res && file_exists("../main.inc.php")) $res = @include("../main.inc.php"); -if (!$res && file_exists("../../main.inc.php")) $res = @include("../../main.inc.php"); -if (!$res && file_exists("../../../main.inc.php")) $res = @include("../../../main.inc.php"); -if (!$res && file_exists("../../../../main.inc.php")) $res = @include("../../../../main.inc.php"); -if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) - $res = @include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only -if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) - $res = @include("../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only -if (!$res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) - $res = @include("../../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only -if (!$res) die("Include of main fails"); +require "../../../main.inc.php"; // CORE @@ -52,8 +41,10 @@ $quality = GETPOST('quality', 'alpha'); try { $url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality; - $api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, - $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api); + $api = new PrestaShopWebservice( + $conf->global->MAIN_MODULE_DOLISTORE_API_SRV, + $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api + ); //echo $url; $request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); header('Content-type:image'); diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index de3ca683519..c6e33023e4c 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -53,7 +53,7 @@ class PrestaShopWebservice * PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated * * * * '; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 1d1ec548853..606d3a5f201 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -114,6 +114,6 @@ print ""; print "\n"; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index eb18f904229..c851010635e 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -507,5 +507,6 @@ print '"; } @@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -119,6 +119,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index 5567e9480e8..cc5a9bddfa5 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -88,7 +88,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -120,6 +120,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 1002b146113..78287f71eab 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -513,7 +513,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/expensereport_extrafields.php b/htdocs/admin/expensereport_extrafields.php index 8db81edb869..3fedf935405 100644 --- a/htdocs/admin/expensereport_extrafields.php +++ b/htdocs/admin/expensereport_extrafields.php @@ -83,7 +83,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -115,6 +115,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index db7100d5928..d3937a98ba7 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -179,6 +179,7 @@ echo ''; echo ''; dol_fiche_end(); -llxFooter(); +// End of page +llxFooter(); $db->close(); diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index b1d65b8635b..d49d25b76b6 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -354,6 +354,7 @@ echo ''; dol_fiche_end(); -llxFooter(); +// End of page +llxFooter(); $db->close(); diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index b6f12a723ff..292c3604799 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * * 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 @@ -32,9 +32,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'exports')); - -$langs->load('other'); +$langs->loadLangs(array('admin', 'exports', 'other')); if (! $user->admin) accessforbidden(); @@ -73,7 +71,7 @@ dol_fiche_head( // Setup page goes here $form=new Form($db); -$var=false; + print ''; print ''; print ''."\n"; @@ -82,8 +80,7 @@ print ''."\n"; // Example with a yes / no select -$var=!$var; -print ''; +print ''; print ''; print ''; print ''; - print '
'.$langs->trans("ExportModel").'
'.$langs->trans("set_EXPORTS_SHARE_MODELS").' '; @@ -94,9 +91,8 @@ echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); print ''; print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index e8683dfc4ee..e0f3f72f927 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -325,6 +325,6 @@ else dol_print_error($db); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index f00d125a4d5..6c28081e6fc 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -782,7 +782,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 19d4a4cc772..bed1d4d9bcb 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -234,6 +234,6 @@ else */ } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index a216f2d4ab7..c714c0c6c1b 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2011-2017 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * * 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 @@ -560,7 +560,6 @@ print "\n"; print ''; //Use draft Watermark - print "
"; print ''; print ""; @@ -635,12 +634,10 @@ print ''; print ''; print '
'; - - - print ''; print '
'; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 9c944324527..9f154591f0f 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -153,6 +153,6 @@ if ($geoip) $geoip->close(); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php new file mode 100644 index 00000000000..e2d1cfca145 --- /dev/null +++ b/htdocs/admin/holiday.php @@ -0,0 +1,522 @@ + + * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2018 Charlene Benke + * + * 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 . + */ + +/** + * \file htdocs/admin/contract.php + * \ingroup contract + * \brief Setup page of module Contracts + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; + +$langs->load("admin"); +$langs->load("errors"); +$langs->load("holiday"); + +if (!$user->admin) accessforbidden(); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scan_dir','alpha'); +$type='contract'; + +if (empty($conf->global->HOLIDAY_ADDON)) +{ + $conf->global->HOLIDAY_ADDON='mod_holiday_madona'; +} + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'updateMask') +{ + $maskconst = GETPOST('maskconstholidaty','alpha'); + $maskvalue = GETPOST('maskholiday','alpha'); + if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +else if ($action == 'specimen') // For contract +{ + $modele= GETPOST('module','alpha'); + + $contract = new Contrat($db); + $contract->initAsSpecimen(); + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db); + + if ($module->write_file($contract,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($obj->error, $obj->errors, 'errors'); + dol_syslog($obj->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +else if ($action == 'set') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +else if ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF',$conf->entity); + } +} + +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->HOLIDAY_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + +else if ($action == 'setmod') +{ + // TODO Verifier si module numerotation choisi peut etre active + // par appel methode canBeActivated + + dolibarr_set_const($db, "HOLIDAY_ADDON",$value,'chaine',0,'',$conf->entity); +} + +else if ($action == 'set_other') +{ + $freetext= GETPOST('HOLIDAY_FREE_TEXT','none'); // No alpha here, we want exact string + $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + + $draft= GETPOST('HOLIDAY_DRAFT_WATERMARK','alpha'); + $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); + + if (! $res1 > 0 || ! $res2 > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +llxHeader(); + +$form=new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("HolidaySetup"),$linkback,'title_setup'); + +$head=holiday_admin_prepare_head(); + +dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday'); + +/* + * Holiday Numbering model + */ + +print load_fiche_titre($langs->trans("HolidaysNumberingModules"),'',''); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/holiday/"); + + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + + while (($file = readdir($handle))!==false) + { + if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php') + { + $file = substr($file, 0, dol_strlen($file)-4); + + require_once $dir.$file.'.php'; + + $module = new $file($db); + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { + + print ''; + + // Show example of numbering model + print ''."\n"; + + print ''; + + $holiday=new Holiday($db); + $holiday->initAsSpecimen(); + + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$contract); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print ''; + } + } + } + closedir($handle); + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->nom."\n"; + print $module->info(); + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); print '
'.$langs->trans($tmp).'
'; } + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->HOLIDAY_ADDON == "$file") + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print '

'; + +/* + * Documents models for Contracts + */ + +print load_fiche_titre($langs->trans("TemplatePDFHolidays"),'',''); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/holiday".$valdir); + + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->HOLIDAY_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'contract').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; +print "
"; + +/* + * Other options + * + */ + +print '
'; +print ''; +print ''; + +print load_fiche_titre($langs->trans("OtherOptions"),'',''); +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +$var=! $var; +print ''."\n"; + +//Use draft Watermark + +print ''."\n"; + +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); +print '
'; +$variablename='HOLIDAY_FREE_TEXT'; +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); + print $doleditor->Create(); +} +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; +print '
'; +print ''; +print '
'; + +print '
'; +print ''; +print '
'; + +print '
'; + +dol_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 62f17d5cb1d..355f5ae44fd 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -578,6 +578,6 @@ else // Show print ''; } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 6542cec1174..2f64793c28b 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -114,7 +114,6 @@ if (empty($reshook)) print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 6776cfb1480..052b2f38988 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -340,5 +340,6 @@ if (function_exists("ldap_connect")) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 3188bf6e58a..dd85a998383 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -318,6 +318,7 @@ if (function_exists("ldap_connect")) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 4ae6ce9ad97..2650fe4fe6e 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -251,5 +251,6 @@ if (function_exists("ldap_connect")) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 616eb99a8da..240901ec04d 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -442,7 +442,6 @@ if (function_exists("ldap_connect")) } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index e45857f2f38..e845fd37adc 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -241,5 +241,6 @@ if (function_exists("ldap_connect")) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 8b11069fc61..513aa63f035 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -470,5 +470,6 @@ if (function_exists("ldap_connect")) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index e9389b0271d..d24891f80f6 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -306,7 +306,6 @@ else */ } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 88ce717f005..91fb9f964e4 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -478,6 +478,7 @@ print ''; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index 6ccf798bc93..55fe6f10362 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -87,7 +87,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -119,6 +119,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index 431d5c3c170..e70b4f2d09b 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -88,7 +88,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -120,6 +120,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index 3349ac0056a..419f6efbee9 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -122,5 +122,6 @@ print "\n"; print '
'; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 32fbdd4aeb6..d5b866d9d20 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -152,6 +152,6 @@ print '
'; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 083d78c03e5..225860e78ad 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -269,7 +269,6 @@ if ($action != 'edit') print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 191db98a402..2864fe79df0 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -514,5 +514,6 @@ elseif ($action == 'edit') print '
'; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index c3211fc2d75..2e6d8a91008 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -410,6 +410,6 @@ else print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index 7789c3fb21c..0446c59af1d 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -105,6 +105,6 @@ print ''; print ''; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index cf4596ccda2..1443be3c104 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -592,7 +592,6 @@ dol_fiche_end(); print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 5ba261b619e..0cf1b646eff 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -7,7 +7,8 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud - * + * Copyright (C) 2018 Nicolas ZABOURI + * * 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 @@ -637,6 +638,7 @@ if ($mode == 'common') } print ''."\n"; + if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''.++$linenum.''; // Picto + Name of module print ' '; @@ -669,6 +671,17 @@ if ($mode == 'common') // Version print ''; print $versiontrans; + if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){ + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (!empty($objMod->url_last_version)) { + $newversion = getURLContent($objMod->url_last_version); + if(isset($newversion['content'])){ + if (version_compare($newversion['content'], $versiontrans) > 0) { + print " ".$newversion['content'].""; + } + } + } + } print "\n"; // Activate/Disable and Setup (2 columns) @@ -1067,8 +1080,6 @@ if ($mode == 'develop') dol_fiche_end(); } - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index d4a031a6148..edb2735b354 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -375,6 +375,6 @@ print ' '; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 43782816202..d93421ef6fb 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -272,7 +272,6 @@ print '"; } @@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -117,6 +117,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index c75551cf9f0..929e49c4ab3 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -86,7 +86,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -118,6 +118,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 1864fdb557c..4ca9411e105 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -262,7 +262,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index f988b27c5e6..9acea7e3955 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -668,7 +668,6 @@ else // Show print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 50bf939c07f..db4e1f33553 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -218,5 +218,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); -$db->close(); +$db->close(); \ No newline at end of file diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6fd40cf2825..c40eca7380e 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -80,6 +80,16 @@ if ($action == "set") $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity); if (! $res > 0) $error++; } + if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="") + { + $res = dolibarr_set_const($db, "END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="") + { + $res = dolibarr_set_const($db, "USTRD", GETPOST("PRELEVEMENT_USTRD"),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } if (! $error) { @@ -221,6 +231,18 @@ print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER' print ''; print ''; +//EntToEnd +print ''.$langs->trans("END_TO_END").''; +print ''; +print ''; +print ''; + +//USTRD +print ''.$langs->trans("USTRD").''; +print ''; +print ''; +print ''; + print ''; print '
'; @@ -511,5 +533,6 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) } */ +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 94b1d1dac67..bc91729829f 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -649,7 +649,6 @@ print "\n"; print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 87a89f5d99b..9490a291729 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -205,5 +205,6 @@ print ''; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 4465017bdc6..abe2fbea655 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -447,7 +447,7 @@ $object->barcode = '3700123862396'; //$printer->sendToPrinter($object, 1, 16); //setEventMessages($printer->error, $printer->errors, 'errors'); +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index e8f8bdba204..566e57e587b 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -137,6 +137,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php index 8193d146aaa..b8ea860ac25 100644 --- a/htdocs/admin/resource_extrafields.php +++ b/htdocs/admin/resource_extrafields.php @@ -84,7 +84,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -97,7 +97,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -116,6 +116,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index 6c5281173c3..c5ec770e393 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -127,5 +127,6 @@ print '
'; - // Form to test upload print '
'; $formfile=new FormFile($db); @@ -188,5 +187,6 @@ $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestF $filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); $formfile->list_of_documents($filearray, null, 'admin_temp', ''); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 6503ab10f77..0e3da947fa8 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -206,6 +206,6 @@ print '
'; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index db1cb20b5e3..3dbc785d1d7 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -331,7 +331,6 @@ else } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index b9892fdf2a9..d179c66d58d 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -163,6 +163,6 @@ else dol_fiche_end(); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index e1098ef262d..b83f87af162 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -566,7 +566,6 @@ if ($conf->global->PRODUIT_SOUSPRODUITS) } */ - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 75a917dd185..367d1fe0d36 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -516,7 +516,6 @@ print "\n"; print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 695d25a963c..72050867dfa 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -589,7 +589,6 @@ print "\n"; print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index c1f3a7cb25d..55fb311ccda 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -430,7 +430,6 @@ print ''; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 99069447e81..eeb148e9d99 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -582,6 +582,7 @@ print "\n"; print "\n ".$langs->trans("PathDirectory")."\n ".$conf->supplier_proposal->dir_output."\n\n"; print "\n
"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 7e913772e2c..65ce01a4faf 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -91,7 +91,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -104,7 +104,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -123,6 +123,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplierinvoicedet_extrafields.php b/htdocs/admin/supplierinvoicedet_extrafields.php index d8156d54779..cdf128871fd 100644 --- a/htdocs/admin/supplierinvoicedet_extrafields.php +++ b/htdocs/admin/supplierinvoicedet_extrafields.php @@ -87,7 +87,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -119,6 +119,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplierorder_extrafields.php b/htdocs/admin/supplierorder_extrafields.php index 30cf4d983e4..640b6375c57 100644 --- a/htdocs/admin/supplierorder_extrafields.php +++ b/htdocs/admin/supplierorder_extrafields.php @@ -85,7 +85,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -117,6 +117,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/supplierorderdet_extrafields.php b/htdocs/admin/supplierorderdet_extrafields.php index 85106bf84f0..65fe0537ba7 100644 --- a/htdocs/admin/supplierorderdet_extrafields.php +++ b/htdocs/admin/supplierorderdet_extrafields.php @@ -86,7 +86,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -118,6 +118,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 45dc91a8b95..e163fc83de5 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -302,6 +302,6 @@ if(! empty($conf->loghandlers['mod_syslog_file']) && ! empty($conf->cron->enable print ''; print "\n"; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index 61780d51386..e9ea61ac944 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -214,7 +214,6 @@ if ($showpromotemessage) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/browser.php b/htdocs/admin/system/browser.php index 4f2a53de88d..c5aeff70b88 100644 --- a/htdocs/admin/system/browser.php +++ b/htdocs/admin/system/browser.php @@ -66,7 +66,6 @@ print ''; print '
'; print '
'; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 82e8481c2dd..9d4c4fc3cec 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -249,7 +249,6 @@ if ($resql) print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 556961cb565..17d72edf20a 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -212,5 +212,6 @@ else } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 45ce3c087e6..d5a7bbcdbfd 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -126,6 +126,6 @@ else } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index cef493c95f8..392c083c382 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -138,6 +138,6 @@ else } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 4b02e7941d2..4dd4ef9dc9b 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -453,7 +453,6 @@ if ($resql) print ''; print '
'; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 3cef158c2ea..65a9354a19f 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -366,11 +366,11 @@ if (! $error && $xml) // Show warning if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) { - setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference")); + setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); } else { - setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings'); + setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); } } else @@ -433,11 +433,8 @@ if (! $error && $xml) print $out; } - - - +// End of page llxFooter(); - $db->close(); exit($error); diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index 3d473640618..7ffef739993 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -25,9 +25,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load("admin"); -$langs->load("user"); -$langs->load("install"); +// Load translation files required by the page +$langs->loadLangs(array("admin", "user", "install")); if (! $user->admin) accessforbidden(); @@ -114,6 +113,6 @@ print '
'; //print "
\n"; print info_admin($langs->trans("SystemInfoDesc")).'
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 4a6967089e2..fda1946875a 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -159,5 +159,6 @@ foreach($rights_ids as $right_id) $old = $right_id; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php index 01d48f2444d..251025a4c9e 100644 --- a/htdocs/admin/system/os.php +++ b/htdocs/admin/system/os.php @@ -49,6 +49,6 @@ $osversion=version_os(); print "".$langs->trans("Version")."".$osversion."\n"; print ''; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 1e757b72f63..85ac2aea006 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -491,7 +491,6 @@ print ''.$langs->trans("DatabaseStatistics").': '; print '
'; */ - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 8664a28b28a..aa502cde421 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -116,7 +116,6 @@ foreach($phparray as $key => $value) print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/system/xcache.php b/htdocs/admin/system/xcache.php index 53eaeec085f..b582e61619b 100644 --- a/htdocs/admin/system/xcache.php +++ b/htdocs/admin/system/xcache.php @@ -76,6 +76,6 @@ if ($action == 'clear') } */ +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 7c4bf64909f..304f9b79bd0 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -273,6 +273,6 @@ if (! empty($conf->accounting->enabled)) print '

'.$langs->trans("AccountingAccountForSalesTaxAreDefinedInto", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup")).''; } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 742f966e4cc..38f0a8eb497 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -54,10 +54,13 @@ if ($action == 'updateMask') { $error++; } - if (!$error) { - setEventMessage($langs->trans("SetupSaved")); - } else { - setEventMessage($langs->trans("Error"), 'errors'); + if (!$error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active @@ -638,6 +641,6 @@ print ''; print '
'; print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 0687a33c52b..07ace9fea0c 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -109,6 +109,6 @@ if ($action == 'edit' && !empty($attrname)) { include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 1c985e23090..c9ef19dae98 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -522,6 +522,6 @@ print $langs->trans("BackupDescX").'

'; close(); diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index f390c192159..aca900c1cbc 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -212,6 +212,6 @@ else if (in_array($type, array('pgsql'))) close(); diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index d3253c02514..9999734a8f8 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -335,7 +335,6 @@ if (function_exists('eaccelerator_get')) { print "

"; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index 98a490550ca..c5a05ef2136 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -56,6 +56,6 @@ print '

'; //print '
'; print '
'; // For a reason I don't know, the div class="center does not works, we must keep the
- +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 48d3ef57fd5..db5157789e1 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -339,6 +339,6 @@ else dol_print_error($db); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 70b0987732b..13b99d92f6d 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -208,5 +208,6 @@ print ''; print '
'; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index f415ed1692c..097fc507240 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -119,7 +119,6 @@ if (preg_match('/^confirm/i',$choice)) print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index d0802d6b473..41923aa068d 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -142,7 +142,6 @@ print '
'; print $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules")); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index cc21a8ff717..4c215e9ae52 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -584,6 +584,6 @@ if (! empty($langcode)) dol_set_focus('#transvalue'); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 1a1893e2eb0..cd2f33b4cb0 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -84,6 +84,6 @@ foreach ($triggers as $trigger) print ''; print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index f888c8410bb..2cf8fc5b6f3 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -337,5 +337,6 @@ print "
"; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 28f1ad6af2f..c1b55dcec6a 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -282,5 +282,6 @@ print "
"; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 80144f93c1f..fcdeee79249 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -322,10 +322,16 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($website->id > 0) { - $sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'"; - $result = $db->query($sql); + $sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website ='".$rowid."'"; + $result = $db->query($sql); - $sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'"; + $sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website ='".$rowid."'"; + $result = $db->query($sql); + + $sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object ='".$rowid."'"; + $result = $db->query($sql); + + $sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'"; $result = $db->query($sql); if (! $result) { @@ -640,9 +646,7 @@ if ($id) dol_fiche_end(); -//print '
'; - - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index c688da0e550..9d724b86390 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -143,9 +143,8 @@ else dol_fiche_end(); -//print '
'; - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index b5bdec73f3e..24a39ce827a 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -187,7 +187,6 @@ if ($nbqualified == 0) } print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 07f124741fe..66c293f2cb0 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -356,6 +356,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } + else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') + { + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + + if (!DolibarrApiAccess::$user->rights->agenda->myactions->read && !DolibarrApiAccess::$user->rights->agenda->allactions->read) { + throw new RestException(401); + } + + $object = new ActionComm($this->db); + $result=$object->fetch($id, $ref); + if ( ! $result ) { + throw new RestException(404, 'Event not found'); + } + + $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); + } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index ef2b4c8bb6d..fe4c73e91fd 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1,8 +1,8 @@ * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2017 Regis Houssin - * Copyright (C) 2017 Neil Orley + * Copyright (C) 2017 Regis Houssin + * Copyright (C) 2017 Neil Orley * * * This program is free software; you can redistribute it and/or modify @@ -863,11 +863,11 @@ class Setup extends DolibarrApi // Show warning if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) { - //setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference")); + //setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); } else { - //setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings'); + //setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); } } else diff --git a/htdocs/asset/admin/assets_extrafields.php b/htdocs/asset/admin/assets_extrafields.php index 1cdf78df4bf..109b0f1e94f 100644 --- a/htdocs/asset/admin/assets_extrafields.php +++ b/htdocs/asset/admin/assets_extrafields.php @@ -109,6 +109,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/asset/admin/assets_type_extrafields.php b/htdocs/asset/admin/assets_type_extrafields.php index d828bffa4de..e8f1d71370b 100644 --- a/htdocs/asset/admin/assets_type_extrafields.php +++ b/htdocs/asset/admin/assets_type_extrafields.php @@ -107,6 +107,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index c240f350590..1168fd3ada3 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -107,9 +107,8 @@ else print ''; } - -// Page end dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 1cb580c8c8d..9126f80617f 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -25,8 +25,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php'; require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; -include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); -include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page $langs->loadLangs(array("asset")); diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 66baaae196c..6427befd03e 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -148,6 +148,6 @@ else accessforbidden('',0,0); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index 71460f31a2c..e8820ee5cfa 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -79,5 +79,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index cf0166df96f..775b3e8747e 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -144,6 +144,6 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index f4409ee5417..001912f7de3 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -851,7 +851,6 @@ if ($rowid > 0) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 8cd5ff979a0..66ff541d499 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -190,5 +190,6 @@ else { print 'Bad parameters in URL. Must be '.$_SERVER['PHP_SELF'].'?caller=99999&called=99999&login=xxxxx&password=xxxxx'; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 26386052480..7086af7f17e 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -319,6 +319,6 @@ if ($conf->product->enabled || $conf->product->service) print ''; print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 7dfec76b39e..6dd578993ca 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -441,6 +441,6 @@ print '
'; print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 326fea79c5d..8c2835d856c 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -178,5 +178,6 @@ if (GETPOST('withtab','alpha')) print '

'; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index dbb0affdbdf..6bb1876b926 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -138,7 +138,7 @@ else if (GETPOST('downloadcsv','alpha')) else { $error++; - setEventMessage($db->lasterror, 'errors'); + setEventMessages($db->lasterror, null, 'errors'); } } @@ -243,7 +243,7 @@ else if (GETPOST('downloadcsv','alpha')) } else { - setEventMessage($db->lasterror, 'errors'); + setEventMessages($db->lasterror, null, 'errors'); } } } @@ -587,5 +587,6 @@ if (GETPOST('withtab','alpha')) print '

'; +// End of page llxFooter(); -$db->close(); +$db->close(); \ No newline at end of file diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 25fa032902f..ed20f619b25 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -81,5 +81,6 @@ print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index d450e476506..b82c2b11b6c 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -336,7 +336,6 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index ac5a89c66f3..10ce877c7e0 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -209,7 +209,7 @@ else dol_print_error($db); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index f4af16b3739..62867d855cb 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -185,5 +185,6 @@ print '
\n"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php index bd778f3422e..2a3c0279df8 100644 --- a/htdocs/cashdesk/affContenu.php +++ b/htdocs/cashdesk/affContenu.php @@ -87,7 +87,7 @@ print '
'; print '
'; print '
'; -require ('tpl/liste_articles.tpl.php'); +require 'tpl/liste_articles.tpl.php'; print '
'; print '
'; diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index f52890b68d2..6a2889f6e71 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -163,4 +163,4 @@ $obj_facturation->paiementLe('RESET'); // Affichage des templates -require ('tpl/facturation1.tpl.php'); +require 'tpl/facturation1.tpl.php'; diff --git a/htdocs/cashdesk/validation.php b/htdocs/cashdesk/validation.php index 289c864ca32..ff1219861e2 100644 --- a/htdocs/cashdesk/validation.php +++ b/htdocs/cashdesk/validation.php @@ -24,5 +24,5 @@ $form=new Form($db); // Affichage des templates -require ('tpl/validation1.tpl.php'); +require 'tpl/validation1.tpl.php'; diff --git a/htdocs/cashdesk/validation_ok.php b/htdocs/cashdesk/validation_ok.php index 70bf3d1b64f..c8c83a91f18 100644 --- a/htdocs/cashdesk/validation_ok.php +++ b/htdocs/cashdesk/validation_ok.php @@ -22,5 +22,5 @@ */ // Affichage des templates -require ('tpl/validation2.tpl.php'); +require 'tpl/validation2.tpl.php'; diff --git a/htdocs/cashdesk/validation_ticket.php b/htdocs/cashdesk/validation_ticket.php index 577df309138..a98b50b0bc9 100644 --- a/htdocs/cashdesk/validation_ticket.php +++ b/htdocs/cashdesk/validation_ticket.php @@ -24,7 +24,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php'; -include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); +require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $obj_facturation = unserialize($_SESSION['serObjFacturation']); unset($_SESSION['serObjFacturation']); @@ -35,7 +35,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$obj_facturation); if (empty($reshook)) { - require ('tpl/ticket.tpl.php'); + require 'tpl/ticket.tpl.php'; } diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index 431f921a1fb..cdf9873e791 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -253,7 +253,7 @@ switch ($action) } else { - setEventMessage($invoice->error, $invoice->errors, 'errors'); + setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index 92e23a2199a..03adfdbb41e 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -122,5 +122,6 @@ print ''; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 3fd7d1c69b5..abea3f41eeb 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -79,7 +79,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -92,7 +92,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -111,6 +111,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index db56902347b..ce3324505eb 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -288,7 +288,6 @@ if ($user->rights->categorie->creer) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index b420847f6fd..cdfac54fb9d 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -192,7 +192,6 @@ print '
'; - - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e57e51caf62..e634da4fe80 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -202,6 +202,6 @@ print ""; print '
'; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 472a8eb9b95..095c0c611c5 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -273,6 +273,6 @@ else print $langs->trans("ErrorUnknown"); } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 7d71b43a81b..dbcfca198d2 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -334,5 +334,6 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print '
'; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 24e70e7d587..ba3580cea87 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -697,6 +697,6 @@ if ($type == Categorie::TYPE_PROJECT) } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index 2c056cd0e07..d7d5e9a8bbd 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -456,9 +456,6 @@ if ($action == 'editcontent') print "\n\n"; - - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 1d6a0286b68..dae5fb70617 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1611,7 +1611,6 @@ if ($id > 0) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 0c7ad11cb3c..6c863580203 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -4,7 +4,8 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos García - * + * Copyright (C) 2018 Nicolas ZABOURI + * * 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 @@ -1220,7 +1221,10 @@ class ActionComm extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $label = $this->label; + if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) + $option = 'nolink'; + + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility $result=''; @@ -1286,6 +1290,10 @@ class ActionComm extends CommonObject $linkstart.=$linkclose.'>'; $linkend=''; + if ($option == 'nolink') { + $linkstart = ''; + $linkend = ''; + } //print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto; if ($withpicto == 2) @@ -1343,9 +1351,9 @@ class ActionComm extends CommonObject { global $conf,$langs,$dolibarr_main_url_root,$mysoc; - require_once (DOL_DOCUMENT_ROOT ."/core/lib/xcal.lib.php"); - require_once (DOL_DOCUMENT_ROOT ."/core/lib/date.lib.php"); - require_once (DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php"); + require_once DOL_DOCUMENT_ROOT ."/core/lib/xcal.lib.php"; + require_once DOL_DOCUMENT_ROOT ."/core/lib/date.lib.php"; + require_once DOL_DOCUMENT_ROOT ."/core/lib/files.lib.php"; dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 43e5b89f115..7fc12129cc5 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -268,7 +268,6 @@ else print $langs->trans("ErrorUnknown"); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index c361d275882..178e4bfb6d7 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1250,8 +1250,8 @@ else // View by day print "\n".''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 9a043a13690..2582e9b6b32 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -114,5 +114,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2c11a1de977..319499d65fd 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -672,7 +672,6 @@ else dol_print_error($db); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 2fdfa180319..9350de8f85c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -730,10 +730,8 @@ jQuery(document).ready(function() { }); '; - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 0cf056ef3a9..58690dc512b 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -865,10 +865,8 @@ jQuery(document).ready(function() { }); '; - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 7e4108b470b..ff1c7746afa 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -209,5 +209,6 @@ else dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 6a6aa12862a..becfabc949c 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -111,6 +111,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index 49784228fe6..7172c0e5b7c 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -86,7 +86,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -118,6 +118,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 83db0e0f1d2..d7d5a3f4f5a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1346,5 +1346,4 @@ else // End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index aa8dae43140..b6d9f0922aa 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -176,6 +176,6 @@ else dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index e90a821b5e3..92757dcac36 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -884,6 +884,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index 1c886e2ba2c..4d10120aaeb 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -84,9 +84,12 @@ if (empty($template_id)) { $result = $advTarget->fetch($template_id); } -if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); -} else { +if ($result < 0) +{ + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); +} +else +{ if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } @@ -101,7 +104,7 @@ if ($action == 'loadfilter') { if (! empty($template_id)) { $result = $advTarget->fetch($template_id); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } else { if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); @@ -202,7 +205,7 @@ if ($action == 'add') { // if ($array_query ['type_of_target'] == 1 || $array_query ['type_of_target'] == 3) { $result = $advTarget->query_thirdparty($array_query); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } /*} else { $advTarget->thirdparty_lines = array (); @@ -211,7 +214,7 @@ if ($action == 'add') { if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2 || $array_query['type_of_target'] == 4)) { $result = $advTarget->query_contact($array_query, 1); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } // If use contact but no result use artefact to so not use socid into add_to_target if (count($advTarget->contact_lines) == 0) { @@ -241,10 +244,10 @@ if ($action == 'add') { exit(); } if ($result == 0) { - setEventMessage($langs->trans("WarningNoEMailsAdded"), 'warnings'); + setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings'); } if ($result < 0) { - setEventMessage($obj->error, 'errors'); + setEventMessages($obj->error, $obj->errors, 'errors'); } } @@ -264,7 +267,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { $error = 0; if ($action == 'createfilter' && empty($template_name)) { - setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), null, 'errors'); $error ++; } @@ -353,13 +356,13 @@ if ($action == 'savefilter' || $action == 'createfilter') { $advTarget->name = $template_name; $result = $advTarget->create($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } } elseif ($action == 'savefilter') { $result = $advTarget->update($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } } $template_id = $advTarget->id; @@ -369,7 +372,7 @@ if ($action == 'savefilter' || $action == 'createfilter') { if ($action == 'deletefilter') { $result = $advTarget->delete($user); if ($result < 0) { - setEventMessage($advTarget->error, 'errors'); + setEventMessages($advTarget->error, $advTarget->errors, 'errors'); } header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit(); @@ -468,5 +471,6 @@ if ($object->fetch($id) >= 0) { } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 97746ad9d82..469db6f2a54 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1358,5 +1358,6 @@ else } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 08ed54d2fc3..6caa262500e 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -649,7 +649,6 @@ if ($object->fetch($id) >= 0) } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 17693a1a73c..9cd1e8546d0 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -210,7 +210,6 @@ if ($langs->file_exists("html/spam.html",0)) { print '
'; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index b4f2eaeb6f3..3c1e6e2cffa 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -75,5 +75,6 @@ if ($object->fetch($id) >= 0) dol_fiche_end(); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 87a390d4006..5087698b9ab 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -224,6 +224,6 @@ else dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 1e8c5c82cf4..e9ddee12b22 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -177,5 +177,6 @@ if ($_socid > 0) } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index dfde7ce613f..7ddeabb660b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2010-2015 Philippe Grand + * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013-2014 Florian Henry @@ -749,7 +749,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; } else { - setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); + setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error ++; } } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 5e21f493c64..4e017ff13d9 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -212,6 +212,6 @@ if ($object->id > 0) } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 1c8d494214d..2f16cd54864 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -179,5 +179,6 @@ else print $langs->trans("ErrorUnknown"); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 0dbe2fb855e..b47a4506412 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -530,7 +530,6 @@ if (! empty($conf->propal->enabled)) //print ''; print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 317c9902d52..7879612b099 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -127,5 +127,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ec4e9c37bf2..45ca1c5212d 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -310,7 +310,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country). if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); -if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); +if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; if ($search_societe) $sql .= natural_search('s.nom', $search_societe); @@ -988,27 +988,40 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield']) + if (isset($totalarray['totalhtfield']) || isset($totalarray['totalvatfield']) || isset($totalarray['totalttcfield']) || isset($totalarray['totalamfield']) || isset($totalarray['totalrtpfield']) + || isset($totalarray['totalizable']) ) { print ''; $i=0; while ($i < $totalarray['nbfield']) { - $i++; - if ($i == 1) - { + $i++; + if ($i == 1) + { if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; - } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; - else print ''; + } + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalizable']) { + $printed = false; + foreach ($totalarray['totalizable'] as $totalizable) { + if ($totalizable['pos']==$i && ! $printed) { + print ''.price($totalizable['total']).''; + $printed = true; + } + } + if (! $printed) { + print ''; + } + } + else print ''; } print ''; } diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 607cff245d9..a346f8df18f 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -144,6 +144,6 @@ if ($id > 0 || ! empty($ref)) } } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index ac6b42c45d8..00db6264377 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -344,7 +344,6 @@ print '
'; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 2273012696f..6d7e93af4be 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -275,6 +275,6 @@ if ($resql) //print ''; print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php index 50127d719c8..93cfada8860 100644 --- a/htdocs/comm/prospect/recap-prospect.php +++ b/htdocs/comm/prospect/recap-prospect.php @@ -89,5 +89,6 @@ else dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 6cd41c6c658..86c1bad0521 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -89,5 +89,6 @@ else dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 6f3287b8831..f045e570c6e 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -129,8 +129,9 @@ if ($socid > 0) print ''; - llxFooter(); - $db->close(); + // End of page + llxFooter(); + $db->close(); exit; } @@ -324,5 +325,6 @@ if ($socid > 0) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 3eec109e6b3..78e4643d5e3 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -998,5 +998,6 @@ if ($socid > 0) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0fe49cf9f12..10005f3004a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2016 Philippe Grand + * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2012 Cedric Salvador @@ -700,8 +700,10 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } else { - setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); + } + else + { + setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error ++; } } @@ -2676,5 +2678,6 @@ if ($action == 'create' && $user->rights->commande->creer) } } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index fd903c4fcfb..605be7e9b3f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3422,6 +3422,9 @@ class Commande extends CommonOrder if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id; else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id; + if (!$user->rights->commande->lire) + $option = 'nolink'; + if ($option !== 'nolink') { // Add param to save lastsearch_values or not @@ -3465,6 +3468,11 @@ class Commande extends CommonOrder $linkstart.=$linkclose.'>'; $linkend=''; + if ($option === 'nolink') { + $linkstart = ''; + $linkend = ''; + } + $result .= $linkstart; if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto != 2) $result.= $this->ref; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 7669239134a..bd00116e026 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -214,5 +214,6 @@ if ($id > 0 || ! empty($ref)) } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 9263ceb3f45..42def36ee28 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -190,7 +190,7 @@ else dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index ffebbaa260a..e7d0514a022 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -189,6 +189,6 @@ else } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 5cfb87c7a25..4c596620c6c 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -479,6 +479,6 @@ if (! empty($conf->commande->enabled)) print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 4bac4a3a447..6c0b5f42ec6 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -128,5 +128,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2b86ad2f18a..98c2333793f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1160,5 +1160,6 @@ else dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 6cff3bfb3bc..bf02c9b993c 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -142,5 +142,6 @@ if ($id > 0 || ! empty($ref)) } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 03d379270b1..37768ade393 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -739,5 +739,6 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 8f259808357..49e7d5cfb60 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -369,7 +369,6 @@ print '
'; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index a786cf5ca28..5e1a10390e2 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -24,7 +24,7 @@ * \brief Page to report input-output of a bank account */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; @@ -494,5 +494,6 @@ else print "\n
\n"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 8ddc3de0014..6c2ad4ef302 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -29,7 +29,7 @@ * \brief List of bank transactions */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1529,6 +1529,6 @@ if ($_POST["action"] == "search" && ! $num) print '
'.$langs->trans("NoRecordFound").'
'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/bilan.php b/htdocs/compta/bank/bilan.php index 5e5194d55c8..99856a2dea2 100644 --- a/htdocs/compta/bank/bilan.php +++ b/htdocs/compta/bank/bilan.php @@ -22,7 +22,7 @@ * \brief Page de bilan */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page @@ -92,5 +92,6 @@ print "".$langs->trans("BankBalance").""; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 280cd9bdbc0..ccec902bf7c 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -24,7 +24,7 @@ * \brief Page de budget */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page @@ -96,5 +96,6 @@ else } print ""; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index db497733863..461d193d1fe 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -27,7 +27,7 @@ * \brief Page to create/view a bank account */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; @@ -1034,5 +1034,6 @@ else } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index be029fcb2f5..7ef798103d5 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -26,7 +26,7 @@ * \brief Page ajout de categories bancaires */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; @@ -144,4 +144,6 @@ if ($action != 'edit') print ''; +// End of page llxFooter(); +$db->close(); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7228214e51c..79b72a5a54c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1301,13 +1301,19 @@ class Account extends CommonObject */ function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1, $notooltip=0) { - global $conf, $langs; + global $conf, $langs, $user; $result=''; $label = '' . $langs->trans("ShowAccount") . ''; $label .= '
' . $langs->trans('BankAccount') . ': ' . $this->label; $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; $label .= '
' . $langs->trans("AccountCurrency") . ': ' . $this->currency_code; + + if (empty($user->rights->banque->lire) || !empty($user->socid)) + { + $option = 'nolink'; + } + if (! empty($conf->accounting->enabled)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -1338,6 +1344,11 @@ class Account extends CommonObject $linkstart = 'ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 33e74dc3691..d41bbd77bbe 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -24,7 +24,7 @@ * \ingroup banque * \brief Page de gestion des documents attaches a un compte bancaire */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . "/core/lib/bank.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/images.lib.php"; @@ -147,7 +147,6 @@ else { exit; } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index b829002a990..7dad720139a 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -23,7 +23,7 @@ * \brief Page graph des transactions bancaires */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; @@ -864,7 +864,6 @@ if ($mode == 'showalltime') print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index ab43b9374aa..7eaeb515aa9 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -21,7 +21,7 @@ * \brief Onglet info d'une ecriture bancaire */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -71,5 +71,6 @@ print ''; print ''; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index e006f78c6e7..e75250a830c 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -28,12 +28,12 @@ * \brief Page to edit a bank transaction record */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); +$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other')); if (! empty($conf->adherent->enabled)) $langs->load("members"); if (! empty($conf->don->enabled)) $langs->load("donations"); if (! empty($conf->loan->enabled)) $langs->load("loan"); @@ -98,8 +98,10 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban { dol_print_error($db); } - } else { - setEventMessage('Missing ids','errors'); + } + else + { + setEventMessages($langs->trans("MissingIds"), null, 'errors'); } } @@ -686,6 +688,6 @@ if ($result) } else dol_print_error($db); +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index e52e285742c..1f01355050c 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -27,7 +27,7 @@ use Stripe\BankAccount; * \brief Home page of bank module */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; @@ -604,7 +604,6 @@ print ""; print ""; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 1d9d5526700..3f1bede8e20 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -25,7 +25,7 @@ * \brief Page to show a bank statement report */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -813,7 +813,6 @@ else } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 765001e75a5..7ad8bc2ad96 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -26,7 +26,7 @@ * \brief Page de saisie d'un virement */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -265,5 +265,6 @@ print '
"; +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 0fb8880ce87..2389d1fec77 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -330,5 +330,6 @@ else print $langs->trans("ErrorBankAccountNotFound"); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 1b4d7579892..9c30dfe3cd8 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -499,8 +499,6 @@ if ($id) print "
"; } - - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index cf596860a4b..e11a608c7d0 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -154,6 +154,6 @@ else print $langs->trans("ErrorUnknown"); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 6535e0c0082..6e4060bbeb1 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -344,5 +344,6 @@ else } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index bb66871d6c0..c39a6379000 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -58,6 +58,6 @@ print ''; print ''; +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 6d369b696b9..50e5285cb14 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -568,7 +568,6 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 05d509e268d..1e8fa358929 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -577,7 +577,6 @@ else if ($id) } } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 59d92140c86..c2b3595b476 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -129,6 +129,6 @@ else print $langs->trans("ErrorUnknown"); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index a390023e280..98c939965a3 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -204,7 +204,6 @@ else dol_print_error($db); print ''; - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php index 6a62484323f..f63b1765efb 100644 --- a/htdocs/compta/deplacement/info.php +++ b/htdocs/compta/deplacement/info.php @@ -59,5 +59,6 @@ if ($id) print ''; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index bdbdad0a712..20d300d9da4 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -212,6 +212,6 @@ else dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index cf652948a6e..193e2c7e9a9 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -312,7 +312,6 @@ print '
'; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index 2c676e399de..1fe26e82a54 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -80,7 +80,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '
"; } @@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -114,6 +114,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php index 18aa3c99442..23c0d79a33c 100644 --- a/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_rec_cust_extrafields.php @@ -81,7 +81,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -115,6 +115,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index 2b90ae7fe05..0947f788719 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -81,7 +81,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -113,6 +113,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php index 97f8b78b195..46d9ed28335 100644 --- a/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_rec_cust_extrafields.php @@ -81,7 +81,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; @@ -113,6 +113,6 @@ if ($action == 'edit' && ! empty($attrname)) require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 45e94d1e5d3..e411f8c5b1b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1705,8 +1705,10 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } else { - setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors'); + } + else + { + setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error ++; } } @@ -2430,7 +2432,7 @@ if (empty($reshook)) if($error) { - setEventMessage($langs->trans('ErrorsOnXLines',$error), 'errors'); + setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors'); } } } @@ -4884,5 +4886,6 @@ else if ($id > 0 || ! empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a82f06ad851..06f33f3f69a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -443,7 +443,7 @@ class FactureRec extends CommonInvoice // Retreive all extrafield for line // fetch optionals attributes and labels - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafieldsline=new ExtraFields($this->db); $extrafieldsline=$extrafieldsline->fetch_name_optionals_label('facturedet_rec',true); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c6e43206c78..4edce36b82f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1159,7 +1159,8 @@ class Facture extends CommonInvoice if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id; else $url = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$this->id; - if ($short) return $url; + if (!$user->rights->facture->lire) + $option = 'nolink'; if ($option !== 'nolink') { @@ -1214,6 +1215,11 @@ class Facture extends CommonInvoice $linkstart.=$linkclose.'>'; $linkend=''; + if ($option == 'nolink') { + $linkstart = ''; + $linkend = ''; + } + $result .= $linkstart; if ($withpicto) $result.=img_object(($notooltip?'':$label), $picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto != 2) $result.= ($max?dol_trunc($this->ref,$max):$this->ref); @@ -3021,7 +3027,7 @@ class Facture extends CommonInvoice { global $mysoc,$user; - include_once(DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'); + include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; // Cap percentages to 100 if ($percent > 100) $percent = 100; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index af872a174ca..ab96700fc53 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -215,6 +215,6 @@ if ($id > 0 || ! empty($ref)) } } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 828c77f1178..1fd8c40bf1f 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.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'; + include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; } // Load translation files required by the page @@ -78,7 +78,7 @@ if ($object->fetch($id)) * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* @@ -191,6 +191,6 @@ else print $langs->trans("ErrorUnknown"); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 6719e7091c8..a46b79d7d1b 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - //require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + //include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; @@ -546,7 +546,7 @@ if (empty($reshook)) } elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); @@ -1734,6 +1734,6 @@ else } } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 8964b85203b..aff7cb362a8 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; } // Load translation files required by the page @@ -122,5 +122,6 @@ print ''; dol_fiche_end(); +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 13db00a02c2..0cfb0347a2d 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -709,6 +709,6 @@ else dol_print_error($db); } +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 75dce3c01a3..7d989e4b63e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1245,5 +1245,6 @@ else dol_print_error($db); } +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 58fc26030b7..c46d3ed690e 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -142,7 +142,6 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); } - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index ecde973bd3b..d7766268989 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -696,6 +696,6 @@ if ($object->id > 0) print ''; } - +// End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 0416e04f7b0..04603076b07 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -347,7 +347,6 @@ print '
'; dol_fiche_end(); - +// End of page llxFooter(); - $db->close(); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 69f3bd102df..428f55f9362 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -273,7 +273,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque) { if ($object->fetch($id) > 0) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 528b01477a6..189afeda59f 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -593,8 +593,8 @@ class RemiseCheque extends CommonObject $file = "pdf_".$model.".class.php"; if (file_exists($dir.$file)) { - require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; - require_once $dir.$file; + include_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; + include_once $dir.$file; $classname='BordereauCheque'.ucfirst($model); $docmodel = new $classname($this->db); diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 527bd05e3a1..b6770e62d33 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -24,7 +24,7 @@ * \brief Home page for cheque receipts */ -require('../../../main.inc.php'); +require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 800f40b9694..44fd508dc3d 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -25,7 +25,7 @@ * \brief Page list of cheque deposits */ -require('../../../main.inc.php'); +require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 539c70f591b..53a17830c09 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -545,7 +545,7 @@ class Paiement extends CommonObject $this->fk_account=$accountid; - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; dol_syslog("$user->id,$mode,$label,$this->fk_account,$emetteur_nom,$emetteur_banque"); @@ -1064,7 +1064,7 @@ class Paiement extends CommonObject $arraybill = $this->getBillsArray(); if (is_array($arraybill) && count($arraybill) > 0) { - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($this->db); foreach ($arraybill as $billid) { @@ -1170,7 +1170,7 @@ class Paiement extends CommonObject */ function fetch_thirdparty($force_thirdparty_id=0) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; if (empty($force_thirdparty_id)) { diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 0cbaa9ce55e..c7fee1f70a8 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -24,7 +24,7 @@ * \brief Page liste des bons de prelevements */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 343a45472b6..84c4087e451 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -23,7 +23,7 @@ * \brief Card of a direct debit */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 245b25be3b6..94d5a764a38 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -762,16 +762,16 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG); - require_once (DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); - require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); + require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; + require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; if (empty($format)) return 'ErrorBadParametersForDirectDebitFileCreate'; $error = 0; $datetimeprev = time(); - //Choice the date of the execution direct debit - if(!empty($executiondate)) $datetimeprev = $executiondate; + //Choice the date of the execution direct debit + if(!empty($executiondate)) $datetimeprev = $executiondate; $month = strftime("%m", $datetimeprev); $year = strftime("%Y", $datetimeprev); @@ -1575,7 +1575,8 @@ class BonPrelevement extends CommonObject $XML_DEBITOR =''; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + // $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + $XML_DEBITOR .=' '.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.round($row_somme, 2).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1607,7 +1608,8 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; // $XML_DEBITOR .=' '.($row_facnumber.'/'.$Rowing.'/'.$Rum).''.$CrLf; - $XML_DEBITOR .=' '.dol_trunc($row_facnumber, 135).''.$CrLf; // 140 max + // $XML_DEBITOR .=' '.dol_trunc($row_facnumber, 135).''.$CrLf; // 140 max + $XML_DEBITOR .=' '.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).''.$CrLf; // 140 max $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; return $XML_DEBITOR; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 74bd282d606..191a54b7484 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -25,7 +25,7 @@ * \brief Prelevement creation page */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index d20f92cb188..b5058b5c685 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -24,7 +24,7 @@ * \brief Page to list withdraw requests */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 2eabd64873d..d4593a3dcef 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -24,7 +24,7 @@ * \brief Page liste des factures prelevees */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 113153bc896..ebf3876406b 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -24,7 +24,7 @@ * \brief Withdraw reject */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index c126212f17c..e4371abfb5c 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -23,7 +23,7 @@ * \brief Prelevement statistics */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index de99b56eb19..83f14169d4c 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -26,7 +26,7 @@ */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 721cf62bcd7..8cad6ed70d5 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -24,7 +24,7 @@ * \brief card of withdraw line */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 8d657f00221..cac9e52b3c9 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -24,7 +24,7 @@ * \brief Page liste des prelevements */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index c8812bba1a9..2e340a2c801 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -24,7 +24,7 @@ * \brief Reject page */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 20d213e820b..7c878787e89 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -24,7 +24,7 @@ * \brief Page with statistics on withdrawals */ -require('../../main.inc.php'); +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 45fee127642..30b4164e81b 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2018 Alexandre Spangaro * Copyright (C) 2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE @@ -29,12 +29,20 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} // Load translation files required by the page $langs->loadLangs(array("compta","banks","bills","users","salaries","hrm")); +if (! empty($conf->projet->enabled)) $langs->load("projects"); $id=GETPOST("id",'int'); $action=GETPOST('action','aZ09'); +$cancel= GETPOST('cancel', 'aZ09'); +$projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST('fk_project','int')); // Security check $socid = GETPOST("socid","int"); @@ -52,20 +60,27 @@ $hookmanager->initHooks(array('salarycard','globalcard')); * Actions */ -if ($_POST["cancel"] == $langs->trans("Cancel")) +if ($cancel) { header("Location: index.php"); exit; } -if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) +// Link to a project +if ($action == 'classin' && $user->rights->banque->modifier) +{ + $object->fetch($id); + $object->setProject(GETPOST('projectid')); +} + +if ($action == 'add' && empty($cancel)) { $error=0; - $datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]); - $datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]); - $datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]); - $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); + $datep=dol_mktime(12,0,0, GETPOST("datepmonth",'int'), GETPOST("datepday",'int'), GETPOST("datepyear",'int')); + $datev=dol_mktime(12,0,0, GETPOST("datevmonth",'int'), GETPOST("datevday",'int'), GETPOST("datevyear",'int')); + $datesp=dol_mktime(12,0,0, GETPOST("datespmonth",'int'), GETPOST("datespday",'int'), GETPOST("datespyear",'int')); + $dateep=dol_mktime(12,0,0, GETPOST("dateepmonth",'int'), GETPOST("dateepday",'int'), GETPOST("dateepyear",'int')); if (empty($datev)) $datev=$datep; $type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1); @@ -82,6 +97,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->type_payment=($type_payment > 0 ? $type_payment : 0); $object->num_payment=GETPOST("num_payment"); $object->fk_user_author=$user->id; + $object->fk_project= GETPOST('fk_project','int'); // Set user current salary as ref salaray for the payment $fuser=new User($db); @@ -187,6 +203,7 @@ if ($action == 'delete') llxHeader("",$langs->trans("SalaryPayment")); $form = new Form($db); +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); if ($id) { @@ -278,6 +295,18 @@ if ($action == 'create') print ''; print ''; + // Project + if (! empty($conf->projet->enabled)) + { + $formproject=new FormProjets($db); + + print ''.$langs->trans("Project").''; + + $numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1); + + print ''; + } + // Bank if (! empty($conf->banque->enabled)) { @@ -335,14 +364,46 @@ if ($id) dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), -1, 'payment'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref='
'; + // Employee $userstatic=new User($db); $userstatic->fetch($object->fk_user); - $morehtmlref.=$langs->trans('Employee') . ' : ' . $userstatic->getNomUrl(1); + + // Project + if (! empty($conf->projet->enabled)) + { + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->salaries->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } $morehtmlref.='
'; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 3a3f34b85b4..31c616ac00d 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Juanjo Menent +/* Copyright (C) 2011-2018 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent * * 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 @@ -17,9 +17,9 @@ */ /** - * \file htdocs/compta/salaries/class/paymentsalary.class.php - * \ingroup salaries - * \brief Class for salaries module payment + * \file htdocs/compta/salaries/class/paymentsalary.class.php + * \ingroup salaries + * \brief Class for salaries module payment */ // Put here all includes required by your class file @@ -40,6 +40,7 @@ class PaymentSalary extends CommonObject public $datep; public $datev; public $amount; + public $fk_project; public $type_payment; public $num_payment; public $label; @@ -102,6 +103,7 @@ class PaymentSalary extends CommonObject $sql.= " datep='".$this->db->idate($this->datep)."',"; $sql.= " datev='".$this->db->idate($this->datev)."',"; $sql.= " amount=".price2num($this->amount).","; + $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; $sql.= " fk_typepayment=".$this->fk_typepayment."',"; $sql.= " num_payment='".$this->db->escape($this->num_payment)."',"; $sql.= " label='".$this->db->escape($this->label)."',"; @@ -161,6 +163,7 @@ class PaymentSalary extends CommonObject $sql.= " s.datep,"; $sql.= " s.datev,"; $sql.= " s.amount,"; + $sql.= " s.fk_projet as fk_project,"; $sql.= " s.fk_typepayment,"; $sql.= " s.num_payment,"; $sql.= " s.label,"; @@ -186,25 +189,26 @@ class PaymentSalary extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->tms = $this->db->jdate($obj->tms); - $this->fk_user = $obj->fk_user; - $this->datep = $this->db->jdate($obj->datep); - $this->datev = $this->db->jdate($obj->datev); - $this->amount = $obj->amount; - $this->type_payement = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->label = $obj->label; - $this->datesp = $this->db->jdate($obj->datesp); - $this->dateep = $this->db->jdate($obj->dateep); - $this->note = $obj->note; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->fk_account = $obj->fk_account; - $this->fk_type = $obj->fk_type; - $this->rappro = $obj->rappro; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->tms = $this->db->jdate($obj->tms); + $this->fk_user = $obj->fk_user; + $this->datep = $this->db->jdate($obj->datep); + $this->datev = $this->db->jdate($obj->datev); + $this->amount = $obj->amount; + $this->fk_project = $obj->fk_project; + $this->type_payement = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->label = $obj->label; + $this->datesp = $this->db->jdate($obj->datesp); + $this->dateep = $this->db->jdate($obj->dateep); + $this->note = $obj->note; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_account = $obj->fk_account; + $this->fk_type = $obj->fk_type; + $this->rappro = $obj->rappro; } $this->db->free($resql); @@ -276,12 +280,12 @@ class PaymentSalary extends CommonObject $this->fk_user_modif=''; } - /** - * Create in database - * - * @param User $user User that create - * @return int <0 if KO, >0 if OK - */ + /** + * Create in database + * + * @param User $user User that create + * @return int <0 if KO, >0 if OK + */ function create($user) { global $conf,$langs; @@ -331,6 +335,7 @@ class PaymentSalary extends CommonObject $sql.= ", datep"; $sql.= ", datev"; $sql.= ", amount"; + $sql.= ", fk_projet"; $sql.= ", salary"; $sql.= ", fk_typepayment"; $sql.= ", num_payment"; @@ -348,6 +353,7 @@ class PaymentSalary extends CommonObject $sql.= ", '".$this->db->idate($this->datep)."'"; $sql.= ", '".$this->db->idate($this->datev)."'"; $sql.= ", ".$this->amount; + $sql.= ", ".($this->fk_project > 0? $this->fk_project : 0); $sql.= ", ".($this->salary > 0 ? $this->salary : "null"); $sql.= ", ".$this->db->escape($this->type_payment); $sql.= ", '".$this->db->escape($this->num_payment)."'"; @@ -502,13 +508,11 @@ class PaymentSalary extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowSalaryPayment").': '.$this->ref; + $label=$langs->trans("ShowSalaryPayment").': '.$this->ref; - $linkstart = ''; + $linkstart = ''; $linkend=''; - $picto='payment'; - $result .= $linkstart; if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); if ($withpicto != 2) $result.= $this->ref; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 101a934a524..697253b90eb 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -32,11 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } if (! empty($conf->accounting->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; + include_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; } // Load translation files required by the page diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index ba9c671f755..114a2e78cf1 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -518,7 +518,7 @@ class PaymentSocialContribution extends CommonObject if (! empty($conf->banque->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $acc = new Account($this->db); $acc->fetch($accountid); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 490dbf3a1fe..5f3fc5aa4eb 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.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'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } // Load translation files required by the page @@ -76,7 +76,7 @@ $modulepart='tax'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; if ($action == 'setlib' && $user->rights->tax->charges->creer) { diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 1827c1597f8..4e184e2099f 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } // Load translation files required by the page diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 7475cf54ddb..886a6171818 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -14,7 +14,7 @@ // dolibarr_main_url_root // This parameter defines the root URL of your Dolibarr index.php page without ending "/". // It must link to the directory htdocs. -// In most cases, this is autodetected but it's still required +// In most cases, this is autodetected but it's still required // * to show full url bookmarks for some services (ie: agenda rss export url, ...) // * or when using Apache dir aliases (autodetect fails) // * or when using nginx (autodetect fails) @@ -40,7 +40,7 @@ $dolibarr_main_document_root=''; // dolibarr_main_url_root_alt // This parameter defines the relative sub URLs to add to $dolibarr_main_url_root to // forge alternative root directories (used by modules developers). -// You can put several values, separated by a coma, but number of entries must match +// You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_document_root_alt. // Examples: // $dolibarr_main_url_root_alt='/custom'; @@ -52,7 +52,7 @@ $dolibarr_main_document_root=''; // dolibarr_main_document_root_alt // This parameter contains absolute alternative root file system directories (used by // modules developers). -// You can put several values, separated by a coma, but number of entries must match +// You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_url_root_alt. // Examples: // $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom'; @@ -162,7 +162,7 @@ $dolibarr_main_db_collation='utf8_unicode_ci'; // Default value: dolibarr // Possible values: Any values found in files in htdocs/core/login directory after // the "function_" string and before the ".php" string. You can also separate several -// values using a ",". In this case, Dolibarr will check login/pass for each value in +// values using a ",". In this case, Dolibarr will check login/pass for each value in // order defined into value. However, note that this can't work with all values. // Examples: // $dolibarr_main_authentication='http'; @@ -207,10 +207,10 @@ $dolibarr_main_authentication='dolibarr'; // 0 = No forced redirect // 1 = Force redirect to https, until SCRIPT_URI start with https into response // 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response -// 'https://my.domain.com' = Force reditect to https using this domain name. +// 'https://my.domain.com' = Force reditect to https using this domain name. // Warning: If you enable this parameter, your web server must be configured to -// respond URL with https protocol. -// According to your web server setup, some values may works and other not. Try +// respond URL with https protocol. +// According to your web server setup, some values may works and other not. Try // different values (1,2 or 'https://my.domain.com') if you experience problems. // Default value: 0 // Possible values: 0, 1, 2 or 'https://my.domain.com' diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index b9b0d51c162..d19c91e0bf2 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -81,7 +81,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print '

'; + print '
'; print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php index 42a8ed589d7..af2585eaf3a 100644 --- a/htdocs/contrat/admin/contractdet_extrafields.php +++ b/htdocs/contrat/admin/contractdet_extrafields.php @@ -81,7 +81,7 @@ dol_fiche_end(); if ($action != 'create' && $action != 'edit') { print '"; } @@ -94,8 +94,8 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; - print load_fiche_titre($langs->trans('NewAttribute')); + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d0120d130df..9c13a57112a 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -30,7 +30,7 @@ * \brief Page of a contract */ -require ("../main.inc.php"); +require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 4d403198eb8..063e3ecb228 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -24,7 +24,7 @@ * \brief Onglet de gestion des contacts des contrats */ -require ("../main.inc.php"); +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 0208d68f80d..20a70830952 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -27,7 +27,7 @@ * \brief Page des documents joints sur les contrats */ -require ("../main.inc.php"); +require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index b78bf52b6be..f348cab8234 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -24,9 +24,9 @@ * \brief Home page of contract area */ -require ("../main.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/product/class/product.class.php"); +require "../main.inc.php"; +require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; // Load translation files required by the page $langs->loadLangs(array('products', 'companies', 'contracts')); diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 8899351c284..c783ca4948c 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -22,7 +22,7 @@ * \brief Page des informations d'un contrat */ -require ("../main.inc.php"); +require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 18e78c7ff0a..e616afefd99 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -28,7 +28,7 @@ * \brief Page liste des contrats */ -require ("../main.inc.php"); +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index c160201191a..a5ea40e146c 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -24,7 +24,7 @@ * \brief Fiche de notes sur un contrat */ -require ("../main.inc.php"); +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; if (! empty($conf->projet->enabled)) { diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index de44410e505..1ce48a7371d 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -25,10 +25,10 @@ * \brief Page to list services in contracts */ -require ("../main.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"); -require_once (DOL_DOCUMENT_ROOT."/product/class/product.class.php"); -require_once (DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); +require "../main.inc.php"; +require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; +require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; +require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; // Load translation files required by the page $langs->loadLangs(array('products', 'contracts', 'companies')); diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 6b6d40acd9c..6b6d4b7a176 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -178,10 +178,12 @@ if ($action == 'add') (GETPOST('alwayseditable', 'alpha')?1:0), (GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''), $visibility, - 0, + GETPOST('help','alpha'), GETPOST('computed_value','alpha'), (GETPOST('entitycurrentorall', 'alpha')?0:''), - GETPOST('langfile', 'alpha') + GETPOST('langfile', 'alpha'), + 1, + (GETPOST('totalizable', 'alpha')?1:0) ); if ($result > 0) { @@ -331,7 +333,7 @@ if ($action == 'update') $visibility = GETPOST('list', 'alpha'); if ($type == 'separate') $visibility=3; - $result=$extrafields->update( + $result=$extrafields->update( GETPOST('attrname', 'alpha'), GETPOST('label', 'alpha'), $type, @@ -344,11 +346,13 @@ if ($action == 'update') (GETPOST('alwayseditable', 'alpha')?1:0), (GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''), $visibility, - 0, + GETPOST('help','alpha'), GETPOST('default_value','alpha'), GETPOST('computed_value','alpha'), (GETPOST('entitycurrentorall', 'alpha')?0:''), - GETPOST('langfile') + GETPOST('langfile'), + 1, + (GETPOST('totalizable', 'alpha')?1:0) ); if ($result > 0) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 4126fc44826..0e806cfe39d 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -378,7 +378,7 @@ if (! $error && $massaction == 'confirm_presend') //var_dump($filepath); // Send mail (substitutionarray must be done just before this) - require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); if ($mailfile->error) { @@ -433,7 +433,7 @@ if (! $error && $massaction == 'confirm_presend') if (! empty($triggername)) { // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"; $interface=new Interfaces($db); $result=$interface->run_triggers($triggername, $objectobj, $user, $langs, $conf); if ($result < 0) { $error++; $errors=$interface->errors; } @@ -703,7 +703,7 @@ if ($massaction == 'confirm_createbills') if (! $error) { $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); // Make a redirect to avoid to bill twice if we make a refresh or back $param=''; diff --git a/htdocs/core/ajax/price.php b/htdocs/core/ajax/price.php index 577f659b2cc..453fdc7bc82 100644 --- a/htdocs/core/ajax/price.php +++ b/htdocs/core/ajax/price.php @@ -25,7 +25,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -require('../../main.inc.php'); +require '../../main.inc.php'; $output = GETPOST('output','alpha'); $amount = price2num(GETPOST('amount','alpha')); diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 976cbf1766c..29bc4410b82 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -23,7 +23,7 @@ * \ingroup projet * \brief Module to show Projet activity of the current Year */ -include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); +include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box to show last projet @@ -80,7 +80,7 @@ class box_project extends ModeleBoxes // list the summary of the orders if ($user->rights->projet->lire) { - include_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'); + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $projectstatic = new Project($this->db); $socid=$user->societe_id; diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 3a665243073..802195ca445 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -22,8 +22,8 @@ * \brief Module to Task activity of the current year */ -include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); +include_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; /** @@ -75,7 +75,7 @@ class box_task extends ModeleBoxes $totalMnt = 0; $totalnb = 0; $totalDuree=0; - include_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php"); + include_once DOL_DOCUMENT_ROOT."/projet/class/task.class.php"; $taskstatic=new Task($db); diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 6851c124743..d9c496add4f 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2018 Regis Houssin * Copyright (C) 2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -145,7 +145,7 @@ class Canvas { if (empty($this->template_dir)) return 0; - if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1; + if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1; else return 0; } @@ -161,7 +161,7 @@ class Canvas global $db, $conf, $langs, $user, $canvas; global $form, $formfile; - include $this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template + include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d3d77640540..45094d7661f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -543,7 +543,7 @@ abstract class CommonDocGenerator $tmpproduct = new Product($this->db); $result = $tmpproduct->fetch($line->fk_product); foreach($tmpproduct->array_options as $key=>$label) - $resarray["line_".$key] = $label; + $resarray["line_product_".$key] = $label; } return $resarray; @@ -722,6 +722,30 @@ abstract class CommonDocGenerator $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } + else if($extrafields->attribute_type[$key] == 'link') + { + $id = $object->array_options['options_'.$key]; + if ($id != "") + { + $param = $extrafields->attribute_param[$key]; + $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' + $InfoFieldList = explode(":", $param_list[0]); + $classname=$InfoFieldList[0]; + $classpath=$InfoFieldList[1]; + if (! empty($classpath)) + { + dol_include_once($InfoFieldList[1]); + if ($classname && class_exists($classname)) + { + $tmpobject = new $classname($this->db); + $tmpobject->fetch($id); + // completely replace the id with the linked object name + $object->array_options['options_'.$key] = $tmpobject->name; + } + } + } + } + $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1dfc9c90718..5e528f6a1d0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5110,10 +5110,10 @@ abstract class CommonObject * @param string $moreparam To add more parameters on html input tag * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @param string|int $showsize Value for css to define size. May also be a numeric. + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @return string */ - function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0) + function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0) { global $conf,$langs,$form; @@ -5123,38 +5123,54 @@ abstract class CommonObject $form=new Form($this->db); } + $val=$this->fields[$key]; + + $out=''; + $type=''; + $param['options']=array(); + $size =$this->fields[$key]['size']; + // Because we work on extrafields + if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + }else if(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + }else if(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){ + + $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); + $type ='sellist'; + }else if(preg_match('/varchar\((\d+)\)/', $val['type'],$reg)){ + + $param['options']=array(); + $type ='varchar'; + $size=$reg[1]; + }else if(preg_match('/varchar/', $val['type'])){ + + $param['options']=array(); + $type ='varchar'; + }else if(is_array($this->fields[$key]['arrayofkeyval'])){ + + $param['options']=$this->fields[$key]['arrayofkeyval']; + $type ='select'; + }else { + $param['options']=array(); + $type =$this->fields[$key]['type']; + } + + $label=$this->fields[$key]['label']; + //$elementtype=$this->fields[$key]['elementtype']; // Seems not used + $default=$this->fields[$key]['default']; + $computed=$this->fields[$key]['computed']; + $unique=$this->fields[$key]['unique']; + $required=$this->fields[$key]['required']; + + $langfile=$this->fields[$key]['langfile']; + $list=$this->fields[$key]['list']; + $hidden=abs($this->fields[$key]['visible'])!=1?1:0; + $objectid = $this->id; - $label= $val['label']; - $type = $val['type']; - $size = $val['css']; - - // Convert var to be able to share same code than showInputField of extrafields - if (preg_match('/varchar\((\d+)\)/', $type, $reg)) - { - $type = 'varchar'; // convert varchar(xx) int varchar - $size = $reg[1]; - } - elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) into varchar - elseif (preg_match('/double/', $type)) $type = 'double'; // convert double(xx) into double - if (is_array($val['arrayofkeyval'])) $type='select'; - if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link'; - - $default=$val['default']; - $computed=$val['computed']; - $unique=$val['unique']; - $required=$val['required']; - $param=$val['param']; - if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval']; - if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) - { - $type='link'; - $param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]); - } - $langfile=$val['langfile']; - $list=$val['list']; - $hidden=(abs($val['visible'])!=1 ? 1 : 0); - $help=$val['help']; if ($computed) { @@ -5162,54 +5178,50 @@ abstract class CommonObject else return ''; } + // Use in priority showsize from parameters, then $val['css'] then autodefine - if (empty($showsize) && ! empty($val['css'])) + if (empty($morecss) && ! empty($val['css'])) { $showsize = $val['css']; } - if (empty($showsize)) + if (empty($morecss)) { if ($type == 'date') { - //$showsize=10; - $showsize = 'minwidth100imp'; + $morecss = 'minwidth100imp'; } elseif ($type == 'datetime') { - //$showsize=19; - $showsize = 'minwidth200imp'; + $morecss = 'minwidth200imp'; } - elseif (in_array($type,array('int','double','price'))) + elseif (in_array($type,array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type)) { - //$showsize=10; - $showsize = 'maxwidth75'; - } - elseif ($type == 'url') + $morecss = 'maxwidth75'; + }elseif ($type == 'url') { - $showsize='minwidth400'; + $morecss='minwidth400'; } elseif ($type == 'boolean') { - $showsize=''; + $morecss=''; } else { if (round($size) < 12) { - $showsize = 'minwidth100'; + $morecss = 'minwidth100'; } else if (round($size) <= 48) { - $showsize = 'minwidth200'; + $morecss = 'minwidth200'; } else { - //$showsize=48; - $showsize = 'minwidth400'; + $morecss = 'minwidth400'; } } } - //var_dump($showsize.' '.$size); + if (in_array($type,array('date','datetime'))) { $tmp=explode(',',$size); @@ -5221,33 +5233,47 @@ abstract class CommonObject if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1); + $out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1); } elseif (in_array($type,array('int','integer'))) { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif (preg_match('/varchar/', $type)) { - $out=''; + $out=''; } elseif (in_array($type, array('mail', 'phone', 'url'))) { - $out=''; + $out=''; } elseif ($type == 'text') { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,0,ROWS_5,'90%'); - $out=$doleditor->Create(1); + if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field + { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,false,ROWS_5,'90%'); + $out=$doleditor->Create(1); + } + else + { + $out=''; + } } elseif ($type == 'html') { - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%'); - $out=$doleditor->Create(1); + if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field + { + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%'); + $out=$doleditor->Create(1); + } + else + { + $out=''; + } } elseif ($type == 'boolean') { @@ -5257,21 +5283,21 @@ abstract class CommonObject } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } - elseif ($type == 'double') + elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type)) { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { @@ -5282,8 +5308,8 @@ abstract class CommonObject $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; + if((! isset($this->fields[$key]['default'])) ||($this->fields[$key]['notnull']!=1))$out.=''; foreach ($param['options'] as $key => $val) { if ((string) $key == '') continue; @@ -5304,11 +5330,13 @@ abstract class CommonObject $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); $InfoFieldList = explode(":", $param_list[0]); + $parentName=''; + $parentField=''; // 0 : tableName // 1 : label field name // 2 : key fields name (if differ of rowid) @@ -5393,8 +5421,9 @@ abstract class CommonObject $obj = $this->db->fetch_object($resql); // Several field into label (eq table:code|libelle:rowid) + $notrans = false; $fields_label = explode('|',$InfoFieldList[1]); - if(is_array($fields_label)) + if (is_array($fields_label)) { $notrans = true; foreach ($fields_label as $field_toshow) @@ -5408,7 +5437,7 @@ abstract class CommonObject } $labeltoshow=dol_trunc($labeltoshow,45); - if ($value==$obj->rowid) + if ($value == $obj->rowid) { foreach ($fields_label as $field_toshow) { @@ -5423,7 +5452,7 @@ abstract class CommonObject } else { - if(!$notrans) + if (! $notrans) { $translabel=$langs->trans($obj->{$InfoFieldList[1]}); if ($translabel!=$obj->{$InfoFieldList[1]}) { @@ -5439,7 +5468,7 @@ abstract class CommonObject $out.=''; } - if (!empty($InfoFieldList[3])) + if (!empty($InfoFieldList[3]) && $parentField) { $parent = $parentName.':'.$obj->{$parentField}; } @@ -5470,7 +5499,7 @@ abstract class CommonObject $out=''; foreach ($param['options'] as $keyopt => $val) { - $out.='db->fetch_object($resql); + $notrans = false; // Several field into label (eq table:code|libelle:rowid) $fields_label = explode('|', $InfoFieldList[1]); if (is_array($fields_label)) { @@ -5602,7 +5634,7 @@ abstract class CommonObject $data[$obj->rowid]=$labeltoshow; } - if (! empty($InfoFieldList[3])) { + if (! empty($InfoFieldList[3]) && $parentField) { $parent = $parentName . ':' . $obj->{$parentField}; } @@ -5619,18 +5651,17 @@ abstract class CommonObject print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.
'; } } - $out .= ''; } elseif ($type == 'link') { $param_list=array_keys($param['options']); // $param_list='ObjectName:classPath' - $showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1); + $showempty=(($required && $default != '')?0:1); $out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); } elseif ($type == 'password') { // If prefix is 'search_', field is used as a filter, we use a common text field. - $out=''; + $out=''; } elseif ($type == 'array') { @@ -5677,7 +5708,6 @@ abstract class CommonObject return $out; } - /** * Return HTML string to show a field into a page * Code very similar with showOutputField of extra fields diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 5cb7d3e6882..9fc1921aa60 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -509,11 +509,11 @@ class DiscountAbsolute } /** - * Return amount (with tax) of all credit notes and deposits invoices used by invoice as a payment + * Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment * * @param CommonInvoice $invoice Object invoice * @param int $multicurrency Return multicurrency_amount instead of amount - * @return int <0 if KO, Sum of credit notes and deposits amount otherwise + * @return int <0 if KO, Sum of credit notes and excess received amount otherwise */ function getSumCreditNotesUsed($invoice, $multicurrency=0) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index df837abdf4b..62122ed636c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2015 Charles-Fr BENKE * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2017 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric 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 @@ -156,14 +157,14 @@ class ExtraFields * @param int $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibilty ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string') - * @param int $notused Deprecated. + * @param string $help Text with help tooltip * @param string $computed Computed value * @param string $entity Entity of extrafields (for multicompany modules) * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ - function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $computed='', $entity='', $langfile='', $enabled='1') + function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $computed='', $entity='', $langfile='', $enabled='1') { if (empty($attrname)) return -1; if (empty($label)) return -1; @@ -174,13 +175,13 @@ class ExtraFields // Create field into database except for separator type which is not stored in database if ($type != 'separate') { - $result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed); + $result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help); } $err1=$this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') { // Add declaration of field into table - $result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $notused, $default_value, $computed, $entity, $langfile, $enabled); + $result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled); $err2=$this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { @@ -300,7 +301,7 @@ class ExtraFields * @param int $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibily - * @param int $notused Deprecated. + * @param string $help Help on tooltip * @param string $default Default value (in database. use the default_value feature for default value on screen). * @param string $computed Computed value * @param string $entity Entity of extrafields @@ -308,7 +309,7 @@ class ExtraFields * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ - private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $default='', $computed='',$entity='', $langfile='', $enabled='1') + private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $default='', $computed='',$entity='', $langfile='', $enabled='1') { global $conf,$user; @@ -357,7 +358,8 @@ class ExtraFields $sql.= " fk_user_author,"; $sql.= " fk_user_modif,"; $sql.= " datec,"; - $sql.= " enabled"; + $sql.= " enabled,"; + $sql.= " help"; $sql.= " )"; $sql.= " VALUES('".$attrname."',"; $sql.= " '".$this->db->escape($label)."',"; @@ -378,7 +380,8 @@ class ExtraFields $sql .= " " . (is_object($user) ? $user->id : 0). ","; $sql .= " " . (is_object($user) ? $user->id : 0). ","; $sql .= "'" . $this->db->idate(dol_now()) . "',"; - $sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1"); + $sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1").","; + $sql.= " ".($help?"'".$this->db->escape($help)."'":"null"); $sql.=')'; dol_syslog(get_class($this)."::create_label", LOG_DEBUG); @@ -508,20 +511,21 @@ class ExtraFields * @param int $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visibility - * @param int $notused Deprecated. + * @param string $help Help on tooltip * @param string $default Default value (in database. use the default_value feature for default value on screen). * @param string $computed Computed value * @param string $entity Entity of extrafields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not + * @param int $totalizable Is extrafield totalizable on list * @return int >0 if OK, <=0 if KO */ - function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $notused=0, $default='', $computed='', $entity='', $langfile='', $enabled='1') + function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $help='', $default='', $computed='', $entity='', $langfile='', $enabled='1', $totalizable=0) { if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'contact') $elementtype='socpeople'; - $table=$elementtype.'_extrafields'; + $table=$elementtype.'_extrafields'; if ($elementtype == 'categorie') $table='categories_extrafields'; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) @@ -566,7 +570,7 @@ class ExtraFields { if ($label) { - $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$notused,$default,$computed,$entity,$langfile,$enabled); + $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$help,$default,$computed,$entity,$langfile,$enabled, $totalizable); } if ($result > 0) { @@ -617,18 +621,19 @@ class ExtraFields * @param int $alwayseditable Is attribute always editable regardless of the document status * @param string $perms Permission to check * @param string $list Visiblity - * @param int $notused Deprecated. + * @param string $help Help on tooltip. * @param string $default Default value (in database. use the default_value feature for default value on screen). * @param string $computed Computed value * @param string $entity Entity of extrafields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not - * @return int <=0 if KO, >0 if OK + * @param int $totalizable Is extrafield totalizable on list + * @return int <=0 if KO, >0 if OK */ - private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$notused=0,$default='',$computed='',$entity='',$langfile='',$enabled='1') + private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$help='',$default='',$computed='',$entity='',$langfile='',$enabled='1', $totalizable=0) { global $conf, $user; - dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$notused.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled); + dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable); // Clean parameters if ($elementtype == 'thirdparty') $elementtype='societe'; @@ -636,6 +641,9 @@ class ExtraFields if (empty($pos)) $pos=0; if (empty($list)) $list='0'; + if (empty($totalizable)) { + $totalizable = 0; + } if (empty($required)) $required=0; if (empty($unique)) $unique=0; if (empty($alwayseditable)) $alwayseditable=0; @@ -679,12 +687,14 @@ class ExtraFields $sql.= " alwayseditable,"; $sql.= " param,"; $sql.= " list,"; + $sql.= " totalizable,"; $sql.= " fielddefault,"; $sql.= " fieldcomputed,"; $sql.= " fk_user_author,"; $sql.= " fk_user_modif,"; $sql.= " datec,"; - $sql.= " enabled"; + $sql.= " enabled,"; + $sql.= " help"; $sql.= ") VALUES ("; $sql.= "'".$attrname."',"; $sql.= " ".($entity===''?$conf->entity:$entity).","; @@ -700,12 +710,14 @@ class ExtraFields $sql.= " '".$this->db->escape($alwayseditable)."',"; $sql.= " '".$this->db->escape($params)."',"; $sql.= " '".$this->db->escape($list)."', "; + $sql.= " ".$totalizable.","; $sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").","; $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").","; $sql .= " " . $user->id . ","; $sql .= " " . $user->id . ","; $sql .= "'" . $this->db->idate(dol_now()) . "',"; - $sql .= "'" . $this->db->escape($enabled). "'"; + $sql .= "'" . $this->db->escape($enabled). "',"; + $sql.= " ".($help?"'".$this->db->escape($help)."'":"null"); $sql.= ")"; $resql2=$this->db->query($sql); @@ -770,7 +782,7 @@ class ExtraFields // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity,enabled"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element @@ -804,6 +816,7 @@ class ExtraFields $this->attribute_perms[$tab->name]=(strlen($tab->perms) == 0 ? 1 : $tab->perms); $this->attribute_langfile[$tab->name]=$tab->langs; $this->attribute_list[$tab->name]=$tab->list; + $this->attribute_totalizable[$tab->name]=$tab->totalizable; $this->attribute_entityid[$tab->name]=$tab->entity; $this->attribute_entitylabel[$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]); @@ -822,9 +835,11 @@ class ExtraFields $this->attributes[$tab->elementtype]['perms'][$tab->name]=(strlen($tab->perms) == 0 ? 1 : $tab->perms); $this->attributes[$tab->elementtype]['langfile'][$tab->name]=$tab->langs; $this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list; + $this->attributes[$tab->elementtype]['totalizable'][$tab->name]=$tab->totalizable; $this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity; $this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]); $this->attributes[$tab->elementtype]['enabled'][$tab->name]=$tab->enabled; + $this->attributes[$tab->elementtype]['help'][$tab->name]=$tab->help; $this->attributes[$tab->elementtype]['loaded']=1; } @@ -882,6 +897,8 @@ class ExtraFields $perms=dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1); $langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key]; $list=dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); + $totalizable=$this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; + $help=$this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } else // Old usage @@ -897,6 +914,7 @@ class ExtraFields $param=$this->attribute_param[$key]; $langfile=$this->attribute_langfile[$key]; $list=$this->attribute_list[$key]; + $totalizable=$this->attribute_totalizable[$key]; $hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } @@ -1748,7 +1766,7 @@ class ExtraFields $align=''; - if ($type == 'date') + if ($type == 'date') { $align="center"; } @@ -1776,6 +1794,10 @@ class ExtraFields { $align="center"; } + elseif ($type == 'price') + { + $align="right"; + } return $align; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 33a74facecf..81a51983daf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1006,9 +1006,10 @@ class Form * @param string $selected_input_value Value of preselected input text (for use with ajax) * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter + * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @return string HTML string with select box for thirdparty. */ - function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array()) + function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false) { global $conf,$user,$langs; @@ -1045,7 +1046,7 @@ class Form else { // Immediate load of all database - $out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam); + $out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple); } return $out; @@ -1067,9 +1068,10 @@ class Form * @param int $limit Limit number of answers * @param string $morecss Add more css styles to the SELECT component * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML string with */ - function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='') + function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false) { global $conf,$user,$langs; @@ -1077,6 +1079,9 @@ class Form $num=0; $outarray=array(); + if ($selected === '') $selected = array(); + else if (!is_array($selected)) $selected = array($selected); + // Clean $filter that may contains sql conditions so sql code if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3); @@ -1125,7 +1130,7 @@ class Form } // Construct $out and $outarray - $out.= ''."\n"; $textifempty=''; // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. @@ -1174,7 +1179,7 @@ class Form if (empty($outputmode)) { - if ($selected > 0 && $selected == $obj->rowid) + if (in_array($obj->rowid,$selected)) { $out.= ''; } @@ -1325,15 +1330,19 @@ class Form * @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 string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @param string $htmlid Html id to use instead of htmlname + * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return int <0 if KO, Nb of contact in list if OK */ - function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='') + function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='', $multiple=false) { global $conf,$langs; $langs->load('companies'); if (empty($htmlid)) $htmlid = $htmlname; + + if ($selected === '') $selected = array(); + else if (!is_array($selected)) $selected = array($selected); $out=''; // On recherche les societes @@ -1358,9 +1367,9 @@ class Form $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); } - if ($htmlname != 'none' || $options_only) $out.= ''; + if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) $out.= ''; + if ($showempty == 2) $out.= ''; $num = $this->db->num_rows($resql); $i = 0; if ($num) @@ -1368,7 +1377,6 @@ class Form include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contactstatic=new Contact($this->db); - if (!is_array($selected)) $selected = array($selected); while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1418,7 +1426,7 @@ class Form } else { - $out.= ''; } @@ -1476,16 +1484,20 @@ class Form * @param string $morecss More css * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @param int $outputmode 0=HTML select string, 1=Array + * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML select string * @see select_dolgroups */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0) + function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false) { global $conf,$user,$langs; // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id; + if ($selected === '') $selected = array(); + else if (!is_array($selected)) $selected = array($selected); + $excludeUsers=null; $includeUsers=null; @@ -1558,9 +1570,9 @@ class Form $out .= ajax_combobox($htmlname); // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined - $out.= ''; + if ($show_empty && !$multiple) $out.= ''."\n"; + if ($show_every) $out.= ''."\n"; $userstatic=new User($this->db); @@ -1575,7 +1587,7 @@ class Form $disableline=''; if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1'); - if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid)) + if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && in_array($obj->rowid,$selected) )) { $out.= '