diff --git a/.travis.yml b/.travis.yml index 637ba35995b..54fc180f515 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,9 @@ # from Dolibarr GitHub repository. # For syntax, see https://docs.travis-ci.com/user/languages/php/ -# We use dist: xenial to have php 5.6+ available +# We use dist: bionic = 18.04 os: linux -dist: xenial -#dist: bionic +dist: bionic language: php @@ -18,22 +17,43 @@ services: - mysql - postgresql + +before_install: +- | + echo "Add ondrej PPA" + sudo add-apt-repository -y ppa:ondrej/php + sudo apt-get update + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + echo $PHP_VERSION_NAME + ls ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/ + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + phpenv rehash + echo + addons: - # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '9.4' + # Force postgresql version + postgresql: '10' apt: sources: - # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - - pgdg-xenial + - sourceline: 'ppa:ondrej/php' packages: # We need a webserver to test the webservices # Let's install Apache with. - apache2 - # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi # We need pgloader for import mysql database into pgsql - pgloader - + - php + - php7.1-pgsql + - php7.1-mysqli + - php7.1-xml + - php7.1-intl + - php8.1-pgsql + - php8.1-mysqli + - php8.1-xml + - php8.1-intl + env: global: # Set to true for very verbose output @@ -44,20 +64,20 @@ jobs: #allow_failures: #- php: nightly include: - - stage: PHP 5.6-7.4 + - stage: PHP 7.0-8.1 if: type = push - php: '5.6' + php: '7.1' env: DB=postgresql - - stage: PHP 5.6-7.4 + - stage: PHP 7.0-8.1 if: type = pull_request OR type = push - php: '7.4.22' + php: '8.1' env: DB=mysql - stage: PHP Dev if: type = push AND branch = develop php: nightly env: DB=mysql - stage: PHP Dev - if: type = push AND branch = 15.0 + if: type = push AND branch = 17.0 php: nightly env: DB=mysql @@ -72,13 +92,6 @@ notifications: on_failure: always use_notice: true -before_install: -- | - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo install: - | @@ -94,13 +107,6 @@ install: - | echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION" - if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then - composer -n require phpunit/phpunit ^5 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - php-parallel-lint/php-var-dump-check ~0.4 \ - squizlabs/php_codesniffer ^3 - fi if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then composer -n require phpunit/phpunit ^6 \ php-parallel-lint/php-parallel-lint ^1 \ @@ -116,8 +122,8 @@ install: squizlabs/php_codesniffer ^3 fi # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then - composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ + if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require --ignore-platform-reqs phpunit/phpunit ^7.5.20 \ php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-console-highlighter ^0 \ php-parallel-lint/php-var-dump-check ~0.4 \ @@ -246,6 +252,10 @@ before_script: - echo "Setting up Apache + FPM" + # setup link for php legacy + - sudo ln -s ~/.phpenv/versions/$(phpenv version-name)/bin/php /bin/php + # install apache web server + - sudo apt-get install apache2 php-fpm php-mysql php-pgsql php-gd php-ldap php-xml php-mbstring libapache2-mod-php # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | @@ -253,10 +263,11 @@ before_script: # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi - - sudo a2enmod rewrite actions fastcgi alias + - sudo a2enmod proxy_fcgi rewrite setenvif cgi alias - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - - sudo chown -R travis:travis /var/lib/apache2/fastcgi + #- sudo chown -R travis:travis /var/lib/apache2/fastcgi + # start php-fpm - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm # configure apache virtual hosts - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf @@ -471,6 +482,9 @@ after_script: ls $TRAVIS_BUILD_DIR/documents #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + echo "After script - Output last lines of apache error.log" + sudo ls /var/log/apache2 + sudo tail -n 50 /var/log/apache2/travis_error_log after_success: - | @@ -479,16 +493,16 @@ after_success: after_failure: - | echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files + # This part of code is executed only if the command that fails are enclosed with set +e + # Show upgrade log files for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` do echo "Debugging informations for file $ficlog" #cat $ficlog done - # Apache log file + # Show Apache log file echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/travis_error_log + sudo tail -n 50 /var/log/apache2/travis_error_log if [ "$DEBUG" = true ]; then # Dolibarr log file echo "Debugging informations for file dolibarr.log (latest 50 lines)" diff --git a/COPYRIGHT b/COPYRIGHT index 8c8a1f56355..46e2f093900 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -13,7 +13,7 @@ The Dolibarr images resources (available in the doc directory) is distributed un The name Dolibarr is a trademark initially registered by Laurent Destailleur and ceased to the Dolibarr foundation. You can use the name Dolibarr -for your own need as long as you follow the rules defined on the page https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22 +for your own need as long as you follow the rules defined on the page https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22 The use of the name DoliStore is also restricted to the same rules defined on https://wiki.dolibarr.org/index.php/Rules_to_use_the_brand_name_%22Dolibarr%22 @@ -31,11 +31,11 @@ Mobiledetect 2.8.39 MIT License Yes NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency ParseDown 1.6 MIT License Yes Markdown parser -PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files +PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files -php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP +php-iban 4.1.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar) diff --git a/ChangeLog b/ChangeLog index 33459d4f234..e1030fa18de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ English Dolibarr ChangeLog For users: --------------- +NEW Minimal PHP version is now PHP 7.0 instead of PHP 5.6 + ... @@ -28,8 +30,8 @@ Following changes may create regressions for some external modules, but were nec For users: --------------- -NEW: PHP 8.1 compatibility: - Warning!! Application works correctly with PHP8 and 8.1 but you will experience a lot of PHP warnings into the PHP server +NEW: PHP 8.0 and 8.1 compatibility: + Warning!! Application works correctly with PHP 8.0 and 8.1 but you will experience a lot of PHP warnings into the PHP server log files (depending on your PHP setup). Removal of all PHP warnings on server side is planned for v17. NEW: Support for recurring purchase invoices. NEW: #20292 Include German public holidays diff --git a/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf new file mode 100644 index 00000000000..45b4a9b8084 --- /dev/null +++ b/dev/setup/fail2ban/filter.d/web-dolibarr-limitpublic.conf @@ -0,0 +1,20 @@ +# Fail2Ban configuration file +# +# Regexp to catch known spambots and software alike. Please verify +# that it is your intent to block IPs which were driven by +# above mentioned bots. + + +[Definition] + +# To test, you can inject this example into log +# echo `date +'%Y-%m-%d %H:%M:%S'`" INFO 1.2.3.4 --- Access to GET /public/clicktodial/cidlookup.php" >> /mypath/documents/dolibarr.log +# +# then +# fail2ban-client status web-dol-passforgotten +# +# To test rule file on a existing log file +# fail2ban-regex /mypath/documents/dolibarr.log /etc/fail2ban/filter.d/web-dolibarr-limitpublic.conf + +failregex = ^ [A-Z\s]+ \s+--- Access to .*/public/ +ignoreregex = diff --git a/dev/setup/fail2ban/jail.local b/dev/setup/fail2ban/jail.local index bd506e20812..733987aa45c 100644 --- a/dev/setup/fail2ban/jail.local +++ b/dev/setup/fail2ban/jail.local @@ -8,21 +8,35 @@ enabled = true port = http,https filter = web-dolibarr-rulespassforgotten -logpath = >> /mypath/documents/documents/dolibarr.log +logpath = /mypath/documents/documents/dolibarr.log action = %(action_mw)s bantime = 4320000 ; 50 days findtime = 86400 ; 1 day maxretry = 10 + [web-dol-bruteforce] ; rule against bruteforce hacking (login + api) enabled = true port = http,https filter = web-dolibarr-rulesbruteforce -logpath = >> /mypath/documents/documents/dolibarr.log +logpath = /mypath/documents/documents/dolibarr.log action = %(action_mw)s bantime = 86400 ; 1 day findtime = 3600 ; 1 hour maxretry = 10 + +[web-dol-limitpublic] + +; rule to add rate limit on some public pages +enabled = true +port = http,https +filter = web-dolibarr-limitpublic +logpath = /mypath/documents/documents/dolibarr.log +action = %(action_mw)s +bantime = 86400 ; 1 day +findtime = 86400 ; 1 day +maxretry = 500 + diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 71e80f703af..c374f5ba9fe 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -653,21 +653,28 @@ if (!empty($sortfield)) { // Export into a file with format defined into setup (FEC, CSV, ...) // Must be after definition of $sql if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) { - // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumew too much memory on large export. Replace this with the query($sql) and loop on each line to export them. + // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumes too much memory on large export. + // Replace this with the query($sql) and loop on each line to export them. $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1)); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - // Export files + // Export files then exit $accountancyexport = new AccountancyExport($db); + + $mimetype = $accountancyexport->getMimeType($formatexportset); + + top_httphead($mimetype, 1); + + // Output data on screen $accountancyexport->export($object->lines, $formatexportset); $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha'); $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha'); if (!empty($accountancyexport->errors)) { - setEventMessages('', $accountancyexport->errors, 'errors'); + dol_print_error('', '', $accountancyexport->errors); } elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) { // Specify as export : update field date_export or date_validated $error = 0; @@ -701,11 +708,10 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex if (!$error) { $db->commit(); - // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExportedOrValidated"), null, 'mesgs'); } else { $error++; $db->rollback(); - setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null, 'errors'); + dol_print_error('', $langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated")); } } exit; @@ -861,8 +867,8 @@ if ($optioncss != '') { print ''; } print ''; -print ''; -print ''; +print ''; +print ''; print ''; if (count($filter)) { @@ -883,7 +889,7 @@ if (empty($reshook)) { $newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").''; if (!empty($user->rights->accounting->mouvements->export)) { - $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); + $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); } $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); @@ -983,14 +989,14 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount'); print ''; } else { - print ''; + print ''; } print ''; } // Label operation if (!empty($arrayfields['t.label_operation']['checked'])) { print ''; - print ''; + print ''; print ''; } // Debit @@ -1008,7 +1014,7 @@ if (!empty($arrayfields['t.credit']['checked'])) { // Lettering code if (!empty($arrayfields['t.lettering_code']['checked'])) { print ''; - print ''; + print ''; print '
'.$langs->trans("NotReconciled").''; print ''; } @@ -1116,10 +1122,10 @@ if (!empty($arrayfields['t.tms']['checked'])) { print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.date_export']['checked'])) { - print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.date_validated']['checked'])) { - print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.import_key']['checked'])) { print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center '); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e4af034b1f4..390aaa9ed4a 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -286,6 +286,28 @@ class AccountancyExport } + /** + * Return the MIME type of a file + * + * @param int $formatexportset Id of export format + * @return string MIME type. + */ + public function getMimeType($formatexportset) + { + $mime = 'text/csv'; + + switch ($formatexportset) { + case self::$EXPORT_TYPE_FEC: + $mime = 'text/tab-separated-values'; + break; + default: + $mime = 'text/csv'; + break; + } + + return $mime; + } + /** * Function who chose which export to use with the default config, and make the export into a file * diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0b2a060d7a2..ebd7df6bbc8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -169,6 +169,16 @@ class BookKeeping extends CommonObject */ public $piece_num; + /** + * @var integer|string date of movement validated & lock + */ + public $date_validation; + + /** + * @var integer|string date of movement who are noticed like exported + */ + public $date_export; + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -788,8 +798,7 @@ class BookKeeping extends CommonObject $this->piece_num = $obj->piece_num; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_export = $this->db->jdate($obj->date_export); - $this->date_validation = $this->db->jdate($obj->date_validated); - $this->date_validation = $this->db->jdate($obj->date_validation); + $this->date_validation = isset($obj->date_validated) ? $this->db->jdate($obj->date_validated) : ''; } $this->db->free($resql); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 34faba7e27c..d2b37c11a87 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -294,9 +294,7 @@ if ($action == 'writebookkeeping') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -636,9 +634,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; @@ -767,7 +763,7 @@ if (empty($action) || $action == 'view') { $periodlink = ''; $exportlink = ''; $builddate = dol_now(); - $description .= $langs->trans("DescJournalOnlyBindedVisible").'
'; + $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { @@ -847,9 +843,7 @@ if (empty($action) || $action == 'view') { foreach ($tabfac as $key => $val) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - $companystatic->code_compta = $tabcompany[$key]['code_compta']; $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; - $companystatic->code_client = $tabcompany[$key]['code_client']; $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->fournisseur = 1; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index d34d1f5c3dc..675c900680d 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -311,9 +311,7 @@ if ($action == 'writebookkeeping') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; @@ -601,9 +599,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; @@ -791,9 +787,7 @@ if (empty($action) || $action == 'view') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->code_compta = $tabcompany[$key]['code_compta']; - $companystatic->code_compta_fournisseur = $tabcompany[$key]['code_compta_fournisseur']; $companystatic->code_client = $tabcompany[$key]['code_client']; - $companystatic->code_fournisseur = $tabcompany[$key]['code_fournisseur']; $companystatic->client = 3; $invoicestatic->id = $key; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 73c527cb2eb..ae26b84baa5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1405,7 +1405,7 @@ class Adherent extends CommonObject $this->email = $obj->email; $this->url = $obj->url; - $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); + $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); $this->photo = $obj->photo; $this->statut = $obj->statut; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index f55190f7bf8..43472c9724c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -843,7 +843,7 @@ if (empty($reshook)) { $_POST["accountancy_code_buy"] = ''; // If empty, we force to null } if ($id == 10 && GETPOSTISSET("code")) { // Spaces are not allowed into code for tax dictionary - $_POST["code"] = preg_replace('/[^a-zA-Z0-9\-\+]/', '', GETPOST("code")); + $_POST["code"] = preg_replace('/[^a-zA-Z0-9_\-\+]/', '', GETPOST("code")); } $tablename = $tabname[$id]; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 19486510f58..8dfafb19b63 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -146,6 +146,7 @@ if (GETPOST('addfilter', 'alpha')) { $emailcollectorfilter->rulevalue = GETPOST('rulevalue', 'alpha'); $emailcollectorfilter->fk_emailcollector = $object->id; $emailcollectorfilter->status = 1; + $result = $emailcollectorfilter->create($user); if ($result > 0) { @@ -235,10 +236,25 @@ if ($action == 'deleteoperation') { } } +if ($action == 'collecttest') { + dol_include_once('/emailcollector/class/emailcollector.class.php'); + + $res = $object->doCollectOneCollector(1); + if ($res > 0) { + $debuginfo = $object->debuginfo; + setEventMessages($object->lastresult, null, 'mesgs'); + } else { + $debuginfo = $object->debuginfo; + setEventMessages($object->error, null, 'errors'); + } + + $action = ''; +} + if ($action == 'confirm_collect') { dol_include_once('/emailcollector/class/emailcollector.class.php'); - $res = $object->doCollectOneCollector(); + $res = $object->doCollectOneCollector(0); if ($res > 0) { $debuginfo = $object->debuginfo; setEventMessages($object->lastresult, null, 'mesgs'); @@ -784,6 +800,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.$langs->trans("ToClone").'
'; // Collect now + print '
'.$langs->trans("TestCollectNow").'
'; + if (count($object->actions) > 0) { print '
'.$langs->trans("CollectNow").'
'; } else { diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 424c426f023..0f8fec1cecc 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -143,7 +143,7 @@ if (!function_exists("ldap_connect")) { print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); -print $langs->trans("LDAPDescContact").'
'; +print ''.$langs->trans("LDAPDescContact").'
'; print '
'; print '
'; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 2422282655e..23a4103bc75 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -117,7 +117,7 @@ if (!function_exists("ldap_connect")) { print dol_get_fiche_head($head, 'groups', $langs->trans("LDAPSetup"), -1); -print $langs->trans("LDAPDescGroups").'
'; +print ''.$langs->trans("LDAPDescGroups").'
'; print '
'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 010b5c08e33..b7783c99ca0 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -191,7 +191,7 @@ print ''; print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); -print $langs->trans("LDAPDescMembers").'
'; +print ''.$langs->trans("LDAPDescMembers").'
'; print '
'; print ''; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 0a71033d465..abb017ea037 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -109,7 +109,7 @@ if (!function_exists("ldap_connect")) { print dol_get_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1); -print $langs->trans("LDAPDescMembersTypes").'
'; +print ''.$langs->trans("LDAPDescMembersTypes").'
'; print '
'; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index a333536a440..2ec3ef169d8 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -180,7 +180,7 @@ print ''; print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1); -print $langs->trans("LDAPDescUsers").'
'; +print ''.$langs->trans("LDAPDescUsers").'
'; print '
'; @@ -501,9 +501,9 @@ if (function_exists("ldap_connect")) { // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement"))); - // Get from LDAP database an array of results + // Get from LDAP database an array of results by making a search on + // $filter = '('.ldap_escape(getDolGlobalString('LDAP_KEY_USERS'), '', LDAP_ESCAPE_FILTER).'=*)'; $ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1); - //$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1); if (is_array($ldapusers)) { $liste = array(); @@ -526,7 +526,7 @@ if (function_exists("ldap_connect")) { print "search: *
\n"; print "userDN: ".getDolGlobalString('LDAP_USER_DN')."
\n"; print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')."
\n"; - print "required_fields: ".implode(',', $required_fields)."
\n"; + print "requested fields: ".implode(',', $required_fields)."
\n"; print "=> ".count($liste)." records
\n"; print "\n
"; } else { diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 1f2966b05b1..e50b4f772c6 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -15,7 +15,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -24,6 +23,7 @@ * \brief Setup page to configure oauth access api */ + // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -37,7 +37,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Load translation files required by the page -$langs->loadLangs(array('admin', 'oauth')); +$langs->loadLangs(array('admin', 'oauth', 'modulebuilder')); // Security check if (!$user->admin) { @@ -85,7 +85,12 @@ if ($action == 'update') { } } if (GETPOSTISSET($constvalue.'_SCOPE')) { - if (!dolibarr_set_const($db, $constvalue.'_SCOPE', GETPOST($constvalue.'_SCOPE'), 'chaine', 0, '', $conf->entity)) { + $scopestring = implode(',', GETPOST($constvalue.'_SCOPE')); + if (!dolibarr_set_const($db, $constvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } else { + if (!dolibarr_set_const($db, $constvalue.'_SCOPE', '', 'chaine', 0, '', $conf->entity)) { $error++; } } @@ -111,7 +116,7 @@ $form = new Form($db); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup'); -print ''; +print ''; print ''; print ''; @@ -141,22 +146,16 @@ foreach ($list as $key) { } print ''; print ajax_combobox('provider'); -print ' '; +print ' '; print ' '; + +print '
'; +print '
'; + +print dol_get_fiche_end(); + print ''; -print '
'; -print '
'; - - -print '
'; -print ''; -print ''; - -print '
'; -print '
'; - -$i = 0; // Define $listinsetup foreach ($conf->global as $key => $val) { @@ -172,112 +171,144 @@ foreach ($conf->global as $key => $val) { } } -// $list is defined into oauth.lib.php to the list of supporter OAuth providers. -foreach ($listinsetup as $key) { - $supported = 0; - $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME - $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); - $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); - if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { - $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); - } else { - $keyforprovider = ''; - } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); - $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) { - $supported = 1; - } - if (!$supported) { - continue; // show only supported - } +if (count($listinsetup) > 0) { + print ''; + print ''; + print ''; - $i++; + print '
'; - // Api Name - $label = $langs->trans($keyforsupportedoauth2array); - print '
'; - print ''; - print ''; - print ''; + $i = 0; - if ($supported) { - $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php'; - print ''; - print ''; - print ''; - - if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { - print ''; - print ''; - print ''; + // $list is defined into oauth.lib.php to the list of supporter OAuth providers. + foreach ($listinsetup as $key) { + $supported = 0; + $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME + $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); + } else { + $keyforprovider = ''; } - } else { - print ''; - print ''; - print ''; - print ''; - } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - // Api Id - print ''; - print ''; - print ''; + if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) { + $supported = 1; + } + if (!$supported) { + continue; // show only supported + } - // Api Secret - print ''; - print ''; - print ''; + $i++; - // TODO Move this into token generation - if ($supported) { - if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { + print '
'; - print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); - if ($label == $keyforsupportedoauth2array) { - print $supportedoauth2array[$keyforsupportedoauth2array]['name']; - } else { - print $label; - } - if ($keyforprovider) { - print ' ('.$keyforprovider.')'; - } else { - print ' ('.$langs->trans("NoName").')'; - } - print ''; - if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) { - print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']); - } - print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''; - print '
'.$langs->trans("URLOfServiceForAuthorization").''; - print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").'
'; - print '
'; - print '
'; + + // OAUTH service name + $label = $langs->trans($keyforsupportedoauth2array); + print ''; + print ''; + print ''; + print ''; + + if ($supported) { + $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php'; print ''; - print ''; - print ''; + print ''; + + if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { + print ''; + print ''; + print ''; + } } else { print ''; - print ''; - print ''; + print ''; print ''; } + + // Api Id + print ''; + print ''; + print ''; + + // Api Secret + print ''; + print ''; + print ''; + + // TODO Move this into token generation + if ($supported) { + if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { + print ''; + print ''; + print ''; + } else { + $availablescopes = array_flip(explode(',', $supportedoauth2array[$keyforsupportedoauth2array]['availablescopes'])); + $currentscopes = explode(',', getDolGlobalString($key[4])); + $scopestodispay = array(); + foreach ($availablescopes as $keyscope => $valscope) { + if (in_array($keyscope, $currentscopes)) { + $scopestodispay[$keyscope] = 1; + } else { + $scopestodispay[$keyscope] = 0; + } + } + // Api Scope + print ''; + print ''; + print ''; + } + } else { + print ''; + print ''; + print ''; + print ''; + } + + print '
'; + print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"'); + if ($label == $keyforsupportedoauth2array) { + print $supportedoauth2array[$keyforsupportedoauth2array]['name']; + } else { + print $label; + } + if ($keyforprovider) { + print ' ('.$keyforprovider.')'; + } else { + print ' ('.$langs->trans("NoName").')'; + } + print ''; + if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) { + print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']); + } + print '
'.$langs->trans("Scopes").''; - print ''; + print ''.$langs->trans("UseTheFollowingUrlAsRedirectURI").''; print '
'.$langs->trans("URLOfServiceForAuthorization").''; + print '
'.$langs->trans("Scopes").''; - //print ''; - print $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope']; + print ''.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").'
'; + print '
'; + print '
'.$langs->trans("Scopes").''; + print ''; + print '
'.$langs->trans("Scopes").''; + foreach ($scopestodispay as $scope => $val) { + print ''; + print ''; + } + print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").'
'."\n"; + + print '
'; } + + print ''; + + print $form->buttonsSaveCancel("Modify", ''); + + print ''; } -print ''."\n"; -print ''; - -print dol_get_fiche_end(); - -print $form->buttonsSaveCancel("Modify", ''); - -print ''; - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 62162616a1a..fa1fd18f049 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -172,7 +172,7 @@ if ($mode == 'setup' && $user->admin) { $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); - $shortscope = $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope']; + $shortscope = ''; if (getDolGlobalString($key[4])) { $shortscope = getDolGlobalString($key[4]); } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index b5a823edfb4..686d13e7e39 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -291,16 +291,16 @@ print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT'); print ''; print ''.$langs->trans("MAIN_PDF_MARGIN_LEFT").''; -print ''; +print ''; print ''; print ''.$langs->trans("MAIN_PDF_MARGIN_RIGHT").''; -print ''; +print ''; print ''; print ''.$langs->trans("MAIN_PDF_MARGIN_TOP").''; -print ''; +print ''; print ''; print ''.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 0ef143d36ad..edfebdcf1b2 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -163,6 +163,7 @@ class DolibarrApi unset($object->statuts_short); unset($object->statuts_logo); unset($object->statuts_long); + //unset($object->labelStatus); //unset($object->labelStatusShort); @@ -184,6 +185,7 @@ class DolibarrApi unset($object->picto); unset($object->fieldsforcombobox); + unset($object->regeximgext); unset($object->skip_update_total); unset($object->context); @@ -259,6 +261,11 @@ class DolibarrApi if (!empty($object->thirdparty) && is_object($object->thirdparty)) { $this->_cleanObjectDatas($object->thirdparty); } + + if (!empty($object->product) && is_object($object->product)) { + $this->_cleanObjectDatas($object->product); + } + return $object; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index ef99f9f7bb7..af14185b3d0 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1320,12 +1320,19 @@ class BOM extends CommonObject */ public function calculateCosts() { - global $conf; + global $conf, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $this->unit_cost = 0; $this->total_cost = 0; + $parameters=array(); + $reshook = $hookmanager->executeHooks('calculateCostsBom', $parameters, $this); // Note that $action and $object may have been modified by hook + + if ($reshook > 0) { + return $hookmanager->resPrint; + } + if (is_array($this->lines) && count($this->lines)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $productFournisseur = new ProductFournisseur($this->db); @@ -1369,16 +1376,14 @@ class BOM extends CommonObject $unit = measuringUnitString($line->fk_unit, '', '', 1); $qty = convertDurationtoHour($line->qty, $unit); - if ($conf->workstation->enabled) { - if ($tmpproduct->fk_default_workstation) { - $workstation = new Workstation($this->db); - $res = $workstation->fetch($tmpproduct->fk_default_workstation); + if ($conf->workstation->enabled && !empty($tmpproduct->fk_default_workstation)) { + $workstation = new Workstation($this->db); + $res = $workstation->fetch($tmpproduct->fk_default_workstation); - if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); - else { - $this->error = $workstation->error; + if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + else { + $this->error = $workstation->error; return -3; - } } } else { $line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT'); diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 2abd90cf538..2fd18aa0893 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -42,8 +42,12 @@ function printDropdownBookmarksList() if (!empty($_SERVER["QUERY_STRING"])) { if (is_array($_GET)) { foreach ($_GET as $key => $val) { - if ($val != '') { - $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); + if (is_array($val)) { + foreach ($val as $tmpsubval) { + $url_param[] = http_build_query(array(dol_escape_htmltag($key).'[]' => dol_escape_htmltag($tmpsubval))); + } + } elseif ($val != '') { + $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } @@ -61,10 +65,11 @@ function printDropdownBookmarksList() if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) && $val != '' && !array_key_exists($key, $url_param)) { - $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); + $url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } + $url .= ($tmpurl ? '?'.$tmpurl : ''); if (!empty($url_param)) { $url .= '&'.implode('&', $url_param); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0eaa9078cd7..7d21f4db1b6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1262,7 +1262,7 @@ class Propal extends CommonObject break; } // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d189eb22851..b02223691af 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -435,7 +435,7 @@ if (empty($reshook)) { } // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8b0967c64b6..baa20d27c18 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1073,7 +1073,7 @@ class Commande extends CommonOrder return -1; } // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 32fbe92b90d..d3e573f21bf 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -4,6 +4,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2015 Marcos García + * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,13 +30,16 @@ 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'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array('banks', 'categories', 'bills', 'companies')); +$langs->loadLangs(array('banks', 'bills', 'categories', 'companies', 'salaries')); // Security check if (GETPOSTISSET("account") || GETPOSTISSET("ref")) { @@ -59,9 +63,12 @@ $hookmanager->initHooks(array('banktreso', 'globalcard')); * View */ $societestatic = new Societe($db); +$userstatic = new User($db); $facturestatic = new Facture($db); $facturefournstatic = new FactureFournisseur($db); $socialcontribstatic = new ChargeSociales($db); +$salarystatic = new Salary($db); +$vatstatic = new TVA($db); $form = new Form($db); @@ -134,6 +141,27 @@ if (GETPOST("account") || GETPOST("ref")) { $sql .= " ORDER BY dlr ASC"; $sqls[] = $sql; + // Salaries + $sql = " SELECT 'salary' as family, sa.rowid as objid, sa.label as ref, (-1*sa.amount) as total_ttc, sa.dateep as dlr,"; + $sql .= " s.rowid as socid, CONCAT(s.firstname, ' ', s.lastname) as name, 0 as fournisseur"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as sa"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON sa.fk_user = s.rowid"; + $sql .= " WHERE sa.entity = ".$conf->entity; + $sql .= " AND sa.paye = 0"; // Not paid + $sql .= " AND (sa.fk_account IN (0, ".$object->id.") OR sa.fk_account IS NULL)"; // Id bank account of salary + $sql .= " ORDER BY dlr ASC"; + $sqls[] = $sql; + + // VAT + $sql = " SELECT 'vat' as family, t.rowid as objid, t.label as ref, (-1*t.amount) as total_ttc, t.datev as dlr,"; + $sql .= " 0 as socid, 'noname' as name, 0 as fournisseur"; + $sql .= " FROM ".MAIN_DB_PREFIX."tva as t"; + $sql .= " WHERE t.entity = ".$conf->entity; + $sql .= " AND t.paye = 0"; // Not paid + $sql .= " AND (t.fk_account IN (-1, 0, ".$object->id.") OR t.fk_account IS NULL)"; // Id bank account of vat + $sql .= " ORDER BY dlr ASC"; + $sqls[] = $sql; + // others sql $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -267,6 +295,26 @@ if (GETPOST("account") || GETPOST("ref")) { $totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done } + if ($tmpobj->family == 'salary') { + $salarystatic->ref = $tmpobj->ref; + $salarystatic->id = $tmpobj->objid; + $salarystatic->label = $langs->trans("SalaryPayment"); + $ref = $salarystatic->getNomUrl(1, ''); + + $userstatic->id = $tmpobj->socid; + $userstatic->name = $tmpobj->name; + $refcomp = $userstatic->getNomUrl(1); + + $totalpayment = -1 * $salarystatic->getSommePaiement(); // Payment already done + } + if ($tmpobj->family == 'vat') { + $vatstatic->ref = $tmpobj->ref; + $vatstatic->id = $tmpobj->objid; + $vatstatic->type = $tmpobj->type; + $ref = $vatstatic->getNomUrl(1, ''); + + $totalpayment = -1 * $vatstatic->getSommePaiement(); // Payment already done + } $parameters = array('obj' => $tmpobj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment); $reshook = $hookmanager->executeHooks('moreFamily', $parameters, $tmpobject, $action); // Note that $action and $tmpobject may have been modified by hook diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9062d98ae93..1975bf9c8e2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1251,7 +1251,7 @@ if (empty($reshook)) { $object->lines[] = $line; // insert new line in current object // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $line->product_type == 9) { $fk_parent_line = $result; } } @@ -1772,7 +1772,7 @@ if (empty($reshook)) { } // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f1e7ddd4bc2..632c61b4449 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -872,7 +872,7 @@ class Facture extends CommonInvoice ); // Defined the new fk_parent_line - if ($result > 0) { + if ($result > 0 && $newinvoiceline->product_type == 9) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 14bb45f0687..c70416fec6e 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -71,9 +71,9 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print ''.$objectlink->ref_client.''; print ''.dol_print_date($objectlink->date, 'day').''; print ''; - if ($user->rights->facture->lire) { + if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) { $sign = 1; - if ($object->type == Facture::TYPE_CREDIT_NOTE) { + if ($objectlink->type == Facture::TYPE_CREDIT_NOTE) { $sign = -1; } if ($objectlink->statut != 3) { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index d87317e2420..a1dcdba6f58 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -454,9 +454,6 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error); } } - //var_dump($paiement->amounts); - //var_dump($thirdpartyid); - //var_dump($cursoramounts); } // Update withdrawal line @@ -1057,9 +1054,9 @@ class BonPrelevement extends CommonObject $this->emetteur_iban = $account->iban; $this->emetteur_bic = $account->bic; - $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); + $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); - $this->raison_sociale = $account->proprio; + $this->raison_sociale = $account->proprio; } $this->factures = $factures_prev_id; @@ -2208,7 +2205,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf;*/ } } else { - fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); + fputs($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf); + $XML_SEPA_INFO = ''; } return $XML_SEPA_INFO; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index afcf2d4f086..5d6a58b9215 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -286,8 +286,8 @@ if ($nb) { if ($type != 'bank-transfer') { print ''; } print ''; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 53d445a4749..8e20f5b0afd 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -270,8 +270,8 @@ if ($result) { $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); - $cum_ht[$obj->dm] = !empty($obj->amount) ? $obj->amount : 0; - $cum[$obj->dm] = $obj->amount_ttc; + $cum_ht[$obj->dm] = empty($obj->amount) ? 0 : $obj->amount; + $cum[$obj->dm] = empty($obj->amount_ttc) ? 0 : $obj->amount_ttc; if ($obj->amount_ttc) { $minyearmonth = ($minyearmonth ? min($minyearmonth, $obj->dm) : $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm); @@ -303,7 +303,11 @@ if ($modecompta == 'RECETTES-DEPENSES') { $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); - $cum[$obj->dm] += $obj->amount_ttc; + if (empty($cum[$obj->dm])) { + $cum[$obj->dm] = $obj->amount_ttc; + } else { + $cum[$obj->dm] += $obj->amount_ttc; + } if ($obj->amount_ttc) { $minyearmonth = ($minyearmonth ?min($minyearmonth, $obj->dm) : $obj->dm); $maxyearmonth = max($maxyearmonth, $obj->dm); @@ -405,12 +409,6 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $case = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage), "%Y-%m"); $caseprev = dol_print_date(dol_mktime(1, 1, 1, $mois_modulo, 1, $annee_decalage - 1), "%Y-%m"); - $total_ht[$annee]=0; - $total[$annee]=0; - $cum_ht[$case]=0; - $cum[$case]=0; - - if ($annee >= $year_start) { // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output. if ($modecompta == 'CREANCES-DETTES') { // Value turnover of month w/o VAT @@ -453,7 +451,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print ""; // Percentage of month - print ''; + print ''; //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { if ($annee_decalage > $minyear && $case <= $casenow) { @@ -483,7 +481,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { } } } - print ''; + print ''; if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) { print ' '; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0a38c1294d4..638022b855a 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1068,7 +1068,7 @@ class Contact extends CommonObject $this->phone_mobile = trim($obj->phone_mobile); $this->email = $obj->email; - $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); + $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fe2d3691eac..9e488b2eafa 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8119,7 +8119,7 @@ abstract class CommonObject switch ($mode) { case "view": - $value = $this->array_options["options_".$key.$keysuffix]; // Value may be clean or formated later + $value = ((!empty($this->array_options) && array_key_exists("options_".$key.$keysuffix, $this->array_options)) ? $this->array_options["options_".$key.$keysuffix] : null); // Value may be cleaned or formated later break; case "create": case "edit": diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index e5b7512895c..1de16e0c764 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -163,7 +163,7 @@ class DolEditor $skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa } - $pluginstodisable = 'elementspath,save,flash'; + $pluginstodisable = 'elementspath,save,flash,div'; if (!empty($conf->dol_optimize_smallscreen)) { $pluginstodisable .= ',scayt,wsc,find,undo'; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8a1ea7222ce..0efee8461dc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1691,8 +1691,8 @@ class ExtraFields if (!empty($obj->$field_toshow)) { $translabel = $langs->trans($obj->$field_toshow); } - if ($translabel != $field_toshow) { - $value .= dol_trunc($translabel, 18).' '; + if ($translabel != $obj->$field_toshow) { + $value .= dol_trunc($translabel, 24).' '; } else { $value .= $obj->$field_toshow.' '; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 360a6cdcbe2..a241aa367cf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4886,7 +4886,7 @@ class Form * @param string $action Action * @param array $formquestion An array with forms complementary inputs * @param string $selectedchoice "" or "no" or "yes" - * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx + * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box * @param int $width Force width of box * @return void @@ -4919,7 +4919,7 @@ class Form * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'select', 'multiselect', 'morecss', * 'other', 'onecolumn' or 'hidden'... * @param int|string $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 - * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx + * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $height Force height of box (0 = auto) * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section. @@ -5150,6 +5150,14 @@ class Form },'; } + $jsforcursor = ''; + if ($useajax == 1) { + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n"; + $jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; + } + + $postconfirmas = 'GET'; + $formconfirm .= ' resizable: false, height: "'.$height.'", @@ -5178,16 +5186,20 @@ class Form options += "&" + inputname + "=" + encodeURIComponent(inputvalue); }); } - var urljump = pageyes + (pageyes.indexOf("?") < 0 ? "?" : "") + options; - if (pageyes.length > 0) { - // The call to urljump can be slow, so we set the wait cursor - jQuery("html,body,#id-container").addClass("cursorwait"); - var post = $.post( + var urljump = pageyes + (pageyes.indexOf("?") < 0 ? "?" : "&") + options; + if (pageyes.length > 0) {'; + if ($postconfirmas == 'GET') { + $formconfirm .= 'location.href = urljump;'; + } else { + $formconfirm .= $jsforcursor; + $formconfirm .= 'var post = $.post( pageyes, options, - (data) => {$("body").html(data)} - ); - console.log("after post"); + function(data) { $("body").html(data); jQuery("html,body,#id-container").removeClass("cursorwait"); } + );'; + } + $formconfirm .= ' + console.log("after post ok"); } $(this).dialog("close"); }, @@ -5205,15 +5217,21 @@ class Form options += "&" + inputname + "=" + encodeURIComponent(inputvalue); }); } - var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options; + var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "&") + options; //alert(urljump); - if (pageno.length > 0) { - var post = $.post( + if (pageno.length > 0) {'; + if ($postconfirmas == 'GET') { + $formconfirm .= 'location.href = urljump;'; + } else { + $formconfirm .= $jsforcursor; + $formconfirm .= 'var post = $.post( pageno, options, - (data) => {$("body").html(data)} - ); - console.log("after location.href"); + function(data) { $("body").html(data); jQuery("html,body,#id-container").removeClass("cursorwait"); } + );'; + } + $formconfirm .= ' + console.log("after post ko"); } $(this).dialog("close"); } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 48e6eab2484..ff6147977f3 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -822,7 +822,7 @@ class FormMail extends Form $out .= '
'; } } elseif (empty($this->withmaindocfile)) { - $out .= ''.$langs->trans("NoAttachedFiles").'
'; + //$out .= ''.$langs->trans("NoAttachedFiles").'
'; } if ($this->withfile == 2) { $maxfilesizearray = getMaxFileSizeArray(); @@ -831,13 +831,13 @@ class FormMail extends Form $out .= ''; // MAX_FILE_SIZE must precede the field type=file } // Can add other files - if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) { + if (empty($conf->global->FROM_MAIL_DONT_USE_INPUT_FILE_MULTIPLE)) { $out .= ''; } else { $out .= ''; } $out .= ' '; - $out .= ''; + $out .= ''; } } else { $out .= $this->withfile; @@ -947,10 +947,13 @@ class FormMail extends Form } $out .= ''; - $out .= ''; + $out .= ''; $out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody'); $out .= ''; - $out .= ''; + $out .= ''; + + $out .= ''; + $out .= ''; if ($this->withbodyreadonly) { $out .= nl2br($defaultmessage); $out .= ''; @@ -1202,8 +1205,8 @@ class FormMail extends Form */ public function getHtmlForDeliveryreceipt() { - global $conf, $langs, $form; - $out = ''.$langs->trans("DeliveryReceipt").''; + global $conf, $langs; + $out = ''; if (!empty($this->withdeliveryreceiptreadonly)) { $out .= yn($this->withdeliveryreceipt); @@ -1224,7 +1227,8 @@ class FormMail extends Form if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') { $defaultvaluefordeliveryreceipt = 1; } - $out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1); + //$out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1); + $out .= ''; } $out .= "\n"; return $out; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 7c5007ddca2..176e2346c17 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -73,6 +73,8 @@ class FormTicket public $withfile; public $withfilereadonly; + public $backtopage; + public $ispublic; // To show information or not into public form public $withtitletopic; @@ -1363,6 +1365,7 @@ class FormTicket print ''; print ''; print ''; + print ''; foreach ($this->param as $key => $value) { print ''; } diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 6f54229c993..2a3972429cd 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -263,6 +263,7 @@ class Ldap if ($this->result) { $this->bind = $this->result; $connected = 2; + $this->connectedServer = $host; break; } else { $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); @@ -275,6 +276,7 @@ class Ldap if ($this->result) { $this->bind = $this->result; $connected = 2; + $this->connectedServer = $host; break; } else { $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); @@ -287,6 +289,7 @@ class Ldap if ($result) { $this->bind = $this->result; $connected = 1; + $this->connectedServer = $host; break; } else { $this->error = ldap_errno($this->connection).' '.ldap_error($this->connection); @@ -297,10 +300,8 @@ class Ldap if (!$connected) { $this->unbind(); - } else { - $this->connectedServer = $host; } - } + } // End loop on each server } if ($connected) { @@ -997,12 +998,12 @@ class Ldap } /** - * Returns an array containing a details or list of LDAP record(s) + * Returns an array containing a details or list of LDAP record(s). * ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword * * @param string $search Value of field to search, '*' for all. Not used if $activefilter is set. * @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) - * @param string $useridentifier Name of key field (Ex: uid) + * @param string $useridentifier Name of key field (Ex: uid). * @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword) * @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter * @param array $attributeAsArray Array of fields wanted as an array not a string diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index aae315ec992..a3367841481 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/db/Database.interface.php'; */ abstract class DoliDB implements Database { - /** @var bool|resource|SQLite3 Database handler */ + /** @var bool|resource|SQLite3|PgSql\connection Database handler */ public $db; /** @var string Database type */ public $type; diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 21afb5f3490..4dbdd9f5be8 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -274,6 +274,9 @@ function getDefaultDatesForTransfer() { global $db, $conf; + $pastmonth = 0; + $pastmonthyear = 0; + // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) $periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER); if ($periodbydefaultontransfer == 2) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 288f3e236ac..db48100867f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -923,6 +923,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $search_status = 1; // always display active customer first } + $search_rowid = GETPOST("search_rowid", 'int'); $search_name = GETPOST("search_name", 'alpha'); $search_address = GETPOST("search_address", 'alpha'); $search_poste = GETPOST("search_poste", 'alpha'); @@ -971,6 +972,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $extrafields->fetch_name_optionals_label($contactstatic->table_element); $contactstatic->fields = array( + 'rowid' =>array('type'=>'integer', 'label'=>"TechnicalID", 'enabled'=>1, 'visible'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) ? 1 : 0), 'position'=>1), 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'index'=>1, 'position'=>20), 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30), @@ -1012,6 +1014,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $search_rowid = ''; $search_status = ''; $search_name = ''; $search_roles = array(); @@ -1055,6 +1058,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl print "\n".''."\n"; $param = "socid=".urlencode($object->id); + if ($search_rowid != '') { + $param .= '&search_rowid='.urlencode($search_rowid); + } if ($search_status != '') { $param .= '&search_status='.urlencode($search_status); } @@ -1083,6 +1089,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " WHERE t.fk_soc = ".((int) $object->id); + if ($search_rowid) { + $sql .= natural_search('t.rowid', $search_rowid); + } if ($search_status != '' && $search_status != '-1') { $sql .= " AND t.statut = ".((int) $search_status); } @@ -1146,7 +1155,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl } } if ($showuserlogin) { - print ''; + print ''; } // Extra fields $extrafieldsobjectkey = $contactstatic->table_element; @@ -1188,7 +1197,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl } } if ($showuserlogin) { - print ''; + print ''; } // Extra fields $extrafieldsobjectkey = $contactstatic->table_element; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d2383a14dfc..9aaf0771d44 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -121,7 +121,9 @@ function getServerTimeZoneInt($refgmtdate = 'now') function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0) { global $conf; - + if ($duration_unit == 's') { + return $time + ($duration_value); + } if ($duration_value == 0) { return $time; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 3b3077425a5..92a0255d76d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2992,10 +2992,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // Wrapping for import module $accessallowed = $user->rights->import->run; $original_file = $conf->import->dir_temp.'/'.$original_file; - } elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_temp)) { - // Wrapping for recruitment module - $accessallowed = $user->rights->$modulepart->recruitmentjobposition->read; - $original_file = $conf->recruitment->dir_output .'/'. $original_file; + } elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_output)) { + // Wrapping for recruitment module + $accessallowed = $user->rights->recruitment->recruitmentjobposition->read; + $original_file = $conf->recruitment->dir_output.'/'.$original_file; } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { // Wrapping for wysiwyg editor $accessallowed = 1; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0009ba93240..cf784f50947 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -470,6 +470,7 @@ function GETPOSTISARRAY($paramname, $method = 0) * 'alphanohtml'=check there is no html content and no " and no ../ * 'aZ'=check it's a-z only * 'aZ09'=check it's simple alpha string (recommended for keys) + * 'aZ09comma'=check it's a string for a sortfield or sortorder * 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) * 'nohtml'=check there is no html content and no " and no ../ * 'restricthtml'=check html content is restricted to some tags only @@ -1164,7 +1165,17 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) function dol_clone($object, $native = 0) { if (empty($native)) { + $tmpsavdb = null; + if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { + $tmpsavdb = $object->db; + unset($object->db); // Such property can not be serialized when PgSql/Connection + } + $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields + + if ($tmpsavdb) { + $object->db = $tmpsavdb; + } } else { $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable) } @@ -3723,6 +3734,8 @@ function isValidMXRecord($domain) return 0; } } + + // function idn_to_ascii or checkdnsrr does not exists return -1; } @@ -4957,7 +4970,9 @@ function dol_print_error($db = '', $error = '', $errors = null) // Return a http header with error code if possible if (!headers_sent()) { - top_httphead(); + if (function_exists('top_httphead')) { // In CLI context, the method does not exists + top_httphead(); + } http_response_code(500); } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index cad97108733..ba34b1283c9 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2655,7 +2655,7 @@ function getModuleDirForApiClass($moduleobject) $moduledirforclass = 'fichinter'; } elseif ($moduleobject == 'mos') { $moduledirforclass = 'mrp'; - } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms'))) { + } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms', 'receptions'))) { $moduledirforclass = preg_replace('/s$/', '', $moduleobject); } diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index bacd8135739..d48775fe84e 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -23,29 +23,17 @@ */ -$shortscopegoogle = 'userinfo_email,userinfo_profile'; -$shortscopegoogle .= ',openid,email,profile'; // For openid connect -if (!empty($conf->printing->enabled)) { - $shortscopegoogle .= ',cloud_print'; -} -if (!empty($conf->global->OAUTH_GOOGLE_GSUITE)) { - $shortscopegoogle .= ',admin_directory_user'; -} -if (!empty($conf->global->OAUTH_GOOGLE_GMAIL)) { - $shortscopegoogle.=',gmail_full'; -} - // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) $supportedoauth2array = array( - 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'defaultscope'=>$shortscopegoogle), + 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full'), ); if (!empty($conf->stripe->enabled)) { - $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'defaultscope'=>'read_write'); - $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'defaultscope'=>'read_write'); + $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); + $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); } -$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'defaultscope'=>'user,public_repo'); +$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'availablescopes'=>'user,public_repo'); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'defaultscope'=>'ToComplete'); + $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard'); } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 1ebca6ba65a..19a251d1b38 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -471,7 +471,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print '
'."\n"; if ($addformmessage) { - print ''; + print ''; print '
'; $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; @@ -482,7 +482,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, } // Add other message if VAT exists - if (!empty($object->total_vat) || $object->total_tva != 0) { + if (!empty($object->total_vat) || !empty($object->total_tva)) { $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; if (!empty($conf->global->$parammessageform)) { print $langs->transnoentities($conf->global->$parammessageform); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b0c2250c49..b7209dd1db0 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1644,7 +1644,17 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, //print $libelleproduitservice; } + // Show information for lot if ($dbatch) { + // $object is a shipment. + //var_dump($object->lines[$i]->details_entrepot); // array from llx_expeditiondet (we can have seral lines for one fk_origin_line) + //var_dump($object->lines[$i]->detail_batch); // array from llx_expeditiondet_batch (each line with a lot is linked to llx_expeditiondet) + + include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + include_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; + $tmpwarehouse = new Entrepot($db); + $tmpproductbatch = new Productbatch($db); + $format = 'day'; foreach ($dbatch as $detail) { $dte = array(); @@ -1658,8 +1668,24 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $dte[] = $outputlangs->transnoentitiesnoconv('printBatch', $detail->batch); } $dte[] = $outputlangs->transnoentitiesnoconv('printQty', $detail->qty); + + // Add also info of planned warehouse for lot + if ($object->element == 'shipping' && $detail->fk_origin_stock > 0 && getDolGlobalInt('PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT')) { + $resproductbatch = $tmpproductbatch->fetch($detail->fk_origin_stock); + if ($resproductbatch > 0) { + $reswarehouse = $tmpwarehouse->fetch($tmpproductbatch->warehouseid); + if ($reswarehouse > 0) { + $dte[] = $tmpwarehouse->ref; + } + } + } + $libelleproduitservice .= "__N__ ".implode(" - ", $dte); } + } else { + if (getDolGlobalInt('PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT')) { + // TODO Show warehouse for shipment line without batch + } } // Now we convert \n into br diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1c0d7d1aab1..0d0a0de3e0d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -120,7 +120,7 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") { global $dolibarr_main_instance_unique_id; - if ($chain === '') { + if ($chain === '' || is_null($chain)) { return ''; } @@ -166,7 +166,7 @@ function dolDecrypt($chain, $key = '') { global $dolibarr_main_instance_unique_id; - if ($chain === '') { + if ($chain === '' || is_null($chain)) { return ''; } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 6f532e078b3..74e6bc4d9e8 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -643,7 +643,7 @@ function showWebsiteTemplates(Website $website) print '
'; print $subdir.' ('.dol_print_size(dol_filesize($dirtheme."/".$subdir), 1, 1).')'; - print '
ref.'&templateuserfile='.$subdir.'" class="button">'.$langs->trans("Load").''; + print '
ref).'&templateuserfile='.urlencode($subdir).'" class="button">'.$langs->trans("Load").''; print '
'; $i++; diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index c4825998b3a..e8c3ab38e46 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -124,8 +124,8 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes if ($passok) { $login = $obj->login; } else { - sleep(2); // Anti brut force protection dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE); + sleep(1); // Anti brut force protection. Must be same delay when login is not valid // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); @@ -153,7 +153,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes } } else { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE); - sleep(1); + sleep(1); // Anti brut force protection. Must be same delay when password is not valid // Load translation files required by the page $langs->loadLangs(array('main', 'errors')); diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 18800c3a19e..cd4ed16eae6 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -122,7 +122,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) print "DEBUG: User ".$usertotest." must change password
\n"; } $ldap->unbind(); - sleep(1); + sleep(1); // Anti brut force protection. Must be same delay when user and password are not valid. $langs->load('ldap'); $_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("YouMustChangePassNextLogon", $usertotest, $ldap->domainFQDN); return ''; @@ -233,17 +233,19 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $usertmp = new User($db); $usertmp->fetch('', $login); - $ret = $mc->checkRight($usertmp->id, $entitytotest); - if ($ret < 0) { - dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE); - $login = ''; // force authentication failure + if (is_object($mc)) { + $ret = $mc->checkRight($usertmp->id, $entitytotest); + if ($ret < 0) { + dol_syslog("functions_ldap::check_user_password_ldap Authentication KO entity '".$entitytotest."' not allowed for user id '".$usertmp->id."'", LOG_NOTICE); + $login = ''; // force authentication failure + } + unset($usertmp); } - unset($usertmp); } } if ($result == 1) { dol_syslog("functions_ldap::check_user_password_ldap Authentication KO bad user/password for '".$usertotest."'", LOG_NOTICE); - sleep(1); + sleep(1); // Anti brut force protection. Must be same delay when user and password are not valid. // Load translation files required by the page $langs->loadLangs(array('main', 'other')); @@ -265,7 +267,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $ldap->ldapErrorText = ldap_error($ldap->connection); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); } - sleep(2); // Anti brut force protection + sleep(1); // Anti brut force protection. Must be same delay when user and password are not valid. // Load translation files required by the page $langs->loadLangs(array('main', 'other', 'errors')); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index afaad336f9e..130eb6192e5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -114,7 +114,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'member', 'class="fa-fw paddingright pictofixedwidth"'), 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members") ? 0 : 1), - 'loadLangs' => array(), + 'loadLangs' => array("members"), 'submenus' => array(), ); @@ -170,7 +170,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'product', 'class="fa-fw paddingright pictofixedwidth"'), 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products") ? 0 : 1), - 'loadLangs' => array("products"), + 'loadLangs' => array("products", "stocks"), 'submenus' => array(), ); @@ -379,7 +379,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'hrm', 'class="fa-fw paddingright pictofixedwidth"'), 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "hrm") ? 0 : 1), - 'loadLangs' => array("holiday"), + 'loadLangs' => array("hrm", "holiday"), 'submenus' => array(), ); @@ -410,7 +410,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'classname' => $classname = (!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => img_picto('', 'ticket', 'class="fa-fw paddingright pictofixedwidth"'), 'session' => ((!empty($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "ticket") ? 0 : 1), - 'loadLangs' => array("other"), + 'loadLangs' => array("ticket", "knowledgemanagement"), 'submenus' => array(), ); diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php index 61579399247..4835c39c194 100644 --- a/htdocs/core/modules/action/rapport.class.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -98,10 +98,10 @@ class CommActionRapport $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->title = $langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; $this->subject = $langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index e313c612eb0..14815f169f2 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -156,10 +156,10 @@ class pdf_standard_asset extends ModelePDFAsset $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); // Get source company $this->emetteur = $mysoc; diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 3ab1cdcc193..bbbd82ec1c7 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -67,10 +67,10 @@ class pdf_ban extends ModeleBankAccountDoc $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 314a1fa7853..e09fef45bf0 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -70,10 +70,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 21c131ad2a6..f32b2306624 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -63,10 +63,10 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); // Retrieves transmitter $this->emetteur = $mysoc; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index b1476b393d0..2b89f229730 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -149,10 +149,10 @@ class pdf_einstein extends ModelePDFCommandes $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 34cdb41e6b8..df28616276d 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -154,10 +154,10 @@ class pdf_eratosthene extends ModelePDFCommandes $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1875cfb833c..5b45d0014be 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -145,10 +145,10 @@ class pdf_strato extends ModelePDFContract $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 7d880328663..550957511ba 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -140,10 +140,10 @@ class pdf_storm extends ModelePDFDeliveryOrder $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 2e0c3f2d05c..ad8e0bd71a5 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -139,10 +139,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 9e2e5286874..485ff20951f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -134,10 +134,10 @@ class pdf_espadon extends ModelePdfExpedition $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_draft_watermark = 1; // Support add of a watermark on drafts diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index e37977144d2..781d581aaf7 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -135,10 +135,10 @@ class pdf_merou extends ModelePdfExpedition $this->page_largeur = $formatarray['width']; $this->page_hauteur = round($formatarray['height'] / 2); $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 0237c294a0d..3872ad3d4a2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -135,10 +135,10 @@ class pdf_rouget extends ModelePdfExpedition $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_draft_watermark = 1; // Support add of a watermark on drafts diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index f6536cbb1df..fae58f49419 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -119,10 +119,10 @@ class pdf_standard extends ModeleExpenseReport $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 2a94a94103e..ee4e43bb444 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -155,10 +155,10 @@ class pdf_crabe extends ModelePDFFactures $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION @@ -1195,7 +1195,7 @@ class pdf_crabe extends ModelePDFFactures require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; - $langs->loadLangs(array('payment', 'paybox')); + $langs->loadLangs(array('payment', 'paybox', 'stripe')); $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ff7a91de9fa..1efca9070d0 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -182,10 +182,10 @@ class pdf_sponge extends ModelePDFFactures $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index bb4a6826278..2d3e89a6316 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -137,10 +137,10 @@ class pdf_soleil extends ModelePDFFicheinter $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index b5dec9cbbe0..979782e61a5 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -217,7 +217,7 @@ class mailing_thirdparties_services_expired extends MailingTargets { global $langs; - $s .= ''; if (count($this->arrayofproducts)) { $s .= ''; } else { @@ -228,6 +228,7 @@ class mailing_thirdparties_services_expired extends MailingTargets } $s .= ''; $s .= ajax_combobox("filter_services_expired"); + return $s; } diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index 376cf9409f2..4f99039f8f7 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -1,8 +1,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI - * Copyright (C) 2019-2020 Frédéric France - * Copyright (C) 2021 SuperAdmin + * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -63,8 +62,6 @@ class modStockTransfer extends DolibarrModules $this->description = $langs->trans("ModuleStockTransferDesc"); // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "StockTransfer description (Long)"; - $this->editor_name = 'Editor name'; - $this->editor_url = 'https://www.example.com'; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = 'development'; // Url to the file with your last numberversion of this module @@ -127,7 +124,7 @@ class modStockTransfer extends DolibarrModules $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("stocktransfer@stocktransfer"); - $this->phpmin = array(5, 5); // Minimum version of PHP required by module + $this->phpmin = array(5, 6); // Minimum version of PHP required by module $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index fd7f658bd48..ef4bced304d 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -2,7 +2,6 @@ /* Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2020 Frédéric France - * Copyright (C) 2022 SuperAdmin * * 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 @@ -67,10 +66,6 @@ class modWebhook extends DolibarrModules // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "WebhookDescription"; - // Author - $this->editor_name = 'Editor name'; - $this->editor_url = 'https://www.example.com'; - // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = 'development'; // Url to the file with your last numberversion of this module diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 6f2a6fcf694..d93a7d99076 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -116,10 +116,10 @@ class pdf_standard extends ModelePDFMovement $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_codestockservice = 0; // Display stock-service code diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index ed10b5ee2bf..1a61a588ae3 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -144,10 +144,10 @@ class pdf_vinci extends ModelePDFMo $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_multilang = 1; //Available in several languages diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index f30d73c2d4e..b993cbdd81e 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -89,10 +89,13 @@ if ($state) { $requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'. $statewithanticsrfonly = preg_replace('/^.*\-/', '', $state); } -if ($action != 'delete' && empty($requestedpermissionsarray)) { - print 'Error, parameter state is not defined'; - exit; + +if ($action != 'delete' && (empty($statewithscopeonly) || empty($requestedpermissionsarray))) { + setEventMessages($langs->trans('ScopeUndefined'), null, 'errors'); + header('Location: '.$backtourl); + exit(); } + //var_dump($requestedpermissionsarray);exit; diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index e4bcc0e4f04..92cf586f848 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -97,10 +97,10 @@ class pdf_standard extends ModelePDFProduct $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_multilang = 1; // Available in several languages diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index df013a2fad0..3bae695f511 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -139,10 +139,10 @@ class pdf_baleine extends ModelePDFProjects $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 1dc5b7bf3f9..c3ce64e3df7 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -175,10 +175,10 @@ class pdf_beluga extends ModelePDFProjects $this->page_hauteur = $formatarray['height']; } $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 9d118b2a555..02f3f0c8cfb 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -138,10 +138,10 @@ class pdf_timespent extends ModelePDFProjects $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo FAC_PDF_LOGO $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index c2971c9344e..ea95036b280 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -145,10 +145,10 @@ class pdf_azur extends ModelePDFPropales $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9d52132db56..cdac495c393 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -148,10 +148,10 @@ class pdf_cyan extends ModelePDFPropales $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index e4991a5830d..8cb10e0a0f8 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -54,10 +54,10 @@ class pdf_paiement $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->tab_top = 30; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 050459d91d2..1b4588e57bb 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -57,10 +57,10 @@ class pdf_squille extends ModelePdfReception $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_draft_watermark = 1; // Support add of a watermark on drafts diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 3fd3917da2d..d3fa898d0a1 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -111,10 +111,10 @@ class pdf_standard extends ModelePDFStock $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_codestockservice = 0; // Display product-service code diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 87a6bcf0e38..2971741f078 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -131,10 +131,10 @@ class pdf_eagle extends ModelePdfStockTransfer $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index fa49b0b6d44..493dd0f2f6f 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -145,10 +145,10 @@ class pdf_eagle_proforma extends ModelePDFCommandes $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 39a9aab7e78..6e340a39981 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -141,10 +141,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 00d1e2e28e7..a11983991cc 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -143,10 +143,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 410a631fa62..5b9a572736b 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -143,10 +143,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 676c5768ea3..a6a272d6274 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -114,10 +114,10 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_multilang = 1; // Available in several languages diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 19411968df4..6ef9463971b 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -101,7 +101,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l if ($action == 'edit_extras') { $value = (GETPOSTISSET("options_".$tmpkeyextra) ? GETPOST("options_".$tmpkeyextra) : $object->array_options["options_".$tmpkeyextra]); } else { - $value = (!empty($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : ''); + $value = (isset($object->array_options["options_".$tmpkeyextra]) ? $object->array_options["options_".$tmpkeyextra] : ''); //var_dump($tmpkeyextra.' - '.$value); } diff --git a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php new file mode 100644 index 00000000000..3d6536bd258 --- /dev/null +++ b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php @@ -0,0 +1,168 @@ +name = $name; + set_error_handler([$this, 'errorHandler'], E_ALL); + } + + /** + * Called by the DebugBar when data needs to be collected. + * + * @return array Collected data. + */ + public function collect() + { + $messages = $this->getMessages(); + return [ + 'count' => count($messages), + 'messages' => $messages, + ]; + } + + /** + * Returns a list of messages ordered by their timestamp. + * + * @return array A list of messages ordered by time. + */ + public function getMessages() + { + $messages = $this->messages; + + usort($messages, function ($itemA, $itemB) { + if ($itemA['time'] === $itemB['time']) { + return 0; + } + return $itemA['time'] < $itemB['time'] ? -1 : 1; + }); + + return $messages; + } + + /** + * Returns a hash where keys are control names and their values an array of options as defined in + * {@see DebugBar\JavascriptRenderer::addControl()} + * + * @return array Needed details to render the widget. + */ + public function getWidgets() + { + $name = $this->getName(); + return [ + $name => [ + 'icon' => 'list', + 'widget' => 'PhpDebugBar.Widgets.MessagesWidget', + 'map' => "$name.messages", + 'default' => '[]', + ], + "$name:badge" => [ + 'map' => "$name.count", + 'default' => 'null', + ], + ]; + } + + /** + * Returns the unique name of the collector. + * + * @return string The widget name. + */ + public function getName() + { + return $this->name; + } + + /** + * Exception error handler. Called from constructor with set_error_handler to add all details. + * + * @param int $severity Error type. + * @param string $message Message of error. + * @param string $fileName File where error is generated. + * @param int $line Line number where error is generated. + * + * @return void + */ + public function errorHandler($severity, $message, $fileName, $line) + { + for ($i = 0; $i < 15; $i++) { + if ($type = $severity & (2 ** $i)) { + $label = $this->friendlyErrorType($type); + $this->messages[] = [ + 'message' => $message . ' (' . $fileName . ':' . $line . ')', + 'message_html' => null, + 'is_string' => true, + 'label' => $label, + 'time' => microtime(true), + ]; + } + } + } + + /** + * Return error name from error code. + * + * @info http://php.net/manual/es/errorfunc.constants.php + * + * @param int $type Error code. + * + * @return string Error name. + */ + private function friendlyErrorType($type) + { + $errors = [ + E_ERROR => 'ERROR', + E_WARNING => 'WARNING', + E_PARSE => 'PARSE', + E_NOTICE => 'NOTICE', + E_CORE_ERROR => 'CORE_ERROR', + E_CORE_WARNING => 'CORE_WARNING', + E_COMPILE_ERROR => 'COMPILE_ERROR', + E_COMPILE_WARNING => 'COMPILE_WARNING', + E_USER_ERROR => 'USER_ERROR', + E_USER_WARNING => 'USER_WARNING', + E_USER_NOTICE => 'USER_NOTICE', + E_STRICT => 'STRICT', + E_RECOVERABLE_ERROR => 'RECOVERABLE_ERROR', + E_DEPRECATED => 'DEPRECATED', + E_USER_DEPRECATED => 'USER_DEPRECATED', + ]; + + $result = ''; + if (isset($errors[$type])) { + $result = $errors[$type]; + } + + return $result; + } +} diff --git a/htdocs/debugbar/class/DebugBar.php b/htdocs/debugbar/class/DebugBar.php index af824a64392..b2ec0f17bf0 100644 --- a/htdocs/debugbar/class/DebugBar.php +++ b/htdocs/debugbar/class/DebugBar.php @@ -10,6 +10,7 @@ dol_include_once('/debugbar/class/DataCollector/DolRequestDataCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolConfigCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolTimeDataCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolMemoryCollector.php'); +dol_include_once('/debugbar/class/DataCollector/DolPhpCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolExceptionsCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolQueryCollector.php'); dol_include_once('/debugbar/class/DataCollector/DolibarrCollector.php'); @@ -36,6 +37,7 @@ class DolibarrDebugBar extends DebugBar $this->addCollector(new DolRequestDataCollector()); //$this->addCollector(new DolConfigCollector()); // Disabled for security purpose $this->addCollector(new DolTimeDataCollector()); + $this->addCollector(new PhpCollector()); $this->addCollector(new DolMemoryCollector()); //$this->addCollector(new DolExceptionsCollector()); $this->addCollector(new DolQueryCollector()); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 55f6293a9d2..ad1a3b9934a 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -973,7 +973,7 @@ class Delivery extends CommonObject $sqlSourceLine .= ", p.ref, p.label"; $sqlSourceLine .= " FROM ".MAIN_DB_PREFIX.$this->linkedObjectsIds[0]['type']."det as st"; $sqlSourceLine .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON st.fk_product = p.rowid"; - $sqlSourceLine .= " WHERE fk_".$this->linked_object[0]['type']." = ".((int) $this->linked_object[0]['linkid']); + $sqlSourceLine .= " WHERE fk_".$this->linked_objects[0]['type']." = ".((int) $this->linked_objects[0]['linkid']); $resultSourceLine = $this->db->query($sqlSourceLine); if ($resultSourceLine) { @@ -986,12 +986,12 @@ class Delivery extends CommonObject // Get lines of sources alread delivered $sql = "SELECT ld.fk_origin_line, sum(ld.qty) as qty"; $sql .= " FROM ".MAIN_DB_PREFIX."deliverydet as ld, ".MAIN_DB_PREFIX."delivery as l,"; - $sql .= " ".MAIN_DB_PREFIX.$this->linked_object[0]['type']." as c"; - $sql .= ", ".MAIN_DB_PREFIX.$this->linked_object[0]['type']."det as cd"; + $sql .= " ".MAIN_DB_PREFIX.$this->linked_objects[0]['type']." as c"; + $sql .= ", ".MAIN_DB_PREFIX.$this->linked_objects[0]['type']."det as cd"; $sql .= " WHERE ld.fk_delivery = l.rowid"; $sql .= " AND ld.fk_origin_line = cd.rowid"; - $sql .= " AND cd.fk_".$this->linked_object[0]['type']." = c.rowid"; - $sql .= " AND cd.fk_".$this->linked_object[0]['type']." = ".((int) $this->linked_object[0]['linkid']); + $sql .= " AND cd.fk_".$this->linked_objects[0]['type']." = c.rowid"; + $sql .= " AND cd.fk_".$this->linked_objects[0]['type']." = ".((int) $this->linked_objects[0]['linkid']); $sql .= " AND ld.fk_origin_line = ".((int) $objSourceLine->rowid); $sql .= " GROUP BY ld.fk_origin_line"; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 47d62197a70..f5da262e0c1 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -16,37 +16,38 @@ */ /** - * \file emailcollector/class/emailcollector.class.php - * \ingroup emailcollector - * \brief This file is a CRUD class file for EmailCollector (Create/Read/Update/Delete) + * \file htdocs/emailcollector/class/emailcollector.class.php + * \ingroup emailcollector + * \brief This file is a CRUD class file for EmailCollector (Create/Read/Update/Delete) */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; -require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; +include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // customer proposal -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // customer order -require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipment -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // supplier invoice -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // supplier order -require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // supplier proposal -require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // reception -include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php'; -//require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; // Holidays (leave request) -//require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // expernse repor +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; + +require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php'; // Customer Proposal +require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php'; // Customer Order +require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php'; // Customer Invoice +require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php'; // Contact / Address +require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php'; // Shipping / Delivery +require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php'; // Supplier Order +require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php'; // Supplier Invoice +require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php'; // Project +require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php'; // Reception +require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting +require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; // Third-Party +require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal +require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php'; // Ticket +//require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php'; // Expense Report +//require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php'; // Holidays (leave request) // use Webklex\PHPIMAP; -require DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php'; -use Webklex\PHPIMAP\ClientManager; +require DOL_DOCUMENT_ROOT .'/includes/webklex/php-imap/vendor/autoload.php'; +use Webklex\PHPIMAP\ClientManager; use Webklex\PHPIMAP\Exceptions\ConnectionFailedException; use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException; use Webklex\PHPIMAP\Exceptions\GetMessagesFailedException; @@ -64,14 +65,17 @@ class EmailCollector extends CommonObject * @var string ID to identify managed object */ public $element = 'emailcollector'; + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'emailcollector_emailcollector'; + /** * @var int Does emailcollector support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; + /** * @var int Does emailcollector support extrafields ? 0=No, 1=Yes */ @@ -91,6 +95,7 @@ class EmailCollector extends CommonObject * @var array List of child tables. To test if we can delete object. */ protected $childtables = array(); + /** * @var array List of child tables. To know object to delete on cascade. */ @@ -126,8 +131,8 @@ class EmailCollector extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax150'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflow125'), - 'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflow125', 'default'=>'993'), + 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'), + 'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflowmax50', 'default'=>'993'), 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'), 'acces_type' => array('type'=>'integer', 'label'=>'accessType', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>101, 'notnull'=>1, 'index'=>1, 'comment'=>"IMAP login type", 'arrayofkeyval'=>array('0'=>'loginPassword', '1'=>'oauthToken'), 'default'=>'0', 'help'=>''), 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), @@ -206,7 +211,6 @@ class EmailCollector extends CommonObject */ public $import_key; - public $host; public $port; public $hostcharset; @@ -851,7 +855,7 @@ class EmailCollector extends CommonObject // Loop on each collector foreach ($arrayofcollectors as $emailcollector) { - $result = $emailcollector->doCollectOneCollector(); + $result = $emailcollector->doCollectOneCollector(0); dol_syslog("doCollect result = ".$result." for emailcollector->id = ".$emailcollector->id); $this->error .= 'EmailCollector ID '.$emailcollector->id.':'.$emailcollector->error.'
'; @@ -872,9 +876,10 @@ class EmailCollector extends CommonObject * @param string $messagetext Body * @param string $subject Subject * @param string $header Header + * @param string $operationslog String with logs of operations done * @return int 0=OK, Nb of error if error */ - private function overwritePropertiesOfObject(&$object, $actionparam, $messagetext, $subject, $header) + private function overwritePropertiesOfObject(&$object, $actionparam, $messagetext, $subject, $header, &$operationslog) { $errorforthisaction = 0; @@ -909,6 +914,7 @@ class EmailCollector extends CommonObject $sourcefield = $regforregex[1]; $regexstring = $regforregex[2]; } + if (!empty($sourcefield) && !empty($regexstring)) { if (strtolower($sourcefield) == 'body') { $sourcestring = $messagetext; @@ -930,7 +936,6 @@ class EmailCollector extends CommonObject //var_dump($tmpproperty.' - '.$regexstring.' - '.$regexoptions.' - '.$sourcestring); if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval)) { - //var_dump($regforval[count($regforval)-1]);exit; // Overwrite param $tmpproperty $valueextracted = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; if (strtolower($sourcefield) == 'header') { @@ -946,9 +951,16 @@ class EmailCollector extends CommonObject $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); } } + if (preg_match('/^options_/', $tmpproperty)) { + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> found '.dol_escape_htmltag(dol_trunc($object->array_options[preg_replace('/^options_/', '', $tmpproperty)], 128)); + } else { + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> found '.dol_escape_htmltag(dol_trunc($object->$tmpproperty, 128)); + } } else { // Regex not found $object->$tmpproperty = null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> not found, so property '.dol_escape_htmltag($tmpproperty).' is set to null.'; } } else { // Nothing can be done for this param @@ -986,6 +998,8 @@ class EmailCollector extends CommonObject } else { $object->$tmpproperty = $valuetouse; } + + $operationslog .= '
Set value '.dol_escape_htmltag($valuetouse).' into variable '.dol_escape_htmltag($tmpproperty); } } else { $errorforthisaction++; @@ -1001,9 +1015,10 @@ class EmailCollector extends CommonObject /** * Execute collect for current collector loaded previously with fetch. * - * @return int <0 if KO, >0 if OK + * @param int $mode 0=Mode production, 1=Mode test (read IMAP and try SQL update then rollback), 2=Mode test with no SQL updates + * @return int <0 if KO, >0 if OK */ - public function doCollectOneCollector() + public function doCollectOneCollector($mode = 0) { global $db, $conf, $langs, $user; global $hookmanager; @@ -1019,6 +1034,15 @@ class EmailCollector extends CommonObject $error = 0; $this->output = ''; $this->error = ''; + $this->debuginfo = ''; + + $search = ''; + $searchhead = ''; + $searchfilterdoltrackid = 0; + $searchfilternodoltrackid = 0; + $searchfilterisanswer = 0; + $searchfilterisnotanswer = 0; + $operationslog = ''; $now = dol_now(); @@ -1166,12 +1190,6 @@ class EmailCollector extends CommonObject if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { $criteria = array(array('UNDELETED')); // Seems not supported by some servers - $search = ''; - $searchhead = ''; - $searchfilterdoltrackid = 0; - $searchfilternodoltrackid = 0; - $searchfilterisanswer = 0; - $searchfilterisnotanswer = 0; foreach ($this->filters as $rule) { if (empty($rule['status'])) { continue; @@ -1269,11 +1287,6 @@ class EmailCollector extends CommonObject $search = var_export($criteria, true); } else { $search = 'UNDELETED'; // Seems not supported by some servers - $searchhead = ''; - $searchfilterdoltrackid = 0; - $searchfilternodoltrackid = 0; - $searchfilterisanswer = 0; - $searchfilterisnotanswer = 0; foreach ($this->filters as $rule) { if (empty($rule['status'])) { continue; @@ -1480,7 +1493,7 @@ class EmailCollector extends CommonObject $emailto = $this->decodeSMTPSubject($overview[0]->to); - + $operationslog .= '
Process email '.dol_escape_htmltag($iforemailloop)." - References: ".dol_escape_htmltag($headers['References'])." - Subject: ".dol_escape_htmltag($headers['Subject']); dol_syslog("** Process email ".$iforemailloop." References: ".$headers['References']." Subject: ".$headers['Subject']); @@ -1738,61 +1751,61 @@ class EmailCollector extends CommonObject $objectid = $reg[2]; // See also list into interface_50_modAgenda_ActionsAuto - if ($reg[1] == 'thi') { + if ($reg[1] == 'thi') { // Third-party $objectemail = new Societe($this->db); } - if ($reg[1] == 'ctc') { + if ($reg[1] == 'ctc') { // Contact $objectemail = new Contact($this->db); } - if ($reg[1] == 'inv') { // customer invoices + if ($reg[1] == 'inv') { // Customer Invoice $objectemail = new Facture($this->db); } - if ($reg[1] == 'sinv') { // supplier invoices + if ($reg[1] == 'sinv') { // Supplier Invoice $objectemail = new FactureFournisseur($this->db); } - if ($reg[1] == 'pro') { // customer proposals + if ($reg[1] == 'pro') { // Customer Proposal $objectemail = new Propal($this->db); } - if ($reg[1] == 'ord') { // customer orders + if ($reg[1] == 'ord') { // Customer Order $objectemail = new Commande($this->db); } - if ($reg[1] == 'shi') { // shipments + if ($reg[1] == 'shi') { // Shipment $objectemail = new Expedition($this->db); } - if ($reg[1] == 'spro') { // supplier proposal + if ($reg[1] == 'spro') { // Supplier Proposal $objectemail = new SupplierProposal($this->db); } - if ($reg[1] == 'sord') { // supplier order + if ($reg[1] == 'sord') { // Supplier Order $objectemail = new CommandeFournisseur($this->db); } - if ($reg[1] == 'rec') { // Reception + if ($reg[1] == 'rec') { // Reception $objectemail = new Reception($this->db); } - if ($reg[1] == 'proj') { + if ($reg[1] == 'proj') { // Project $objectemail = new Project($this->db); } - if ($reg[1] == 'tas') { + if ($reg[1] == 'tas') { // Task $objectemail = new Task($this->db); } - if ($reg[1] == 'con') { + if ($reg[1] == 'con') { // Contact $objectemail = new Contact($this->db); } - if ($reg[1] == 'use') { + if ($reg[1] == 'use') { // User $objectemail = new User($this->db); } - if ($reg[1] == 'tic') { + if ($reg[1] == 'tic') { // Ticket $objectemail = new Ticket($this->db); } - if ($reg[1] == 'recruitmentcandidature') { + if ($reg[1] == 'recruitmentcandidature') { // Recruiting Candidate $objectemail = new RecruitmentCandidature($this->db); } - if ($reg[1] == 'mem') { + if ($reg[1] == 'mem') { // Member $objectemail = new Adherent($this->db); } - /*if ($reg[1] == 'leav') { + /*if ($reg[1] == 'leav') { // Leave / Holiday $objectemail = new Holiday($db); } - if ($reg[1] == 'exp') { + if ($reg[1] == 'exp') { // ExpenseReport $objectemail = new ExpenseReport($db); }*/ } elseif (preg_match('/<(.*@.*)>/', $reference, $reg)) { @@ -1950,305 +1963,324 @@ class EmailCollector extends CommonObject } // Do operations - foreach ($this->actions as $operation) { - $errorforthisaction = 0; + if ($mode < 2) { + foreach ($this->actions as $operation) { + $errorforthisaction = 0; - if ($errorforactions) { - break; - } - if (empty($operation['status'])) { - continue; - } - - // Make Operation - dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); - dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object - - $actioncode = 'EMAIL_IN'; - // If we scan the Sent box, we use the code for out email - if ($this->source_directory == 'Sent') { - $actioncode = 'EMAIL_OUT'; - } - - $description = $descriptiontitle = $descriptionmeta = $descriptionfull = ''; - - $descriptiontitle = $langs->trans("RecordCreatedByEmailCollector", $this->ref, $msgid); - - $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTopic").' : '.dol_escape_htmltag($subject)); - $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailFrom").($langs->trans("MailFrom") != 'From' ? ' (From)' : '').' : '.dol_escape_htmltag($fromstring)); - if ($sender) { - $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Sender").($langs->trans("Sender") != 'Sender' ? ' (Sender)' : '').' : '.dol_escape_htmltag($sender)); - } - $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTo").($langs->trans("MailTo") != 'To' ? ' (To)' : '').' : '.dol_escape_htmltag($to)); - if ($sendtocc) { - $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailCC").($langs->trans("MailCC") != 'CC' ? ' (CC)' : '').' : '.dol_escape_htmltag($sendtocc)); - } - - // Search and create thirdparty - if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') { - if (empty($operation['actionparam'])) { - $errorforactions++; - $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'name=HEADER:^From:(.*);' or 'name=SET:xxx' or 'name=EXTRACT:(body|subject):regex where 'name' can be replaced with 'id' or 'email' to define how to set or extract data. More properties can also be set, for example client=SET:2;"; - $this->errors[] = $this->error; - } else { - $actionparam = $operation['actionparam']; - $idtouseforthirdparty = ''; - $nametouseforthirdparty = ''; - $emailtouseforthirdparty = ''; - - // $actionparam = 'param=SET:aaa' or 'param=EXTRACT:BODY:....' - $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); - foreach ($arrayvaluetouse as $propertytooverwrite => $valueforproperty) { - $sourcestring = ''; - $sourcefield = ''; - $regexstring = ''; - $regforregex = array(); - - if (preg_match('/^EXTRACT:([a-zA-Z0-9_]+):(.*)$/', $valueforproperty, $regforregex)) { - $sourcefield = $regforregex[1]; - $regexstring = $regforregex[2]; - } - - if (!empty($sourcefield) && !empty($regexstring)) { - if (strtolower($sourcefield) == 'body') { - $sourcestring = $messagetext; - } elseif (strtolower($sourcefield) == 'subject') { - $sourcestring = $subject; - } elseif (strtolower($sourcefield) == 'header') { - $sourcestring = $header; - } - - if ($sourcestring) { - $regforval = array(); - //var_dump($regexstring);var_dump($sourcestring); - if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval)) { - //var_dump($regforval[count($regforval)-1]);exit; - // Overwrite param $tmpproperty - if ($propertytooverwrite == 'id') { - $idtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - } elseif ($propertytooverwrite == 'email') { - $emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - } else { - $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; - } - } else { - // Regex not found - $idtouseforthirdparty = null; - $nametouseforthirdparty = null; - $emailtouseforthirdparty = null; - } - //var_dump($object->$tmpproperty);exit; - } else { - // Nothing can be done for this param - $errorforactions++; - $this->error = 'The extract rule to use to load thirdparty has on an unknown source (must be HEADER, SUBJECT or BODY)'; - $this->errors[] = $this->error; - } - } elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg)) { - //if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1]; - //else $object->$tmpproperty = $reg[1]; - if ($propertytooverwrite == 'id') { - $idtouseforthirdparty = $reg[2]; - } elseif ($propertytooverwrite == 'email') { - $emailtouseforthirdparty = $reg[2]; - } else { - $nametouseforthirdparty = $reg[2]; - } - } else { - $errorforactions++; - $this->error = 'Bad syntax for description of action parameters: '.$actionparam; - $this->errors[] = $this->error; - break; - } - } - - if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty)) { - $result = $thirdpartystatic->fetch($idtouseforthirdparty, $nametouseforthirdparty, '', '', '', '', '', '', '', '', $emailtouseforthirdparty); - if ($result < 0) { - $errorforactions++; - $this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)'; - $this->errors[] = $this->error; - break; - } elseif ($result == 0) { - if ($operation['type'] == 'loadthirdparty') { - dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found"); - - $errorforactions++; - $langs->load("errors"); - $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty); - $this->errors[] = $this->error; - } elseif ($operation['type'] == 'loadandcreatethirdparty') { - dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found. We try to create it."); - - // Create thirdparty - $thirdpartystatic->name = $nametouseforthirdparty; - if ($fromtext != $nametouseforthirdparty) { - $thirdpartystatic->name_alias = $fromtext; - } - $thirdpartystatic->email = ($emailtouseforthirdparty ? $emailtouseforthirdparty : $from); - - // Overwrite values with values extracted from source email - $errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject, $header); - - if ($thirdpartystatic->client && empty($thirdpartystatic->code_client)) { - $thirdpartystatic->code_client = 'auto'; - } - if ($thirdpartystatic->fournisseur && empty($thirdpartystatic->code_fournisseur)) { - $thirdpartystatic->code_fournisseur = 'auto'; - } - - if ($errorforthisaction) { - $errorforactions++; - } else { - $result = $thirdpartystatic->create($user); - if ($result <= 0) { - $errorforactions++; - $this->error = $thirdpartystatic->error; - $this->errors = $thirdpartystatic->errors; - } - } - } - } - } + if ($errorforactions) { + break; + } + if (empty($operation['status'])) { + continue; } - } elseif ($operation['type'] == 'recordevent') { - // Create event - $actioncomm = new ActionComm($this->db); - $alreadycreated = $actioncomm->fetch(0, '', '', $msgid); - if ($alreadycreated == 0) { - if ($projectstatic->id > 0) { - if ($projectfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby); - } - } - if ($thirdpartystatic->id > 0) { - if ($thirdpartyfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); - } - } - if ($contactstatic->id > 0) { - if ($contactfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); - } - } + // Make Operation + dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); + dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); + $actioncode = 'EMAIL_IN'; + // If we scan the Sent box, we use the code for out email + if ($this->source_directory == 'Sent') { + $actioncode = 'EMAIL_OUT'; + } - $descriptionfull = $description; - if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); - } + $description = $descriptiontitle = $descriptionmeta = $descriptionfull = ''; - // Insert record of emails sent - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) - $actioncomm->code = 'AC_'.$actioncode; - $actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from; - $actioncomm->note_private = $descriptionfull; - $actioncomm->fk_project = $projectstatic->id; - $actioncomm->datep = $date; // date of email - $actioncomm->datef = $date; // date of email - $actioncomm->percentage = -1; // Not applicable - $actioncomm->socid = $thirdpartystatic->id; - $actioncomm->contact_id = $contactstatic->id; - $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array()); - $actioncomm->authorid = $user->id; // User saving action - $actioncomm->userownerid = $user->id; // Owner of action - // Fields when action is an email (content should be added into note) - $actioncomm->email_msgid = $msgid; - $actioncomm->email_from = $fromstring; - $actioncomm->email_sender = $sender; - $actioncomm->email_to = $to; - $actioncomm->email_tocc = $sendtocc; - $actioncomm->email_tobcc = $sendtobcc; - $actioncomm->email_subject = $subject; - $actioncomm->errors_to = ''; + $descriptiontitle = $langs->trans("RecordCreatedByEmailCollector", $this->ref, $msgid); - if (!in_array($fk_element_type, array('societe', 'contact', 'project', 'user'))) { - $actioncomm->fk_element = $fk_element_id; - $actioncomm->elementid = $fk_element_id; - $actioncomm->elementtype = $fk_element_type; - if (is_object($objectemail) && $objectemail->module) { - $actioncomm->elementtype .= '@'.$objectemail->module; - } - } + $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTopic").' : '.dol_escape_htmltag($subject)); + $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailFrom").($langs->trans("MailFrom") != 'From' ? ' (From)' : '').' : '.dol_escape_htmltag($fromstring)); + if ($sender) { + $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("Sender").($langs->trans("Sender") != 'Sender' ? ' (Sender)' : '').' : '.dol_escape_htmltag($sender)); + } + $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailTo").($langs->trans("MailTo") != 'To' ? ' (To)' : '').' : '.dol_escape_htmltag($to)); + if ($sendtocc) { + $descriptionmeta = dol_concatdesc($descriptionmeta, $langs->trans("MailCC").($langs->trans("MailCC") != 'CC' ? ' (CC)' : '').' : '.dol_escape_htmltag($sendtocc)); + } - //$actioncomm->extraparams = $extraparams; - - // Overwrite values with values extracted from source email - $errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header); - - //var_dump($fk_element_id); - //var_dump($fk_element_type); - //var_dump($alreadycreated); - //var_dump($operation['type']); - //var_dump($actioncomm); - //exit; - - if ($errorforthisaction) { + // Search and create thirdparty + if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') { + if (empty($operation['actionparam'])) { $errorforactions++; + $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'name=HEADER:^From:(.*);' or 'name=SET:xxx' or 'name=EXTRACT:(body|subject):regex where 'name' can be replaced with 'id' or 'email' to define how to set or extract data. More properties can also be set, for example client=SET:2;"; + $this->errors[] = $this->error; } else { - $result = $actioncomm->create($user); - if ($result <= 0) { - $errorforactions++; - $this->errors = $actioncomm->errors; + $actionparam = $operation['actionparam']; + $idtouseforthirdparty = ''; + $nametouseforthirdparty = ''; + $emailtouseforthirdparty = ''; + + // $actionparam = 'param=SET:aaa' or 'param=EXTRACT:BODY:....' + $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); + foreach ($arrayvaluetouse as $propertytooverwrite => $valueforproperty) { + $sourcestring = ''; + $sourcefield = ''; + $regexstring = ''; + $regforregex = array(); + + if (preg_match('/^EXTRACT:([a-zA-Z0-9_]+):(.*)$/', $valueforproperty, $regforregex)) { + $sourcefield = $regforregex[1]; + $regexstring = $regforregex[2]; + } + + if (!empty($sourcefield) && !empty($regexstring)) { + if (strtolower($sourcefield) == 'body') { + $sourcestring = $messagetext; + } elseif (strtolower($sourcefield) == 'subject') { + $sourcestring = $subject; + } elseif (strtolower($sourcefield) == 'header') { + $sourcestring = $header; + } + + if ($sourcestring) { + $regforval = array(); + //var_dump($regexstring);var_dump($sourcestring); + if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval)) { + //var_dump($regforval[count($regforval)-1]);exit; + // Overwrite param $tmpproperty + if ($propertytooverwrite == 'id') { + $idtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found idtouseforthirdparty='.dol_escape_htmltag($idtouseforthirdparty); + } elseif ($propertytooverwrite == 'email') { + $emailtouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found propertytooverwrite='.dol_escape_htmltag($propertytooverwrite); + } else { + $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ? trim($regforval[count($regforval) - 1]) : null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Found nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); + } + } else { + // Regex not found + $idtouseforthirdparty = null; + $nametouseforthirdparty = null; + $emailtouseforthirdparty = null; + + $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/ms into '.strtolower($sourcefield).' -> Not found'; + } + //var_dump($object->$tmpproperty);exit; + } else { + // Nothing can be done for this param + $errorforactions++; + $this->error = 'The extract rule to use to load thirdparty has an unknown source (must be HEADER, SUBJECT or BODY)'; + $this->errors[] = $this->error; + } + } elseif (preg_match('/^(SET|SETIFEMPTY):(.*)$/', $valueforproperty, $reg)) { + //if (preg_match('/^options_/', $tmpproperty)) $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $reg[1]; + //else $object->$tmpproperty = $reg[1]; + if ($propertytooverwrite == 'id') { + $idtouseforthirdparty = $reg[2]; + + $operationslog .= '
We set property idtouseforthrdparty='.dol_escape_htmltag($idtouseforthirdparty); + } elseif ($propertytooverwrite == 'email') { + $emailtouseforthirdparty = $reg[2]; + + $operationslog .= '
We set property emailtouseforthrdparty='.dol_escape_htmltag($emailtouseforthirdparty); + } else { + $nametouseforthirdparty = $reg[2]; + + $operationslog .= '
We set property nametouseforthirdparty='.dol_escape_htmltag($nametouseforthirdparty); + } + } else { + $errorforactions++; + $this->error = 'Bad syntax for description of action parameters: '.$actionparam; + $this->errors[] = $this->error; + break; + } + } + + if (!$errorforactions && ($idtouseforthirdparty || $emailtouseforthirdparty || $nametouseforthirdparty)) { + $result = $thirdpartystatic->fetch($idtouseforthirdparty, $nametouseforthirdparty, '', '', '', '', '', '', '', '', $emailtouseforthirdparty); + if ($result < 0) { + $errorforactions++; + $this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)'; + $this->errors[] = $this->error; + break; + } elseif ($result == 0) { + if ($operation['type'] == 'loadthirdparty') { + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found"); + + $errorforactions++; + $langs->load("errors"); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty); + $this->errors[] = $this->error; + } elseif ($operation['type'] == 'loadandcreatethirdparty') { + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." was not found. We try to create it."); + + // Create thirdparty + $thirdpartystatic->name = $nametouseforthirdparty; + if ($fromtext != $nametouseforthirdparty) { + $thirdpartystatic->name_alias = $fromtext; + } + $thirdpartystatic->email = ($emailtouseforthirdparty ? $emailtouseforthirdparty : $from); + + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($thirdpartystatic, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + if ($thirdpartystatic->client && empty($thirdpartystatic->code_client)) { + $thirdpartystatic->code_client = 'auto'; + } + if ($thirdpartystatic->fournisseur && empty($thirdpartystatic->code_fournisseur)) { + $thirdpartystatic->code_fournisseur = 'auto'; + } + + if ($errorforthisaction) { + $errorforactions++; + } else { + $result = $thirdpartystatic->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = $thirdpartystatic->error; + $this->errors = $thirdpartystatic->errors; + } else { + $operationslog .= '
Thirdparty created -> id = '.dol_escape_htmltag($thirdpartystatic->id); + } + } + } + } } } - } - } elseif ($operation['type'] == 'recordjoinpiece') { - $pj = getAttachments($imapemail, $connection); - foreach ($pj as $key => $val) { - $data[$val['filename']] = getFileData($imapemail, $val['pos'], $val['type'], $connection); - } - if (count($pj) > 0) { - $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."user WHERE email LIKE '%".$this->db->escape($from)."%'"; - $resql = $this->db->query($sql); - if ($this->db->num_rows($resql) == 0) { - $this->errors[] = 'User Not allowed to add documents'; + } elseif ($operation['type'] == 'recordevent') { + // Create event + $actioncomm = new ActionComm($this->db); + + $alreadycreated = $actioncomm->fetch(0, '', '', $msgid); + if ($alreadycreated == 0) { + if ($projectstatic->id > 0) { + if ($projectfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Project found from '.$projectfoundby); + } + } + if ($thirdpartystatic->id > 0) { + if ($thirdpartyfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); + } + } + if ($contactstatic->id > 0) { + if ($contactfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); + } + } + + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); + + $descriptionfull = $description; + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } + + // Insert record of emails sent + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) + $actioncomm->code = 'AC_'.$actioncode; + $actioncomm->label = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from; + $actioncomm->note_private = $descriptionfull; + $actioncomm->fk_project = $projectstatic->id; + $actioncomm->datep = $date; // date of email + $actioncomm->datef = $date; // date of email + $actioncomm->percentage = -1; // Not applicable + $actioncomm->socid = $thirdpartystatic->id; + $actioncomm->contact_id = $contactstatic->id; + $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array()); + $actioncomm->authorid = $user->id; // User saving action + $actioncomm->userownerid = $user->id; // Owner of action + // Fields when action is an email (content should be added into note) + $actioncomm->email_msgid = $msgid; + $actioncomm->email_from = $fromstring; + $actioncomm->email_sender = $sender; + $actioncomm->email_to = $to; + $actioncomm->email_tocc = $sendtocc; + $actioncomm->email_tobcc = $sendtobcc; + $actioncomm->email_subject = $subject; + $actioncomm->errors_to = ''; + + if (!in_array($fk_element_type, array('societe', 'contact', 'project', 'user'))) { + $actioncomm->fk_element = $fk_element_id; + $actioncomm->elementid = $fk_element_id; + $actioncomm->elementtype = $fk_element_type; + if (is_object($objectemail) && $objectemail->module) { + $actioncomm->elementtype .= '@'.$objectemail->module; + } + } + + //$actioncomm->extraparams = $extraparams; + + // Overwrite values with values extracted from source email + $errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + //var_dump($fk_element_id); + //var_dump($fk_element_type); + //var_dump($alreadycreated); + //var_dump($operation['type']); + //var_dump($actioncomm); + //exit; + + if ($errorforthisaction) { + $errorforactions++; + } else { + $result = $actioncomm->create($user); + if ($result <= 0) { + $errorforactions++; + $this->errors = $actioncomm->errors; + } else { + $operationslog .= '
Event created -> id='.dol_escape_htmltag($actioncomm->id); + } + } } - $arrayobject = array( + } elseif ($operation['type'] == 'recordjoinpiece') { + $pj = getAttachments($imapemail, $connection); + foreach ($pj as $key => $val) { + $data[$val['filename']] = getFileData($imapemail, $val['pos'], $val['type'], $connection); + } + if (count($pj) > 0) { + $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."user WHERE email LIKE '%".$this->db->escape($from)."%'"; + $resql = $this->db->query($sql); + if ($this->db->num_rows($resql) == 0) { + $this->errors[] = 'User Not allowed to add documents'; + } + $arrayobject = array( 'propale' => array('table' => 'propal', - 'fields' => array('ref'), - 'class' => 'comm/propal/class/propal.class.php', - 'object' => 'Propal'), + 'fields' => array('ref'), + 'class' => 'comm/propal/class/propal.class.php', + 'object' => 'Propal'), 'holiday' => array('table' => 'holiday', - 'fields' => array('ref'), - 'class' => 'holiday/class/holiday.class.php', - 'object' => 'Holiday'), + 'fields' => array('ref'), + 'class' => 'holiday/class/holiday.class.php', + 'object' => 'Holiday'), 'expensereport' => array('table' => 'expensereport', - 'fields' => array('ref'), - 'class' => 'expensereport/class/expensereport.class.php', - 'object' => 'ExpenseReport'), + 'fields' => array('ref'), + 'class' => 'expensereport/class/expensereport.class.php', + 'object' => 'ExpenseReport'), 'recruitment/recruitmentjobposition' => array('table' => 'recruitment_recruitmentjobposition', - 'fields' => array('ref'), - 'class' => 'recruitment/class/recruitmentjobposition.class.php', - 'object' => 'RecruitmentJobPosition'), + 'fields' => array('ref'), + 'class' => 'recruitment/class/recruitmentjobposition.class.php', + 'object' => 'RecruitmentJobPosition'), 'recruitment/recruitmentjobposition' => array('table' => 'recruitment_recruitmentcandidature', - 'fields' => array('ref'), - 'class' => 'recruitment/class/recruitmentcandidature.class.php', - 'object' => ' RecruitmentCandidature'), + 'fields' => array('ref'), + 'class' => 'recruitment/class/recruitmentcandidature.class.php', + 'object' => ' RecruitmentCandidature'), 'societe' => array('table' => 'societe', 'fields' => array('code_client', 'code_fournisseur'), 'class' => 'societe/class/societe.class.php', 'object' => 'Societe'), - 'commande' => array('table' => 'commande', + 'commande' => array('table' => 'commande', 'fields' => array('ref'), 'class' => 'commande/class/commande.class.php', 'object' => 'Commande'), - 'expedition' => array('table' => 'expedition', + 'expedition' => array('table' => 'expedition', 'fields' => array('ref'), 'class' => 'expedition/class/expedition.class.php', 'object' => 'Expedition'), - 'contract' => array('table' => 'contrat', + 'contract' => array('table' => 'contrat', 'fields' => array('ref'), 'class' => 'contrat/class/contrat.class.php', 'object' => 'Contrat'), - 'fichinter' => array('table' => 'fichinter', + 'fichinter' => array('table' => 'fichinter', 'fields' => array('ref'), 'class' => 'fichinter/class/fichinter.class.php', 'object' => 'Fichinter'), @@ -2256,395 +2288,407 @@ class EmailCollector extends CommonObject 'fields' => array('ref'), 'class' => 'ticket/class/ticket.class.php', 'object' => ' Ticket'), - 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord', + 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord', 'fields' => array('ref'), 'class' => 'knowledgemanagement/class/knowledgemanagement.class.php', 'object' => 'KnowledgeRecord'), - 'supplier_proposal' => array('table' => 'supplier_proposal', + 'supplier_proposal' => array('table' => 'supplier_proposal', 'fields' => array('ref'), 'class' => 'supplier_proposal/class/supplier_proposal.class.php', 'object' => 'SupplierProposal'), - 'fournisseur/commande' => array('table' => 'commande_fournisseur', + 'fournisseur/commande' => array('table' => 'commande_fournisseur', 'fields' => array('ref', 'ref_supplier'), 'class' => 'fourn/class/fournisseur.commande.class.php', 'object' => 'SupplierProposal'), - 'facture' => array('table' => 'facture', + 'facture' => array('table' => 'facture', 'fields' => array('ref'), 'class' => 'compta/facture/class/facture.class.php', 'object' => 'Facture'), - 'fournisseur/facture' => array('table' => 'facture_fourn', + 'fournisseur/facture' => array('table' => 'facture_fourn', 'fields' => array('ref', ref_client), 'class' => 'fourn/class/fournisseur.facture.class.php', 'object' => 'FactureFournisseur'), - 'produit' => array('table' => 'product', + 'produit' => array('table' => 'product', 'fields' => array('ref'), 'class' => 'product/class/product.class.php', 'object' => 'Product'), - 'productlot' => array('table' => 'product_lot', + 'productlot' => array('table' => 'product_lot', 'fields' => array('batch'), 'class' => 'product/stock/class/productlot.class.php', 'object' => 'Productlot'), - 'projet' => array('table' => 'projet', + 'projet' => array('table' => 'projet', 'fields' => array('ref'), 'class' => 'projet/class/projet.class.php', 'object' => 'Project'), - 'projet_task' => array('table' => 'projet_task', + 'projet_task' => array('table' => 'projet_task', 'fields' => array('ref'), 'class' => 'projet/class/task.class.php', 'object' => 'Task'), - 'ressource' => array('table' => 'resource', + 'ressource' => array('table' => 'resource', 'fields' => array('ref'), 'class' => 'ressource/class/dolressource.class.php', 'object' => 'Dolresource'), - 'bom' => array('table' => 'bom_bom', + 'bom' => array('table' => 'bom_bom', 'fields' => array('ref'), 'class' => 'bom/class/bom.class.php', 'object' => 'BOM'), - 'mrp' => array('table' => 'mrp_mo', + 'mrp' => array('table' => 'mrp_mo', 'fields' => array('ref'), 'class' => 'mrp/class/mo.class.php', 'object' => 'Mo'), - ); + ); - if (!is_object($hookmanager)) { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($this->db); - } - $hookmanager->initHooks(array('emailcolector')); - $parameters = array('arrayobject' => $arrayobject); - $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) { - $arrayobject = $hookmanager->resArray; - } - - $resultobj = array(); - - foreach ($arrayobject as $key => $objectdesc) { - $sql = 'SELECT DISTINCT t.rowid '; - $sql .= ' FROM ' . MAIN_DB_PREFIX . $objectdesc['table'] . ' AS t'; - $sql .= ' WHERE '; - foreach ($objectdesc['fields'] as $field) { - $sql .= "'" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $field . ", '%') OR "; + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('emailcolector')); + $parameters = array('arrayobject' => $arrayobject); + $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $arrayobject = $hookmanager->resArray; } - $sql = substr($sql, 0, -4); - $ressqlobj = $this->db->query($sql); - if ($ressqlobj) { - while ($obj = $this->db->fetch_object($ressqlobj)) { - $resultobj[$key][] = $obj->rowid; + $resultobj = array(); + + foreach ($arrayobject as $key => $objectdesc) { + $sql = 'SELECT DISTINCT t.rowid '; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $objectdesc['table'] . ' AS t'; + $sql .= ' WHERE '; + foreach ($objectdesc['fields'] as $field) { + $sql .= "'" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $field . ", '%') OR "; + } + $sql = substr($sql, 0, -4); + + $ressqlobj = $this->db->query($sql); + if ($ressqlobj) { + while ($obj = $this->db->fetch_object($ressqlobj)) { + $resultobj[$key][] = $obj->rowid; + } } } + $dirs = array(); + foreach ($resultobj as $mod => $ids) { + $moddesc = $arrayobject[$mod]; + $elementpath = $mod; + dol_include_once($moddesc['class']); + $objectmanaged = new $moddesc['object']($this->db); + foreach ($ids as $val) { + $res = $objectmanaged->fetch($val); + if ($res) { + $path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : ''); + $dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/'; + } else { + $this->errors[] = 'object not found'; + } + } + } + foreach ($dirs as $target) { + foreach ($data as $filename => $content) { + $prefix = $this->actions[$this->id]['actionparam']; + + $resr = saveAttachment($target, $prefix . '_' . $filename, $content); + if ($resr == -1) { + $this->errors[] = 'Doc not saved'; + } + } + } + + $operationslog .= '
Save attachment files on disk'; + } else { + $this->errors[] = 'no joined piece'; + + $operationslog .= '
No joinded files'; } - $dirs = array(); - foreach ($resultobj as $mod => $ids) { - $moddesc = $arrayobject[$mod]; - $elementpath = $mod; - dol_include_once($moddesc['class']); - $objectmanaged = new $moddesc['object']($this->db); - foreach ($ids as $val) { - $res = $objectmanaged->fetch($val); - if ($res) { - $path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : ''); - $dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/'; + } elseif ($operation['type'] == 'project') { + // Create project / lead + $projecttocreate = new Project($this->db); + $alreadycreated = $projecttocreate->fetch(0, '', '', $msgid); + if ($alreadycreated == 0) { + if ($thirdpartystatic->id > 0) { + $projecttocreate->socid = $thirdpartystatic->id; + if ($thirdpartyfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); + } + } + if ($contactstatic->id > 0) { + $projecttocreate->contact_id = $contactstatic->id; + if ($contactfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); + } + } + + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); + + $descriptionfull = $description; + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } + + $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid'); + $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); + + $projecttocreate->title = $subject; + $projecttocreate->date_start = $date; // date of email + $projecttocreate->date_end = ''; + $projecttocreate->opp_status = $id_opp_status; + $projecttocreate->opp_percent = $percent_opp_status; + $projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...'); + $projecttocreate->note_private = $descriptionfull; + $projecttocreate->entity = $conf->entity; + $projecttocreate->email_msgid = $msgid; + + $savesocid = $projecttocreate->socid; + + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + // Set project ref if not yet defined + if (empty($projecttocreate->ref)) { + // Get next Ref + $defaultref = ''; + $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; + + // Search template files + $file = ''; $classname = ''; $filefound = 0; $reldir = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0); + if (file_exists($file)) { + $filefound = 1; + $classname = $modele; + break; + } + } + + if ($filefound) { + if ($savesocid > 0) { + if ($savesocid != $projecttocreate->socid) { + $errorforactions++; + setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors'); + } + } else { + if ($projecttocreate->socid > 0) { + $thirdpartystatic->fetch($projecttocreate->socid); + } + } + + $result = dol_include_once($reldir."core/modules/project/".$modele.'.php'); + $modModuleToUseForNextValue = new $classname; + $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate); + } + $projecttocreate->ref = $defaultref; + } + + + if ($errorforthisaction) { + $errorforactions++; + } else { + if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)) { + $errorforactions++; + $this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; } else { - $this->errors[] = 'object not found'; + // Create project + $result = $projecttocreate->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); + $this->errors = $projecttocreate->errors; + } else { + if ($attachments) { + $destdir = $conf->project->dir_output.'/'.$projecttocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); + } + } else { + $this->getmsg($connection, $imapemail, $destdir); + } + + $operationslog .= '
Project created with attachments -> id='.dol_escape_htmltag($projecttocreate->id); + } else { + $operationslog .= '
Project created without attachments -> id='.dol_escape_htmltag($projecttocreate->id); + } + } } } } - foreach ($dirs as $target) { - foreach ($data as $filename => $content) { - $prefix = $this->actions[$this->id]['actionparam']; + } elseif ($operation['type'] == 'ticket') { + // Create ticket + $tickettocreate = new Ticket($this->db); - $resr = saveAttachment($target, $prefix . '_' . $filename, $content); - if ($resr == -1) { - $this->errors[] = 'Doc not saved'; + $alreadycreated = $tickettocreate->fetch(0, '', '', $msgid); + if ($alreadycreated == 0) { + if ($thirdpartystatic->id > 0) { + $tickettocreate->socid = $thirdpartystatic->id; + $tickettocreate->fk_soc = $thirdpartystatic->id; + if ($thirdpartyfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); + } + } + if ($contactstatic->id > 0) { + $tickettocreate->contact_id = $contactstatic->id; + if ($contactfoundby) { + $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); + } + } + + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); + + $descriptionfull = $description; + if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); + $descriptionfull = dol_concatdesc($descriptionfull, $header); + } + + $tickettocreate->subject = $subject; + $tickettocreate->message = $description; + $tickettocreate->type_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_TYPE_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_TYPE_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_type', 'use_default', 'code', 1)); + $tickettocreate->category_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_CATEGORY_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_CATEGORY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_category', 'use_default', 'code', 1)); + $tickettocreate->severity_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_severity', 'use_default', 'code', 1)); + $tickettocreate->origin_email = $from; + $tickettocreate->fk_user_create = $user->id; + $tickettocreate->datec = dol_now(); + $tickettocreate->fk_project = $projectstatic->id; + $tickettocreate->notify_tiers_at_create = 0; + $tickettocreate->note_private = $descriptionfull; + $tickettocreate->entity = $conf->entity; + $tickettocreate->email_msgid = $msgid; + $tickettocreate->email_date = $date; + //$tickettocreate->fk_contact = $contactstatic->id; + + $savesocid = $tickettocreate->socid; + + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); + + // Set ticket ref if not yet defined + if (empty($tickettocreate->ref)) { + // Get next Ref + $defaultref = ''; + $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; + + // Search template files + $file = ''; $classname = ''; $filefound = 0; $reldir = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); + if (file_exists($file)) { + $filefound = 1; + $classname = $modele; + break; + } + } + + if ($filefound) { + if ($savesocid > 0) { + if ($savesocid != $tickettocreate->socid) { + $errorforactions++; + setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors'); + } + } else { + if ($tickettocreate->socid > 0) { + $thirdpartystatic->fetch($tickettocreate->socid); + } + } + + $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); + $modModuleToUseForNextValue = new $classname; + $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); + } + $tickettocreate->ref = $defaultref; + } + + if ($errorforthisaction) { + $errorforactions++; + } else { + if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0) { + $errorforactions++; + $this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; + } else { + // Create project + $result = $tickettocreate->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error); + $this->errors = $tickettocreate->errors; + } else { + if ($attachments) { + $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + foreach ($attachments as $attachment) { + $attachment->save($destdir.'/'); + } + } else { + $this->getmsg($connection, $imapemail, $destdir); + } + + $operationslog .= '
Ticket created with attachments -> id='.dol_escape_htmltag($tickettocreate->id); + } else { + $operationslog .= '
Ticket created without attachments -> id='.dol_escape_htmltag($tickettocreate->id); + } + } } } } - } else { - $this->errors[] = 'no joined piece'; - } - } elseif ($operation['type'] == 'project') { - // Create project / lead - $projecttocreate = new Project($this->db); - $alreadycreated = $projecttocreate->fetch(0, '', '', $msgid); - if ($alreadycreated == 0) { - if ($thirdpartystatic->id > 0) { - $projecttocreate->socid = $thirdpartystatic->id; - if ($thirdpartyfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); - } - } - if ($contactstatic->id > 0) { - $projecttocreate->contact_id = $contactstatic->id; - if ($contactfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); - } - } + } elseif ($operation['type'] == 'candidature') { + // Create candidature + $candidaturetocreate = new RecruitmentCandidature($this->db); - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); + $alreadycreated = $candidaturetocreate->fetch(0, '', $msgid); + if ($alreadycreated == 0) { + $description = $descriptiontitle; + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $descriptionmeta); + $description = dol_concatdesc($description, "-----"); + $description = dol_concatdesc($description, $messagetext); - $descriptionfull = $description; - if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { + $descriptionfull = $description; $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); $descriptionfull = dol_concatdesc($descriptionfull, $header); - } - $id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid'); - $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); + $candidaturetocreate->subject = $subject; + $candidaturetocreate->message = $description; + $candidaturetocreate->type_code = 0; + $candidaturetocreate->category_code = null; + $candidaturetocreate->severity_code = null; + $candidaturetocreate->email = $from; + //$candidaturetocreate->lastname = $langs->trans("Anonymous").' - '.$from; + $candidaturetocreate->fk_user_creat = $user->id; + $candidaturetocreate->date_creation = dol_now(); + $candidaturetocreate->fk_project = $projectstatic->id; + $candidaturetocreate->description = $description; + $candidaturetocreate->note_private = $descriptionfull; + $candidaturetocreate->entity = $conf->entity; + $candidaturetocreate->email_msgid = $msgid; + $candidaturetocreate->email_date = $date; // date of email + $candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT; + //$candidaturetocreate->fk_contact = $contactstatic->id; - $projecttocreate->title = $subject; - $projecttocreate->date_start = $date; // date of email - $projecttocreate->date_end = ''; - $projecttocreate->opp_status = $id_opp_status; - $projecttocreate->opp_percent = $percent_opp_status; - $projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...'); - $projecttocreate->note_private = $descriptionfull; - $projecttocreate->entity = $conf->entity; - $projecttocreate->email_msgid = $msgid; + // Overwrite values with values extracted from source email. + // This may overwrite any $projecttocreate->xxx properties. + $errorforthisaction = $this->overwritePropertiesOfObject($candidaturetocreate, $operation['actionparam'], $messagetext, $subject, $header, $operationslog); - $savesocid = $projecttocreate->socid; - - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $errorforthisaction = $this->overwritePropertiesOfObject($projecttocreate, $operation['actionparam'], $messagetext, $subject, $header); - - // Set project ref if not yet defined - if (empty($projecttocreate->ref)) { - // Get next Ref - $defaultref = ''; - $modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; - - // Search template files - $file = ''; $classname = ''; $filefound = 0; $reldir = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0); - if (file_exists($file)) { - $filefound = 1; - $classname = $modele; - break; - } - } - - if ($filefound) { - if ($savesocid > 0) { - if ($savesocid != $projecttocreate->socid) { - $errorforactions++; - setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$projecttocreate->socid.') by setting socid in operation with a different value', null, 'errors'); - } - } else { - if ($projecttocreate->socid > 0) { - $thirdpartystatic->fetch($projecttocreate->socid); - } - } - - $result = dol_include_once($reldir."core/modules/project/".$modele.'.php'); - $modModuleToUseForNextValue = new $classname; - $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate); - } - $projecttocreate->ref = $defaultref; - } - - - if ($errorforthisaction) { - $errorforactions++; - } else { - if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)) { - $errorforactions++; - $this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; - } else { - // Create project - $result = $projecttocreate->create($user); - if ($result <= 0) { - $errorforactions++; - $this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error); - $this->errors = $projecttocreate->errors; - } else { - if ($attachments) { - $destdir = $conf->project->dir_output.'/'.$projecttocreate->ref; - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - foreach ($attachments as $attachment) { - $attachment->save($destdir.'/'); - } - } else { - $this->getmsg($connection, $imapemail, $destdir); - } - } - } - } - } - } - } elseif ($operation['type'] == 'ticket') { - // Create ticket - $tickettocreate = new Ticket($this->db); - - $alreadycreated = $tickettocreate->fetch(0, '', '', $msgid); - if ($alreadycreated == 0) { - if ($thirdpartystatic->id > 0) { - $tickettocreate->socid = $thirdpartystatic->id; - $tickettocreate->fk_soc = $thirdpartystatic->id; - if ($thirdpartyfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Third party found from '.$thirdpartyfoundby); - } - } - if ($contactstatic->id > 0) { - $tickettocreate->contact_id = $contactstatic->id; - if ($contactfoundby) { - $descriptionmeta = dol_concatdesc($descriptionmeta, 'Contact/address found from '.$contactfoundby); - } - } - - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); - - $descriptionfull = $description; - if (empty($conf->global->MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER)) { - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); - } - - $tickettocreate->subject = $subject; - $tickettocreate->message = $description; - $tickettocreate->type_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_TYPE_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_TYPE_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_type', 'use_default', 'code', 1)); - $tickettocreate->category_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_CATEGORY_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_CATEGORY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_category', 'use_default', 'code', 1)); - $tickettocreate->severity_code = (!empty($conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE) ? $conf->global->MAIN_EMAILCOLLECTOR_TICKET_SEVERITY_CODE : dol_getIdFromCode($this->db, 1, 'c_ticket_severity', 'use_default', 'code', 1)); - $tickettocreate->origin_email = $from; - $tickettocreate->fk_user_create = $user->id; - $tickettocreate->datec = dol_now(); - $tickettocreate->fk_project = $projectstatic->id; - $tickettocreate->notify_tiers_at_create = 0; - $tickettocreate->note_private = $descriptionfull; - $tickettocreate->entity = $conf->entity; - $tickettocreate->email_msgid = $msgid; - $tickettocreate->email_date = $date; - //$tickettocreate->fk_contact = $contactstatic->id; - - $savesocid = $tickettocreate->socid; - - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $errorforthisaction = $this->overwritePropertiesOfObject($tickettocreate, $operation['actionparam'], $messagetext, $subject, $header); - - // Set ticket ref if not yet defined - if (empty($tickettocreate->ref)) { - // Get next Ref - $defaultref = ''; - $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; - - // Search template files - $file = ''; $classname = ''; $filefound = 0; $reldir = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); - if (file_exists($file)) { - $filefound = 1; - $classname = $modele; - break; - } - } - - if ($filefound) { - if ($savesocid > 0) { - if ($savesocid != $tickettocreate->socid) { - $errorforactions++; - setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$tickettocreate->socid.') by setting socid in operation with a different value', null, 'errors'); - } - } else { - if ($tickettocreate->socid > 0) { - $thirdpartystatic->fetch($tickettocreate->socid); - } - } - - $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); - $modModuleToUseForNextValue = new $classname; - $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); - } - $tickettocreate->ref = $defaultref; - } - - if ($errorforthisaction) { - $errorforactions++; - } else { - if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0) { - $errorforactions++; - $this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; - } else { - // Create project - $result = $tickettocreate->create($user); - if ($result <= 0) { - $errorforactions++; - $this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error); - $this->errors = $tickettocreate->errors; - } else { - if ($attachments) { - $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - foreach ($attachments as $attachment) { - $attachment->save($destdir.'/'); - } - } else { - $this->getmsg($connection, $imapemail, $destdir); - } - } - } - } - } - } - } elseif ($operation['type'] == 'candidature') { - // Create candidature - $candidaturetocreate = new RecruitmentCandidature($this->db); - - $alreadycreated = $candidaturetocreate->fetch(0, '', $msgid); - if ($alreadycreated == 0) { - $description = $descriptiontitle; - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $descriptionmeta); - $description = dol_concatdesc($description, "-----"); - $description = dol_concatdesc($description, $messagetext); - - $descriptionfull = $description; - $descriptionfull = dol_concatdesc($descriptionfull, "----- Header"); - $descriptionfull = dol_concatdesc($descriptionfull, $header); - - $candidaturetocreate->subject = $subject; - $candidaturetocreate->message = $description; - $candidaturetocreate->type_code = 0; - $candidaturetocreate->category_code = null; - $candidaturetocreate->severity_code = null; - $candidaturetocreate->email = $from; - //$candidaturetocreate->lastname = $langs->trans("Anonymous").' - '.$from; - $candidaturetocreate->fk_user_creat = $user->id; - $candidaturetocreate->date_creation = dol_now(); - $candidaturetocreate->fk_project = $projectstatic->id; - $candidaturetocreate->description = $description; - $candidaturetocreate->note_private = $descriptionfull; - $candidaturetocreate->entity = $conf->entity; - $candidaturetocreate->email_msgid = $msgid; - $candidaturetocreate->email_date = $date; // date of email - $candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT; - //$candidaturetocreate->fk_contact = $contactstatic->id; - - // Overwrite values with values extracted from source email. - // This may overwrite any $projecttocreate->xxx properties. - $errorforthisaction = $this->overwritePropertiesOfObject($candidaturetocreate, $operation['actionparam'], $messagetext, $subject, $header); - - // Set candidature ref if not yet defined - /*if (empty($candidaturetocreate->ref)) We do not need this because we create object in draft status - { + // Set candidature ref if not yet defined + /*if (empty($candidaturetocreate->ref)) We do not need this because we create object in draft status + { // Get next Ref $defaultref = ''; $modele = empty($conf->global->CANDIDATURE_ADDON) ? 'mod_candidature_simple' : $conf->global->CANDIDATURE_ADDON; @@ -2680,68 +2724,73 @@ class EmailCollector extends CommonObject $defaultref = $modModuleToUseForNextValue->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate); } $candidaturetocreate->ref = $defaultref; - }*/ + }*/ - if ($errorforthisaction) { - $errorforactions++; - } else { - // Create project - $result = $candidaturetocreate->create($user); - if ($result <= 0) { + if ($errorforthisaction) { $errorforactions++; - $this->error = 'Failed to create ticket: '.join(', ', $candidaturetocreate->errors); - $this->errors = $candidaturetocreate->errors; + } else { + // Create project + $result = $candidaturetocreate->create($user); + if ($result <= 0) { + $errorforactions++; + $this->error = 'Failed to create ticket: '.join(', ', $candidaturetocreate->errors); + $this->errors = $candidaturetocreate->errors; + } + + $operationslog .= '
Candidature created without attachments -> id='.dol_escape_htmltag($candidaturetocreate->id); } } - } - } elseif (substr($operation['type'], 0, 4) == 'hook') { - // Create event specific on hook - // this code action is hook..... for support this call - if (!is_object($hookmanager)) { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($this->db); + } elseif (substr($operation['type'], 0, 4) == 'hook') { + // Create event specific on hook + // this code action is hook..... for support this call + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + + $parameters = array( + 'connection'=> $connection, + 'imapemail'=>$imapemail, + 'overview'=>$overview, + + 'from' => $from, + 'fromtext' => $fromtext, + + 'actionparam'=> $operation['actionparam'], + + 'thirdpartyid' => $thirdpartyid, + 'objectid'=> $objectid, + 'objectemail'=> $objectemail, + + 'messagetext'=>$messagetext, + 'subject'=>$subject, + 'header'=>$header, + 'attachments'=>$attachments, + ); + $reshook = $hookmanager->executeHooks('doCollectImapOneCollector', $parameters, $this, $operation['type']); + + if ($reshook < 0) { + $errorforthisaction++; + $this->error = $hookmanager->resPrint; + } + if ($errorforthisaction) { + $errorforactions++; + $operationslog .= '
Hook doCollectImapOneCollector executed with error'; + } else { + $operationslog .= '
Hook doCollectImapOneCollector executed without error'; + } } - $parameters = array( - 'connection'=> $connection, - 'imapemail'=>$imapemail, - 'overview'=>$overview, - - 'from' => $from, - 'fromtext' => $fromtext, - - 'actionparam'=> $operation['actionparam'], - - 'thirdpartyid' => $thirdpartyid, - 'objectid'=> $objectid, - 'objectemail'=> $objectemail, - - 'messagetext'=>$messagetext, - 'subject'=>$subject, - 'header'=>$header, - 'attachments'=>$attachments, - ); - $reshook = $hookmanager->executeHooks('doColleimapctOneCollector', $parameters, $this, $operation['type']); - - if ($reshook < 0) { - $errorforthisaction++; - $this->error = $hookmanager->resPrint; + if (!$errorforactions) { + $nbactiondoneforemail++; } - if ($errorforthisaction) { - $errorforactions++; - } - } - - - if (!$errorforactions) { - $nbactiondoneforemail++; } } // Error for email or not ? if (!$errorforactions) { - if (empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - if ($targetdir) { + if ($targetdir && empty($mode)) { + if (empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { dol_syslog("EmailCollector::doCollectOneCollector move message ".$imapemail." to ".$connectstringtarget, LOG_DEBUG); $res = imap_mail_move($connection, $imapemail, $targetdir, 0); if ($res == false) { @@ -2751,9 +2800,10 @@ class EmailCollector extends CommonObject dol_syslog(imap_last_error()); } } else { - dol_syslog("EmailCollector::doCollectOneCollector message ".$imapemail." to ".$connectstringtarget." was set to read", LOG_DEBUG); - // TODO Make the move + // TODO Move mail using PHP-IMAP } + } else { + dol_syslog("EmailCollector::doCollectOneCollector message ".$imapemail." to ".$connectstringtarget." was set to read", LOG_DEBUG); } } else { $errorforemail++; @@ -2771,7 +2821,11 @@ class EmailCollector extends CommonObject $nbactiondone += $nbactiondoneforemail; $nbemailok++; - $this->db->commit(); + if (empty($mode)) { + $this->db->commit(); + } else { + $this->db->rollback(); + } // Stop the loop to process email if we reach maximum collected per collect if ($this->maxemailpercollect > 0 && $nbemailok >= $this->maxemailpercollect) { @@ -2795,19 +2849,23 @@ class EmailCollector extends CommonObject if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { $client->disconnect(); } else { - imap_expunge($connection); // To validate any move - + if (empty($mode)) { + imap_expunge($connection); // To validate any move + } imap_close($connection); } $this->datelastresult = $now; $this->lastresult = $output; - $this->debuginfo = 'IMAP search string used : '.$search; + $this->debuginfo .= 'IMAP search string used : '.$search; if ($searchhead) { - $this->debuginfo .= '
Then search string into email header : '.$searchhead; + $this->debuginfo .= '
Then search string into email header : '.dol_escape_htmltag($searchhead); + } + if ($operationslog) { + $this->debuginfo .= $operationslog; } - if (!$error) { + if (empty($error) && empty($mode)) { $this->datelastok = $now; } @@ -2815,11 +2873,14 @@ class EmailCollector extends CommonObject $this->lastresult .= "
".join("
", $this->errors); } $this->codelastresult = ($error ? 'KO' : 'OK'); - $this->update($user); + + if (empty($mode)) { + $this->update($user); + } dol_syslog("EmailCollector::doCollectOneCollector end", LOG_DEBUG); - return $error ?-1 : 1; + return $error ? -1 : 1; } @@ -2875,6 +2936,7 @@ class EmailCollector extends CommonObject 2.2.1 text/plain 2.2.2 text/html */ + /** * Sub function for getpart(). Only called by createPartArray() and itself. * @@ -2993,10 +3055,10 @@ class EmailCollector extends CommonObject /** * Converts a string from one encoding to another. * - * @param string $string String to convert - * @param string $fromEncoding String encoding - * @param string $toEncoding String return encoding - * @return string Converted string if conversion was successful, or the original string if not + * @param string $string String to convert + * @param string $fromEncoding String encoding + * @param string $toEncoding String return encoding + * @return string Converted string if conversion was successful, or the original string if not * @throws Exception */ protected function convertStringEncoding($string, $fromEncoding, $toEncoding = 'UTF-8') diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index c19610f14ad..cff80aa4153 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -158,6 +158,7 @@ class EmailCollectorFilter extends CommonObject public function create(User $user, $notrigger = false) { global $langs; + if (empty($this->type)) { $langs->load("errors"); $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")); @@ -169,6 +170,12 @@ class EmailCollectorFilter extends CommonObject return -2; } + if (in_array($this->type, array('to')) && strpos($this->rulevalue, '+') != false) { + $langs->load("errors"); + $this->errors[] = $langs->trans("ErrorCharPlusNotSupportedByImapForSearch"); + return -3; + } + return $this->createCommon($user, $notrigger); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index dc9a5c04b6e..e46fea6790b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2016 Yasser Carreón - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2022 Josep Lluís Amador * @@ -214,13 +214,13 @@ if (empty($reshook)) { $db->begin(); $object->note = GETPOST('note', 'alpha'); - $object->origin = $origin; + $object->origin = $origin; $object->origin_id = $origin_id; $object->fk_project = GETPOST('projectid', 'int'); - $object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int'); - $object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int'); - $object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int'); - $object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int'); + $object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int'); + $object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int'); + $object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int'); + $object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int'); $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); @@ -233,8 +233,8 @@ if (empty($reshook)) { $object->ref_customer = GETPOST('ref_customer', 'alpha'); $object->model_pdf = GETPOST('model'); $object->date_delivery = $date_delivery; // Date delivery planed - $object->fk_delivery_address = $objectsrc->fk_delivery_address; - $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); + $object->fk_delivery_address = $objectsrc->fk_delivery_address; + $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->tracking_number = GETPOST('tracking_number', 'alpha'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); @@ -265,7 +265,7 @@ if (empty($reshook)) { $qty .= '_'.$j; while (GETPOSTISSET($batch)) { // save line of detail into sub_qty - $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record + $sub_qty[$j]['q'] = price2num(GETPOST($qty, 'alpha'), 'MS'); // the qty we want to move for this stock record $sub_qty[$j]['id_batch'] = GETPOST($batch, 'int'); // the id into llx_product_batch of stock record to move $subtotalqty += $sub_qty[$j]['q']; @@ -285,12 +285,13 @@ if (empty($reshook)) { $totalqty += $subtotalqty; } else { - // No detail were provided for lots, so if a qty was provided, we can show an error. + // No detail were provided for lots, so if a qty was provided, we can throw an error. if (GETPOST($qty)) { // We try to set an amount // Case we dont use the list of available qty for each warehouse/lot // GUI does not allow this yet - setEventMessages($langs->trans("StockIsRequiredToChooseWhichLotToUse"), null, 'errors'); + setEventMessages($langs->trans("StockIsRequiredToChooseWhichLotToUse").' ('.$langs->trans("Line").' '.GETPOST($idl, 'int').')', null, 'errors'); + $error++; } } } elseif (GETPOSTISSET($stockLocation)) { @@ -328,7 +329,7 @@ if (empty($reshook)) { //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship + if ($totalqty > 0 && !$error) { // There is at least one thing to ship and no error for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; if (!isset($batch_line[$i])) { @@ -388,7 +389,7 @@ if (empty($reshook)) { $error++; } } - } else { + } elseif (!$error) { $labelfieldmissing = $langs->transnoentitiesnoconv("QtyToShip"); if (!empty($conf->stock->enabled)) { $labelfieldmissing .= '/'.$langs->transnoentitiesnoconv("Warehouse"); @@ -481,7 +482,7 @@ if (empty($reshook)) { // setEventMessages($object->error, $object->errors, 'errors'); // } //} - } elseif ($action == 'setdate_livraison' && $user->rights->expedition->creer) { + } elseif ($action == 'setdate_livraison' && !empty($user->rights->expedition->creer)) { $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); @@ -1120,12 +1121,15 @@ if ($action == 'create') { $type = 1; } - print ''."\n"; - print '
'."\n"; + print ''."\n"; + print ''."\n"; // Product label if ($line->fk_product > 0) { // If predefined product - $product->fetch($line->fk_product); + $res = $product->fetch($line->fk_product); + if ($res < 0) { + dol_print_error($db, $product->error, $product->errors); + } $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch //var_dump($product->stock_warehouse[1]); @@ -1408,7 +1412,7 @@ if ($action == 'create') { $deliverableQty = GETPOST($inputName, 'int'); } - print ''; + print ''; print ''; } else { if (!empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b1a767e197d..500b2c7ba4a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -217,11 +217,11 @@ class Expedition extends CommonObject $this->statuts[2] = 'StatusSendingProcessed'; // List of short language codes for status - $this->statutshorts = array(); - $this->statutshorts[-1] = 'StatusSendingCanceledShort'; - $this->statutshorts[0] = 'StatusSendingDraftShort'; - $this->statutshorts[1] = 'StatusSendingValidatedShort'; - $this->statutshorts[2] = 'StatusSendingProcessedShort'; + $this->statuts_short = array(); + $this->statuts_short[-1] = 'StatusSendingCanceledShort'; + $this->statuts_short[0] = 'StatusSendingDraftShort'; + $this->statuts_short[1] = 'StatusSendingValidatedShort'; + $this->statuts_short[2] = 'StatusSendingProcessedShort'; } /** @@ -771,7 +771,7 @@ 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. - // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) + // Note: ->fk_origin_stock = id into table llx_product_batch (may be renamed 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), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock, '', 1); if ($result < 0) { $error++; @@ -965,8 +965,9 @@ class Expedition extends CommonObject } // If product need a batch number, we should not have called this function but addline_batch instead. + // If this happen, we may have a bug in card.php page if (isModEnabled('productbatch') && !empty($orderline->fk_product) && !empty($orderline->product_tobatch)) { - $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH'; + $this->error = 'ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH '.$orderline->id.' '.$orderline->fk_product; // return -4; } @@ -1883,7 +1884,7 @@ class Expedition extends CommonObject global $langs; $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statutshorts[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { @@ -2498,12 +2499,28 @@ class ExpeditionLigne extends CommonObjectLine */ public $table_element = 'expeditiondet'; + + /** + * Id of the line. Duplicate of $id. + * + * @var int + * @deprecated + */ + public $line_id; // deprecated + /** * @deprecated * @see $fk_origin_line */ public $origin_line_id; + /** + * Code of object line that is origin of the shipment line. + * + * @var string + */ + public $fk_origin; // Example: 'orderline' + /** * @var int ID */ @@ -2533,8 +2550,16 @@ class ExpeditionLigne extends CommonObjectLine * @var int Id of product */ public $fk_product; + + // detail of lot and qty = array(id in llx_expeditiondet_batch, fk_expeditiondet, batch, qty, fk_origin_stock) + // We can use this to know warehouse planned to be used for each lot. public $detail_batch; + // detail of warehouses and qty + // We can use this to know warehouse when there is no lot. + public $details_entrepot; + + /** * @var int Id of warehouse */ diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index b2562734447..5d99d1c7a74 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -44,7 +44,7 @@ class ExpeditionLineBatch extends CommonObject public $qty; public $dluo_qty; // deprecated, use qty public $entrepot_id; - public $fk_origin_stock; + public $fk_origin_stock; // rowid in llx_product_batch table public $fk_expeditiondet; diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 0d374f1c722..503fa92b108 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -120,13 +120,12 @@ class ExpenseReportIk extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } + return $result; } + /** * Update object into database * diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index 02bf8b8ce5c..d695359229d 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -171,6 +171,19 @@ class ExpenseReportRule extends CommonObject } + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetchLines() + { + $this->lines = array(); + + $result = $this->fetchLinesCommon(); + return $result; + } + /** * Update object into database * diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d495035b5f6..9b1513b676a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -751,7 +751,7 @@ class CommandeFournisseur extends CommonOrder // phpcs:enable global $conf, $langs, $hookmanager; - if (empty($this->statuts) || empty($this->statutshort)) { + if (empty($this->statuts) || empty($this->statuts_short)) { $langs->load('orders'); $this->statuts[0] = 'StatusSupplierOrderDraft'; @@ -769,15 +769,15 @@ class CommandeFournisseur extends CommonOrder $this->statuts[9] = 'StatusSupplierOrderRefused'; // List of language codes for status - $this->statutshort[0] = 'StatusSupplierOrderDraftShort'; - $this->statutshort[1] = 'StatusSupplierOrderValidatedShort'; - $this->statutshort[2] = 'StatusSupplierOrderApprovedShort'; - $this->statutshort[3] = 'StatusSupplierOrderOnProcessShort'; - $this->statutshort[4] = 'StatusSupplierOrderReceivedPartiallyShort'; - $this->statutshort[5] = 'StatusSupplierOrderReceivedAllShort'; - $this->statutshort[6] = 'StatusSupplierOrderCanceledShort'; - $this->statutshort[7] = 'StatusSupplierOrderCanceledShort'; - $this->statutshort[9] = 'StatusSupplierOrderRefusedShort'; + $this->statuts_short[0] = 'StatusSupplierOrderDraftShort'; + $this->statuts_short[1] = 'StatusSupplierOrderValidatedShort'; + $this->statuts_short[2] = 'StatusSupplierOrderApprovedShort'; + $this->statuts_short[3] = 'StatusSupplierOrderOnProcessShort'; + $this->statuts_short[4] = 'StatusSupplierOrderReceivedPartiallyShort'; + $this->statuts_short[5] = 'StatusSupplierOrderReceivedAllShort'; + $this->statuts_short[6] = 'StatusSupplierOrderCanceledShort'; + $this->statuts_short[7] = 'StatusSupplierOrderCanceledShort'; + $this->statuts_short[9] = 'StatusSupplierOrderRefusedShort'; } $statustrans = array( @@ -806,7 +806,7 @@ class CommandeFournisseur extends CommonOrder } $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; - $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); + $statusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed); $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index dfb1e371636..7c8e4acb25f 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -131,9 +131,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine $this->statuts[0] = 'Received'; $this->statuts[1] = 'Verified'; $this->statuts[2] = 'Denied'; - $this->statutshort[0] = 'Received'; - $this->statutshort[1] = 'Verified'; - $this->statutshort[2] = 'Denied'; + $this->statuts_short[0] = 'Received'; + $this->statuts_short[1] = 'Verified'; + $this->statuts_short[2] = 'Denied'; } @@ -580,7 +580,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine if ($mode == 0) { return $langs->trans($this->statuts[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statutshort[$status]); + return $langs->trans($this->statuts_short[$status]); } elseif ($mode == 2) { return $langs->trans($this->statuts[$status]); } elseif ($mode == 3) { @@ -601,11 +601,11 @@ class CommandeFournisseurDispatch extends CommonObjectLine } } elseif ($mode == 5) { if ($status == 0) { - return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); + return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut0'); } elseif ($status == 1) { - return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); + return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut4'); } elseif ($status == 2) { - return ''.$langs->trans($this->statutshort[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); + return ''.$langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut8'); } } } diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 1b6b5a35564..5c02b533bb7 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -20,25 +20,27 @@ */ /** - * \file evaluation_note.php - * \ingroup hrm - * \brief Tab for notes on Evaluation + * \file htdocs/hrm/evaluation_note.php + * \ingroup hrm + * \brief Tab for notes on Evaluation */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; +require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php'; + // Load translation files required by the page -$langs->loadLangs(array("hrm", "companies")); +$langs->loadLangs(array('hrm', 'companies')); // Get parameters -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); + +$action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -47,6 +49,7 @@ $object = new Evaluation($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('evaluationnote', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -56,8 +59,9 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->hrm->evaluation->write; // Used by the include of actions_setnotes.inc.php -$permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include of actions_addupdatedelete.inc.php +// Permissions +$permissionnote = $user->rights->hrm->evaluation->write; // Used by the include of actions_setnotes.inc.php +$permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index e8554c9da3d..05967606a8e 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -21,9 +21,9 @@ */ /** - * \file htdocs/hrm/index.php - * \ingroup hrm - * \brief Home page for HRM area. + * \file htdocs/hrm/index.php + * \ingroup hrm + * \brief Home page for HRM area. */ @@ -32,10 +32,10 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; if (isModEnabled('deplacement')) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index a9ec4f77121..d8be48bce69 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -20,7 +20,7 @@ */ /** - * \file job_card.php + * \file htdocs/hrm/job_card.php * \ingroup hrm * \brief Page to create/edit/view job */ @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("hrm", "other", 'products')); +$langs->loadLangs(array('hrm', 'other', 'products')); // why products? // Get parameters $id = GETPOST('id', 'int'); @@ -76,9 +76,9 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. - +// Permissions $permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->hrm->all->delete; $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job'; diff --git a/htdocs/hrm/job_contact.php b/htdocs/hrm/job_contact.php index 4a6c9995127..dc25ad6eae2 100644 --- a/htdocs/hrm/job_contact.php +++ b/htdocs/hrm/job_contact.php @@ -20,22 +20,23 @@ */ /** - * \file job_contact.php - * \ingroup hrm - * \brief Tab for contacts linked to Job + * \file htdocs/hrm/job_contact.php + * \ingroup hrm + * \brief Tab for contacts linked to Job */ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("hrm", "companies", "other", "mails")); +$langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); +// Get Parameters $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); $lineid = GETPOST('lineid', 'int'); @@ -53,6 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +// Permissions $permission = $user->rights->hrm->job->write; // Security check (enable the most restrictive one) diff --git a/htdocs/hrm/job_document.php b/htdocs/hrm/job_document.php index 0e4d34e0412..eda504b07cd 100644 --- a/htdocs/hrm/job_document.php +++ b/htdocs/hrm/job_document.php @@ -20,9 +20,9 @@ */ /** - * \file job_document.php - * \ingroup hrm - * \brief Tab for documents linked to Job + * \file htdocs/hrm/job_document.php + * \ingroup hrm + * \brief Tab for documents linked to Job */ // Load Dolibarr environment @@ -36,15 +36,15 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("hrm", "companies", "other", "mails")); - +$langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); +// Get parameters $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); -// Get parameters + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -68,6 +68,7 @@ $object = new Job($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('jobdocument', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -78,6 +79,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->hrm->multidir_output[$object->entity ? $object->entity : $conf->entity]."/job/".get_exdir(0, 0, 0, 1, $object); } +// Permissions $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 53cb43ad080..ed0fb480a3a 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -20,9 +20,9 @@ */ /** - * \file job_list.php - * \ingroup hrm - * \brief List page for job + * \file htdocs/hrm/job_list.php + * \ingroup hrm + * \brief List page of jobs */ @@ -40,8 +40,9 @@ require_once __DIR__.'/class/job.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("hrm", "other")); +$langs->loadLangs(array('hrm', 'other')); +// Get Parameters $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? @@ -130,8 +131,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +// Permissions $permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; +$permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; // Security check diff --git a/htdocs/hrm/job_note.php b/htdocs/hrm/job_note.php index 7205afec247..9e64e27d6ae 100644 --- a/htdocs/hrm/job_note.php +++ b/htdocs/hrm/job_note.php @@ -20,9 +20,9 @@ */ /** - * \file job_note.php - * \ingroup hrm - * \brief Tab for notes on Job + * \file htdocs/hrm/job_note.php + * \ingroup hrm + * \brief Tab for notes on Job */ @@ -33,12 +33,13 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("hrm", "companies")); +$langs->loadLangs(array('hrm', 'companies')); // Get parameters -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); + +$action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -47,6 +48,7 @@ $object = new Job($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('jobnote', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -56,6 +58,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id; } +// Permissions $permissiontoread = $user->rights->hrm->all->read; $permissionnote = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index fc90a24dec6..fa0e6ab3aed 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -20,9 +20,9 @@ */ /** - * \file position_agenda.php - * \ingroup hrm - * \brief Tab of events on Position + * \file htdocs/hrm/position_agenda.php + * \ingroup hrm + * \brief Tab of events on Position */ @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; // Load translation files required by the page -$langs->loadLangs(array("hrm", "other")); +$langs->loadLangs(array('hrm', 'other')); // Get parameters $id = GETPOST('id', 'int'); @@ -79,6 +79,7 @@ $object = new Position($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('positionagenda', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -88,6 +89,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id; } +// Permissions $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index 168756d9851..c3b9251b5ef 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -20,9 +20,9 @@ */ /** - * \file position_card.php - * \ingroup hrm - * \brief Page to create/edit/view position + * \file htdocs/hrm/position_card.php + * \ingroup hrm + * \brief Page to create/edit/view job position */ @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; //dol_include_once('/hrm/position.php'); +// Get Parameters $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); @@ -50,6 +51,7 @@ if ($res < 0) { dol_print_error($db, $object->error); } +// Permissions $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->hrm->all->delete; diff --git a/htdocs/hrm/position_contact.php b/htdocs/hrm/position_contact.php index f443099a9e4..4d85987f4d6 100644 --- a/htdocs/hrm/position_contact.php +++ b/htdocs/hrm/position_contact.php @@ -20,22 +20,23 @@ */ /** - * \file position_contact.php - * \ingroup hrm - * \brief Tab for contacts linked to Position + * \file htdocs/hrm/position_contact.php + * \ingroup hrm + * \brief Tab for contacts linked to Job Position */ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; // Load translation files required by the page $langs->loadLangs(array("hrm", "companies", "other", "mails")); +// Get Parameters $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); $lineid = GETPOST('lineid', 'int'); @@ -47,12 +48,14 @@ $object = new Position($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('positioncontact', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +// Permissions $permission = $user->rights->hrm->position->write; // Security check (enable the most restrictive one) diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index e9eb83e12e4..e79af867a74 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -20,9 +20,9 @@ */ /** - * \file position_list.php - * \ingroup hrm - * \brief List page for position + * \file htdocs/hrm/position_list.php + * \ingroup hrm + * \brief List page for job positions */ @@ -40,8 +40,9 @@ require_once __DIR__.'/class/position.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("hrm", "other")); +$langs->loadLangs(array('hrm', 'other')); +// Get Parameters $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? @@ -130,8 +131,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->hrm->all->read; -$permissiontoadd = $user->rights->hrm->all->write; +// Permissions +$permissiontoread = $user->rights->hrm->all->read; +$permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; // Security check diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php index 99d6581247f..1ecd77b4bdc 100644 --- a/htdocs/hrm/position_note.php +++ b/htdocs/hrm/position_note.php @@ -20,26 +20,27 @@ */ /** - * \file position_note.php - * \ingroup hrm - * \ingroup hrm - * \brief Tab for notes on Position + * \file htdocs/hrm/position_note.php + * \ingroup hrm + * \brief Tab for notes on Position */ // Load Dolibarr environment require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';; require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';; + // Load translation files required by the page -$langs->loadLangs(array("hrm", "companies")); +$langs->loadLangs(array('hrm', 'companies')); + // Get parameters -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -58,7 +59,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->hrm->all->write; +// Permissions +$permissionnote = $user->rights->hrm->all->write; $permissiontoread = $user->rights->hrm->all->read; // Used by the include of actions_addupdatedelete.inc.php // Security check (enable the most restrictive one) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ab5223697e6..3db5ef13ef5 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -198,15 +198,15 @@ if ($action=='downfield' || $action=='upfield') } } */ -if ($action == 'builddoc') { - // Build import file - $result = $objimport->build_file($user, GETPOST('model', 'alpha'), $datatoimport, $array_match_file_to_database); - if ($result < 0) { - setEventMessages($objimport->error, $objimport->errors, 'errors'); - } else { - setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs'); - } -} +// if ($action == 'builddoc') { +// // Build import file +// $result = $objimport->build_file($user, GETPOST('model', 'alpha'), $datatoimport, $array_match_file_to_database); +// if ($result < 0) { +// setEventMessages($objimport->error, $objimport->errors, 'errors'); +// } else { +// setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs'); +// } +// } if ($action == 'deleteprof') { if (GETPOST("id", 'int')) { diff --git a/htdocs/includes/php-iban/README.md b/htdocs/includes/php-iban/README.md index 78b5c121c30..238b8ea7678 100644 --- a/htdocs/includes/php-iban/README.md +++ b/htdocs/includes/php-iban/README.md @@ -9,10 +9,6 @@ php-iban All parts of an IBAN can be retrieved, including country code, checksum, BBAN, financial institution or bank code, account number, and where a fixed-length national system is in use, also branch/sort code. Legacy national checksums may also be retrieved, validated and correctly set, where available, whether they apply to the account number portion, bank and branch identifiers, part or all of the above. IBAN country codes can be converted in to ISO3166-1 alpha-2 and IANA formats, the parent IBAN country acting as registrar for dependent territories may be queried, the official national currency (ISO4217 alpha code format), central bank name and central bank URL may also be queried to ease integration. IBANs may be converted between human and machine representation. IBANs may be obfuscated for presentation to humans in special circumstances such as relative identification. A database of example/test IBANs from different countries is included. Finally, highly accurate suggestions for originally intended input can be made when an incorrect IBAN is detected and is due to mistranscription error. -Tested on PHP versions: ![PHP 5.2](https://img.shields.io/badge/version-PHP%205.2%2B-lightgrey.svg) ![PHP 5.3](https://img.shields.io/badge/version-PHP%205.3%2B-lightgrey.svg) ![PHP 5.4](https://img.shields.io/badge/version-PHP%205.4%2B-lightgrey.svg) ![PHP 5.5](https://img.shields.io/badge/version-PHP%205.5%2B-lightgrey.svg) ![PHP 5.6](https://img.shields.io/badge/version-PHP%205.6%2B-lightgrey.svg) ![PHP 7.0](https://img.shields.io/badge/version-PHP%207.0%2B-lightgrey.svg) ![PHP 7.4](https://img.shields.io/badge/version-PHP%207.4%2B-lightgrey.svg) - -Test on HHVM versions: ![HHVM 3.3](https://img.shields.io/badge/version-HHVM%203.3%2B-lightgrey.svg) ![HHVM 3.6](https://img.shields.io/badge/version-HHVM%203.6%2B-lightgrey.svg) ![HHVM 3.9](https://img.shields.io/badge/version-HHVM%203.9%2B-lightgrey.svg) ![HHVM 3.12](https://img.shields.io/badge/version-HHVM%203.12%2B-lightgrey.svg) ![HHVM 3.15](https://img.shields.io/badge/version-HHVM%203.15%2B-lightgrey.svg) ![HHVM 3.18](https://img.shields.io/badge/version-HHVM%203.18%2B-lightgrey.svg) - The parser was built using regular expressions to adapt the contents of the _official_ IBAN registry available from SWIFT then manually modified for special cases such as [errors and omissions in SWIFT's official specifications](https://raw.githubusercontent.com/globalcitizen/php-iban/master/docs/COMEDY-OF-ERRORS). Various deficiencies in the initial adaptation have since been rectified, and the current version should be a fairly correct and reliable implementation. @@ -256,14 +252,14 @@ The following table compares __php-iban__ to other PHP projects offering IBAN-re | Project | Lic. | Proc | OO | Began | Latest | Star | Watch | Fork | Installs | Home culture | Deps | | ---------------------------------------------------------- | ---- | ---- | --- | ------ | ------ | ---- | ----- | ---- | -------- | ------------ | ------- | -| __php-iban__ | LGPL | ✔ | ✔ | 2009 | 4.1.0 | 344 | 26 | 76 | ~2M* | Global* | *none* | +| __php-iban__ | LGPL | ✔ | ✔ | 2009 | 4.1.1 | 414 | 28 | 98 | ~3.5M* | Global* | *none* | | [Iban](https://github.com/jschaedl/Iban) | MIT | ✘ | ✔ | 2013 | 1.3.0 | 50 | 9 | 19 | 178.39k | German | lots | | [IsoCodes](https://github.com/ronanguilloux/IsoCodes) | GPL3 | ✘ | ✔ | 2012 | 2.1.1 | 466 | 22 | 54 | 145k | French | lots | | [SepaUtil's](https://github.com/AbcAeffchen/SepaUtilities) | GPL3 | ✘ | ✔ | 2014 | 1.2.3 | 8 | 4 | 3 | 25k | German | phpunit | | [Symfony](https://github.com/symfony/symfony) | MIT | ✘ | ✔ | 2013 | 3.3.6 | 15k | 1214 | 5.6k | 23M+ | French | lots | Notes: - * Original download records for __php-iban__ releases were hosted on Google Code and are now lost. Prior to establishing a release process on Github, we just expected that people would download the code... so we're really not sure how many installs exist, but this is a fair guess (~11k + composer installs + a little bit now and then). + * Original download records for __php-iban__ releases were hosted on Google Code and are now lost. Prior to establishing a release process on Github, we just expected that people would download the code... so we're really not sure how many installs exist, but this is a fair guess (now over 3M composer installs + all prior google code and Github installs). * __php-iban__ also powers: * [adm-gravity-iban](https://github.com/InternativeNL/adm-gravity-iban) * [Azzana consulting's XML Solver for ISO20022](http://www.azzana-consulting.com/xmlsolver/) @@ -324,6 +320,12 @@ Your Help Wanted * If you are willing to spend some time searching, we could do with some more test IBANs for most countries, especially smaller ones... +News: August 2022 +----------------- + +__[Version 4.1.1](https://github.com/globalcitizen/php-iban/releases/tag/v4.1.1)__ has been released. + * Long-standing bug affecting Belgian pre-IBAN national checksum verification fixed - thanks to [Arne Peirs](https://github.com/Olympic1) for a [very well documented pull request](https://github.com/globalcitizen/php-iban/pull/119). + News: July 2021 --------------- diff --git a/htdocs/includes/php-iban/php-iban.php b/htdocs/includes/php-iban/php-iban.php index 902cc1e2669..effc0cbf6a8 100644 --- a/htdocs/includes/php-iban/php-iban.php +++ b/htdocs/includes/php-iban/php-iban.php @@ -29,7 +29,7 @@ function verify_iban($iban,$machine_format_only=false) { # Check regex if(preg_match($regex,$iban)) { # Regex passed, check checksum - if(!iban_verify_checksum($iban)) { + if(!iban_verify_checksum($iban)) { return false; } } @@ -56,9 +56,9 @@ function iban_to_machine_format($iban) { # Convert an IBAN to human format. To do this, we # simply insert spaces right now, as per the ECBS -# (European Committee for Banking Standards) +# (European Committee for Banking Standards) # recommendations available at: -# http://www.europeanpaymentscouncil.eu/knowledge_bank_download.cfm?file=ECBS%20standard%20implementation%20guidelines%20SIG203V3.2.pdf +# http://www.europeanpaymentscouncil.eu/knowledge_bank_download.cfm?file=ECBS%20standard%20implementation%20guidelines%20SIG203V3.2.pdf function iban_to_human_format($iban) { # Remove all spaces $iban = str_replace(' ','',$iban); @@ -71,15 +71,15 @@ function iban_to_human_format($iban) { # asterisk, except for the final four characters, and then # return in human format, ie. # HU69107000246667654851100005 -> HU** **** **** **** **** **** 0005 -# +# # We avoid the checksum as it may be used to infer the rest # of the IBAN in cases where the country has few valid banks # and branches, or other information about the account such # as bank, branch, or date issued is known (where a sequential # issuance scheme is in use). -# -# Note that output of this function should be presented with -# other information to a user, such as the date last used or +# +# Note that output of this function should be presented with +# other information to a user, such as the date last used or # the date added to their account, in order to better facilitate # unambiguous relative identification. function iban_to_obfuscated_format($iban) { @@ -439,10 +439,10 @@ function iban_country_get_is_eu_member($iban_country) { # - turkish TL/TK thing # - norway NO gets dropped due to mis-identification with "No." for number (ie. if no country code try prepending NO) function iban_mistranscription_suggestions($incorrect_iban) { - + # remove funky characters $incorrect_iban = iban_to_machine_format($incorrect_iban); - + # abort on ridiculous length input (but be liberal) $length = strlen($incorrect_iban); if($length<5 || $length>34) { return array('(supplied iban length insane)'); } @@ -663,7 +663,7 @@ function _iban_nationalchecksum_set($iban,$nationalchecksum) { return $fixed_iban; } -# Currently unused but may be useful for Norway. +# Currently unused but may be useful for Norway. # ISO7064 MOD11-2 # Adapted from https://gist.github.com/andreCatita/5714353 by Andrew Catita function _iso7064_mod112_catita($input) { @@ -678,7 +678,7 @@ function _iso7064_mod112_catita($input) { return $result; } -# Currently unused but may be useful for Norway. +# Currently unused but may be useful for Norway. # ISO 7064:1983.MOD 11-2 # by goseaside@sina.com function _iso7064_mod112_goseaside($vString) { @@ -688,10 +688,10 @@ function _iso7064_mod112_goseaside($vString) { $i_size = strlen($vString); $bModify = '?' == substr($vString, -1); $i_size1 = $bModify ? $i_size : $i_size + 1; - for ($i = 1; $i <= $i_size; $i++) { + for ($i = 1; $i <= $i_size; $i++) { $i1 = $vString[$i - 1] * 1; $w1 = $wi[($i_size1 - $i) % 10]; - $sigma += ($i1 * $w1) % 11; + $sigma += ($i1 * $w1) % 11; } if($bModify) return str_replace('?', $hash_map[($sigma % 11)], $vString); else return $hash_map[($sigma % 11)]; @@ -714,13 +714,13 @@ function _iso7064_mod97_10($str) { } # Implement the national checksum for a Belgium (BE) IBAN -# (Credit: @gaetan-be) +# (Credit: @gaetan-be, fixed by @Olympic1) function _iban_nationalchecksum_implementation_be($iban,$mode) { if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution $nationalchecksum = iban_get_nationalchecksum_part($iban); - $account = iban_get_account_part($iban); - $account_less_checksum = substr($account,strlen($account)-2); - $expected_nationalchecksum = $account_less_checksum % 97; + $bban = iban_get_bban_part($iban); + $bban_less_checksum = substr($bban, 0, -strlen($nationalchecksum)); + $expected_nationalchecksum = $bban_less_checksum % 97; if($mode=='find') { return $expected_nationalchecksum; } @@ -776,8 +776,8 @@ function _iban_nationalchecksum_implementation_es($iban,$mode) { function _iban_nationalchecksum_implementation_fr_letters2numbers_helper($bban) { $allNumbers = ""; $conversion = array( - "A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5, "F" => 6, "G" => 7, "H" => 8, "I" => 9, - "J" => 1, "K" => 2, "L" => 3, "M" => 4, "N" => 5, "O" => 6, "P" => 7, "Q" => 8, "R" => 9, + "A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5, "F" => 6, "G" => 7, "H" => 8, "I" => 9, + "J" => 1, "K" => 2, "L" => 3, "M" => 4, "N" => 5, "O" => 6, "P" => 7, "Q" => 8, "R" => 9, "S" => 2, "T" => 3, "U" => 4, "V" => 5, "W" => 6, "X" => 7, "Y" => 8, "Z" => 9 ); for ($i=0; $i < strlen($bban); $i++) { @@ -852,7 +852,7 @@ function _iban_nationalchecksum_implementation_mc($iban,$mode) { } # Implement the national checksum for a France (FR) IBAN -# (Credit: @gaetan-be, http://www.credit-card.be/BankAccount/ValidationRules.htm#FR_Validation and +# (Credit: @gaetan-be, http://www.credit-card.be/BankAccount/ValidationRules.htm#FR_Validation and # https://docs.oracle.com/cd/E18727_01/doc.121/e13483/T359831T498954.htm) function _iban_nationalchecksum_implementation_fr($iban,$mode) { if($mode != 'set' && $mode != 'find' && $mode != 'verify') { return ''; } # blank value on return to distinguish from correct execution @@ -1100,7 +1100,7 @@ function _iban_nationalchecksum_implementation_pt($iban,$mode) { } # Implement the national checksum for an Serbia (RS) IBAN -# (NOTE: Reverse engineered, including bank 'Narodna banka Srbije' (908) exception. For two +# (NOTE: Reverse engineered, including bank 'Narodna banka Srbije' (908) exception. For two # separately published and legitimate looking IBANs from that bank, there appears to # be a +97 offset on the checksum, so we simply ignore all checksums for this bank.) function _iban_nationalchecksum_implementation_rs($iban,$mode) { @@ -1118,7 +1118,7 @@ function _iban_nationalchecksum_implementation_rs($iban,$mode) { function _iban_nationalchecksum_implementation_si($iban,$mode) { $bank = iban_get_bank_part($iban); # Bank of Slovenia does not use the legacy checksum scheme. - # Accounts in this namespace appear to be the central bank + # Accounts in this namespace appear to be the central bank # accounts for licensed local banks. if($bank == '01') { return ''; @@ -1277,7 +1277,7 @@ function _iban_nationalchecksum_implementation_sm($iban,$mode) { # Italian (and San Marino's) checksum # (Credit: Translated by Francesco Zanoni from http://community.visual-basic.it/lucianob/archive/2004/12/26/2464.aspx) -# (Source: European Commettee of Banking Standards' Register of European Account Numbers (TR201 V3.23 — FEBRUARY 2007), +# (Source: European Commettee of Banking Standards' Register of European Account Numbers (TR201 V3.23 — FEBRUARY 2007), # available at URL http://www.cnb.cz/cs/platebni_styk/iban/download/TR201.pdf) function _italian($input) { diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 1923204c272..c72885ef1ea 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -82,7 +82,7 @@ if (!empty($useragent)) { // Check PHP version min $arrayphpminversionerror = array(5, 6, 0); -$arrayphpminversionwarning = array(5, 6, 0); +$arrayphpminversionwarning = array(7, 0, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { // Minimum to use (error if lower) print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); $checksok = 0; // 0=error, 1=warning diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index f8dcdfe230b..54325f97ed4 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -695,7 +695,7 @@ function jscheckparam() else if (! checkDatabaseName(document.forminstall.db_name.value)) { ok=false; - alert('transnoentities("ErrorSpecialCharNotAllowedForField", $langs->transnoentitiesnoconv("DatabaseName"))); ?>'); + alert('transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentitiesnoconv("DatabaseName"))); ?>'); } // If create database asked else if (document.forminstall.db_create_database.checked == true && (document.forminstall.db_user_root.value == '')) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 657e9841100..c717d55850e 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -319,7 +319,7 @@ function conf($dolibarr_main_document_root) $conf->db->port = trim($dolibarr_main_db_port); $conf->db->name = trim($dolibarr_main_db_name); $conf->db->user = trim($dolibarr_main_db_user); - $conf->db->pass = trim($dolibarr_main_db_pass); + $conf->db->pass = (empty($dolibarr_main_db_pass) ? '' : trim($dolibarr_main_db_pass)); // Mysql driver support has been removed in favor of mysqli if ($conf->db->type == 'mysql') { diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index d8c193bce19..6b32c245305 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -28,254 +28,254 @@ -- -- delete from llx_c_country; -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (0,'',NULL,'-',1,1); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (1,'FR','FRA','France',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (2,'BE','BEL','Belgium',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (3,'IT','ITA','Italy',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (4,'ES','ESP','Spain',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (5,'DE','DEU','Germany',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (6,'CH','CHE','Switzerland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (7,'GB','GBR','United Kingdom',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (8,'IE','IRL','Ireland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (9,'CN','CHN','China',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (10,'TN','TUN','Tunisia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (11,'US','USA','United States',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (12,'MA','MAR','Morocco',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (13,'DZ','DZA','Algeria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (14,'CA','CAN','Canada',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (15,'TG','TGO','Togo',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (16,'GA','GAB','Gabon',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (17,'NL','NLD','Netherlands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (18,'HU','HUN','Hungary',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (19,'RU','RUS','Russia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (20,'SE','SWE','Sweden',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (21,'CI','CIV','Côte d''Ivoire',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (22,'SN','SEN','Senegal',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (23,'AR','ARG','Argentina',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24,'CM','CMR','Cameroun',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (25,'PT','PRT','Portugal',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (26,'SA','SAU','Saudi Arabia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (27,'MC','MCO','Monaco',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (28,'AU','AUS','Australia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (29,'SG','SGP','Singapore',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (30,'AF','AFG','Afghanistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (31,'AX','ALA','Åland Island',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (32,'AL','ALB','Albania',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (33,'AS','ASM','American Samoa',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (34,'AD','AND','Andorra',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (35,'AO','AGO','Angola',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (36,'AI','AIA','Anguilla',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (37,'AQ','ATA','Antarctica',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (38,'AG','ATG','Antigua and Barbuda',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (39,'AM','ARM','Armenia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (41,'AT','AUT','Austria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (42,'AZ','AZE','Azerbaijan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (43,'BS','BHS','Bahamas',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (44,'BH','BHR','Bahrain',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (45,'BD','BGD','Bangladesh',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (46,'BB','BRB','Barbados',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (47,'BY','BLR','Belarus',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (48,'BZ','BLZ','Belize',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (49,'BJ','BEN','Benin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (50,'BM','BMU','Bermuda',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (51,'BT','BTN','Bhutan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (52,'BO','BOL','Bolivia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (53,'BA','BIH','Bosnia and Herzegovina',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (54,'BW','BWA','Botswana',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (55,'BV','BVT','Bouvet Island',0,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (56,'BR','BRA','Brazil',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (57,'IO','IOT','British Indian Ocean Territory',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (58,'BN','BRN','Brunei',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (59,'BG','BGR','Bulgaria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (60,'BF','BFA','Burkina Faso',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (61,'BI','BDI','Burundi',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (62,'KH','KHM','Cambodge / Cambodia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (63,'CV','CPV','Cap-Vert',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (64,'KY','CYM','Iles Cayman',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (65,'CF','CAF','Central African Republic (CAR/RCA)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (66,'TD','TCD','Tchad',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (67,'CL','CHL','Chile',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (68,'CX','CXR','Ile Christmas',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (69,'CC','CCK','Iles des Cocos (Keeling)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (70,'CO','COL','Colombie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (71,'KM','COM','Comores',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (72,'CG','COG','Congo',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (73,'CD','COD','DR Congo (RDC)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (74,'CK','COK','Iles Cook',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (75,'CR','CRI','Costa Rica',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (76,'HR','HRV','Croatia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (77,'CU','CUB','Cuba',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (78,'CY','CYP','Cyprus',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (79,'CZ','CZE','Czech Republic',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (80,'DK','DNK','Denmark',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (81,'DJ','DJI','Djibouti',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (82,'DM','DMA','Dominica',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (83,'DO','DOM','Dominican Republic',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (84,'EC','ECU','Republic of Ecuador',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (85,'EG','EGY','Egypt',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (86,'SV','SLV','El Salvador',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (87,'GQ','GNQ','Equatorial Guinea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (88,'ER','ERI','Eritrea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (89,'EE','EST','Estonia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (90,'ET','ETH','Ethiopia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (91,'FK','FLK','Falkland Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (92,'FO','FRO','Faroe Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (93,'FJ','FJI','Fidji Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (94,'FI','FIN','Finland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (95,'GF','GUF','French Guiana',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (96,'PF','PYF','French Polynesia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (97,'TF','ATF','Terres australes françaises',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (98,'GM','GMB','Gambie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (99,'GE','GEO','Georgia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (100,'GH','GHA','Ghana',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (101,'GI','GIB','Gibraltar',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (102,'GR','GRC','Greece',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (103,'GL','GRL','Groenland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (104,'GD','GRD','Grenade',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (106,'GU','GUM','Guam',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (107,'GT','GTM','Guatemala',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (108,'GN','GIN','Guinea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (109,'GW','GNB','Guinea-Bissao',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (111,'HT','HTI','Haiti',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (112,'HM','HMD','Iles Heard et McDonald',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (113,'VA','VAT','Vatican City (Saint-Siège)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (114,'HN','HND','Honduras',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (115,'HK','HKG','Hong Kong',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (116,'IS','ISL','Islande',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (117,'IN','IND','India',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (118,'ID','IDN','Indonesia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (119,'IR','IRN','Iran',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (120,'IQ','IRQ','Iraq',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (121,'IL','ISR','Israel',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (122,'JM','JAM','Jamaica',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (123,'JP','JPN','Japan (Nippon)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (124,'JO','JOR','Jordanie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (125,'KZ','KAZ','Kazakhstan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (126,'KE','KEN','Kenya',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (127,'KI','KIR','Kiribati',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (128,'KP','PRK','North Corea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (129,'KR','KOR','South Corea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (130,'KW','KWT','Koweït',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (131,'KG','KGZ','Kirghizistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (132,'LA','LAO','Laos',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (133,'LV','LVA','Lettonie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (134,'LB','LBN','Liban',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (135,'LS','LSO','Lesotho',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (136,'LR','LBR','Liberia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (137,'LY','LBY','Libye',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (138,'LI','LIE','Liechtenstein',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (139,'LT','LTU','Lituanie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (140,'LU','LUX','Luxembourg',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (141,'MO','MAC','Macao',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (142,'MK','MKD','North Macedonia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (143,'MG','MDG','Madagascar',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (144,'MW','MWI','Malawi',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (145,'MY','MYS','Malaisie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (146,'MV','MDV','Maldives',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (147,'ML','MLI','Mali',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (148,'MT','MLT','Malte',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (149,'MH','MHL','Iles Marshall',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (151,'MR','MRT','Mauritanie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (152,'MU','MUS','Maurice',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (153,'YT','MYT','Mayotte',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (154,'MX','MEX','Mexique',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (155,'FM','FSM','Micronésie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (156,'MD','MDA','Moldavie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (157,'MN','MNG','Mongolie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (158,'MS','MSR','Monserrat',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (159,'MZ','MOZ','Mozambique',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (160,'MM','MMR','Birmanie (Myanmar)',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (161,'NA','NAM','Namibie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (162,'NR','NRU','Nauru',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (163,'NP','NPL','Népal',1,0); ---INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (164,'AN','AWP','Antilles néerlandaises',1,0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (0, '', NULL, '-', 1, 1); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (1, 'FR', 'FRA', 'France', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (2, 'BE', 'BEL', 'Belgium', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (3, 'IT', 'ITA', 'Italy', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (4, 'ES', 'ESP', 'Spain', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (5, 'DE', 'DEU', 'Germany', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (6, 'CH', 'CHE', 'Switzerland', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (7, 'GB', 'GBR', 'United Kingdom', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (8, 'IE', 'IRL', 'Ireland', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (9, 'CN', 'CHN', 'China', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (10, 'TN', 'TUN', 'Tunisia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (11, 'US', 'USA', 'United States', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (12, 'MA', 'MAR', 'Morocco', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (13, 'DZ', 'DZA', 'Algeria', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (14, 'CA', 'CAN', 'Canada', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (15, 'TG', 'TGO', 'Togo', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (16, 'GA', 'GAB', 'Gabon', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (17, 'NL', 'NLD', 'Netherlands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (18, 'HU', 'HUN', 'Hungary', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (19, 'RU', 'RUS', 'Russia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (20, 'SE', 'SWE', 'Sweden', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (21, 'CI', 'CIV', 'Côte d''Ivoire', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (22, 'SN', 'SEN', 'Senegal', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (23, 'AR', 'ARG', 'Argentina', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (24, 'CM', 'CMR', 'Cameroun', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (25, 'PT', 'PRT', 'Portugal', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (26, 'SA', 'SAU', 'Saudi Arabia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (27, 'MC', 'MCO', 'Monaco', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (28, 'AU', 'AUS', 'Australia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (29, 'SG', 'SGP', 'Singapore', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (30, 'AF', 'AFG', 'Afghanistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (31, 'AX', 'ALA', 'Åland Island', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (32, 'AL', 'ALB', 'Albania', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (33, 'AS', 'ASM', 'American Samoa', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (34, 'AD', 'AND', 'Andorra', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (35, 'AO', 'AGO', 'Angola', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (36, 'AI', 'AIA', 'Anguilla', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (37, 'AQ', 'ATA', 'Antarctica', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (38, 'AG', 'ATG', 'Antigua and Barbuda', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (39, 'AM', 'ARM', 'Armenia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (41, 'AT', 'AUT', 'Austria', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (42, 'AZ', 'AZE', 'Azerbaijan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (43, 'BS', 'BHS', 'Bahamas', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (44, 'BH', 'BHR', 'Bahrain', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (45, 'BD', 'BGD', 'Bangladesh', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (46, 'BB', 'BRB', 'Barbados', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (47, 'BY', 'BLR', 'Belarus', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (48, 'BZ', 'BLZ', 'Belize', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (49, 'BJ', 'BEN', 'Benin', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (50, 'BM', 'BMU', 'Bermuda', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (51, 'BT', 'BTN', 'Bhutan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (52, 'BO', 'BOL', 'Bolivia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (53, 'BA', 'BIH', 'Bosnia and Herzegovina', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (54, 'BW', 'BWA', 'Botswana', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (55, 'BV', 'BVT', 'Bouvet Island',0,0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (56, 'BR', 'BRA', 'Brazil', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (57, 'IO', 'IOT', 'British Indian Ocean Territory', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (58, 'BN', 'BRN', 'Brunei', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (59, 'BG', 'BGR', 'Bulgaria', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (60, 'BF', 'BFA', 'Burkina Faso', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (61, 'BI', 'BDI', 'Burundi', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (62, 'KH', 'KHM', 'Cambodge / Cambodia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (63, 'CV', 'CPV', 'Cap-Vert', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (64, 'KY', 'CYM', 'Iles Cayman', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (65, 'CF', 'CAF', 'Central African Republic (CAR/RCA)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (66, 'TD', 'TCD', 'Tchad', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (67, 'CL', 'CHL', 'Chile', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (68, 'CX', 'CXR', 'Ile Christmas', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (69, 'CC', 'CCK', 'Iles des Cocos (Keeling)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (70, 'CO', 'COL', 'Colombie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (71, 'KM', 'COM', 'Comores', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (72, 'CG', 'COG', 'Congo', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (73, 'CD', 'COD', 'DR Congo (RDC)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (74, 'CK', 'COK', 'Iles Cook', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (75, 'CR', 'CRI', 'Costa Rica', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (76, 'HR', 'HRV', 'Croatia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (77, 'CU', 'CUB', 'Cuba', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (78, 'CY', 'CYP', 'Cyprus', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (79, 'CZ', 'CZE', 'Czech Republic', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (80, 'DK', 'DNK', 'Denmark', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (81, 'DJ', 'DJI', 'Djibouti', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (82, 'DM', 'DMA', 'Dominica', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (83, 'DO', 'DOM', 'Dominican Republic', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (84, 'EC', 'ECU', 'Republic of Ecuador', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (85, 'EG', 'EGY', 'Egypt', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (86, 'SV', 'SLV', 'El Salvador', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (87, 'GQ', 'GNQ', 'Equatorial Guinea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (88, 'ER', 'ERI', 'Eritrea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (89, 'EE', 'EST', 'Estonia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (90, 'ET', 'ETH', 'Ethiopia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (91, 'FK', 'FLK', 'Falkland Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (92, 'FO', 'FRO', 'Faroe Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (93, 'FJ', 'FJI', 'Fidji Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (94, 'FI', 'FIN', 'Finland', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (95, 'GF', 'GUF', 'French Guiana', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (96, 'PF', 'PYF', 'French Polynesia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (97, 'TF', 'ATF', 'Terres australes françaises', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (98, 'GM', 'GMB', 'Gambie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (99, 'GE', 'GEO', 'Georgia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (100, 'GH', 'GHA', 'Ghana', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (101, 'GI', 'GIB', 'Gibraltar', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (102, 'GR', 'GRC', 'Greece', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (103, 'GL', 'GRL', 'Groenland', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (104, 'GD', 'GRD', 'Grenade', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (106, 'GU', 'GUM', 'Guam', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (107, 'GT', 'GTM', 'Guatemala', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (108, 'GN', 'GIN', 'Guinea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (109, 'GW', 'GNB', 'Guinea-Bissao', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (111, 'HT', 'HTI', 'Haiti', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (112, 'HM', 'HMD', 'Iles Heard et McDonald', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (113, 'VA', 'VAT', 'Vatican City (Saint-Siège)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (114, 'HN', 'HND', 'Honduras', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (115, 'HK', 'HKG', 'Hong Kong', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (116, 'IS', 'ISL', 'Islande', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (117, 'IN', 'IND', 'India', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (118, 'ID', 'IDN', 'Indonesia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (119, 'IR', 'IRN', 'Iran', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (120, 'IQ', 'IRQ', 'Iraq', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (121, 'IL', 'ISR', 'Israel', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (122, 'JM', 'JAM', 'Jamaica', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (123, 'JP', 'JPN', 'Japan (Nippon)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (124, 'JO', 'JOR', 'Jordanie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (125, 'KZ', 'KAZ', 'Kazakhstan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (126, 'KE', 'KEN', 'Kenya', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (127, 'KI', 'KIR', 'Kiribati', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (128, 'KP', 'PRK', 'North Corea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (129, 'KR', 'KOR', 'South Corea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (130, 'KW', 'KWT', 'Koweït', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (131, 'KG', 'KGZ', 'Kirghizistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (132, 'LA', 'LAO', 'Laos', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (133, 'LV', 'LVA', 'Lettonie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (134, 'LB', 'LBN', 'Liban', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (135, 'LS', 'LSO', 'Lesotho', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (136, 'LR', 'LBR', 'Liberia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (137, 'LY', 'LBY', 'Libye', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (138, 'LI', 'LIE', 'Liechtenstein', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (139, 'LT', 'LTU', 'Lituanie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (140, 'LU', 'LUX', 'Luxembourg', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (141, 'MO', 'MAC', 'Macao', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (142, 'MK', 'MKD', 'North Macedonia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (143, 'MG', 'MDG', 'Madagascar', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (144, 'MW', 'MWI', 'Malawi', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (145, 'MY', 'MYS', 'Malaisie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (146, 'MV', 'MDV', 'Maldives', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (147, 'ML', 'MLI', 'Mali', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (148, 'MT', 'MLT', 'Malte', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (149, 'MH', 'MHL', 'Iles Marshall', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (151, 'MR', 'MRT', 'Mauritanie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (152, 'MU', 'MUS', 'Maurice', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (153, 'YT', 'MYT', 'Mayotte', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (154, 'MX', 'MEX', 'Mexique', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (155, 'FM', 'FSM', 'Micronésie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (156, 'MD', 'MDA', 'Moldavie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (157, 'MN', 'MNG', 'Mongolie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (158, 'MS', 'MSR', 'Monserrat', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (159, 'MZ', 'MOZ', 'Mozambique', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (160, 'MM', 'MMR', 'Birmanie (Myanmar)', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (161, 'NA', 'NAM', 'Namibie', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (162, 'NR', 'NRU', 'Nauru', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (163, 'NP', 'NPL', 'Népal', 1, 0); +--INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (164, 'AN', 'AWP', 'Antilles néerlandaises', 1, 0); --The Antilles nederland does not exist anymore as a seperate country since 2010. Aruba, Curaçao and Sint Maarten became seperate countries then: -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (40,'AW','ABW','Aruba',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (300,'CW','CUW','Curaçao',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (301,'SX','SXM','Sint Maarten',1,0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (40, 'AW', 'ABW', 'Aruba', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (300, 'CW', 'CUW', 'Curaçao', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (301, 'SX', 'SXM', 'Sint Maarten', 1, 0); --End of antilles nederland -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (165,'NC','NCL','New Caledonia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (166,'NZ','NZL','New Zealand',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (167,'NI','NIC','Nicaragua',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (168,'NE','NER','Niger',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (169,'NG','NGA','Nigeria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (170,'NU','NIU','Niue',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (171,'NF','NFK','Norfolk Island',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (172,'MP','MNP','Northern Mariana Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (173,'NO','NOR','Norway',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (174,'OM','OMN','Oman',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (175,'PK','PAK','Pakistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (176,'PW','PLW','Palau',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (177,'PS','PSE','Palestinian territories',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (178,'PA','PAN','Panama',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (179,'PG','PNG','Papua New Guinea',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (180,'PY','PRY','Paraguay',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (181,'PE','PER','Peru',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (182,'PH','PHL','Philippines',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (183,'PN','PCN','Pitcairn Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (184,'PL','POL','Pologne',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (185,'PR','PRI','Puerto Rico',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (186,'QA','QAT','Qatar',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (188,'RO','ROU','Romania',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (189,'RW','RWA','Rwanda',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (190,'SH','SHN','Saint Helena',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (191,'KN','KNA','Saint Kitts and Nevis',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (192,'LC','LCA','Saint Lucia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (193,'PM','SPM','Saint Pierre and Miquelon',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (194,'VC','VCT','Saint Vincent and the Grenadines',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (195,'WS','WSM','Samoa',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (196,'SM','SMR','San Marino ',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (197,'ST','STP','Saint Thomas and Prince',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (198,'RS','SRB','Serbia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (199,'SC','SYC','Seychelles',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (200,'SL','SLE','Sierra Leone',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovakia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovenia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Solomon Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','South Africa',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (206,'GS','SGS','South Georgia and the South Sandwich Islands ',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (207,'LK','LKA','Sri Lanka',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (208,'SD','SDN','Sudan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (209,'SR','SUR','Suriname',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (210,'SJ','SJM','Svalbard and Jan Mayen',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (211,'SZ','SWZ','Swaziland / Eswatini',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (212,'SY','SYR','Syria',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (213,'TW','TWN','Taiwan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (214,'TJ','TJK','Tajikistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (215,'TZ','TZA','Tanzania',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (216,'TH','THA','Thailand',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (217,'TL','TLS','Timor-Leste',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (218,'TK','TKL','Tokelau',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (219,'TO','TON','Tonga',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (220,'TT','TTO','Trinidad and Tobago',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (221,'TR','TUR','Turkey',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (222,'TM','TKM','Turkmenistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (223,'TC','TCA','Turks and Caicos Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (224,'TV','TUV','Tuvalu',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (225,'UG','UGA','Uganda',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (226,'UA','UKR','Ukraine',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (227,'AE','ARE','United Arab Emirates',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (228,'UM','UMI','United States Minor Outlying Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (229,'UY','URY','Uruguay',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (230,'UZ','UZB','Uzbekistan',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (231,'VU','VUT','Vanuatu',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (232,'VE','VEN','Venezuela',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (233,'VN','VNM','Vietnam',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (234,'VG','VGB','British Virgin Islands',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (235,'VI','VIR','Virgin Islands of the United States',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (236,'WF','WLF','Wallis and Futuna',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (237,'EH','ESH','Western Sahara',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (238,'YE','YEM','Yemen',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (239,'ZM','ZMB','Zambia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (240,'ZW','ZWE','Zimbabwe',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (241,'GG','GGY','Guernsey',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (242,'IM','IMN','Isle of Man',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (243,'JE','JEY','Jersey',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (244,'ME','MNE','Montenegro',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (245,'BL','BLM','Saint-Barthélemy',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (246,'MF','MAF','Saint-Martin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (247,'XK','XKX','Kosovo',1,0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (165, 'NC', 'NCL', 'New Caledonia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (166, 'NZ', 'NZL', 'New Zealand', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (167, 'NI', 'NIC', 'Nicaragua', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (168, 'NE', 'NER', 'Niger', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (169, 'NG', 'NGA', 'Nigeria', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (170, 'NU', 'NIU', 'Niue', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (171, 'NF', 'NFK', 'Norfolk Island', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (172, 'MP', 'MNP', 'Northern Mariana Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (173, 'NO', 'NOR', 'Norway', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (174, 'OM', 'OMN', 'Oman', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (175, 'PK', 'PAK', 'Pakistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (176, 'PW', 'PLW', 'Palau', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (177, 'PS', 'PSE', 'Palestinian territories', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (178, 'PA', 'PAN', 'Panama', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (179, 'PG', 'PNG', 'Papua New Guinea', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (180, 'PY', 'PRY', 'Paraguay', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (181, 'PE', 'PER', 'Peru', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (182, 'PH', 'PHL', 'Philippines', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (183, 'PN', 'PCN', 'Pitcairn Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (184, 'PL', 'POL', 'Pologne', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (185, 'PR', 'PRI', 'Puerto Rico', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (186, 'QA', 'QAT', 'Qatar', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (188, 'RO', 'ROU', 'Romania', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (189, 'RW', 'RWA', 'Rwanda', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (190, 'SH', 'SHN', 'Saint Helena', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (191, 'KN', 'KNA', 'Saint Kitts and Nevis', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (192, 'LC', 'LCA', 'Saint Lucia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (193, 'PM', 'SPM', 'Saint Pierre and Miquelon', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (194, 'VC', 'VCT', 'Saint Vincent and the Grenadines', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (195, 'WS', 'WSM', 'Samoa', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (196, 'SM', 'SMR', 'San Marino ', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (197, 'ST', 'STP', 'Saint Thomas and Prince', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (198, 'RS', 'SRB', 'Serbia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (199, 'SC', 'SYC', 'Seychelles', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (200, 'SL', 'SLE', 'Sierra Leone', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (201, 'SK', 'SVK', 'Slovakia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (202, 'SI', 'SVN', 'Slovenia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (203, 'SB', 'SLB', 'Solomon Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (204, 'SO', 'SOM', 'Somalia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (205, 'ZA', 'ZAF', 'South Africa', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (206, 'GS', 'SGS', 'South Georgia and the South Sandwich Islands ', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (207, 'LK', 'LKA', 'Sri Lanka', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (208, 'SD', 'SDN', 'Sudan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (209, 'SR', 'SUR', 'Suriname', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (210, 'SJ', 'SJM', 'Svalbard and Jan Mayen', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (211, 'SZ', 'SWZ', 'Swaziland / Eswatini', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (212, 'SY', 'SYR', 'Syria', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (213, 'TW', 'TWN', 'Taiwan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (214, 'TJ', 'TJK', 'Tajikistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (215, 'TZ', 'TZA', 'Tanzania', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (216, 'TH', 'THA', 'Thailand', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (217, 'TL', 'TLS', 'Timor-Leste', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (218, 'TK', 'TKL', 'Tokelau', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (219, 'TO', 'TON', 'Tonga', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (220, 'TT', 'TTO', 'Trinidad and Tobago', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (221, 'TR', 'TUR', 'Turkey', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (222, 'TM', 'TKM', 'Turkmenistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (223, 'TC', 'TCA', 'Turks and Caicos Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (224, 'TV', 'TUV', 'Tuvalu', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (225, 'UG', 'UGA', 'Uganda', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (226, 'UA', 'UKR', 'Ukraine', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (227, 'AE', 'ARE', 'United Arab Emirates', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (228, 'UM', 'UMI', 'United States Minor Outlying Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (229, 'UY', 'URY', 'Uruguay', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (230, 'UZ', 'UZB', 'Uzbekistan', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (231, 'VU', 'VUT', 'Vanuatu', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (232, 'VE', 'VEN', 'Venezuela', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (233, 'VN', 'VNM', 'Vietnam', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (234, 'VG', 'VGB', 'British Virgin Islands', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (235, 'VI', 'VIR', 'Virgin Islands of the United States', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (236, 'WF', 'WLF', 'Wallis and Futuna', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (237, 'EH', 'ESH', 'Western Sahara', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (238, 'YE', 'YEM', 'Yemen', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (239, 'ZM', 'ZMB', 'Zambia', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (240, 'ZW', 'ZWE', 'Zimbabwe', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (241, 'GG', 'GGY', 'Guernsey', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (242, 'IM', 'IMN', 'Isle of Man', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (243, 'JE', 'JEY', 'Jersey', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (244, 'ME', 'MNE', 'Montenegro', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (245, 'BL', 'BLM', 'Saint-Barthélemy', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (246, 'MF', 'MAF', 'Saint-Martin', 1, 0); +INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUES (247, 'XK', 'XKX', 'Kosovo', 1, 0); -- Set field eec diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index b0ffb509c18..04fea66c8ed 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -427,102 +427,102 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 4, '974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values ( 6, '976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'94','94028',2,'VAL-DE-MARNE','Val-de-Marne'); -insert into llx_c_departements (fk_region, code_departement, cheflieu,tncc,ncc,nom) values (11,'95','95500',2,'VAL-D OISE','Val-d Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '01', '01053',5, 'AIN', 'Ain'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (32, '02', '02408',5, 'AISNE', 'Aisne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '03', '03190',5, 'ALLIER', 'Allier'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '04', '04070',4, 'ALPES-DE-HAUTE-PROVENCE', 'Alpes-de-Haute-Provence'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '05', '05061',4, 'HAUTES-ALPES', 'Hautes-Alpes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '06', '06088',4, 'ALPES-MARITIMES', 'Alpes-Maritimes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '07', '07186',5, 'ARDECHE', 'Ardèche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '08', '08105',4, 'ARDENNES', 'Ardennes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '09', '09122',5, 'ARIEGE', 'Ariège'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '10', '10387',5, 'AUBE', 'Aube'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '11', '11069',5, 'AUDE', 'Aude'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '12', '12202',5, 'AVEYRON', 'Aveyron'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '13', '13055',4, 'BOUCHES-DU-RHONE', 'Bouches-du-Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (28, '14', '14118',2, 'CALVADOS', 'Calvados'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '15', '15014',2, 'CANTAL', 'Cantal'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '16', '16015',3, 'CHARENTE', 'Charente'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '17', '17300',3, 'CHARENTE-MARITIME', 'Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '18', '18033',2, 'CHER', 'Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '19', '19272',3, 'CORREZE', 'Corrèze'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (94, '2A', '2A004',3, 'CORSE-DU-SUD', 'Corse-du-Sud'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (94, '2B', '2B033',3, 'HAUTE-CORSE', 'Haute-Corse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '21', '21231',3, 'COTE-D OR', 'Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (53, '22', '22278',4, 'COTES-D ARMOR', 'Côtes-d Armor'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '23', '23096',3, 'CREUSE', 'Creuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '24', '24322',3, 'DORDOGNE', 'Dordogne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '25', '25056',2, 'DOUBS', 'Doubs'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '26', '26362',3, 'DROME', 'Drôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (28, '27', '27229',5, 'EURE', 'Eure'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '28', '28085',1, 'EURE-ET-LOIR', 'Eure-et-Loir'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (53, '29', '29232',2, 'FINISTERE', 'Finistère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '30', '30189',2, 'GARD', 'Gard'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '31', '31555',3, 'HAUTE-GARONNE', 'Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '32', '32013',2, 'GERS', 'Gers'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '33', '33063',3, 'GIRONDE', 'Gironde'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '34', '34172',5, 'HERAULT', 'Hérault'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (53, '35', '35238',1, 'ILLE-ET-VILAINE', 'Ille-et-Vilaine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '36', '36044',5, 'INDRE', 'Indre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '37', '37261',1, 'INDRE-ET-LOIRE', 'Indre-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '38', '38185',5, 'ISERE', 'Isère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '39', '39300',2, 'JURA', 'Jura'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '40', '40192',4, 'LANDES', 'Landes'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '41', '41018',0, 'LOIR-ET-CHER', 'Loir-et-Cher'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '42', '42218',3, 'LOIRE', 'Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '43', '43157',3, 'HAUTE-LOIRE', 'Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (52, '44', '44109',3, 'LOIRE-ATLANTIQUE', 'Loire-Atlantique'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (24, '45', '45234',2, 'LOIRET', 'Loiret'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '46', '46042',2, 'LOT', 'Lot'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '47', '47001',0, 'LOT-ET-GARONNE', 'Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '48', '48095',3, 'LOZERE', 'Lozère'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (52, '49', '49007',0, 'MAINE-ET-LOIRE', 'Maine-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (28, '50', '50502',3, 'MANCHE', 'Manche'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '51', '51108',3, 'MARNE', 'Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '52', '52121',3, 'HAUTE-MARNE', 'Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (52, '53', '53130',3, 'MAYENNE', 'Mayenne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '54', '54395',0, 'MEURTHE-ET-MOSELLE', 'Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '55', '55029',3, 'MEUSE', 'Meuse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (53, '56', '56260',2, 'MORBIHAN', 'Morbihan'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '57', '57463',3, 'MOSELLE', 'Moselle'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '58', '58194',3, 'NIEVRE', 'Nièvre'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (32, '59', '59350',2, 'NORD', 'Nord'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (32, '60', '60057',5, 'OISE', 'Oise'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (28, '61', '61001',5, 'ORNE', 'Orne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (32, '62', '62041',2, 'PAS-DE-CALAIS', 'Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '63', '63113',2, 'PUY-DE-DOME', 'Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '64', '64445',4, 'PYRENEES-ATLANTIQUES', 'Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '65', '65440',4, 'HAUTES-PYRENEES', 'Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '66', '66136',4, 'PYRENEES-ORIENTALES', 'Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '67', '67482',2, 'BAS-RHIN', 'Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '68', '68066',2, 'HAUT-RHIN', 'Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '69', '69123',2, 'RHONE', 'Rhône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '70', '70550',3, 'HAUTE-SAONE', 'Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '71', '71270',0, 'SAONE-ET-LOIRE', 'Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (52, '72', '72181',3, 'SARTHE', 'Sarthe'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '73', '73065',3, 'SAVOIE', 'Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (84, '74', '74010',3, 'HAUTE-SAVOIE', 'Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '75', '75056',0, 'PARIS', 'Paris'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (28, '76', '76540',3, 'SEINE-MARITIME', 'Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '77', '77288',0, 'SEINE-ET-MARNE', 'Seine-et-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '78', '78646',4, 'YVELINES', 'Yvelines'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '79', '79191',4, 'DEUX-SEVRES', 'Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (32, '80', '80021',3, 'SOMME', 'Somme'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '81', '81004',2, 'TARN', 'Tarn'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (76, '82', '82121',0, 'TARN-ET-GARONNE', 'Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '83', '83137',2, 'VAR', 'Var'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (93, '84', '84007',0, 'VAUCLUSE', 'Vaucluse'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (52, '85', '85191',3, 'VENDEE', 'Vendée'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '86', '86194',3, 'VIENNE', 'Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (75, '87', '87085',3, 'HAUTE-VIENNE', 'Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (44, '88', '88160',4, 'VOSGES', 'Vosges'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '89', '89024',5, 'YONNE', 'Yonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (27, '90', '90010',0, 'TERRITOIRE DE BELFORT', 'Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '91', '91228',5, 'ESSONNE', 'Essonne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '92', '92050',4, 'HAUTS-DE-SEINE', 'Hauts-de-Seine'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '93', '93008',3, 'SEINE-SAINT-DENIS', 'Seine-Saint-Denis'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '94', '94028',2, 'VAL-DE-MARNE', 'Val-de-Marne'); +insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) values (11, '95', '95500',2, 'VAL-D OISE', 'Val-d Oise'); -- Germany States / Bundesländer (id country=5) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 6d9aebf934f..f7e7a7a1ba5 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -689,3 +689,6 @@ ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; ALTER TABLE llx_loan_schedule ADD UNIQUE INDEX uk_loan_schedule_ref (fk_loan, datep); + +-- We need when upgrade 15 to 16 with Dolibarr v17+ for upgrade2 function migrate_user_photospath2() +ALTER TABLE llx_user CHANGE COLUMN note note_private text; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 4d7bca3f7c9..d0e9cdc7b95 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -175,5 +175,5 @@ create table llx_element_categorie ALTER TABLE llx_element_categorie ADD UNIQUE INDEX idx_element_categorie_idx (fk_element, fk_categorie); -ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_fk_categorie(rowid); +ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_categorie(rowid); diff --git a/htdocs/install/mysql/tables/llx_element_categorie.key.sql b/htdocs/install/mysql/tables/llx_element_categorie.key.sql index 5ad41616d38..9bc70cf0863 100644 --- a/htdocs/install/mysql/tables/llx_element_categorie.key.sql +++ b/htdocs/install/mysql/tables/llx_element_categorie.key.sql @@ -19,4 +19,4 @@ ALTER TABLE llx_element_categorie ADD UNIQUE INDEX idx_element_categorie_idx (fk_element, fk_categorie); -ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_fk_categorie(rowid); +ALTER TABLE llx_element_categorie ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_categorie(rowid); diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 7b86b5c3396..e70716d90c4 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -75,8 +75,8 @@ create table llx_user idpers2 varchar(128), idpers3 varchar(128), - note_public text, - note_private text DEFAULT NULL, + note_public text, + note_private text DEFAULT NULL, model_pdf varchar(255) DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index ee592007522..b91d48bad36 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -128,9 +128,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { $error = 0; // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) { + if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; - if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) { + if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 25dd1ee84fd..22ef26295aa 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -117,9 +117,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $error = 0; // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) { + if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; - if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) { + if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 94eeb6d6243..c6cbab64965 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -123,9 +123,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ print '
'.$langs->trans("DolibarrLogin").''.$langs->trans("DolibarrLogin").'
'; // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) { + if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) { require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; - if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) { + if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted @@ -455,7 +455,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '8.0.9'); $beforeversionarray = explode('.', '9.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { - migrate_user_photospath(); + //migrate_user_photospath(); } // Scripts for 11.0 @@ -480,6 +480,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '15.0.9'); $beforeversionarray = explode('.', '16.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + migrate_user_photospath(); migrate_user_photospath2(); } } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d95791111cd..6e64f1c6e48 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -286,7 +286,7 @@ DescClosure=Consult here the number of movements by month not yet validated & lo OverviewOfMovementsNotValidated=Overview of movements not validated and locked AllMovementsWereRecordedAsValidated=All movements were recorded as validated and locked NotAllMovementsCouldBeRecordedAsValidated=Not all movements could be recorded as validated and locked -ValidateMovements=Validate and lock record... +ValidateMovements=Validate and lock movements... DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible ValidateHistory=Bind Automatically diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 704d9ed238e..6a1146a2f9d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2081,6 +2081,7 @@ MailboxTargetDirectory=Mailbox target directory EmailcollectorOperations=Operations to do by collector EmailcollectorOperationsDesc=Operations are executed from top to bottom order MaxEmailCollectPerCollect=Max number of emails collected per collect +TestCollectNow=Test collect CollectNow=Collect now ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s? DateLastCollectResult=Date of latest collect try diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index afcc12e9362..e53220e661d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -97,7 +97,6 @@ ErrorFieldValueNotIn=Field %s: '%s' is not a value found in field ErrorFieldRefNotIn=Field %s: '%s' is not a %s existing ref ErrorsOnXLines=%s errors found ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus) -ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field "%s" ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module. ErrorQtyTooLowForThisSupplier=Quantity too low for this vendor or no price defined on this product for this vendor ErrorOrdersNotCreatedQtyTooLow=Some orders haven't been created because of too-low quantities @@ -294,6 +293,7 @@ ErrorQuantityIsLimitedTo=Quantity is limited to %s ErrorFailedToLoadThirdParty=Failed to find/load thirdparty from id=%s, email=%s, name=%s ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first. +ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character + # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index b86ec3ebbd8..f83637c9c40 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -7,10 +7,10 @@ MailCard=EMailing card MailRecipients=Recipients MailRecipient=Recipient MailTitle=Description -MailFrom=Sender +MailFrom=From MailErrorsTo=Errors to MailReply=Reply to -MailTo=Receiver(s) +MailTo=To MailToUsers=To user(s) MailCC=Copy to MailToCCUsers=Copy to users(s) diff --git a/htdocs/langs/en_US/oauth.lang b/htdocs/langs/en_US/oauth.lang index b7f7c0c2c1a..01bb08e38bd 100644 --- a/htdocs/langs/en_US/oauth.lang +++ b/htdocs/langs/en_US/oauth.lang @@ -36,4 +36,5 @@ OAUTH_SECRET=OAuth secret OAuthProviderAdded=OAuth provider added AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=An OAuth entry for this provider and label already exists URLOfServiceForAuthorization=URL provided by OAuth service for authentication -Scopes=Scopes \ No newline at end of file +Scopes=Permissions (Scopes) +ScopeUndefined=Permissions (Scopes) undefined (see previous tab) \ No newline at end of file diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 4bd64f44577..a1039e05e62 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -17,6 +17,7 @@ printBatch=Lot/Serial: %s printEatby=Eat-by: %s printSellby=Sell-by: %s printQty=Qty: %d +printPlannedWarehouse=Warehouse: %s AddDispatchBatchLine=Add a line for Shelf Life dispatching WhenProductBatchModuleOnOptionAreForced=When module Lot/Serial is on, automatic stock decrease is forced to 'Decrease real stocks on shipping validation' and automatic increase mode is forced to 'Increase real stocks on manual dispatching into warehouses' and can't be edited. Other options can be defined as you want. ProductDoesNotUseBatchSerial=This product does not use lot/serial number diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 492cdd48864..5332b8123e0 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -235,7 +235,7 @@ StockIncrease=Stock increase StockDecrease=Stock decrease InventoryForASpecificWarehouse=Inventory for a specific warehouse InventoryForASpecificProduct=Inventory for a specific product -StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use +StockIsRequiredToChooseWhichLotToUse=An existing stock is required to be able to choose which lot to use ForceTo=Force to AlwaysShowFullArbo=Display full tree of warehouse on popup of warehouse links (Warning: This may decrease dramatically performances) StockAtDatePastDesc=You can view here the stock (real stock) at a given date in the past diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index 2a905a76530..1d17bc750ea 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -82,7 +82,7 @@ ProductsToProduce=Produits à produire UnitCost=Coût unitaire TotalCost=Coût total BOMTotalCost=Le coût de production de cette nomenclature basé sur chaque quantité et produit à consommer (utilise le prix de revient si défini, sinon le PMP si défini, sinon le meilleur prix d'achat) -BOMTotalCostService=Si le module "Poste de travail" est activé, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service" +BOMTotalCostService=Si le module "Poste de travail" est activé et qu'un poste de travil est défini par défaut sur la ligne, alors le calcul est "quantité (convertie en heures) x thm du poste de travail", sinon "quantité (convertie en heures) x prix de revient du service" BOMProductsList=Liste des composants BOMServicesList=Liste des services GoOnTabProductionToProduceFirst=Vous devez avoir la production pour clôturer un Ordre de Fabrication (voir onglet '%s'). Mais vous pouvez l'annuler. diff --git a/htdocs/langs/fr_FR/oauth.lang b/htdocs/langs/fr_FR/oauth.lang index 493cf00deb9..95cb2958bcb 100644 --- a/htdocs/langs/fr_FR/oauth.lang +++ b/htdocs/langs/fr_FR/oauth.lang @@ -34,3 +34,5 @@ OAUTH_ID=ID OAuth OAUTH_SECRET=Code secret OAuth OAuthProviderAdded=Fournisseur OAuth ajouté AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=Une entrée OAuth pour ce fournisseur et ce libellé existe déjà +ScopeUndefined=Permissions (Scopes) non définies (voir onglet précédent) +Scopes=Portées \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index a0642c4c627..2b3559787d3 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -234,7 +234,7 @@ StockIncrease=Augmentation du stock StockDecrease=Diminution du stock InventoryForASpecificWarehouse=Inventaire pour un entrepôt spécifique InventoryForASpecificProduct=Inventaire pour un produit spécifique -StockIsRequiredToChooseWhichLotToUse=Le module Stock est requis pour choisir une lot +StockIsRequiredToChooseWhichLotToUse=Un stock existant est requis pour pouvoir choisir un lot ForceTo=Forcer à AlwaysShowFullArbo=Afficher l'arborescence complète de l'entrepôt sur la popup du lien entrepôt (Avertissement: cela peut réduire considérablement les performances) StockAtDatePastDesc=Vous pouvez voir ici le stock (stock réel) à une date donnée dans le passé diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9969ea061e9..934782b89ec 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -518,7 +518,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions and mass actions are processed as sensitive. - if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'file_manager'))) { // We exclude the case action='create' and action='file_manager' that are legitimate + if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'createsite', 'file_manager', 'presend', 'presend_addmessage'))) { // We exclude the case action='create' and action='file_manager' that are legitimate $sensitiveget = true; } } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) { @@ -526,12 +526,13 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( $arrayofactiontoforcetokencheck = array( 'activate', 'doprev', 'donext', 'dvprev', 'dvnext', - 'install', + 'freezone', 'install', 'reopen' ); if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } + // We also match for value with just a simple string that must match if (preg_match('/^(add|classify|close|confirm|copy|del|disable|enable|remove|set|unset|update|save)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index d348bb4e9b7..f3254c3a8dd 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -44,8 +44,6 @@ $result = restrictedArea($user, 'societe', '', ''); $result = restrictedArea($user, 'margins'); -$mesg = ''; - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -65,18 +63,18 @@ if (!$sortorder) { } $startdate = $enddate = ''; - -if (!empty($_POST['startdatemonth'])) { - $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); +if (GETPOST('startdatemonth')) { + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } -if (!empty($_POST['enddatemonth'])) { - $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +if (GETPOST('enddatemonth')) { + $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Societe($db); $hookmanager->initHooks(array('margincustomerlist')); + /* * View */ @@ -189,7 +187,7 @@ print '
'; // Total Margin print ''; // Margin Rate @@ -272,6 +270,30 @@ $sql .= $db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +$param = '&socid='.((int) $socid); +if (GETPOST('startdatemonth', 'int')) { + $param .= '&startdateyear='.GETPOST('startdateyear', 'int'); + $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int'); + $param .= '&startdateday='.GETPOST('startdateday', 'int'); +} +if (GETPOST('enddatemonth', 'int')) { + $param .= '&enddateyear='.GETPOST('enddateyear', 'int'); + $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int'); + $param .= '&enddateday='.GETPOST('enddateday', 'int'); +} +$listofproducts = GETPOST('products', 'array:int'); +if (is_array($listofproducts)) { + foreach ($listofproducts as $val) { + $param .= '&products[]='.$val; + } +} +$listofcateg = GETPOST('categories', 'array:int'); +if (is_array($listofcateg)) { + foreach ($listofcateg as $val) { + $param .= '&categories[]='.$val; + } +} + dol_syslog('margin::customerMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { @@ -294,19 +316,19 @@ if ($result) { print ''; if (!empty($client)) { - print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$socid, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$socid, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder); } else { - print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder); + print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); } - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); } print "\n"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index f25b9c1937a..5b2a7593d42 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -74,18 +74,18 @@ if (!$sortfield) { } $startdate = $enddate = ''; - -if (!empty($_POST['startdatemonth'])) { - $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); +if (GETPOST('startdatemonth')) { + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } -if (!empty($_POST['enddatemonth'])) { - $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); +if (GETPOST('enddatemonth')) { + $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Product($db); $hookmanager->initHooks(array('marginproductlist')); + /* * View */ @@ -150,7 +150,7 @@ print '
'.$langs->trans("TotalMargin").''; -print ''; // set by jquery (see below) +print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below) print '
'; // Total Margin print ''; // Margin Rate @@ -225,13 +225,31 @@ $sql .= $db->order($sortfield, $sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); +$param = '&id='.((int) $id); +if (GETPOST('startdatemonth', 'int')) { + $param .= '&startdateyear='.GETPOST('startdateyear', 'int'); + $param .= '&startdatemonth='.GETPOST('startdatemonth', 'int'); + $param .= '&startdateday='.GETPOST('startdateday', 'int'); +} +if (GETPOST('enddatemonth', 'int')) { + $param .= '&enddateyear='.GETPOST('enddateyear', 'int'); + $param .= '&enddatemonth='.GETPOST('enddatemonth', 'int'); + $param .= '&enddateday='.GETPOST('enddateday', 'int'); +} +$listofcateg = GETPOST('categories', 'array:int'); +if (is_array($listofcateg)) { + foreach ($listofcateg as $val) { + $param .= '&categories[]='.$val; + } +} + dol_syslog('margin::productMargins.php', LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); print '
'; - print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&id=".$id, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); + print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); //var_dump($conf->global->MARGIN_TYPE); if ($conf->global->MARGIN_TYPE == "1") { @@ -248,20 +266,20 @@ if ($result) { print ''; if ($id > 0) { - print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center '); } else { - print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder); + print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); } - print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } print "\n"; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 3990d49fa6d..382b5a0f0ab 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -121,10 +121,10 @@ class pdf_standard_myobject extends ModelePDFMyObject $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); // Get source company $this->emetteur = $mysoc; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index ff6b180b9d8..7b11ecd7e81 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1027,6 +1027,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $disable = 'disabled'; } + // input hidden with fk_product of line + print ''; + // Qty print ''; @@ -1070,7 +1073,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ' '.img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.((int) $line->id).', \''.dol_escape_js($type).'\', \'qtymissingconsume\')"'); print ''; print ''; } print ''; diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 516e4eddf51..a08e4c25ad2 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -26,7 +26,7 @@ if (empty($conf) || !is_object($conf)) { print "\n"; -global $user, $db; +global $user, $db, $hookmanager; global $noMoreLinkedObjectBlockAfter; $langs = $GLOBALS['langs']; @@ -42,31 +42,34 @@ $ilink = 0; $mo_static = new Mo($db); $res = $mo_static->fetch($object->id); $TMoChilds = $mo_static->getMoChilds(); +$hookmanager->initHooks('LinesLinkedObjectBlock'); +$parameters = array('TMoChilds' => $TMoChilds); +$reshook = $hookmanager->executeHooks('LinesLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + foreach ($TMoChilds as $key => $objectlink) { + $ilink++; -foreach ($TMoChilds as $key => $objectlink) { - $ilink++; + $trclass = 'oddeven'; - $trclass = 'oddeven'; + echo ''; + echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo "\n"; } - echo ''; - echo ''; - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo "\n"; } - echo "\n"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 69e1f0c8357..d68a320482e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4830,7 +4830,7 @@ class Product extends CommonObject $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql.= " ORDER BY pa.rang"; - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.$parents, LOG_DEBUG); + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',', $parents), LOG_DEBUG); if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index f42563ceb19..00d2dc80fee 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -136,7 +136,6 @@ class Productbatch extends CommonObject global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; - $sql .= " t.tms,"; $sql .= " t.fk_product_stock,"; $sql .= " t.sellby as oldsellby,"; @@ -148,8 +147,8 @@ class Productbatch extends CommonObject $sql .= " w.fk_product,"; $sql .= " pl.eatby,"; $sql .= " pl.sellby"; - - $sql .= " FROM ".$this->db->prefix()."product_batch as t INNER JOIN ".$this->db->prefix()."product_stock w on t.fk_product_stock = w.rowid"; + $sql .= " FROM ".$this->db->prefix()."product_batch as t"; + $sql .= " INNER JOIN ".$this->db->prefix()."product_stock w on t.fk_product_stock = w.rowid"; // llx_product_stock is a parent table so this link does NOT generate duplicate record $sql .= " LEFT JOIN ".$this->db->prefix()."product_lot as pl on pl.fk_product = w.fk_product and pl.batch = t.batch"; $sql .= " WHERE t.rowid = ".((int) $id); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index d24b4e0d12b..5382f231322 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -371,7 +371,9 @@ if (empty($reshook)) { foreach ($toselect as $toselectid) { $result = $product->fetch($toselectid); if ($result > 0 && $product->id > 0) { - $product->setStatut($product->status ? 0 : 1, null, 'product', 'PRODUCT_MODIFY', 'tosell'); + if ($product->setStatut($product->status ? 0 : 1, null, 'product', 'PRODUCT_MODIFY', 'tosell') < 0) { + setEventMessages($product->error, $product->errors, 'errors'); + } } } } @@ -380,7 +382,9 @@ if (empty($reshook)) { foreach ($toselect as $toselectid) { $result = $product->fetch($toselectid); if ($result > 0 && $product->id > 0) { - $product->setStatut($product->status_buy ? 0 : 1, null, 'product', 'PRODUCT_MODIFY', 'tobuy'); + if ($product->setStatut($product->status_buy ? 0 : 1, null, 'product', 'PRODUCT_MODIFY', 'tobuy') < 0) { + setEventMessages($product->error, $product->errors, 'errors'); + } } } } diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 95da65cd540..a0310a16359 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -114,23 +114,17 @@ class ProductStockEntrepot extends CommonObject // Insert request $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'('; - $sql .= 'fk_product,'; $sql .= 'fk_entrepot,'; $sql .= 'seuil_stock_alerte,'; $sql .= 'desiredstock,'; $sql .= 'import_key'; - - $sql .= ') VALUES ('; - $sql .= ' '.(!isset($this->fk_product) ? 'NULL' : $this->fk_product).','; $sql .= ' '.(!isset($this->fk_entrepot) ? 'NULL' : $this->fk_entrepot).','; $sql .= ' '.(!isset($this->seuil_stock_alerte) ? '0' : $this->seuil_stock_alerte).','; $sql .= ' '.(!isset($this->desiredstock) ? '0' : $this->desiredstock).','; $sql .= ' '.(!isset($this->import_key) ? 'NULL' : "'".$this->db->escape($this->import_key)."'"); - - $sql .= ')'; $this->db->begin(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 31144a708c7..26b5ee7f3b8 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -71,8 +71,8 @@ if (!$user->rights->projet->lire) { $diroutputmassaction = $conf->project->dir_output.'/temp/massgeneration/'.$user->id; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST("sortfield", "aZ09comma"); -$sortorder = GETPOST("sortorder", 'aZ09comma'); +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // If $page is not defined, or '' or -1 or if we click on clear filters @@ -229,7 +229,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -356,13 +357,22 @@ if (empty($reshook)) { * View */ -$companystatic = new Societe($db); $form = new Form($db); + +$companystatic = new Societe($db); $formother = new FormOther($db); $formproject = new FormProjets($db); $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; -$title = $langs->trans("Projects"); +$title = $langs->trans("LeadsOrProjects"); +if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $title = $langs->trans("Projects"); +} +if (isset($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $title = $langs->trans("Leads"); +} +$morejs = array(); +$morecss = array(); // Get list of project id allowed to user (in a string list separated by comma) @@ -1190,8 +1200,12 @@ $totalarray = array( 'nbfield' => 0, 'val' => array(), ); -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } $object->id = $obj->id; $object->user_author_id = $obj->fk_user_creat; @@ -1648,14 +1662,26 @@ while ($i < min($num, $limit)) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''; +} + $db->free($resql); -$parameters = array('sql' => $sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "
'.$langs->trans("TotalMargin").''; -print ''; // set by jquery (see below) +print ' '.$langs->getCurrencySymbol($conf->currency).''; // set by jquery (see below) print '
'; - if (($action == 'consumeorproduce' || $action == 'consumeandproduceall')) print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" data-max-qty="1" onClick="addDispatchLine('.$line->id.', \'batch\', \'allmissingconsume\')"'); + if (($action == 'consumeorproduce' || $action == 'consumeandproduceall') && $tmpproduct->status_batch == 2) print img_picto($langs->trans('SplitAllQuantity'), 'split.png', 'class="splitbutton splitallbutton field-error-icon" data-max-qty="1" onClick="addDispatchLine('.$line->id.', \'batch\', \'allmissingconsume\')"'); print '
' . $langs->trans("ManufacturingOrder"); + if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + print ' '; + echo '' . $objectlink->getNomUrl(1) . '
'.$langs->trans("ManufacturingOrder"); - if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { - print ' '; + // $result = $product_static->fetch($objectlink->fk_product); + print '' . dol_print_date($objectlink->date_creation, 'day') . '-' . $objectlink->getLibStatut(3) . ''; + // For now, shipments must stay linked to order, so link is not deletable + echo '' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . ''; + echo '
'.$objectlink->getNomUrl(1).''; - // $result = $product_static->fetch($objectlink->fk_product); - print ''.dol_print_date($objectlink->date_creation, 'day').'-'.$objectlink->getLibStatut(3).''; - // For now, shipments must stay linked to order, so link is not deletable - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; - echo '
'.$langs->trans("NoRecordFound").'
\n"; print ''; + print "
\n"; // End of page diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 19fd85ace7e..76b26b09a3b 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -426,6 +426,7 @@ if ($action == "dosign" && empty($cancel)) { dataType: "text", data: { "action" : "importSignature", + "token" : \''.newToken().'\', "signaturebase64" : signature, "ref" : \''.dol_escape_js($REF).'\', "securekey" : \''.dol_escape_js($SECUREKEY).'\', diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 0fbb1b69b02..61bb3472c56 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -912,14 +912,14 @@ print ''."\n"; print ''."\n"; // Additionnal information for each payment system if (!empty($conf->paypal->enabled)) { - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; } if (!empty($conf->paybox->enabled)) { - print ''."\n"; + print ''."\n"; } if (!empty($conf->stripe->enabled)) { - print ''."\n"; + print ''."\n"; } print ''."\n"; print ''."\n"; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 85071a49b94..dcfc3e64884 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -149,11 +149,11 @@ class Reception extends CommonObject $this->statuts[2] = 'StatusReceptionProcessed'; // List of short language codes for status - $this->statutshorts = array(); - $this->statutshorts[-1] = 'StatusReceptionCanceledShort'; - $this->statutshorts[0] = 'StatusReceptionDraftShort'; - $this->statutshorts[1] = 'StatusReceptionValidatedShort'; - $this->statutshorts[2] = 'StatusReceptionProcessedShort'; + $this->statuts_short = array(); + $this->statuts_short[-1] = 'StatusReceptionCanceledShort'; + $this->statuts_short[0] = 'StatusReceptionDraftShort'; + $this->statuts_short[1] = 'StatusReceptionValidatedShort'; + $this->statuts_short[2] = 'StatusReceptionProcessedShort'; } /** @@ -456,8 +456,8 @@ class Reception extends CommonObject $this->brouillon = 1; } - $file = $conf->reception->dir_output."/".get_exdir($this->id, 2, 0, 0, $this, 'reception')."/".$this->id.".pdf"; - $this->pdf_filename = $file; + //$file = $conf->reception->dir_output."/".get_exdir(0, 0, 0, 1, $this, 'reception')."/".$this->id.".pdf"; + //$this->pdf_filename = $file; // Tracking url $this->getUrlTrackingStatus($obj->tracking_number); @@ -1177,6 +1177,8 @@ class Reception extends CommonObject $line = new CommandeFournisseurDispatch($this->db); $line->fetch($obj->rowid); + + // TODO Remove or keep this ? $line->fetch_product(); $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; @@ -1304,7 +1306,7 @@ class Reception extends CommonObject global $langs; $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statutshorts[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts_short[$status]); $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 4632d90fee6..794eed1716d 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -825,6 +825,9 @@ class RecruitmentCandidature extends CommonObject $statusType = 'status'.$status; //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; if ($status == self::STATUS_CANCELED) { + $statusType = 'status9'; + } + if ($status == self::STATUS_CONTRACT_SIGNED) { $statusType = 'status6'; } if ($status == self::STATUS_REFUSED) { diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 9237a752d99..a6cd787b343 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -107,7 +107,7 @@ class RecruitmentJobPosition extends CommonObject 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php:status=1', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'), - 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php::t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), + 'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'), 'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'), 'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 2e85bfab121..bf267a475c6 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -121,10 +121,10 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $this->page_largeur = $formatarray['width']; $this->page_hauteur = $formatarray['height']; $this->format = array($this->page_largeur, $this->page_hauteur); - $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; - $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; - $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; - $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; + $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10); + $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10); + $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10); + $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10); $this->option_logo = 1; // Display logo $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 33bf5b677af..7f1bbab2566 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -586,7 +586,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Cancel if ($permissiontoadd) { if ($object->status == $object::STATUS_VALIDATED) { - print ''.$langs->trans("Cancel").''."\n"; + print ''.$langs->trans("Cancel").''."\n"; } elseif ($object->status == $object::STATUS_REFUSED || $object->status == $object::STATUS_CANCELED || $object->status == $object::STATUS_CONTRACT_REFUSED) { print ''.$langs->trans("Re-Open").''."\n"; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4b612df0c00..90aafe95f5d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2022 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 @@ -342,6 +342,7 @@ if (empty($reshook)) { if (!$error) { //We finally remove the old thirdparty if ($soc_origin->delete($soc_origin->id, $user) < 1) { + setEventMessages($soc_origin->error, $soc_origin->errors, 'errors'); $error++; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 717278379e4..19f1c79565c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1844,7 +1844,7 @@ class Societe extends CommonObject $this->stcomm_picto = $obj->stcomm_picto; // picto statut commercial $this->email = $obj->email; - $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); + $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); $this->url = $obj->url; $this->phone = $obj->phone; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 523a6ad2986..e22f6e6d226 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -50,11 +50,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; - $hookmanager->initHooks(array('takeposinvoice')); -global $mysoc; - $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks", "banks")); $id = GETPOST('id', 'int'); diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 5f7263f5214..6f1fa43b472 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -83,7 +83,7 @@ if (!$action) { // Security check $id = GETPOST("id", 'int'); if ($user->socid > 0) $socid = $user->socid; -$result = restrictedArea($user, 'ticket', $id, ''); +$result = restrictedArea($user, 'ticket', $object->id, ''); // restrict access for externals users if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { @@ -164,11 +164,15 @@ if ($object->fk_user_create > 0) { $langs->load("users"); $fuser = new User($db); $fuser->fetch($object->fk_user_create); - $morehtmlref .= $fuser->getNomUrl(0); -} -if (!empty($object->origin_email)) { + $morehtmlref .= $fuser->getNomUrl(-1); +} elseif (!empty($object->email_msgid)) { $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; - $morehtmlref .= $object->origin_email.' ('.$langs->trans("TicketEmailOriginIssuer").')'; + $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"'); + $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$form->textwithpicto($langs->trans("CreatedByEmailCollector"), $langs->trans("EmailMsgID").': '.$object->email_msgid).')'; +} elseif (!empty($object->origin_email)) { + $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; + $morehtmlref .= img_picto('', 'email', 'class="paddingrightonly"'); + $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("CreatedByPublicPortal").')'; } // Thirdparty diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 9abc2893cda..862ea805a72 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -57,7 +57,7 @@ $ref = GETPOST('ref', 'alpha'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('$backtopage', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $contactid = GETPOST('contactid', 'int'); $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); @@ -1521,6 +1521,8 @@ if ($action == 'create' || $action == 'presend') { $formticket->withsubstit = 1; $formticket->substit = $substitutionarray; + $formticket->backtopage = $backtopage; + $formticket->showMessageForm('100%'); print ''; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index df581d96fdc..4994faf5230 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1724,9 +1724,10 @@ class Ticket extends CommonObject * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message + * @param boolean $send_email Whether the message is sent by email * @return int <0 if KO, >0 if OK */ - public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) + public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $send_email = false) { global $conf, $langs; $error = 0; @@ -1752,6 +1753,9 @@ class Ticket extends CommonObject if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } + if ($send_email) { + $actioncomm->type_code = 'AC_EMAIL'; + } $actioncomm->socid = $this->socid; $actioncomm->label = $this->subject; $actioncomm->note_private = $this->message; @@ -2536,7 +2540,7 @@ class Ticket extends CommonObject $listofnames = $resarray['listofnames']; $listofmimes = $resarray['listofmimes']; - $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames); + $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames, $send_email); if ($id <= 0) { $error++; $this->error = $object->error; diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 6e9c63462a2..6c8438b5ac0 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -51,7 +51,7 @@ if (!$sortfield) { $sortfield = "a.datep,a.id"; } if (!$sortorder) { - $sortorder = "desc"; + $sortorder = "DESC"; } $offset = $limit * $page; $pageprev = $page - 1; @@ -246,12 +246,12 @@ if (!empty($object->id)) { // Show link to add a message (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init'; + $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); // Show link to add event (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f7c28d7ebd9..a0e6c16fe45 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -546,7 +546,7 @@ class User extends CommonObject $this->personal_mobile = $obj->personal_mobile; $this->email = $obj->email; $this->personal_email = $obj->personal_email; - $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); + $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -744,6 +744,9 @@ class User extends CommonObject // If module is abc@module, we check permission user->rights->module->abc->permlevel1 $tmp = explode('@', $rightsPath, 2); if (!empty($tmp[1])) { + if (strpos($module, '@') !== false) { + $module = $tmp[1]; + } $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 47de2cbebcc..0b6feb18903 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -29,6 +29,7 @@ global $conf,$user,$langs,$db; //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php'; +require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; if (! defined('NOREQUIREUSER')) { define('NOREQUIREUSER', '1'); @@ -166,6 +167,30 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase print __METHOD__."\n"; } + /** + * testDolClone + * + * @return void + */ + public function testDolClone() + { + $newproduct1 = new Product($this->savdb); + + print __METHOD__." this->savdb has type ".(is_resource($this->savdb->db) ? get_resource_type($this->savdb->db) : (is_object($this->savdb->db) ? 'object' : 'unknown'))."\n"; + print __METHOD__." newproduct1->db->db has type ".(is_resource($newproduct1->db->db) ? get_resource_type($newproduct1->db->db) : (is_object($newproduct1->db->db) ? 'object' : 'unknown'))."\n"; + $this->assertEquals($this->savdb->connected, 1, 'Savdb is connected'); + $this->assertNotNull($newproduct1->db->db, 'newproduct1->db is not null'); + + $newproductcloned1 = dol_clone($newproduct1); + + print __METHOD__." this->savdb has type ".(is_resource($this->savdb->db) ? get_resource_type($this->savdb->db) : (is_object($this->savdb->db) ? 'object' : 'unknown'))."\n"; + print __METHOD__." newproduct1->db->db has type ".(is_resource($newproduct1->db->db) ? get_resource_type($newproduct1->db->db) : (is_object($newproduct1->db->db) ? 'object' : 'unknown'))."\n"; + $this->assertEquals($this->savdb->connected, 1, 'Savdb is connected'); + $this->assertNotNull($newproduct1->db->db, 'newproduct1->db is not null'); + + //print __METHOD__." newproductcloned1->db must be null\n"; + //$this->assertNull($newproductcloned1->db, 'newproductcloned1->db is null'); + } /** * testNum2Alpha