diff --git a/.gitignore b/.gitignore index ca0334a63e9..1efe4f4bb82 100755 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ Thumbs.db # Vagrant generated files .vagrant # Composer installed repositories -composer.lock /htdocs/includes/**/.git # Composer autoloader and unwanted files htdocs/includes/autoload.php diff --git a/.travis.yml b/.travis.yml index 74d951bf7bf..8e0116c49d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,11 @@ before_install: install: - | echo "Updating Composer" + rm $TRAVIS_BUILD_DIR/composer.json + rm $TRAVIS_BUILD_DIR/composer.lock composer self-update + composer -n init + composer -n config vendor-dir htdocs/includes echo - | @@ -100,13 +104,14 @@ install: - | echo "Installing PHP CodeSniffer" - composer require squizlabs/php_codesniffer ^2 + composer -n require squizlabs/php_codesniffer ^2 echo - | - echo "Adding Composer binaries to the path" + echo "Adding path of binaries tools installed by composer to the PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" echo + before_script: - | @@ -269,29 +274,31 @@ script: set +e cd htdocs/install php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log - php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log - php step5.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-3.log + php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log - php step5.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-3.log + php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log - php step5.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-3.log + php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log - php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log - php step5.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-3.log + php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-2.log - php step5.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log cd - set +e echo - + #cat $TRAVIS_BUILD_DIR/upgrade390400-2.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 log file. set -e - #phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php set +e - | diff --git a/build/composer/README b/build/composer/README new file mode 100644 index 00000000000..d58359defec --- /dev/null +++ b/build/composer/README @@ -0,0 +1,10 @@ + +To test upgrade of a lib with composer: + +composer update --no-dev --no-autoloader --dry-run ccampbell/chromephp + +To upgrade a lib with composer: + +composer update --no-dev --no-autoloader ccampbell/chromephp + + diff --git a/composer.json b/composer.json index ab60ce4f1b2..fb3109fbc40 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,15 @@ "irc": "irc://chat.freenode.net/dolibarr", "source": "https://github.com/Dolibarr/dolibarr" }, + "config": { + "vendor-dir": "htdocs/includes" + }, "require": { "php": ">=5.3.0", "ext-curl": "*", - "ccampbell/chromephp": "^4.1", + "ccampbell/chromephp": "4.1.0", "ckeditor/ckeditor": "dev-full/stable", - "mike42/escpos-php": "dev-master", + "mike42/escpos-php": "1.2.1", "mobiledetect/mobiledetectlib": "2.8.17", "phpoffice/phpexcel": "1.8.1", "restler/framework": "3.0.0-RC6", @@ -45,8 +48,5 @@ "ext-xml": "Excel support", "firephp/firephp-core": "Logging to Firebug console support", "raven/raven": "Sentry logging server support" - }, - "config": { - "vendor-dir": "htdocs/includes" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000000..2e30ef6bd01 --- /dev/null +++ b/composer.lock @@ -0,0 +1,408 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f666a32d1a59518b8ecc55899e829e79", + "content-hash": "8d110e7d8fca6eca1aa814ee35d0032b", + "packages": [ + { + "name": "ccampbell/chromephp", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/ccampbell/chromephp.git", + "reference": "c3c297615d48ae5b2a86a82311152d1ed095fcef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ccampbell/chromephp/zipball/c3c297615d48ae5b2a86a82311152d1ed095fcef", + "reference": "c3c297615d48ae5b2a86a82311152d1ed095fcef", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "ChromePhp": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Craig Campbell", + "email": "iamcraigcampbell@gmail.com", + "homepage": "http://craig.is", + "role": "Developer" + } + ], + "description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).", + "homepage": "http://github.com/ccampbell/chromephp", + "keywords": [ + "log", + "logging" + ], + "time": "2013-06-26 03:44:33" + }, + { + "name": "ckeditor/ckeditor", + "version": "dev-full/stable", + "source": { + "type": "git", + "url": "https://github.com/ckeditor/ckeditor-releases.git", + "reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91", + "reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+", + "LGPL-2.1+", + "MPL-1.1+" + ], + "authors": [ + { + "name": "CKSource", + "homepage": "http://cksource.com" + } + ], + "description": "JavaScript WYSIWYG web text editor.", + "homepage": "http://ckeditor.com", + "keywords": [ + "CKEditor", + "editor", + "fckeditor", + "html", + "javascript", + "richtext", + "text", + "wysiwyg" + ], + "time": "2016-05-12 15:36:04" + }, + { + "name": "mike42/escpos-php", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/mike42/escpos-php.git", + "reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mike42/escpos-php/zipball/cfea4c4fc95516ac953e1e5b623f854632afa2ee", + "reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.5.*", + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Mike42\\": "src/Mike42" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roni Saha", + "email": "roni.cse@gmail.com" + }, + { + "name": "Michael Billington", + "email": "michael.billington@gmail.com" + }, + { + "name": "Gergely Radics", + "email": "gerifield@ustream.tv" + }, + { + "name": "Warren Doyle", + "email": "w.doyle@fuelled.co" + }, + { + "name": "vharo", + "email": "vharo@geepok.com" + } + ], + "description": "Thermal receipt printer library, for use with ESC/POS compatible printers", + "homepage": "https://github.com/mike42/escpos-php", + "keywords": [ + "ESC-POS", + "driver", + "escpos", + "print", + "receipt" + ], + "time": "2016-04-25 01:14:07" + }, + { + "name": "mobiledetect/mobiledetectlib", + "version": "2.8.17", + "source": { + "type": "git", + "url": "https://github.com/serbanghita/Mobile-Detect.git", + "reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/b87da5f63a76e9615a0c74fcf168657b1ea7e41d", + "reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "codeclimate/php-test-reporter": "dev-master", + "johnkary/phpunit-speedtrap": "~1.0@dev", + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "Mobile_Detect.php" + ], + "psr-0": { + "Detection": "namespaced/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Serban Ghita", + "email": "serbanghita@gmail.com", + "homepage": "http://mobiledetect.net", + "role": "Developer" + } + ], + "description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.", + "homepage": "https://github.com/serbanghita/Mobile-Detect", + "keywords": [ + "detect mobile devices", + "mobile", + "mobile detect", + "mobile detector", + "php mobile detect" + ], + "time": "2015-09-17 14:45:21" + }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://blog.rootslabs.net" + }, + { + "name": "Erik Tilt" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "http://phpexcel.codeplex.com", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2015-05-01 07:00:55" + }, + { + "name": "restler/framework", + "version": "3.0.0-RC6", + "target-dir": "Luracast/Restler", + "source": { + "type": "git", + "url": "https://github.com/Luracast/Restler-Framework.git", + "reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/bfe1139b233852b745c6a0ec14d7244ceb3b3fc6", + "reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "replace": { + "luracast/restler": "3.*" + }, + "suggest": { + "bshaffer/oauth2-server-php": "If you want to use OAuth2 for authentication", + "illuminate/view": "If you want to use laravel blade templates with Html format", + "mustache/mustache": "If you want to use mustache/handlebar templates with Html format", + "rodneyrehm/plist": "If you need Apple plist binary/xml format", + "symfony/yaml": "If you need YAML format", + "twig/twig": "If you want to use twig templates with Html format", + "zendframework/zendamf": "If you need AMF format" + }, + "type": "library", + "extra": { + "branch-alias": { + "master": "v3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Luracast\\Restler": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Luracast", + "email": "arul@luracast.com" + } + ], + "description": "Just the Restler Framework without the tests and examples", + "homepage": "http://luracast.com/products/restler/", + "keywords": [ + "api", + "framework", + "rest", + "server" + ], + "time": "2016-02-28 15:57:37" + }, + { + "name": "tecnickcom/tcpdf", + "version": "6.2.12", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/TCPDF.git", + "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f", + "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "fonts", + "config", + "include", + "tcpdf.php", + "tcpdf_parser.php", + "tcpdf_import.php", + "tcpdf_barcodes_1d.php", + "tcpdf_barcodes_2d.php", + "include/tcpdf_colors.php", + "include/tcpdf_filters.php", + "include/tcpdf_font_data.php", + "include/tcpdf_fonts.php", + "include/tcpdf_images.php", + "include/tcpdf_static.php", + "include/barcodes/datamatrix.php", + "include/barcodes/pdf417.php", + "include/barcodes/qrcode.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPLv3" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "homepage": "http://nicolaasuni.tecnick.com" + } + ], + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "homepage": "http://www.tcpdf.org/", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ], + "time": "2015-09-12 10:08:34" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "ckeditor/ckeditor": 20, + "restler/framework": 5 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.0", + "ext-curl": "*" + }, + "platform-dev": [] +} diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index a7aed128151..82f364b0c1f 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -116,8 +116,15 @@ JQUERYFILETREE: RESTLER: -------- - if ($className == 'Luracast\Restler\string') return; - if ($className == 'Luracast\Restler\mixed') return; - +* Add 2 lines into function + private function alias($className, $currentClass) + { + ... +to get + private function alias($className, $currentClass) + { + if ($className == 'Luracast\Restler\string') return; + if ($className == 'Luracast\Restler\mixed') return; + ... \ No newline at end of file diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 4de319dabc9..ecdbbd09dc4 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -180,7 +180,7 @@ if (! $sourcecontent) } // Define output variables -$outfile='out.'.$classmin.'.class.php'; +$outfile=$classmin.'.class.php'; $targetcontent=$sourcecontent; // Substitute module name @@ -259,7 +259,7 @@ foreach($property as $key => $prop) if ($addfield) { $varprop.="\t\t\$sql.= '".$prop['field']; - if ($i <= count($property)-$no_output_field) $varprop.=","; + if ($i < (count($property)-$no_output_field)) $varprop.=","; $varprop.="';"; $varprop.="\n"; } @@ -455,9 +455,9 @@ else $error++; //-------------------------------------------------------------------- $skeletonfiles=array( - $path.'skeleton_script.php' => 'out.'.$classmin.'_script.php', - $path.'skeleton_list.php' => 'out.'.$classmin.'_list.php', - $path.'skeleton_card.php' => 'out.'.$classmin.'_card.php' + $path.'skeleton_script.php' => $classmin.'_script.php', + $path.'skeleton_list.php' => $classmin.'_list.php', + $path.'skeleton_card.php' => $classmin.'_card.php' ); foreach ($skeletonfiles as $skeletonfile => $outfile) @@ -670,5 +670,5 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) // -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT -------------------- -print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n"; +print "You can now move generated files to store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n"; return $error; diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 6fbecbf2675..f1413bb3712 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -266,7 +266,8 @@ if ($resql) $num = $db->num_rows($resql); $params=''; - if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_field1 != '') $params.= '&search_field1='.urlencode($search_field1); if ($search_field2 != '') $params.= '&search_field2='.urlencode($search_field2); if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 050707daf91..608ef55d106 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -20,5 +20,5 @@ /allscreens* /ecommerce/ /cabinetmed* -/conf/conf.php /webmail* +/conf/conf.php diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e8c5749088a..66de3be2cc5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1376,17 +1376,12 @@ else print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); } - /* - * Confirm add in spip - */ + // Confirm add in spip if ($action == 'add_spip') { print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); } - - /* - * Confirm removed from spip - */ + // Confirm removed from spip if ($action == 'del_spip') { print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); @@ -1551,8 +1546,16 @@ else } else { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } } print ''; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 998dc53d525..784f6d4dea7 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -722,8 +722,16 @@ if ($rowid > 0) } else { - print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if (! $adht->cotisation) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } } print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 797b35f7c75..7045695c1c2 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1553,7 +1553,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); + if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db); foreach ($fieldlist as $field => $value) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 38447c17c5e..e1828e911c7 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -233,11 +233,6 @@ if ($id > 0) print '
'; print ''; - // Alias name (commercial, trademark or alias name) - print '"; - // Prospect/Customer print ''; + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; print '"; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index fa1b2064ed2..5731535697e 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -123,7 +123,7 @@ if ($resql) foreach ($listofstatus as $status) { $dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0)); - if ($status==3 && $bool==false) $bool=true; + if ($status==3 && ! $bool) $bool=true; else $bool=false; } if ($conf->use_javascript_ajax) @@ -147,7 +147,7 @@ if ($resql) print ''; print ''; print "\n"; - if ($status==3 && $bool==false) $bool=true; + if ($status==3 && ! $bool) $bool=true; else $bool=false; } } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index cddd511dbe4..13c10a5da0c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -760,8 +760,120 @@ class FactureRec extends CommonInvoice $arraynow=dol_getdate($now); $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); - parent::initAsSpecimen($option); + $prodids = array(); + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."product"; + $sql.= " WHERE entity IN (".getEntity('product', 1).")"; + $resql = $this->db->query($sql); + if ($resql) + { + $num_prods = $this->db->num_rows($resql); + $i = 0; + while ($i < $num_prods) + { + $i++; + $row = $this->db->fetch_row($resql); + $prodids[$i] = $row[0]; + } + } + // Initialize parameters + $this->id=0; + $this->ref = 'SPECIMEN'; + $this->specimen=1; + $this->socid = 1; + $this->date = $nownotime; + $this->date_lim_reglement = $nownotime + 3600 * 24 *30; + $this->cond_reglement_id = 1; + $this->cond_reglement_code = 'RECEP'; + $this->date_lim_reglement=$this->calculate_date_lim_reglement(); + $this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR + $this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR + $this->note_public='This is a comment (public)'; + $this->note_private='This is a comment (private)'; + $this->note='This is a comment (private)'; + $this->fk_incoterms=0; + $this->location_incoterms=''; + + if (empty($option) || $option != 'nolines') + { + // Lines + $nbp = 5; + $xnbp = 0; + while ($xnbp < $nbp) + { + $line=new FactureLigne($this->db); + $line->desc=$langs->trans("Description")." ".$xnbp; + $line->qty=1; + $line->subprice=100; + $line->tva_tx=19.6; + $line->localtax1_tx=0; + $line->localtax2_tx=0; + $line->remise_percent=0; + if ($xnbp == 1) // Qty is negative (product line) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + $line->qty=-1; + $line->total_ht=-100; + $line->total_ttc=-119.6; + $line->total_tva=-19.6; + } + else if ($xnbp == 2) // UP is negative (free line) + { + $line->subprice=-100; + $line->total_ht=-100; + $line->total_ttc=-119.6; + $line->total_tva=-19.6; + $line->remise_percent=0; + } + else if ($xnbp == 3) // Discount is 50% (product line) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + $line->total_ht=50; + $line->total_ttc=59.8; + $line->total_tva=9.8; + $line->remise_percent=50; + } + else // (product line) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + $line->total_ht=100; + $line->total_ttc=119.6; + $line->total_tva=19.6; + $line->remise_percent=00; + } + + $this->lines[$xnbp]=$line; + $xnbp++; + + $this->total_ht += $line->total_ht; + $this->total_tva += $line->total_tva; + $this->total_ttc += $line->total_ttc; + } + $this->revenuestamp = 0; + + // Add a line "offered" + $line=new FactureLigne($this->db); + $line->desc=$langs->trans("Description")." (offered line)"; + $line->qty=1; + $line->subprice=100; + $line->tva_tx=19.6; + $line->localtax1_tx=0; + $line->localtax2_tx=0; + $line->remise_percent=100; + $line->total_ht=0; + $line->total_ttc=0; // 90 * 1.196 + $line->total_tva=0; + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + + $this->lines[$xnbp]=$line; + $xnbp++; + } + $this->usenewprice = 1; } diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bcca56ed645..bd72fcc17f7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -202,13 +202,14 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $paramlist=''; - $paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); - $paramlist.=($search_ref?"&search_ref=".urlencode($search_ref):""); - $paramlist.=($search_company?"&search_company=".urlencode($search_company):""); - $paramlist.=($search_amount?"&search_amount=".urlencode($search_amount):""); - $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); - if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + $param.=(GETPOST("orphelins")?"&orphelins=1":""); + $param.=($search_ref?"&search_ref=".urlencode($search_ref):""); + $param.=($search_company?"&search_company=".urlencode($search_company):""); + $param.=($search_amount?"&search_amount=".urlencode($search_amount):""); + $param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); print ''; if ($optioncss != '') print ''; @@ -218,24 +219,24 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); + print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); @@ -461,8 +456,8 @@ if ($id > 0) } // Categories - if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { - print '
' . $langs->trans( "Categories" ) . '
' . $langs->trans("CustomersCategoriesShort") . ''; print $form->showCategories( $object->id, 'customer', 1 ); print "
'; print ''; - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 36c79c0f7c5..0a34723e2ce 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -328,8 +328,7 @@ if (empty($reshook)) $label = $lines[$i]->product_label; } - if ($conf->global->PRODUIT_DESC_IN_FORM) - $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; + $desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); @@ -360,7 +359,6 @@ if (empty($reshook)) $error++; break; } - } } } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 18a60a3429d..250f1c98199 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -190,7 +190,7 @@ foreach($listofstatus as $status) print ''; print "\n"; } - if ($status==4 && $bool==false) $bool=true; + if ($status==4 && ! $bool) $bool=true; else $bool=false; } if (! empty($conf->use_javascript_ajax)) @@ -210,7 +210,7 @@ foreach($listofstatus as $status) print ''; print ''; print ''; - if ($status==4 && $bool==false) $bool=true; + if ($status==4 && ! $bool) $bool=true; else $bool=false; print "\n"; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 74cd27bc460..dcf593e6ccd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4297,7 +4297,7 @@ class Form } $return.= '>'.vatrate($rate['libtva']); //$return.=($rate['code']?' '.$rate['code']:''); - $return.= (empty($defaultcode) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) + $return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used) $return.= ''; } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 0be65dfe2e6..97c72160d76 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -192,8 +192,12 @@ class DoliDBMssql extends DoliDB function getVersion() { $resql=$this->query("SELECT @@VERSION"); - $version=$this->fetch_array($resql); - return $version['computed']; + if ($resql) + { + $version=$this->fetch_array($resql); + return $version['computed']; + } + else return ''; } /** @@ -203,10 +207,7 @@ class DoliDBMssql extends DoliDB */ function getDriverInfo() { - // FIXME: Dummy method - // TODO: Implement - - return ''; + return 'php mssql driver'; } /** @@ -359,7 +360,7 @@ class DoliDBMssql extends DoliDB $query_comp[]=$fld->COLUMN_NAME." IS NOT NULL"; } } - if ($query_comp) + if (! empty($query_comp)) $query.=" WHERE ".implode(" AND ",$query_comp); } } @@ -648,7 +649,7 @@ class DoliDBMssql extends DoliDB function last_insert_id($tab,$fieldid='rowid') { $res = $this->query("SELECT @@IDENTITY as id"); - if ($data = $this->fetch_array($res)) + if ($res && $data = $this->fetch_array($res)) { return $data["id"]; } @@ -709,8 +710,12 @@ class DoliDBMssql extends DoliDB function DDLGetConnectId() { $resql=$this->query('SELECT CONNECTION_ID()'); - $row=$this->fetch_row($resql); - return $row[0]; + if ($resql) + { + $row=$this->fetch_row($resql); + return $row[0]; + } + else return '?'; } /** diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 34a7ebdf9f5..a92bb09e0b3 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -549,8 +549,12 @@ class DoliDBMysql extends DoliDB function DDLGetConnectId() { $resql=$this->query('SELECT CONNECTION_ID()'); - $row=$this->fetch_row($resql); - return $row[0]; + if ($resql) + { + $row=$this->fetch_row($resql); + return $row[0]; + } + else return '?'; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index d21caecea36..b6df8420490 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -532,8 +532,12 @@ class DoliDBMysqli extends DoliDB function DDLGetConnectId() { $resql=$this->query('SELECT CONNECTION_ID()'); - $row=$this->fetch_row($resql); - return $row[0]; + if ($resql) + { + $row=$this->fetch_row($resql); + return $row[0]; + } + else return '?'; } /** diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 048ef2d450d..c8b72ebcdd9 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -874,31 +874,34 @@ class DoliDBPgsql extends DoliDB */ function DDLInfoTable($table) { - $infotables=array(); + $infotables=array(); - $sql="SELECT "; - $sql.=" infcol.column_name as \"Column\","; - $sql.=" CASE WHEN infcol.character_maximum_length IS NOT NULL THEN infcol.udt_name || '('||infcol.character_maximum_length||')'"; - $sql.=" ELSE infcol.udt_name"; - $sql.=" END as \"Type\","; - $sql.=" infcol.collation_name as \"Collation\","; - $sql.=" infcol.is_nullable as \"Null\","; - $sql.=" '' as \"Key\","; - $sql.=" infcol.column_default as \"Default\","; - $sql.=" '' as \"Extra\","; - $sql.=" '' as \"Privileges\""; - $sql.=" FROM information_schema.columns infcol"; - $sql.=" WHERE table_schema='public' "; - $sql.=" AND table_name='".$table."'"; - $sql.=" ORDER BY ordinal_position;"; + $sql="SELECT "; + $sql.=" infcol.column_name as \"Column\","; + $sql.=" CASE WHEN infcol.character_maximum_length IS NOT NULL THEN infcol.udt_name || '('||infcol.character_maximum_length||')'"; + $sql.=" ELSE infcol.udt_name"; + $sql.=" END as \"Type\","; + $sql.=" infcol.collation_name as \"Collation\","; + $sql.=" infcol.is_nullable as \"Null\","; + $sql.=" '' as \"Key\","; + $sql.=" infcol.column_default as \"Default\","; + $sql.=" '' as \"Extra\","; + $sql.=" '' as \"Privileges\""; + $sql.=" FROM information_schema.columns infcol"; + $sql.=" WHERE table_schema='public' "; + $sql.=" AND table_name='".$table."'"; + $sql.=" ORDER BY ordinal_position;"; - dol_syslog($sql,LOG_DEBUG); - $result = $this->query($sql); - while($row = $this->fetch_row($result)) - { - $infotables[] = $row; - } - return $infotables; + dol_syslog($sql,LOG_DEBUG); + $result = $this->query($sql); + if ($result) + { + while($row = $this->fetch_row($result)) + { + $infotables[] = $row; + } + } + return $infotables; } @@ -1111,8 +1114,12 @@ class DoliDBPgsql extends DoliDB function getDefaultCharacterSetDatabase() { $resql=$this->query('SHOW SERVER_ENCODING'); - $liste=$this->fetch_array($resql); - return $liste['server_encoding']; + if ($resql) + { + $liste=$this->fetch_array($resql); + return $liste['server_encoding']; + } + else return ''; } /** @@ -1127,7 +1134,7 @@ class DoliDBPgsql extends DoliDB if ($resql) { $i = 0; - while ($obj = $this->fetch_object($resql) ) + while ($obj = $this->fetch_object($resql)) { $liste[$i]['charset'] = $obj->server_encoding; $liste[$i]['description'] = 'Default database charset'; @@ -1148,8 +1155,12 @@ class DoliDBPgsql extends DoliDB function getDefaultCollationDatabase() { $resql=$this->query('SHOW LC_COLLATE'); - $liste=$this->fetch_array($resql); - return $liste['lc_collate']; + if ($resql) + { + $liste=$this->fetch_array($resql); + return $liste['lc_collate']; + } + else return ''; } /** diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8631c576576..b2b6d8274a5 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -186,9 +186,9 @@ function societe_prepare_head(Societe $object) if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) { $head[$h][1] = $langs->trans("Events"); - $head[$h][1].= ' / '; + $head[$h][1].= '/'; } - $head[$h][1].= $langs->trans("Info"); + $head[$h][1].= $langs->trans("Agenda"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index a39783820f8..98b281d04dd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -209,7 +209,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); -- Accounting Expert -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '(! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); -- Dispatch insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 2, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index cbd4b035c4e..5a853baad51 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param DoliDB $db Database handler * @param string $atarget Target * @param int $type_user 0=Menu for backoffice, 1=Menu for front office - * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param array $menu Object Menu to return back list of menu entries + * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @return int 0 */ diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1ce08a25bba..7164f52393f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @param array $menu Object Menu to return back list of menu entries + * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout 1=Disable output (Initialise &$menu only). * @return int 0 */ diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 1434399d225..918b338aa12 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -49,7 +49,7 @@ class pdf_proforma extends pdf_einstein function __construct($db) { global $conf,$langs,$mysoc; - + parent::__construct($db); $this->name = "proforma"; @@ -64,13 +64,14 @@ class pdf_proforma extends pdf_einstein * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output + * @param string $titlekey Translation key to show as title of document * @return void */ - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="InvoiceProForma") { global $conf,$langs,$hookmanager; - parent::_pagehead($pdf, $object, $showaddress, $outputlangs, "InvoiceProForma"); + parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey); } } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php old mode 100755 new mode 100644 diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index ae556b6d7f2..86c772fe4c8 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -165,11 +165,11 @@ class modBanque extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='Bordereaux remise Chq/Fact'; $this->export_permission[$r]=array(array("banque","export")); - $this->export_fields_array[$r]=array("bch.rowid"=>"DepositId","bch.number"=>"Numero","bch.ref_ext"=>"RefExt",'ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.num_chq'=>'ChequeOrTransferNumber','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation", + $this->export_fields_array[$r]=array("bch.rowid"=>"DepositId","bch.ref"=>"Numero","bch.ref_ext"=>"RefExt",'ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.num_chq'=>'ChequeOrTransferNumber','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation", "bch.date_bordereau"=>"Date","bch.amount"=>"Total","bch.nbcheque"=>"NbCheque","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","f.facnumber"=>"InvoiceRef" ); $this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.num_chq'=>'Text','b.amount'=>'Numeric','b.num_releve'=>'Text','b.datec'=>"Date", - "bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.number"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","f.facnumber"=>"Text" + "bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.ref"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","f.facnumber"=>"Text" ); $this->export_entities_array[$r]=array('ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.num_chq'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account", "bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company","f.facnumber"=>"invoice"); diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index ea44daee18e..4f7baff0c64 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -83,7 +83,7 @@ class modExpedition extends DolibarrModules // Constants $this->const = array(); $r=0; - + $this->const[$r][0] = "EXPEDITION_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "rouget"; @@ -125,14 +125,14 @@ class modExpedition extends DolibarrModules $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; $this->const[$r][3] = "Enable shipments"; $this->const[$r][4] = 0; $r++; - + // Boxes $this->boxes = array(); @@ -224,8 +224,14 @@ class modExpedition extends DolibarrModules include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $shipment=new Commande($this->db); - $idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,''))); - + $contact_arrays=$shipment->liste_type_contact('external','',0,0,''); + if (is_array($contact_arrays) && count($contact_arrays)>0){ + $idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,''))); + } else { + $idcontacts=0; + } + + $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found) @@ -237,7 +243,7 @@ class modExpedition extends DolibarrModules $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment",'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment",'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note_public'=>"shipment",'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product','p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product'); if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); $this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { $keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 1f0756a666c..4c5b654a76f 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -117,7 +117,7 @@ $coldisplay=-1; // We remove first td } $coldisplay++; - print ''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 35ef726be20..6d3f7b05966 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -705,7 +705,9 @@ class Expedition extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref)); if ($result < 0) { - $error++; break; + $error++; + $this->errors[]=$mouvS->error; + break; } } else @@ -713,17 +715,12 @@ class Expedition extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch); + // ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) + $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); if ($result < 0) { - $error++; break; - } - - // We update content of table llx_product_batch (will be rename into llx_product_stock_batch inantoher version) - // We can set livraison_batch to deprecated and adapt livraison to handle batch too (mouvS->_create also calls mouvS->_create_batch) - if (! empty($conf->productbatch->enabled)) - { - $result=$mouvS->livraison_batch($obj->fk_origin_stock, $qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version) - if ($result < 0) { $error++; $this->errors[]=$mouvS->error; break; } + $error++; + $this->errors[]=$mouvS->error; + break; } } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a946649592a..71b852880fb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -333,7 +333,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -390,6 +390,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id else { $mesg=$mailfile->error; + setEventMessages($mesg, null, 'errors'); } // END - Send mail } @@ -438,7 +439,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -542,7 +543,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -583,7 +584,6 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user else { setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors'); - $mesg="Impossible d'envoyer l'email."; } // END - Send mail } @@ -627,7 +627,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_ if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -667,6 +667,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_ else { $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); } // END - Send mail } @@ -756,7 +757,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) if ($result > 0) { - if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) + if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition { // Send mail @@ -806,9 +807,8 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid) endif; else: - - $mesg="Impossible d'envoyer l'email."; - + $mesg="Impossible d'envoyer l'email."; + setEventMessages($mesg, null, 'errors'); endif; // END - Send mail } @@ -921,7 +921,7 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes") $total_ht = $object_ligne->total_ht; $total_tva = $object_ligne->total_tva; - $result=$object->deleteline(GETPOST("rowid")); + $result=$object->deleteline(GETPOST("rowid"), $user); if ($result >= 0) { if ($result > 0) @@ -961,7 +961,6 @@ if ($action == "updateligne" ) $rowid = $_POST['rowid']; $type_fees_id = GETPOST('fk_c_type_fees'); - $object_ligne->vatrate = price2num(GETPOST('vatrate')); $projet_id = $fk_projet; $comments = GETPOST('comments'); $qty = GETPOST('qty'); @@ -983,6 +982,7 @@ if ($action == "updateligne" ) if (! $error) { + // TODO Use update method of ExpenseReportLine $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id); if ($result >= 0) { @@ -1078,29 +1078,6 @@ $formfile = new FormFile($db); $formproject = new FormProjets($db); $projecttmp = new Project($db); -if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) -{ - if(!empty($_GET['mesg'])) - { - $text_mesg = explode(",",$_GET['mesg']); - - foreach($text_mesg as $text) - { - $mesg.= "- ".$langs->trans($text)."
"; - } - - print "
"; - print $langs->trans("LINE_NOT_ADDED")."
"; - print $mesg; - print "
"; - } - else - { - if ($mesg) print "
".$mesg."
"; - } -} - - // Create if ($action == 'create') { diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 3e629e05789..fc24d8c8326 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -120,7 +120,7 @@ if ($resql) foreach ($listofstatus as $status) { $dataseries[]=array('label'=>$fichinterstatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0)); - if ($status==3 && $bool==false) $bool=true; + if ($status==3 && ! $bool) $bool=true; else $bool=false; } if ($conf->use_javascript_ajax) @@ -144,7 +144,7 @@ if ($resql) print ''; print ''; print "\n"; - if ($status==3 && $bool==false) $bool=true; + if ($status==3 && ! $bool) $bool=true; else $bool=false; } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index b64a8ee77e4..8c533f0f547 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -231,7 +231,7 @@ if ($object->id > 0) // Categories if (! empty($conf->categorie->enabled)) { - print ''; + print ''; print '"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index cb7d0ce6e6f..f8c57d7cc94 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1126,7 +1126,7 @@ class CommandeFournisseur extends CommonOrder // insert products details into database for ($i=0;$i<$num;$i++) { - $result = $this->addline( + $result = $this->addline( // This include test on qty if option SUPPLIERORDER_WITH_NOPRICEDEFINED is not set $this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, @@ -1306,11 +1306,11 @@ class CommandeFournisseur extends CommonOrder */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null) { - global $langs,$mysoc, $conf; + global $langs,$mysoc,$conf; $error = 0; - dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2. $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit"); + dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit"); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Clean parameters @@ -1350,40 +1350,45 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - if ($fk_prod_fourn_price > 0) + if ($fk_product > 0) { - $prod = new Product($this->db, $fk_product); - if ($prod->fetch($fk_product) > 0) + if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED)) { - $result=$prod->get_buyprice($fk_prod_fourn_price,$qty,$fk_product,$fourn_ref); - if ($result > 0) + // Check quantity is enough + dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); + $prod = new Product($this->db, $fk_product); + if ($prod->fetch($fk_product) > 0) { - $label = $prod->libelle; - $pu = $prod->fourn_pu; - $ref = $prod->ref_fourn; - $product_type = $prod->type; + $result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, $fourn_ref); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref + if ($result > 0) + { + $label = $prod->libelle; + $pu = $prod->fourn_pu; + $ref = $prod->ref_fourn; + $product_type = $prod->type; + } + if ($result == 0 || $result == -1) + { + $langs->load("errors"); + $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); + $this->db->rollback(); + dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG); + return -1; + } + if ($result < -1) + { + $this->error=$prod->error; + $this->db->rollback(); + dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); + return -1; + } } - if ($result == 0 || $result == -1) - { - $langs->load("errors"); - $this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier"); - $this->db->rollback(); - dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG); - return -1; - } - if ($result < -1) - { + else + { $this->error=$prod->error; - $this->db->rollback(); - dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); return -1; } } - else - { - $this->error=$prod->error; - return -1; - } } else { @@ -1449,7 +1454,6 @@ class CommandeFournisseur extends CommonOrder $sql.= ", ".$multicurrency_total_ttc; $sql.= ")"; - dol_syslog(get_class($this)."::addline", LOG_DEBUG); $resql=$this->db->query($sql); //print $sql; if ($resql) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 48896689dce..05024f9991a 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -216,7 +216,7 @@ class ProductFournisseur extends Product $this->db->begin(); - if ($this->product_fourn_price_id) + if ($this->product_fourn_price_id > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " SET fk_user = " . $user->id." ,"; @@ -237,7 +237,7 @@ class ProductFournisseur extends Product $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc - dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG); + dol_syslog(get_class($this).'::update_buyprice update knowing id of line = product_fourn_price_id = '.$this->product_fourn_price_id, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -249,7 +249,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); - return 0; + return $this->product_fourn_price_id; } else { @@ -267,94 +267,88 @@ class ProductFournisseur extends Product else { - // Delete price for this quantity - $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; - $sql.= " WHERE fk_soc = ".$fourn->id." AND ref_fourn = '".$this->db->escape($ref_fourn)."' AND quantity = ".$qty." AND entity = ".$conf->entity; - dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - // Add price for this quantity to supplier - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)"; - $sql.= " values('".$this->db->idate($now)."',"; - $sql.= " ".$this->id.","; - $sql.= " ".$fourn->id.","; - $sql.= " '".$this->db->escape($ref_fourn)."',"; - $sql.= " ".$user->id.","; - $sql.= " ".$buyprice.","; - $sql.= " ".$qty.","; - $sql.= " ".$remise_percent.","; - $sql.= " ".$remise.","; - $sql.= " ".$unitBuyPrice.","; - $sql.= " ".$tva_tx.","; - $sql.= " ".$charges.","; - $sql.= " ".$unitCharges.","; - $sql.= " ".$availability.","; - $sql.= " ".$newnpr.","; - $sql.= $conf->entity.","; - $sql.= $delivery_time_days.","; - $sql.= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'"); - $sql.=")"; - - dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG); - if (! $this->db->query($sql)) - { - $error++; - } - - if (! $error && !empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) - { - // Add record into log table - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log("; - $sql.= "datec, fk_product_fournisseur,fk_user,price,quantity)"; - $sql.= "values('".$this->db->idate($now)."',"; - $sql.= " ".$this->product_fourn_id.","; - $sql.= " ".$user->id.","; - $sql.= " ".price2num($buyprice).","; - $sql.= " ".$qty; - $sql.=")"; - - $resql=$this->db->query($sql); - if (! $resql) - { - $error++; - } - } - - - if (! $error) - { - // Call trigger - $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$user); - if ($result < 0) $error++; + dol_syslog(get_class($this) . '::update_buyprice without knowing id of line, so we delete from company, quantity and supplier_ref and insert again', LOG_DEBUG); + + // Delete price for this quantity + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_fournisseur_price"; + $sql .= " WHERE fk_soc = " . $fourn->id . " AND ref_fourn = '" . $this->db->escape($ref_fourn) . "' AND quantity = " . $qty . " AND entity = " . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + // Add price for this quantity to supplier + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price("; + $sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)"; + $sql .= " values('" . $this->db->idate($now) . "',"; + $sql .= " " . $this->id . ","; + $sql .= " " . $fourn->id . ","; + $sql .= " '" . $this->db->escape($ref_fourn) . "',"; + $sql .= " " . $user->id . ","; + $sql .= " " . $buyprice . ","; + $sql .= " " . $qty . ","; + $sql .= " " . $remise_percent . ","; + $sql .= " " . $remise . ","; + $sql .= " " . $unitBuyPrice . ","; + $sql .= " " . $tva_tx . ","; + $sql .= " " . $charges . ","; + $sql .= " " . $unitCharges . ","; + $sql .= " " . $availability . ","; + $sql .= " " . $newnpr . ","; + $sql .= $conf->entity . ","; + $sql .= $delivery_time_days . ","; + $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'"); + $sql .= ")"; + + $idinserted = 0; + + $resql = $this->db->query($sql); + if ($resql) { + $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + } + else { + $error++; + } + + if (! $error && ! empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { + // Add record into log table + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log("; + $sql .= "datec, fk_product_fournisseur,fk_user,price,quantity)"; + $sql .= "values('" . $this->db->idate($now) . "',"; + $sql .= " " . $this->product_fourn_id . ","; + $sql .= " " . $user->id . ","; + $sql .= " " . price2num($buyprice) . ","; + $sql .= " " . $qty; + $sql .= ")"; + + $resql = $this->db->query($sql); + if (! $resql) { + $error++; + } + } + + if (! $error) { + // Call trigger + $result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE', $user); + if ($result < 0) + $error++; // End call triggers - - if (empty($error)) - { - $this->db->commit(); - return 0; - } - else - { - $this->db->rollback(); - return -1; - } - } - else - { - $this->error=$this->db->error()." sql=".$sql; - $this->db->rollback(); - return -2; - } - } - else - { - $this->error=$this->db->error()." sql=".$sql; - $this->db->rollback(); - return -1; - } - } + + if (empty($error)) { + $this->db->commit(); + return $idinserted; + } else { + $this->db->rollback(); + return -1; + } + } else { + $this->error = $this->db->lasterror() . " sql=" . $sql; + $this->db->rollback(); + return -2; + } + } else { + $this->error = $this->db->lasterror() . " sql=" . $sql; + $this->db->rollback(); + return - 1; + } + } } /** diff --git a/htdocs/includes/ckeditor/ckeditor/CHANGES.md b/htdocs/includes/ckeditor/ckeditor/CHANGES.md index f751de99327..f1fb5c7a31d 100644 --- a/htdocs/includes/ckeditor/ckeditor/CHANGES.md +++ b/htdocs/includes/ckeditor/ckeditor/CHANGES.md @@ -1,6 +1,21 @@ CKEditor 4 Changelog ==================== +## CKEditor 4.5.9 + +Fixed Issues: + +* [#10685](http://dev.ckeditor.com/ticket/10685): Fixed: Unreadable toolbar icons after updating to the new editor version. Fixed with [6876179](https://github.com/ckeditor/ckeditor-dev/commit/6876179db4ee97e786b07b8fd72e6b4120732185) in [ckeditor-dev](https://github.com/ckeditor/ckeditor-dev) and [6c9189f4](https://github.com/ckeditor/ckeditor-presets/commit/6c9189f46392d2c126854fe8889b820b8c76d291) in [ckeditor-presets](https://github.com/ckeditor/ckeditor-presets). +* [#14573](https://dev.ckeditor.com/ticket/14573): Fixed: Missing [Widget](http://ckeditor.com/addon/widget) drag handler CSS when there are multiple editor instances. +* [#14620](https://dev.ckeditor.com/ticket/14620): Fixed: Setting both the `min-height` style for the `` element and the `height` style for the `` element breaks the [Auto Grow](http://ckeditor.com/addon/autogrow) plugin. +* [#14538](http://dev.ckeditor.com/ticket/14538): Fixed: Keyboard focus goes into an embedded `
'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'
'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'
situation_counter > 1) print ' readonly'; print '>
' . $langs->trans("Categories") . '
' . $langs->trans("SuppliersCategoriesShort") . ''; print $form->showCategories($object->id, 'supplier', 1); print "