diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index dfe3fa53994..e6bcc7ad12e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,6 +8,8 @@ $finder = (new PhpCsFixer\Finder()) 'custom', 'documents', 'doctemplates', + 'vendor', + 'install/doctemplates', 'htdocs/custom', 'htdocs/includes', 'htdocs/install/doctemplates', @@ -41,6 +43,8 @@ return (new PhpCsFixer\Config()) // So we use target PHP70 for the moment. '@PHP70Migration' => true, //'@PHP71Migration' => true, + // Avoid adding public to const (incompatible with PHP 7.0): + 'visibility_required' => ['elements'=>['property', 'method']], //'strict_param' => true, //'array_syntax' => ['syntax' => 'short'], diff --git a/COPYRIGHT b/COPYRIGHT index 31b7f47434e..fb2d6159e06 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -26,7 +26,7 @@ PHP libraries: EvalMath 1.0 BSD Yes Safe math expressions evaluation. Used by dynamic price only. TODO Replace with dol_eval ? Escpos-php 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert -MathPHP 2.8.1 MIT License Yes Modern math library for PHP +MathPHP 2.8.1 MIT License Yes Modern math library for PHP (only few files) Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers 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 diff --git a/SECURITY.md b/SECURITY.md index 953059e625f..f004cea7c86 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -82,18 +82,17 @@ Scope is the web application (backoffice) and the APIs. ## Examples of vulnerabilities that are Non-qualified for reporting. * "Self" XSS -* SSL/TLS best practices -* Denial of Service attacks * Clickjacking/UI redressing -* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device * Presence of autocomplete attribute on web forms -* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself. * Logout and other instances of low-severity Cross-Site Request Forgery -* Missing security-related HTTP headers which do not lead directly to a vulnerability * Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated -* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC) -* Reports on features flagged as "experimental" or "development" -* Software version or private IP disclosure when logged-in user is admin +* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production). +* Software or libraries versions or private IP disclosure when logged-in user is admin * Stack traces or path disclosure when logged-in user is admin * Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities". -* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed. +* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself. +* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed. +* SSL/TLS best practices +* Denial of Service attacks +* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC) +* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device diff --git a/dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt b/dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt new file mode 100644 index 00000000000..d85bedd9528 --- /dev/null +++ b/dev/examples/stripe/webhook_ipn_paymentintent_failed_sepa.txt @@ -0,0 +1,124 @@ +{ + "id": "evt_123456789", + "object": "event", + "api_version": "2023-10-16", + "created": 1702053463, + "data": { + "object": { + "id": "pi_123456789", + "object": "payment_intent", + "amount": 60, + "amount_capturable": 0, + "amount_details": { + "tip": { + } + }, + "amount_received": 0, + "application": null, + "application_fee_amount": null, + "automatic_payment_methods": null, + "canceled_at": null, + "cancellation_reason": null, + "capture_method": "automatic", + "client_secret": "pi_123456789_secret_123456789", + "confirmation_method": "automatic", + "created": 1702053448, + "currency": "eur", + "customer": "cus_123456789", + "description": "Stripe payment from makeStripeSepaRequest: DID=31262-INV=123-CUS=123 did=123 ref=FA2312-123", + "invoice": null, + "last_payment_error": { + "code": "", + "decline_code": "generic_decline", + "message": "The transaction can't be processed because your customer's account information is missing or incorrect. Collect a new mandate and ask your customer to provide their name and address exactly as it appears on their bank account. After this, you can attempt the transaction again.", + "payment_method": { + "id": "pm_123456789", + "object": "payment_method", + "billing_details": { + "address": { + "city": null, + "country": "FR", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "email": "email@example.com", + "name": "Test example", + "phone": null + }, + "created": 1692688898, + "customer": "cus_123456789", + "livemode": false, + "metadata": { + "dol_version": "19.0.0-dev", + "dol_thirdparty_id": "123", + "ipaddress": "1.2.3.4", + "dol_id": "123", + "dol_type": "companypaymentmode", + "dol_entity": "1" + }, + "sepa_debit": { + "bank_code": "123", + "branch_code": "", + "country": "AT", + "fingerprint": "123456789", + "generated_from": { + "charge": null, + "setup_attempt": null + }, + "last4": "3202" + }, + "type": "sepa_debit" + }, + "type": "card_error" + }, + "latest_charge": "py_123456789", + "livemode": false, + "metadata": { + "dol_version": "19.0.0-beta", + "dol_thirdparty_id": "123", + "ipaddress": "1.2.3.4", + "dol_id": "123", + "dol_type": "facture", + "dol_entity": "1" + }, + "next_action": null, + "on_behalf_of": null, + "payment_method": null, + "payment_method_configuration_details": null, + "payment_method_options": { + "card": { + "installments": null, + "mandate_options": null, + "network": null, + "request_three_d_secure": "automatic" + }, + "sepa_debit": { + } + }, + "payment_method_types": [ + "card", + "sepa_debit" + ], + "processing": null, + "receipt_email": null, + "review": null, + "setup_future_usage": null, + "shipping": null, + "source": null, + "statement_descriptor": "DID=123-", + "statement_descriptor_suffix": "DID=123-", + "status": "requires_payment_method", + "transfer_data": null, + "transfer_group": null + } + }, + "livemode": false, + "pending_webhooks": 1, + "request": { + "id": null, + "idempotency_key": null + }, + "type": "payment_intent.payment_failed" +} diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index e15c8b5ace2..cad08090550 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -38,6 +38,8 @@ error_reporting(E_ALL & ~E_DEPRECATED); define('PRODUCT', "apstats"); define('VERSION', "1.0"); +$phpstanlevel = 2; + print '***** '.constant('PRODUCT').' - '.constant('VERSION').' *****'."\n"; if (empty($argv[1])) { @@ -71,6 +73,7 @@ while ($i < $argc) { $i++; } +$timestart = time(); // Count lines of code of Dolibarr itself /* @@ -102,7 +105,7 @@ exec($commandcheck, $output_arrdep, $resexecdep); // Get technical debt -$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github'; +$commandcheck = ($dirphpstan ? $dirphpstan.'/' : '').'phpstan --level='.$phpstanlevel.' -v analyze -a build/phpstan/bootstrap.php --memory-limit 5G --error-format=github'; print 'Execute PHPStan to get the technical debt: '.$commandcheck."\n"; $output_arrtd = array(); $resexectd = 0; @@ -169,6 +172,8 @@ foreach (array('proj', 'dep') as $source) { } } +$timeend = time(); + /* * View @@ -224,7 +229,7 @@ th,td { .nowrap { white-space: nowrap; } -.opacity { +.opacitymedium { opacity: 0.5; } .centpercent { @@ -293,7 +298,7 @@ $html .= ''."\n"; $html .= '
'."\n"; $html .= '

Advanced Project Statistics

'."\n"; $currentDate = date("Y-m-d H:i:s"); // Format: Year-Month-Day Hour:Minute:Second -$html .= 'Generated on '.$currentDate.''."\n"; +$html .= 'Generated on '.$currentDate.' in '.($timeend - $timestart).' seconds'."\n"; $html .= '
'."\n"; $html .= '
'."\n"; @@ -372,19 +377,24 @@ $html .= ''.formatNumber($arraycocomo['proj']['people'] * $arraycocomo['proj' $html .= ' monthes people
'; $html .= '
'."\n"; -$html .= '
'."\n"; -$html .= '

Technical debt ('.count($output_arrtd).')


'."\n"; -$html .= '
'."\n"; -$html .= ''."\n"; -$html .= ''."\n"; +$tmp = ''; +$nblines = 0; foreach ($output_arrtd as $line) { $reg = array(); //print $line."\n"; preg_match('/^::error file=(.*),line=(\d+),col=(\d+)::(.*)$/', $line, $reg); if (!empty($reg[1])) { - $html .= ''."\n"; + $tmp .= ''."\n"; + $nblines++; } } + +$html .= '
'."\n"; +$html .= '

Technical debt (PHPStan level '.$phpstanlevel.' => '.$nblines.' warnings)


'."\n"; +$html .= '
'."\n"; +$html .= '
FileLineType
'.$reg[1].''.$reg[2].''.$reg[4].'
'.$reg[1].''.$reg[2].''.$reg[4].'
'."\n"; +$html .= ''."\n"; +$html .= $tmp; $html .= '
FileLineType
'; $html .= '
'; $html .= '
'."\n"; diff --git a/dev/tools/php-cs-fixer/run-php-cs-fixer.sh b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh index b62befcf011..d8c9d4ae6bb 100755 --- a/dev/tools/php-cs-fixer/run-php-cs-fixer.sh +++ b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh @@ -36,7 +36,7 @@ MINPHPVERSION="7.0" echo "***** run-php-cs-fixer.sh *****" if [ "x$1" = "x" ]; then - echo "Syntax: run-php-cs-fixer.sh check|fix [path]" + echo "Syntax: run-php-cs-fixer.sh check|fix [path_from_root_project]" exit 1; fi diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index d20c2867cdb..656a7d4ff59 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -21,10 +21,12 @@ use Rector\Php71\ValueObject\TwoNodeMatch; use Symplify\RuleDocGenerator\Exception\PoorDocumentationException; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; +use PhpParser\Node\Expr\BinaryOp\NotEqual; use PhpParser\Node\Expr\BinaryOp\Greater; use PhpParser\Node\Expr\BinaryOp\GreaterOrEqual; use PhpParser\Node\Expr\BinaryOp\Smaller; use PhpParser\Node\Expr\BinaryOp\SmallerOrEqual; +use PhpParser\Node\Expr\BinaryOp\NotIdentical; /** * Class with Rector custom rule to fix code @@ -55,7 +57,7 @@ class GlobalToFunction extends AbstractRector public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Change $conf->global to getDolGlobal', + 'Change $conf->global to getDolGlobal in context (1) conf->global Operator Value or (2) function(conf->global...)', [new CodeSample( '$conf->global->CONSTANT', 'getDolGlobalInt(\'CONSTANT\')' @@ -70,14 +72,15 @@ class GlobalToFunction extends AbstractRector */ public function getNodeTypes(): array { - return [Equal::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, BooleanAnd::class, Concat::class, ArrayDimFetch::class]; + return [FuncCall::class, Equal::class, NotEqual::class, Greater::class, GreaterOrEqual::class, Smaller::class, SmallerOrEqual::class, NotIdentical::class, BooleanAnd::class, Concat::class, ArrayDimFetch::class]; } /** * refactor * * @param Node $node A node - * @return Equal|Concat|ArrayDimFetch|void + * @return FuncCall|Equal|Concat|ArrayDimFetch|void + * return $node unchanged or void to do nothing */ public function refactor(Node $node) { @@ -97,6 +100,35 @@ class GlobalToFunction extends AbstractRector } return $node; } + + if ($node instanceof FuncCall) { + $tmpfunctionname = $this->getName($node); + if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'make_substitutions', 'min', 'max', 'explode'))) { + $args = $node->getArgs(); + $nbofparam = count($args); + + if ($nbofparam >= 1) { + $tmpargs = $args; + foreach ($args as $key => $arg) { // only 1 element in this array + //var_dump($key); + //var_dump($arg->value);exit; + if ($this->isGlobalVar($arg->value)) { + $constName = $this->getConstName($arg->value); + if (empty($constName)) { + return; + } + $a = new FuncCall(new Name('getDolGlobalString'), [new Arg($constName)]); + $tmpargs[$key] = new Arg($a); + + $r = new FuncCall(new Name($tmpfunctionname), $tmpargs); + return $r; + } + } + } + } + return $node; + } + if ($node instanceof Concat) { if ($this->isGlobalVar($node->left)) { $constName = $this->getConstName($node->left); @@ -125,6 +157,7 @@ class GlobalToFunction extends AbstractRector } return new Concat($leftConcat, $rightConcat); } + if ($node instanceof BooleanAnd) { $nodes = $this->resolveTwoNodeMatch($node); if (!isset($nodes)) { @@ -135,10 +168,16 @@ class GlobalToFunction extends AbstractRector $node = $nodes->getFirstExpr(); } + // Now process all comparison like: + // $conf->global->... Operator Value + $typeofcomparison = ''; if ($node instanceof Equal) { $typeofcomparison = 'Equal'; } + if ($node instanceof NotEqual) { + $typeofcomparison = 'NotEqual'; + } if ($node instanceof Greater) { $typeofcomparison = 'Greater'; } @@ -151,6 +190,10 @@ class GlobalToFunction extends AbstractRector if ($node instanceof SmallerOrEqual) { $typeofcomparison = 'SmallerOrEqual'; } + if ($node instanceof NotIdentical) { + $typeofcomparison = 'NotIdentical'; + //var_dump($node->left); + } if (empty($typeofcomparison)) { return; } @@ -160,7 +203,8 @@ class GlobalToFunction extends AbstractRector } // Test the type after the comparison conf->global->xxx to know the name of function - switch ($node->right->getType()) { + $typeright = $node->right->getType(); + switch ($typeright) { case 'Scalar_LNumber': $funcName = 'getDolGlobalInt'; break; @@ -185,6 +229,15 @@ class GlobalToFunction extends AbstractRector $node->right ); } + if ($typeofcomparison == 'NotEqual') { + return new NotEqual( + new FuncCall( + new Name($funcName), + [new Arg($constName)] + ), + $node->right + ); + } if ($typeofcomparison == 'Greater') { return new Greater( new FuncCall( @@ -221,6 +274,15 @@ class GlobalToFunction extends AbstractRector $node->right ); } + if ($typeofcomparison == 'NotIdentical') { + return new NotIdentical( + new FuncCall( + new Name($funcName), + [new Arg($constName)] + ), + $node->right + ); + } } /** @@ -233,7 +295,7 @@ class GlobalToFunction extends AbstractRector { return $this->binaryOpManipulator->matchFirstAndSecondConditionNode( $booleanAnd, - // $conf->global == $value + // Function to check if we are in the case $conf->global->... == $value function (Node $node): bool { if (!$node instanceof Equal) { return \false; @@ -257,7 +319,7 @@ class GlobalToFunction extends AbstractRector * Check if node is a global access with format conf->global->XXX * * @param Node $node A node - * @return bool Return true if noe is conf->global->XXX + * @return bool Return true if node is conf->global->XXX */ private function isGlobalVar($node) { diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index d1b0d10e262..faf5360c984 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -145,14 +145,14 @@ print ''; print ''; print ''.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT").''; print ''; -print ''; +print ''; print ''; // Accounting groups used for the income statement print ''; print ''.$langs->trans("ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT").''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index a1881cf212d..aaba332d2ef 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -100,7 +100,7 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction')) { $search_date_start = strtotime($fiscalYear->date_start); $search_date_end = strtotime($fiscalYear->date_end); } else { - $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 5323c3c9cce..b6f21694a4f 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -170,7 +170,7 @@ if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GE $search_date_start = strtotime($fiscalYear->date_start); $search_date_end = strtotime($fiscalYear->date_end); } else { - $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f722e32df08..580ea4287d1 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -165,7 +165,7 @@ if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('beg $search_date_start = strtotime($fiscalYear->date_start); $search_date_end = strtotime($fiscalYear->date_end); } else { - $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 864508e99d8..a6999195470 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -141,7 +141,7 @@ if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('searc $search_date_start = strtotime($fiscalYear->date_start); $search_date_end = strtotime($fiscalYear->date_end); } else { - $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) { $year_start--; // If current month is lower that starting fiscal month, we start last year diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 8759890a020..ffda82c2174 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -367,7 +367,7 @@ class BookKeeping extends CommonObject $this->piece_num = $objnum->piece_num; } - dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG); + dol_syslog(get_class($this)."::create this->piece_num=".$this->piece_num, LOG_DEBUG); if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 3920cd1ef54..085c8a65e80 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -87,8 +87,8 @@ if (is_array($fiscal_periods)) { } } -$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', $conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT)), 'strlen'); -$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', $conf->global->ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT)), 'strlen'); +$accounting_groups_used_for_balance_sheet_account = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT'))), 'strlen'); +$accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); /* @@ -263,6 +263,7 @@ if (isset($current_fiscal_period)) { 'label' => $langs->trans('DateEnd'), 'value' => $current_fiscal_period['date_end'] ); + $formconfirm = $form->formconfirm( $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], $langs->trans('AccountancyClosureAccountingReversal'), diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 14e69593c02..0551a3fe95a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -53,7 +53,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) { $accountingAccount = new AccountingAccount($db); -$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); +$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (GETPOST("year", 'int')) { $year_start = GETPOST("year", 'int'); } else { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 0f0b5ec146c..1382eaf5ac6 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -36,7 +36,7 @@ $langs->loadLangs(array("compta", "bills", "other", "accountancy")); $validatemonth = GETPOST('validatemonth', 'int'); $validateyear = GETPOST('validateyear', 'int'); -$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); +$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (GETPOST("year", 'int')) { $year_start = GETPOST("year", 'int'); } else { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e9cb8de0705..5d80232d51d 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -104,10 +104,16 @@ $error = 0; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) { +if (empty($date_startmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} +if (empty($date_endmonth)) { + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); $date_end = $dates['date_end']; $pastmonthyear = $dates['pastmonthyear']; $pastmonth = $dates['pastmonth']; @@ -306,16 +312,28 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { + // Test if entry is for a social contribution, salary or expense report. + // In such a case, we will ignore the bank url line for user $is_sc = false; + $is_salary = false; + $is_expensereport = false; foreach ($links as $v) { if ($v['type'] == 'sc') { $is_sc = true; break; } + if ($v['type'] == 'payment_salary') { + $is_salary = true; + break; + } + if ($v['type'] == 'payment_expensereport') { + $is_expensereport = true; + break; + } } // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { - if ($links[$key]['type'] == 'user' && !$is_sc) { + if ($links[$key]['type'] == 'user' && !$is_sc && !$is_salary && !$is_expensereport) { continue; } if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { @@ -365,6 +383,7 @@ if ($result) { $userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname']; $userstatic->statut = $tabuser[$obj->rowid]['status']; + $userstatic->status = $tabuser[$obj->rowid]['status']; $userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code']; if ($userstatic->id > 0) { $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0); diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 39fa8d8e050..fb86cdc3505 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -90,10 +90,16 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) { +if (empty($date_startmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} +if (empty($date_endmonth)) { + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); $date_end = $dates['date_end']; $pastmonthyear = $dates['pastmonthyear']; $pastmonth = $dates['pastmonth']; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ed03d708b79..8439ff5ec99 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -92,10 +92,16 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) { +if (empty($date_startmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} +if (empty($date_endmonth)) { + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); $date_end = $dates['date_end']; $pastmonthyear = $dates['pastmonthyear']; $pastmonth = $dates['pastmonth']; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 5ca5c164007..b91a7393572 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -94,10 +94,16 @@ $journal_label = $accountingjournalstatic->label; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) { +if (empty($date_startmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} +if (empty($date_endmonth)) { + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); $date_end = $dates['date_end']; $pastmonthyear = $dates['pastmonthyear']; $pastmonth = $dates['pastmonth']; @@ -464,7 +470,7 @@ if ($action == 'writebookkeeping' && !$error) { // Warranty if (!$errorforline) { - if (is_iterable($tabwarranty[$key])) { + if (is_array($tabwarranty[$key])) { foreach ($tabwarranty[$key] as $k => $mt) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -706,7 +712,7 @@ if ($action == 'writebookkeeping' && !$error) { // Revenue stamp if (!$errorforline) { - if (is_iterable($tabrevenuestamp[$key])) { + if (is_array($tabrevenuestamp[$key])) { foreach ($tabrevenuestamp[$key] as $k => $mt) { if ($mt) { $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label @@ -1144,7 +1150,7 @@ if (empty($action) || $action == 'view') { } // Warranty - if (is_iterable($tabwarranty[$key])) { + if (is_array($tabwarranty[$key])) { foreach ($tabwarranty[$key] as $k => $mt) { print ''; print ""; @@ -1292,7 +1298,7 @@ if (empty($action) || $action == 'view') { } // Revenue stamp - if (is_iterable($tabrevenuestamp[$key])) { + if (is_array($tabrevenuestamp[$key])) { foreach ($tabrevenuestamp[$key] as $k => $mt) { print ''; print ""; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 7d496cee5a0..0906f7c4754 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -61,10 +61,16 @@ $parameters = array(); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) { +if (empty($date_startmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; + $pastmonthyear = $dates['pastmonthyear']; + $pastmonth = $dates['pastmonth']; +} +if (empty($date_endmonth)) { + // Period by default on transfer + $dates = getDefaultDatesForTransfer(); $date_end = $dates['date_end']; $pastmonthyear = $dates['pastmonthyear']; $pastmonth = $dates['pastmonth']; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index fd07ac82704..a8181885c3a 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -51,7 +51,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) { $accountingAccount = new AccountingAccount($db); -$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); +$month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if (GETPOST("year", 'int')) { $year_start = GETPOST("year", 'int'); } else { diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 0a87cf13b4a..9853dd08bf1 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -53,7 +53,7 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc } $datetouseforfilename = $search_date_end; $tmparray = dol_getdate($datetouseforfilename); - $fiscalmonth = !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START; + $fiscalmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); // Define end of month to use if ($tmparray['mon'] < $fiscalmonth || $fiscalmonth == 1) { $tmparray['mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1; diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 06cd83397c4..b78cd367c9d 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -353,12 +353,12 @@ print "\n"; print ''; print $langs->trans("MemberSubscriptionStartAfter"); print ''; -print ''; +print ''; print "\n"; // Mail required for members print ''.$langs->trans("AdherentMailRequired").''; -print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1); +print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1); print "\n"; // Login/Pass required for members @@ -370,24 +370,24 @@ print "\n"; // Send mail information is on by default print ''.$langs->trans("MemberSendInformationByMailByDefault").''; -print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1); +print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL', 0), 1); print "\n"; // Create an external user login for each new member subscription validated print ''.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").''; -print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN') ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1); +print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 0), 1); print "\n"; // Create an external user login for each new member subscription validated -$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); +$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); print ''.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; -print $form->selectyesno('MEMBER_PUBLIC_ENABLED', (getDolGlobalString('MEMBER_PUBLIC_ENABLED') ? $conf->global->MEMBER_PUBLIC_ENABLED : 0), 1); +print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED', 0), 1); print "\n"; // Allow members to change type on renewal forms /* To test during next beta print ''.$langs->trans("MemberAllowchangeOfType").''; -print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (!empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE) ? 0 : 1), 1); +print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1); print "\n"; */ @@ -416,7 +416,7 @@ if (isModEnabled('facture')) { print ''.$langs->trans("VATToUseForSubscriptions").''; if (isModEnabled("banque")) { print ''; - print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); + print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0); print ''; } else { print ''; @@ -428,7 +428,7 @@ if (isModEnabled('facture')) { if (isModEnabled("product") || isModEnabled("service")) { print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; print ''; - $selected = (!getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); + $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); print img_picto('', 'product', 'class="pictofixedwidth"'); $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0); print ''; diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 4a9ba7ee1c7..8ac296f9449 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -215,7 +215,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print ''; $listofval = array(); $listofval += $adht->liste_array(1); - $forcetype = !getDolGlobalString('MEMBER_NEWFORM_FORCETYPE') ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE; + $forcetype = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', -1); print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0); print "\n"; @@ -225,7 +225,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print ''; print $langs->trans("ForceMemberNature"); print ''; - $forcenature = !getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY') ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY; + $forcenature = getDolGlobalInt('MEMBER_NEWFORM_FORCEMORPHY', 0); print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1); print "\n"; @@ -233,25 +233,25 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print ''; print $langs->trans("DefaultAmount"); print ''; - print ''; + print ''; print "\n"; // Min amount print ''; print $langs->trans("MinimumAmount"); print ''; - print ''; + print ''; print "\n"; // SHow counter of validated members publicly print ''; print $langs->trans("MemberCountersArePublic"); print ''; - print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", (getDolGlobalString('MEMBER_COUNTERS_ARE_PUBLIC') ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1); + print $form->selectyesno("MEMBER_COUNTERS_ARE_PUBLIC", getDolGlobalInt('MEMBER_COUNTERS_ARE_PUBLIC'), 1); print "\n"; // Show the table of all available membership types. If not, show a form (as the default was for Dolibarr <=16.0) - $skiptable = (getDolGlobalString('MEMBER_SKIP_TABLE') ? $conf->global->MEMBER_SKIP_TABLE : 0); + $skiptable = getDolGlobalInt('MEMBER_SKIP_TABLE'); print ''; print $langs->trans("MembersShowMembershipTypesTable"); print ''; @@ -259,7 +259,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { print "\n"; // Show "vote allowed" setting for membership types - $hidevoteallowed = (getDolGlobalString('MEMBER_HIDE_VOTE_ALLOWED') ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0); + $hidevoteallowed = getDolGlobalInt('MEMBER_HIDE_VOTE_ALLOWED'); print ''; print $langs->trans("MembersShowVotesAllowed"); print ''; @@ -282,7 +282,7 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { if (isModEnabled('stripe')) { $listofval['stripe'] = 'Stripe'; } - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); + print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, getDolGlobalString('MEMBER_NEWFORM_PAYONLINE'), 0); print "\n"; print ''; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index fcfe87209c0..c47e745c8b8 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -150,10 +150,10 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { // For business cards if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') { - $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); - $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); - $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); - $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); + $textleft = make_substitutions(getDolGlobalString('ADHERENT_CARD_TEXT'), $substitutionarray); + $textheader = make_substitutions(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT'), $substitutionarray); + $textfooter = make_substitutions(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT'), $substitutionarray); + $textright = make_substitutions(getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT'), $substitutionarray); if (is_numeric($foruserid) || $foruserlogin) { $nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; // $_Avery_Labels is defined into an include @@ -190,7 +190,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { if (!getDolGlobalString('ADHERENT_ETIQUETTE_TEXT')) { $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__"; } - $textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray); + $textleft = make_substitutions(getDolGlobalString('ADHERENT_ETIQUETTE_TEXT'), $substitutionarray); $textheader = ''; $textfooter = ''; $textright = ''; @@ -275,7 +275,7 @@ dol_htmloutput_errors($mesg); print '
'; -print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", (getDolGlobalString('ADHERENT_CARD_TYPE') ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; +print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", getDolGlobalString('ADHERENT_CARD_TYPE', $langs->transnoentitiesnoconv("None"))).' '; print '
'; print ''; print ''; @@ -288,13 +288,13 @@ foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; } asort($arrayoflabels); -print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : getDolGlobalString('ADHERENT_CARD_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; print '
'; print '

'; -print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", (getDolGlobalString('ADHERENT_CARD_TYPE') ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; +print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", getDolGlobalString('ADHERENT_CARD_TYPE', $langs->transnoentitiesnoconv("None"))).' '; print '
'; print ''; print ''; @@ -306,14 +306,14 @@ foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; } asort($arrayoflabels); -print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : getDolGlobalString('ADHERENT_CARD_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'.$langs->trans("Login").': '; print '
'; print '
'; print '

'; -print img_picto('', 'card').' '.$langs->trans("DocForLabels", (!getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' '; +print img_picto('', 'card').' '.$langs->trans("DocForLabels", getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')).' '; print '
'; print ''; print ''; @@ -325,7 +325,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; } asort($arrayoflabels); -print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (!getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; print '
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 294e0c4689d..51af75d9591 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1151,7 +1151,6 @@ class Adherent extends CommonObject // Mise a jour $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."'"; - //if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) if ($isencrypted) { $sql .= ", pass = null"; } else { @@ -1921,7 +1920,7 @@ class Adherent extends CommonObject $outputlangs->setDefaultLang($newlang); } // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email - //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + //if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) $invoice->generateDocument($invoice->model_pdf, $outputlangs); } @@ -2727,7 +2726,7 @@ class Adherent extends CommonObject $keymodified = false; // Object classes - $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_OBJECT_CLASS); + $info["objectclass"] = explode(',', getDolGlobalString('LDAP_MEMBER_OBJECT_CLASS')); $this->fullname = $this->getFullName($langs); @@ -2752,7 +2751,7 @@ class Adherent extends CommonObject $info[getDolGlobalString($constname)] = $this->$varname; // Check if it is the LDAP key and if its value has been changed - if (getDolGlobalString('LDAP_KEY_MEMBERS') && $conf->global->LDAP_KEY_MEMBERS == getDolGlobalString($constname)) { + if (getDolGlobalString('LDAP_KEY_MEMBERS') && getDolGlobalString('LDAP_KEY_MEMBERS') == getDolGlobalString($constname)) { if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) { $keymodified = true; // For check if LDAP key has been modified } @@ -2821,15 +2820,15 @@ class Adherent extends CommonObject if (getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')) { $info[getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE) } - } elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { + } elseif (getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION') !== '3') { // Set LDAP password if possible // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password - if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { - // Just for the default MD5 ! - if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) { + if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { // This should be on on default installation + // Just for the case we use old md5 encryption (deprecated, no more used, kept for compatibility) + if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO') || getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'md5') { if ($this->pass_indatabase_crypted && getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')) { // Create OpenLDAP MD5 password from Dolibarr MD5 password - // Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))" + // Note: This suppose that "pass_indatabase_crypted" is a md5 (this should not happen anymore)" $info[getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD_CRYPTED')] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5'); } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index c75ec565b35..4832a4242e7 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -844,7 +844,7 @@ class AdherentType extends CommonObject $dn = getDolGlobalString('LDAP_KEY_MEMBERS_TYPES') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS_TYPES')]."," . getDolGlobalString('LDAP_MEMBER_TYPE_DN'); } if ($mode == 1) { - $dn = $conf->global->LDAP_MEMBER_TYPE_DN; + $dn = getDolGlobalString('LDAP_MEMBER_TYPE_DN'); } if ($mode == 2) { $dn = getDolGlobalString('LDAP_KEY_MEMBERS_TYPES') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS_TYPES')]; @@ -868,7 +868,7 @@ class AdherentType extends CommonObject $info = array(); // Object classes - $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS); + $info["objectclass"] = explode(',', getDolGlobalString('LDAP_MEMBER_TYPE_OBJECT_CLASS')); if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility $this->note_public = $this->note; diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 351b7092dd8..d2cd86f7de0 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -41,7 +41,7 @@ if ($user->socid > 0) { $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 4dc2f756df1..fd64e315ff1 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -43,7 +43,7 @@ if ($user->socid > 0) { $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 182957bc97d..511553b9e88 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -1056,7 +1056,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') { + if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') != 'defaultforfoundationcountry') { print '. '.$langs->trans("NoVatOnSubscription", 0).''; } if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product') || isModEnabled('service'))) { @@ -1086,7 +1086,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h print $langs->trans("CreateDolibarrThirdParty"); print ')'; } - if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') { + if (!getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') || getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS') != 'defaultforfoundationcountry') { print '. '.$langs->trans("NoVatOnSubscription", 0).''; } if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled('product')|| isModEnabled('service'))) { diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 11590149cbb..c92d0032176 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search +$page_y = GETPOSTINT('page_y'); // Load translation files required by the page $langs->loadLangs(array('admin', 'companies', 'bills')); @@ -137,7 +138,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) dol_mkdir($dirforimage); } $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) { + + if (is_numeric($result) && $result > 0) { $constant = "MAIN_INFO_SOCIETE_LOGO"; if ($varforimage == 'logo_squarred') { $constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED"; @@ -267,7 +269,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) } if ($action != 'updateedit' && !$error) { - header("Location: ".$_SERVER["PHP_SELF"]); + header("Location: ".$_SERVER["PHP_SELF"].($page_y ? '?page_y='.$page_y : '')); exit; } } @@ -426,6 +428,7 @@ if (!empty($conf->use_javascript_ajax)) { print '
'; print ''; print ''; +print ''; print ''; print ''."\n"; @@ -457,7 +460,7 @@ print ''."\n"; print ''; + print ''; print ''; } @@ -518,6 +521,9 @@ if ($maxmin > 0) { print ''; print ''; if (!empty($mysoc->logo_small)) { + print '
'; + print ''.img_delete($langs->trans("Delete"), '', 'marginleftonly').''; + print '
'; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { print '
'; print ''; @@ -531,9 +537,6 @@ if (!empty($mysoc->logo_small)) { print ''; print '
'; } - print '
'; - print ''.img_delete($langs->trans("Delete"), '', 'marginleftonly').''; - print '
'; } elseif (!empty($mysoc->logo)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { print '
'; @@ -542,7 +545,7 @@ if (!empty($mysoc->logo_small)) { print ''; } else { print '
'; - print ''; + print ''; print '
'; } } @@ -560,6 +563,9 @@ if ($maxmin > 0) { print ''; print '
'; if (!empty($mysoc->logo_squarred_small)) { + print '
'; + print ''.img_delete($langs->trans("Delete"), '', 'marginleftonly').''; + print '
'; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) { print '
'; print ''; @@ -573,7 +579,6 @@ if (!empty($mysoc->logo_squarred_small)) { print ''; print '
'; } - print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; } elseif (!empty($mysoc->logo_squarred)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) { print '
'; @@ -582,7 +587,7 @@ if (!empty($mysoc->logo_squarred_small)) { print ''; } else { print '
'; - print ''; + print ''; print '
'; } } @@ -596,8 +601,9 @@ print ''; print '
'.$langs->trans("CompanyInfo").'
'; $state_id = 0; if (getDolGlobalString('MAIN_INFO_SOCIETE_STATE')) { - $tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_STATE')); $state_id = $tmp[0]; } print img_picto('', 'state', 'class="pictofixedwidth"'); @@ -499,7 +502,7 @@ if (isModEnabled('barcode')) { print '
'; print ''; print ''; - print '
'; +print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); -print '
'; +print '

'; // IDs of the company (country-specific) @@ -762,9 +768,12 @@ print ''.$langs->trans("FiscalYearInformation").'\n"; print ''; -print $formother->select_month(getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; +print $formother->select_month(getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').''; print ""; + +print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); + print '
'; @@ -947,7 +956,7 @@ if ($mysoc->country_code == 'GR') { print ""; } -print $form->buttonsSaveCancel("Save", ''); +print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); print '
'; diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php index 426b5a8eeb3..d4784351dba 100644 --- a/htdocs/admin/company_socialnetworks.php +++ b/htdocs/admin/company_socialnetworks.php @@ -128,11 +128,11 @@ foreach ($listofnetworks as $key => $value) { $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL'; $networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).''; + print ''.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag(getDolGlobalString($networkconstid)) : ''), 0, 0, $key, $listofnetworks).''; print ''."\n"; } } diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 804797237b8..8e4ae808f3e 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -286,7 +286,7 @@ if ($action == 'edit') { print '
'; -if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_METEO != 1) { +if (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') != 1) { // Show logo for weather print ''.$langs->trans("DescWeather").' '; diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 11b0d8668af..f71ddb0ca60 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -43,8 +43,9 @@ class PrestaShopWebservice /** @var string PS version */ protected $version; - /** @var array compatible versions of PrestaShop Webservice */ + /** @var string compatible min version of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; + /** @var string compatible max version of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMAX = '1.7.99.99'; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index dca0d5c02f7..e85f5aa51ea 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -262,13 +262,13 @@ if ($resql) { print ''; print ''.$langs->trans("Title").""; - print ''; + print ''; print ''."\n"; print ''; print "".$langs->trans("URL").""; - print ''; + print ''; print ''."\n"; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 0f33e1506f5..5f8afdb7fe2 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -707,7 +707,7 @@ if ($action == 'edit') { // SMTPS PW if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') != "XOAUTH2") { - print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).''; + print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW')).''; } // SMTPS oauth service @@ -918,7 +918,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''; print ''; if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) { - $listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO); + $listofemail = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')); $i = 0; foreach ($listofemail as $key => $val) { if ($i) { diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index dbb6ad27d61..eee4b71f42b 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -533,7 +533,7 @@ if ($action == 'edit') { } print ''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { // Host server if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; @@ -653,8 +653,8 @@ if ($action == 'edit') { print ''.$langs->trans("Modify").''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { - if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail' || !$linuxlike) { if (function_exists('fsockopen') && $port && $server) { print '' . $langs->trans("DoTestServerAvailability") . ''; } diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 104efa16c19..1fa1cd2bb33 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -510,7 +510,7 @@ if ($action == 'edit') { } print ''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') { // Host server if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; @@ -615,8 +615,8 @@ if ($action == 'edit') { print ''.$langs->trans("Modify").''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { - if ($conf->global->MAIN_MAIL_SENDMODE_TICKET != 'mail' || !$linuxlike) { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'mail' || !$linuxlike) { if (function_exists('fsockopen') && $port && $server) { print ''.$langs->trans("DoTestServerAvailability").''; } diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 038a41c66bb..0c191d9ae7b 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -155,7 +155,7 @@ if (isset($max)) { } print ''; print ''; -print ' '.$langs->trans("Kb"); +print ' '.$langs->trans("Kb"); print ''; print ''; @@ -165,7 +165,7 @@ print ''; print $form->textwithpicto($langs->trans("UMask"), $langs->trans("UMaskExplanation")); print ''; print ''; -print ''; +print ''; print ''; print ''; @@ -200,7 +200,7 @@ print ''.$langs->trans("AntiVirusParam").'
'; print ''.$langs->trans("AntiVirusParamExample").''; print ''; print ''; -print ''; +print ''; if (defined('MAIN_ANTIVIRUS_PARAM')) { print '
'.$langs->trans("ValueIsForcedBySystem").''; } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index bf686d3c93b..a784792ae02 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -776,7 +776,7 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_SUPPORTS_SERVICES'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES); + print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, getDolGlobalString('STOCK_SUPPORTS_SERVICES')); } print "\n"; print "\n"; diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index dd37a06b4da..88d590ffc35 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -186,16 +186,20 @@ if (isModEnabled('multicompany') && $user->entity) { // Output mode + +print '
'; + print load_fiche_titre($langs->trans("SyslogOutput"), '', ''); -// Mode -print ''; print ''; print ''; + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; foreach ($syslogModules as $moduleName) { @@ -209,9 +213,9 @@ foreach ($syslogModules as $moduleName) { print ''; - print ''; - print '
'.$langs->trans("Type").''.$langs->trans("Value").''.$langs->trans("Type").''.$langs->trans("Value").'
'; - print ' '; - print $module->getName(); + print ''; + print ' '; + print ''; if ($moduleName == 'mod_syslog_syslog') { if (!$module->isActive()) { $langs->load("errors"); @@ -235,22 +239,23 @@ foreach ($syslogModules as $moduleName) { $value = (isset($option['default']) ? $option['default'] : ''); } - print $option['name'].': '; + print ''.$option['name'].': '; if (!empty($option['example'])) { - print '
'.$langs->trans("Example").': '.$option['example']; + print '
'.$langs->trans("Example").': '.dol_escape_htmltag($option['example']); } if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/', $value)) { - $filelogparam = ' ('; + $filelogparam = '     '; $filelogparam .= $langs->trans('Download'); - $filelogparam .= ' '.basename($value).')'; + $filelogparam .= img_picto($langs->trans('Download').' '.basename($value), 'download', 'class="paddingleft"'); + $filelogparam .= ''; print $filelogparam; } } } print '
'; + print ''; if ($module->getInfo()) { print $form->textwithpicto('', $module->getInfo(), 1, 'help'); } @@ -262,42 +267,54 @@ foreach ($syslogModules as $moduleName) { } print "
\n"; +print "
\n"; + print "
\n"; + print '
'."\n\n"; -print load_fiche_titre($langs->trans("SyslogLevel"), '', ''); // Level -print '
'; + +print ''; + +print load_fiche_titre($langs->trans("SyslogLevel"), '', ''); + print ''; print ''; + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; print ''; -print ''; +print ''; print "\n"; -print ''; -print ''; +print ''; if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) { - print ''; - print ''; + print ''; + print ''; } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("SyslogLevel").'
'.$langs->trans("SyslogLevel").''; + +print ajax_combobox("level"); print '
'.$langs->trans("SyslogFileNumberOfSaves").''; - print ' ('.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').')
'.$langs->trans("SyslogFileNumberOfSaves").''; + print '   ('.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').')
'; +print "
\n"; + print "
\n"; // End of page diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 00d9a461048..7ad70c385b5 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -350,7 +350,7 @@ print ' -> PHP streams allowed = '; $arrayofstreams = stream_get_wrappers(); if (!empty($arrayofstreams)) { sort($arrayofstreams); - print (join(',', $arrayofstreams)).'     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')'."\n"; + print(join(',', $arrayofstreams)).'     ('.$langs->trans("Recommended").': '.$langs->trans("TryToKeepOnly", 'file,http,https,php').')'."\n"; } print '
'; @@ -627,13 +627,13 @@ print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SEC if (!getDolGlobalString('MAIN_SECURITY_HASH_ALGO')) { print '     If unset: \'md5\''; } -if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { +if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') { print '
MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT', ''.$langs->trans("Undefined").'').'
'; } else { print '('.$langs->trans("Recommended").': password_hash)'; print '
'; } -if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { +if (getDolGlobalString('MAIN_SECURITY_HASH_ALGO') != 'password_hash') { print '
The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.
'; print 'If you really want to switch, you must:
'; print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'
'; @@ -713,7 +713,9 @@ print 'MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = '.(getDol print '   ('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)
"; print '
'; -print 'MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1)')."
"; +// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1, disallow url links except if on /medias +// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2, disallow all external urls link +print 'MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': 1=only local links allowed or 2=no links at all)')."
"; print '
'; print 'MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; diff --git a/htdocs/api/admin/explorer_withredoc.php b/htdocs/api/admin/explorer_withredoc.php index 387da2a06af..8c94e7a6f62 100644 --- a/htdocs/api/admin/explorer_withredoc.php +++ b/htdocs/api/admin/explorer_withredoc.php @@ -47,7 +47,7 @@ if (getDolGlobalString('API_EXPLORER_DISABLED')) { // Restrict API to some IPs if (getDolGlobalString('API_RESTRICT_ON_IP')) { - $allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP); + $allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP')); $ipremote = getUserRemoteIP(); if (!in_array($ipremote, $allowedip)) { dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP')); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 45b8be32763..292add085d2 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -2097,7 +2097,7 @@ class Setup extends DolibarrApi $constvalue = (empty($constvalue) ? '0' : $constvalue); // Value found $value = ''; - if ($constname && $conf->global->$constname != '') { + if ($constname && getDolGlobalString($constname) != '') { $value = $conf->global->$constname; } $valueforchecksum = (empty($value) ? '0' : $value); diff --git a/htdocs/api/index.php b/htdocs/api/index.php index da711f6f43b..b824c7b97dc 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -198,7 +198,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', // Restrict API to some IPs if (getDolGlobalString('API_RESTRICT_ON_IP')) { - $allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP); + $allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP')); $ipremote = getUserRemoteIP(); if (!in_array($ipremote, $allowedip)) { dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP')); @@ -343,7 +343,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && // Test rules on endpoints. For example: // $conf->global->API_ENDPOINT_RULES = 'endpoint1:1,endpoint2:1,...' if (getDolGlobalString('API_ENDPOINT_RULES')) { - $listofendpoints = explode(',', $conf->global->API_ENDPOINT_RULES); + $listofendpoints = explode(',', getDolGlobalString('API_ENDPOINT_RULES')); $endpointisallowed = false; foreach ($listofendpoints as $endpointrule) { diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index e73f4cb1196..75acdf7b230 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -155,7 +155,7 @@ if ($resql) { } } -$seledted = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY); +$seledted = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY')); print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $seledted); print ''; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 70611f174e9..9874be8bebe 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -442,7 +442,6 @@ print ''; // User print ''; print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); - print ''; // Actions code @@ -570,7 +569,7 @@ if (is_array($blocks)) { print ''.dol_print_date($block->date_creation, 'dayhour').''; // User - print ''; + print ''; //print $block->getUser() print dol_escape_htmltag($block->user_fullname); print ''; @@ -580,7 +579,7 @@ if (is_array($blocks)) { // Ref print ''; - print $block->ref_object; + print dol_escape_htmltag($block->ref_object); print ''; // Link to source object @@ -596,7 +595,7 @@ if (is_array($blocks)) { print ''.img_info($langs->trans('ShowDetails')).''; // Fingerprint - print ''; + print ''; $texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':
'.$block->signature; $texttoshow .= '

'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):
'.$checkdetail[$block->id]['calculatedsignature']; $texttoshow .= '
'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 27a05d81e0e..a69c839f369 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -211,7 +211,7 @@ class BlockedLog // Add more action to track from a conf variable // For example: STOCK_MOVEMENT,... if (getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')) { - $tmparrayofmoresupportedevents = explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED); + $tmparrayofmoresupportedevents = explode(',', getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')); foreach ($tmparrayofmoresupportedevents as $val) { $this->trackedevents[$val] = 'log'.$val; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 9a5d6305301..f008b84dfad 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1683,7 +1683,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month $maxnbofchar = 80; - $tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS); + $tmp = explode('-', getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS')); $minhour = round($tmp[0], 0); $maxhour = round($tmp[1], 0); if ($minhour > 23) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 27ac6154296..44a7565e9be 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -70,7 +70,7 @@ $now = dol_now(); //restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read') - && !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) { + && !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read') && !$user->hasRight('contrat', 'read')) { accessforbidden(); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7ff7de223bf..d470fc8bc52 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1512,7 +1512,7 @@ class Propal extends CommonObject $error++; } - if (!$error) { + if (!$error && !getDolGlobalInt('MAIN_IGNORE_CONTACTS_ON_CLONING')) { // copy internal contacts if ($object->copy_linked_contact($this, 'internal') < 0) { $error++; @@ -2720,7 +2720,7 @@ class Propal extends CommonObject } } - if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE') && !getDolGlobalInt('PROPAL_DISABLE_AUTOUPDATE_ON_CLOSE')) { // Define output language $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS')) { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 3f6f8be39c3..7c4e197bdec 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -54,7 +54,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 99024dca83f..5ec0a3374d1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1191,7 +1191,7 @@ class Commande extends CommonOrder return 0; } else { - dol_print_error($this->db); + $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d799b588478..8c8f661fac8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2023 Ferran Marcet - * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2018-2023 Charlene Benke * Copyright (C) 2021 Anthony Berton * * This program is free software; you can redistribute it and/or modify @@ -322,6 +322,8 @@ if (empty($reshook)) { } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; + $year=""; + $month=""; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; if ($massaction == 'confirm_createbills') { // Create bills from orders. diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index a909820ae6e..702ee59d5e9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -75,7 +75,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ce013aa89e2..1d56ac2016d 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1079,7 +1079,7 @@ if ($resql) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields // When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation). if ($action == 'reconcile') { $arrayfields['b.num_releve']['checked'] = 1; @@ -1088,12 +1088,16 @@ if ($resql) { print '
'; print ''."\n"; + // Fields title search + // -------------------------------------------------------------------- print ''; // Actions and select if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } if (!empty($arrayfields['b.rowid']['checked'])) { @@ -1171,77 +1175,105 @@ if ($resql) { if (!empty($arrayfields['b.fk_bordereau']['checked'])) { print ''; } + // Action edit/delete and select + print ''; // Actions and select if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print "\n"; + $totalarray = array(); + $totalarray['nbfield'] = 0; + // Fields title print ''; // Actions and select if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } if (!empty($arrayfields['b.rowid']['checked'])) { print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.label']['checked'])) { print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.dateo']['checked'])) { print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center "); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.datev']['checked'])) { print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (!empty($arrayfields['type']['checked'])) { print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.num_chq']['checked'])) { print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center "); + $totalarray['nbfield']++; } if (!empty($arrayfields['bu.label']['checked'])) { print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['ba.ref']['checked'])) { print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.debit']['checked'])) { print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.credit']['checked'])) { print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right "); + $totalarray['nbfield']++; } if (!empty($arrayfields['balancebefore']['checked'])) { print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); + $totalarray['nbfield']++; } if (!empty($arrayfields['balance']['checked'])) { print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right "); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.num_releve']['checked'])) { print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center "); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.conciliated']['checked'])) { print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center "); + $totalarray['nbfield']++; } if (!empty($arrayfields['b.fk_bordereau']['checked'])) { print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center "); + $totalarray['nbfield']++; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action edit/delete and select + print ''; + $totalarray['nbfield']++; // Actions and select if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + //print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } print "\n"; @@ -1251,10 +1283,15 @@ if ($resql) { $posconciliatecol = 0; $cachebankaccount = array(); - // Loop on each record $sign = 1; - while ($i < min($num, $limit)) { + // Loop on each record + $i = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $links = $bankaccountstatic->get_url($objp->rowid); @@ -1364,13 +1401,17 @@ if ($resql) { '; print ''; } + + // conciliate print ''; + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } + print ''; } } @@ -1411,6 +1452,7 @@ if ($resql) { // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + print ''; } print "
'; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + $searchpicto = $form->showFilterButtons('left'); print $searchpicto; + //$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + //print $searchpicto; print ''; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + //$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + //print $searchpicto; + $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; print ' '; print '
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->rowid, $arrayofselected)) { @@ -1814,9 +1856,14 @@ if ($resql) { print ''; } } + print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($objp->rowid, $arrayofselected)) { @@ -1872,7 +1919,7 @@ if ($resql) { $colspan++; } } - print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
"; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index eb82d04a190..5b10b742d87 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -590,7 +590,7 @@ class Account extends CommonObject // Check parameters if (!$oper) { - $this->error = "oper not defined"; + $this->error = "Operation code not defined"; return -1; } if (!$this->id) { diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index cda42de38d3..449866b5e74 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -258,25 +258,38 @@ if ($user->hasRight('banque', 'consolidate') && ($action == 'num_releve' || $act } $sql .= " WHERE rowid = ".((int) $rowid); - dol_syslog("line.php", LOG_DEBUG); + $updatePathFile = true; + $update_dir = true; + + dol_syslog("line.php update bank line to set the new bank receipt nuber", LOG_DEBUG); + $result = $db->query($sql); + + // We must not rename the directory of the bank receipt when we change 1 line of bank receipt. Other lines may share the same old ref. + // Renaming can be done when we rename globaly a bank receipt but not when changing 1 line from one receipt into another one. + /* if ($result) { - $oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel); - $filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel); + if ($oldNum_rel) { + if ($num_rel) { + $oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel); + $filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel); - $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files"; - $sql .= " SET filepath = '".$db->escape($filepath)."'"; - $sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'"; - $updatePathFile = $db->query($sql); + $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files"; + $sql .= " SET filepath = '".$db->escape($filepath)."'"; + $sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'"; + $updatePathFile = $db->query($sql); - $srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel); - $destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel); + $srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel); + $destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel); - $update_dir = true; - if (dol_is_dir($srcdir)) { - $update_dir = dol_move_dir($srcdir, $destdir, 1); + if (dol_is_dir($srcdir)) { + $update_dir = dol_move_dir($srcdir, $destdir, 1); + } + } } } + */ + if ($result && $updatePathFile && $update_dir) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index c9f4809998c..479f09dabde 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -416,7 +416,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { print ''; $array = array(); - $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); + $numterminals = max(1, getDolGlobalString('TAKEPOS_NUM_TERMINALS')); for ($i = 1; $i <= $numterminals; $i++) { $array[$i] = $i; } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 4e41cfb8a26..381baabadae 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -64,7 +64,7 @@ if ($userid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; $mode = GETPOST("mode") ? GETPOST("mode") : 'customer'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cdf811dd5c3..b819569d041 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -165,7 +165,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede // retained warranty invoice available type $retainedWarrantyInvoiceAvailableType = array(); if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) { - $retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY); + $retainedWarrantyInvoiceAvailableType = explode('+', getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')); } // Security check @@ -1684,7 +1684,7 @@ if (empty($reshook)) { if (!isset($conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE)) { $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE = '5'; } - if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', $conf->global->CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE))) { + if ($srcobject->element == 'contrat' && in_array($lines[$i]->statut, explode(',', getDolGlobalString('CONTRACT_EXCLUDE_SERVICES_STATUS_FOR_INVOICE')))) { continue; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9bc9d68220f..b277db0da53 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -181,8 +181,6 @@ class Facture extends CommonInvoice public $fk_facture_source; public $linked_objects = array(); - public $date_lim_reglement; - /** * @var int ID Field to store bank id to use when payment mode is withdraw */ @@ -5534,7 +5532,7 @@ class Facture extends CommonInvoice } if ($rounding < 0) { - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); + $rounding = min(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), $conf->global->MAIN_MAX_DECIMALS_TOT); } if ($rounding > 0) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e3e7a952a6c..d58a1cf15d4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -214,7 +214,7 @@ $arrayfields = array( 'f.subtype'=>array('label'=>"InvoiceSubtype", 'checked'=>0, 'position'=>17), 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25), 'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>40), + 'p.ref'=>array('label'=>"ProjectRef", 'langs'=>'projects', 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>40), 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>41), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51), @@ -910,38 +910,6 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles. -/* -if (!$sall) { - $sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,'; - $sql .= ' f.localtax1, f.localtax2,'; - $sql .= ' f.datef, f.date_valid, f.date_lim_reglement, f.module_source, f.pos_source,'; - $sql .= ' f.paye, f.fk_statut, f.close_code,'; - $sql .= ' f.datec, f.tms, f.date_closing,'; - $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; - $sql .= ' f.fk_user_author, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht,'; - $sql .= ' f.multicurrency_total_tva, f.multicurrency_total_ttc,'; - $sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; - $sql .= ' typent.code,'; - $sql .= ' state.code_departement, state.nom,'; - $sql .= ' country.code,'; - $sql .= " p.rowid, p.ref, p.title,"; - $sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender"; - if ($search_categ_cus && $search_categ_cus != -1) { - $sql .= ", cc.fk_categorie, cc.fk_soc"; - } - // Add fields from extrafields - if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); - } - } - // Add GroupBy from hooks - $parameters = array('all' => !empty($all) ? $all : 0, 'fieldstosearchall' => $fieldstosearchall); - $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook - $sql .= $hookmanager->resPrint; -} else { -*/ if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } @@ -1708,6 +1676,7 @@ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['p.ref']['checked'])) { + $langs->load("projects"); print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index a33215086a2..54042ae0ec8 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -66,7 +66,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 4a90dd52b66..49925556725 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -104,7 +104,7 @@ $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '. report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink); -$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); +$p = explode(":", getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); $idpays = $p[0]; @@ -137,7 +137,7 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); // les variables - $cptfour = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); + $cptfour = ((getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $cpttva = (getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT') ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); $tabfac = array(); diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 9ffa49798e0..6f76ebfcedb 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -107,7 +107,7 @@ if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink); -$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); +$p = explode(":", getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')); $idpays = $p[0]; $sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,"; @@ -165,7 +165,7 @@ if ($result) { while ($i < $num) { $obj = $db->fetch_object($result); // les variables - $cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); + $cptcli = ((getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $cptcli); $compta_prod = $obj->accountancy_code_sell; if (empty($compta_prod)) { diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index d1fe6e7f2b5..fc1dbded732 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -55,7 +55,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } else { - $date_start = dol_get_first_day($year_start, !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); + $date_start = dol_get_first_day($year_start, !getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); if (!getDolGlobalString('MAIN_INFO_VAT_RETURN') || getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 2) { $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; } elseif (getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 3) { diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 49a448b2196..6a508abb5f8 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -65,7 +65,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { - $date_start = dol_get_first_day($year_start, !getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); + $date_start = dol_get_first_day($year_start, !getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false); if (!getDolGlobalString('MAIN_INFO_VAT_RETURN') || getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 2) { $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; } elseif (getDolGlobalInt('MAIN_INFO_VAT_RETURN') == 3) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index a5605f59873..32e05251fde 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -391,7 +391,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } if ($(\'#fieldchqemetteur\').val() == \'\') { - var emetteur = ('.$facture->type.' == '.Facture::TYPE_CREDIT_NOTE.') ? \''.dol_escape_js(dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM)).'\' : jQuery(\'#thirdpartylabel\').val(); + var emetteur = ('.$facture->type.' == '.Facture::TYPE_CREDIT_NOTE.') ? \''.dol_escape_js(dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'))).'\' : jQuery(\'#thirdpartylabel\').val(); $(\'#fieldchqemetteur\').val(emetteur); } } diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 9a83639b3dd..9ab0d0e0aeb 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -92,21 +92,23 @@ $totaltoshow = 0; if (isModEnabled('supplier_invoice')) { print ''.$langs->trans("NbOfInvoiceToPayByBankTransfer").''; print ''; - print ''; + $amounttoshow = $bprev->SommeAPrelever('bank-transfer'); + print ''; print $bprev->nbOfInvoiceToPay('bank-transfer'); print ''; print ''; - $totaltoshow += $bprev->SommeAPrelever('bank-transfer'); + $totaltoshow += $amounttoshow; } if (isModEnabled('salaries')) { print ''.$langs->trans("NbOfInvoiceToPayByBankTransferForSalaries").''; print ''; - print ''; + $amounttoshow = $bprev->SommeAPrelever('bank-transfer', 'salary'); + print ''; print $bprev->nbOfInvoiceToPay('bank-transfer', 'salary'); print ''; print ''; - $totaltoshow += $bprev->SommeAPrelever('bank-transfer', 'salary'); + $totaltoshow += $amounttoshow; } print ''.$langs->trans("Total").''; @@ -116,18 +118,15 @@ print '

'; /* - * Invoices waiting for withdraw + * Invoices waiting for credit transfer */ if (isModEnabled('supplier_invoice')) { $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,"; $sql .= " pfd.date_demande, pfd.amount,"; $sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; - $sql .= " ".MAIN_DB_PREFIX."societe as s"; - if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - $sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " ".MAIN_DB_PREFIX."societe as s,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; @@ -137,17 +136,10 @@ if (isModEnabled('supplier_invoice')) { $sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.ext_payment_id IS NULL"; $sql .= " AND pfd.fk_facture_fourn = f.rowid"; - if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); - } if ($socid) { $sql .= " AND f.fk_soc = ".((int) $socid); } - $sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd"; - $sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; - $sqlForSalary .= " AND s.entity IN (".getEntity('salary').")"; - $resql = $db->query($sql); if ($resql) { @@ -219,6 +211,10 @@ if (isModEnabled('supplier_invoice')) { } if (isModEnabled('salaries')) { + $sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd"; + $sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; + $sqlForSalary .= " AND s.entity IN (".getEntity('salary').")"; + $resql2 = $db->query($sqlForSalary); if ($resql2) { $numRow = $db->num_rows($resql2); diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index a5e7c3fc17c..04b59c959ce 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -149,14 +149,14 @@ if (empty($reshook)) { } // Set direct debit order to credited, create payment and close invoices - if ($action == 'infocredit' && $permissiontocreditdebit) { + if ($action == 'setinfocredit' && $permissiontocreditdebit) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (($object->type != 'bank-transfer' && $object->statut == BonPrelevement::STATUS_CREDITED) || ($object->type == 'bank-transfer' && $object->statut == BonPrelevement::STATUS_DEBITED)) { $error = 1; setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); } else { - $error = $object->set_infocredit($user, $dt); + $error = $object->set_infocredit($user, $dt, ($salaryBonPl ? 'salary' : '')); } if ($error) { @@ -164,6 +164,14 @@ if (empty($reshook)) { } } + if ($action == 'reopen' && $permissiontocreditdebit) { + $savtype = $object->type; + $res = $object->setStatut(BonPrelevement::STATUS_TRANSFERED); + if ($res <= 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + if ($action == 'confirm_delete' && $permissiontodelete) { $savtype = $object->type; $res = $object->delete($user); @@ -386,11 +394,11 @@ if ($id > 0 || $ref) { print '
'; } - if (!empty($object->date_trans) && empty($object->date_credit) && (($user->hasRight('prelevement', 'bons', 'credit') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'debit') && $object->type == 'bank-transfer')) && $action == 'setcredited') { + if ($object->status == BonPrelevement::STATUS_TRANSFERED && (($user->hasRight('prelevement', 'bons', 'credit') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'debit') && $object->type == 'bank-transfer')) && $action == 'setcredited') { $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); print '
'; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -417,7 +425,8 @@ if ($id > 0 || $ref) { print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'send')); } } - if (!empty($object->date_trans) && empty($object->date_credit)) { + + if ($object->status == BonPrelevement::STATUS_TRANSFERED) { if ($object->type == 'bank-transfer') { print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit')); } else { @@ -425,6 +434,16 @@ if ($id > 0 || $ref) { } } + if (getDolGlobalString('BANK_CAN_REOPEN_DIRECT_DEBIT_OR_CREDIT_TRANSFER')) { + if ($object->status == BonPrelevement::STATUS_DEBITED || $object->status == BonPrelevement::STATUS_CREDITED) { + if ($object->type == 'bank-transfer') { + print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit')); + } else { + print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit')); + } + } + } + if ($object->type == 'bank-transfer') { print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'create')); } else { @@ -437,15 +456,21 @@ if ($id > 0 || $ref) { $ligne = new LignePrelevement($db); - /* - * Lines into withdraw request - */ + // Lines into withdraw request if ($salaryBonPl) { - $sql = "SELECT pl.rowid, pl.statut, pl.amount,pl.fk_user"; - $sql .=" FROM llx_prelevement as p, llx_prelevement_lignes as pl, llx_salary as s"; - $sql .= " WHERE pl.rowid = p.fk_prelevement_lignes"; - $sql .= " AND p.fk_salary = s.rowid"; - $sql .= " AND pl.fk_prelevement_bons = ".((int) $id); + $sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,"; + $sql .= " u.rowid as socid, u.login as name"; + $sql .=" FROM llx_prelevement_lignes as pl"; + $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; + $sql .= ", ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $id); + $sql .= " AND pl.fk_prelevement_bons = pb.rowid"; + $sql .= " AND pb.entity = ".((int) $conf->entity); // No sharing of entity here + $sql .= " AND pl.fk_user = u.rowid"; + if ($socid) { + $sql .= " AND u.rowid = ".((int) $socid); + } + $sql .= $db->order($sortfield, $sortorder); } else { $sql = "SELECT pl.rowid, pl.statut, pl.amount,"; $sql .= " s.rowid as socid, s.nom as name"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 765431e15b6..6ec256df84f 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; @@ -186,8 +187,6 @@ class BonPrelevement extends CommonObject */ public function __construct($db) { - global $conf, $langs; - $this->db = $db; $this->filename = ''; @@ -217,7 +216,7 @@ class BonPrelevement extends CommonObject /** * Add invoice to withdrawal * - * @param int $invoice_id id invoice to add + * @param int $invoice_id ID of invoice to add or ID of salary to add * @param int $client_id id invoice customer * @param string $client_nom customer name * @param int $amount amount of invoice @@ -226,7 +225,7 @@ class BonPrelevement extends CommonObject * @param string $number bank account number * @param string $number_key number key of account number * @param string $type 'debit-order' or 'bank-transfer' - * @param string $sourcetype 'salary' for invoice of salary + * @param string $sourcetype 'salary' for salary, '' for invoices * @return int >0 if OK, <0 if KO */ public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '') @@ -235,7 +234,7 @@ class BonPrelevement extends CommonObject $result = 0; $line_id = 0; - // Add lines + // Add lines into prelevement_lignes $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype); @@ -245,7 +244,7 @@ class BonPrelevement extends CommonObject if ($type != 'bank-transfer') { $sql .= "fk_facture"; } else { - if (!empty($sourcetype)) { + if ($sourcetype == 'salary') { $sql .= "fk_salary"; } else { $sql .= "fk_facture_fourn"; @@ -280,21 +279,21 @@ class BonPrelevement extends CommonObject /** * Add line to withdrawal * - * @param int $line_id id line to add - * @param int $client_id id invoice customer + * @param int $line_id ID of line added (returned parameter) + * @param int $client_id ID of thirdparty for invoices, ID of user for salaries * @param string $client_nom customer name * @param int $amount amount of invoice * @param string $code_banque code of bank withdrawal * @param string $code_guichet code of bank's office * @param string $number bank account number * @param string $number_key number key of account number - * @param string $sourcetype check if is salary invoice + * @param string $sourcetype 'salary' for salary, '' for invoices * @return int >0 if OK, <0 if KO */ public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '') { $result = -1; - $concat = 0; + $concat = 0; // ??? what is this for. Seems not used. if ($concat == 1) { /* @@ -303,10 +302,10 @@ class BonPrelevement extends CommonObject $sql = "SELECT rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes"; $sql .= " WHERE fk_prelevement_bons = ".((int) $this->id); - if (empty($sourcetype)) { - $sql .= " AND fk_soc =".((int) $client_id); + if ($sourcetype == 'salary') { + $sql .= " AND fk_soc = ".((int) $client_id); } else { - $sql .= " AND fk_user =".((int) $client_id); + $sql .= " AND fk_user = ".((int) $client_id); } $sql .= " AND code_banque = '".$this->db->escape($code_banque)."'"; $sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'"; @@ -331,17 +330,17 @@ class BonPrelevement extends CommonObject $sql .= ", code_guichet"; $sql .= ", number"; $sql .= ", cle_rib"; - $sql .= (!empty($sourcetype) ? ", fk_user" : ""); + $sql .= ($sourcetype == 'salary' ? ", fk_user" : ""); $sql .= ") VALUES ("; $sql .= $this->id; - $sql .= ", ".(empty($sourcetype) ? ((int) $client_id) : 0); + $sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null $sql .= ", '".$this->db->escape($client_nom)."'"; $sql .= ", ".((float) price2num($amount)); $sql .= ", '".$this->db->escape($code_banque)."'"; $sql .= ", '".$this->db->escape($code_guichet)."'"; $sql .= ", '".$this->db->escape($number)."'"; $sql .= ", '".$this->db->escape($number_key)."'"; - $sql .= (!empty($sourcetype) ? ", ". ((int) $client_id) : ''); + $sql .= (($sourcetype == 'salary') ? ", ". ((int) $client_id) : ''); $sql .= ")"; if ($this->db->query($sql)) { $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); @@ -451,13 +450,14 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set direct debit or credit transfer order to "paid" status. - * Then create the payment for each invoice of the prelemevement_bon. + * Then create the payment for each invoice or salary of the prelemevement_bon. * * @param User $user Id of user * @param int $date date of action + * @param string $type 'salary' for type=salary * @return int >0 if OK, <0 if KO */ - public function set_infocredit($user, $date) + public function set_infocredit($user, $date, $type = '') { // phpcs:enable global $conf, $langs; @@ -475,10 +475,10 @@ class BonPrelevement extends CommonObject $this->db->begin(); $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; - $sql .= " SET fk_user_credit = ".$user->id; + $sql .= " SET fk_user_credit = ".((int) $user->id); $sql .= ", statut = ".self::STATUS_CREDITED; $sql .= ", date_credit = '".$this->db->idate($date)."'"; - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " WHERE rowid = ".((int) $this->id); $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND statut = ".self::STATUS_TRANSFERED; @@ -498,13 +498,21 @@ class BonPrelevement extends CommonObject $amounts = array(); $amountsperthirdparty = array(); - $facs = $this->getListInvoices(1); + $facs = $this->getListInvoices(1, $type); + if ($this->error) { + $error++; + } - // Loop on each invoice. $facs=array(0=>id, 1=>amount requested) + // Loop on each invoice or salary. + // $facs should be array(0=>id, 1=>amount requested) $num = count($facs); for ($i = 0; $i < $num; $i++) { if ($this->type == 'bank-transfer') { - $fac = new FactureFournisseur($this->db); + if ($type == 'salary') { + $fac = new Salary($this->db); + } else { + $fac = new FactureFournisseur($this->db); + } } else { $fac = new Facture($this->db); } @@ -512,15 +520,34 @@ class BonPrelevement extends CommonObject $result = $fac->fetch($facs[$i][0]); $amounts[$fac->id] = $facs[$i][1]; - $amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1]; + if ($this->type == 'bank-transfer') { + if ($type == 'salary') { + $amountsperthirdparty[$fac->fk_user][$fac->id] = $facs[$i][1]; + } else { + $amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1]; + } + } else { + $amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1]; + } $totalpaid = $fac->getSommePaiement(); - $totalcreditnotes = $fac->getSumCreditNotesUsed(); - $totaldeposits = $fac->getSumDepositsUsed(); + $totalcreditnotes = 0; + if (method_exists($fac, 'getSumCreditNotesUsed')) { + $totalcreditnotes = $fac->getSumCreditNotesUsed(); + } + $totaldeposits = 0; + if (method_exists($fac, 'getSumDepositsUsed')) { + $totaldeposits = $fac->getSumDepositsUsed(); + } $alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits; - // @TODO Move this after creation of payment - if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) { + // Set the main document to pay with status Paid. + // @TODO Move this after creation of payments done after + $amountofdocument = $fac->total_ttc; + if ($type == 'salary') { + $amountofdocument = $fac->amount; + } + if (price2num($alreadypayed + $facs[$i][1], 'MT') == price2num($amountofdocument, 'MT')) { $result = $fac->setPaid($user); if ($result < 0) { $this->error = $fac->error; @@ -528,12 +555,15 @@ class BonPrelevement extends CommonObject } } } - //var_dump($amountsperthirdparty);exit; - // Make one payment per customer + // Make one payment per customer or employee foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts) { if ($this->type == 'bank-transfer') { - $paiement = new PaiementFourn($this->db); + if ($type == 'salary') { + $paiement = new PaymentSalary($this->db); + } else { + $paiement = new PaiementFourn($this->db); + } } else { $paiement = new Paiement($this->db); } @@ -541,8 +571,16 @@ class BonPrelevement extends CommonObject $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice if ($this->type == 'bank-transfer') { - $paiement->paiementid = 2; - $paiement->paiementcode = 'VIR'; + if ($type == 'salary') { + $paiement->datep = $date; + + $paiement->paiementid = 2; + $paiement->fk_typepayment = 2; + $paiement->paiementcode = 'VIR'; + } else { + $paiement->paiementid = 2; + $paiement->paiementcode = 'VIR'; + } } else { $paiement->paiementid = 3; $paiement->paiementcode = 'PRE'; @@ -551,17 +589,24 @@ class BonPrelevement extends CommonObject $paiement->num_payment = $this->ref; // Set ref of direct debit note $paiement->id_prelevement = $this->id; - $paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode - if ($paiement_id < 0) { + $result = $paiement->create($user); // This use ->paiementid, that is ID of payment mode + + if ($result < 0) { $error++; $this->error = $paiement->error; $this->errors = $paiement->errors; dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error); } else { if ($this->type == 'bank-transfer') { - $modeforaddpayment = 'payment_supplier'; - $labelforaddpayment = '(SupplierInvoicePayment)'; - $addbankurl = 'credit-transfer'; + if ($type == 'salary') { + $modeforaddpayment = 'payment_salary'; + $labelforaddpayment = '(SalaryPayment)'; + $addbankurl = 'credit-transfer'; + } else { + $modeforaddpayment = 'payment_supplier'; + $labelforaddpayment = '(SupplierInvoicePayment)'; + $addbankurl = 'credit-transfer'; + } } else { $modeforaddpayment = 'payment'; $labelforaddpayment = '(CustomerInvoicePayment)'; @@ -569,6 +614,7 @@ class BonPrelevement extends CommonObject } $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl); + if ($result < 0) { $error++; $this->error = $paiement->error; @@ -596,12 +642,11 @@ class BonPrelevement extends CommonObject $error++; } - /* - * End of procedure - */ + // End of procedure if ($error == 0) { - $this->date_credit = $date; + $this->date_credit = $date; // date credit or debit $this->statut = self::STATUS_CREDITED; + $this->status = self::STATUS_CREDITED; $this->db->commit(); return 0; @@ -618,9 +663,9 @@ class BonPrelevement extends CommonObject /** * Set withdrawal to transmited status * - * @param User $user id of user - * @param int $date date of action - * @param string $method method of transmision to bank (0=Internet, 1=Api...) + * @param User $user Id of user + * @param int $date Date of action + * @param string $method Method of transmision to bank (0=Internet, 1=Api...) * @return int >0 if OK, <0 if KO */ public function set_infotrans($user, $date, $method) @@ -631,6 +676,7 @@ class BonPrelevement extends CommonObject $error = 0; dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO); + if ($this->db->begin()) { $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; $sql .= " SET fk_user_trans = ".$user->id; @@ -639,7 +685,7 @@ class BonPrelevement extends CommonObject $sql .= " , statut = ".self::STATUS_TRANSFERED; $sql .= " WHERE rowid = ".((int) $this->id); $sql .= " AND entity = ".((int) $conf->entity); - $sql .= " AND statut = 0"; + $sql .= " AND statut = ".self::STATUS_DRAFT; if ($this->db->query($sql)) { $this->method_trans = $method; @@ -655,8 +701,10 @@ class BonPrelevement extends CommonObject if ($error == 0) { $this->date_trans = $date; - $this->statut = 1; + $this->statut = self::STATUS_TRANSFERED; + $this->status = self::STATUS_TRANSFERED; $this->user_trans = $user->id; + $this->db->commit(); return 0; @@ -673,41 +721,50 @@ class BonPrelevement extends CommonObject } /** - * Get invoice list + * Get invoice or salary list (with amount or not) * - * @param int $amounts If you want to get the amount of the order for each invoice - * @return array Id of invoices + * @param int $amounts If you want to get the amount of the order for each invoice or salary + * @param string $type 'salary' for type=salary + * @return array Array(Id of invoices/salary, Amount to pay) */ - private function getListInvoices($amounts = 0) + private function getListInvoices($amounts = 0, $type = '') { global $conf; $arr = array(); - /* - * Returns all invoices presented within same order - */ + dol_syslog(get_class($this)."::getListInvoices"); + + // Returns all invoices presented within same order $sql = "SELECT "; if ($this->type == 'bank-transfer') { - $sql .= " p.fk_facture_fourn"; + if ($type == 'salary') { + $sql .= " p.fk_salary"; + } else { + $sql .= " p.fk_facture_fourn"; + } } else { $sql .= " p.fk_facture"; } if ($amounts) { $sql .= ", SUM(pl.amount)"; } - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement as p"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; $sql .= " WHERE p.fk_prelevement_lignes = pl.rowid"; - $sql .= " AND pl.fk_prelevement_bons = p.rowid"; - $sql .= " AND p.rowid = ".((int) $this->id); - $sql .= " AND p.entity = ".((int) $conf->entity); + $sql .= " AND pl.fk_prelevement_bons = pb.rowid"; + $sql .= " AND pb.rowid = ".((int) $this->id); + $sql .= " AND pb.entity = ".((int) $conf->entity); if ($amounts) { if ($this->type == 'bank-transfer') { - $sql .= " GROUP BY fk_facture_fourn"; + if ($type == 'salary') { + $sql .= " GROUP BY p.fk_salary"; + } else { + $sql .= " GROUP BY p.fk_facture_fourn"; + } } else { - $sql .= " GROUP BY fk_facture"; + $sql .= " GROUP BY p.fk_facture"; } } @@ -732,7 +789,7 @@ class BonPrelevement extends CommonObject } $this->db->free($resql); } else { - dol_syslog(get_class($this)."::getListInvoices Erreur"); + $this->error = $this->db->lasterror(); } return $arr; @@ -749,8 +806,6 @@ class BonPrelevement extends CommonObject public function SommeAPrelever($mode = 'direct-debit', $type = '') { // phpcs:enable - global $conf; - $sql = "SELECT sum(pd.amount) as nb"; if ($type !== 'salary') { if ($mode != 'bank-transfer') { @@ -817,7 +872,7 @@ class BonPrelevement extends CommonObject * Get number of invoices to pay * * @param string $type 'direct-debit' or 'bank-transfer' - * @param int $forsalary 0= for facture & facture_supplier, 1=for salary + * @param int $forsalary 0= for facture & facture_supplier, 1=for salary * @return int Return integer db->escape($ref)."%'"; @@ -1230,18 +1285,11 @@ class BonPrelevement extends CommonObject } if (!$error) { + dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande"); + // Add lines for the bon if (count($factures_prev) > 0) { foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary - // Fetch invoice - /* - $result = $fact->fetch($fac[0]); - if ($result < 0) { - $this->error = 'ERRORBONPRELEVEMENT Failed to load invoice with id '.$fac[0]; - break; - } - */ - /* * Add standing order. This add record into llx_prelevement_lignes and llx_prelevement * @@ -1259,7 +1307,6 @@ class BonPrelevement extends CommonObject * $fac[11] : IBAN * $fac[12] : frstrcur */ - $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type, $sourcetype); if ($ri <> 0) { @@ -1799,7 +1846,7 @@ class BonPrelevement extends CommonObject * Section Creditor (sepa Crediteurs bloc lines) */ if (!empty($user_dest)) { - $sql = "SELECT u.rowid as userId, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,"; + $sql = "SELECT u.rowid as userId, u.address, u.zip, u.town, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,"; $sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql .= " s.ref as reffac, p.fk_salary as idfac,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum"; @@ -1807,15 +1854,14 @@ class BonPrelevement extends CommonObject $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."salary as s,"; $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; - $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; - $sql .= " ".MAIN_DB_PREFIX."user as u,"; + $sql .= " ".MAIN_DB_PREFIX."user as u"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,"; $sql .= " ".MAIN_DB_PREFIX."user_rib as rib"; $sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id); $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; $sql .= " AND p.fk_salary = s.rowid"; $sql .= " AND s.fk_user = u.rowid"; $sql .= " AND rib.fk_user = s.fk_user"; - $sql .= " AND rib.fk_country = c.rowid"; } else { $sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; @@ -1825,14 +1871,13 @@ class BonPrelevement extends CommonObject $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; - $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; - $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; + $sql .= " ".MAIN_DB_PREFIX."societe as soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,"; $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; $sql .= " AND p.fk_facture_fourn = f.rowid"; $sql .= " AND f.fk_soc = soc.rowid"; - $sql .= " AND soc.fk_pays = c.rowid"; $sql .= " AND rib.fk_soc = f.fk_soc"; $sql .= " AND rib.default_rib = 1"; $sql .= " AND rib.type = 'ban'"; @@ -1854,8 +1899,12 @@ class BonPrelevement extends CommonObject $cachearraytotestduplicate[$obj->idfac] = $obj->rowid; $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $refobj = $obj->reffac; + if (empty($refobj) && !empty($user_dest)) { // If ref of salary not defined, we force a value + $refobj = "SAL".$obj->idfac; + } - $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); $this->total = $this->total + $obj->somme; $i++; @@ -2071,6 +2120,7 @@ class BonPrelevement extends CommonObject fputs($this->file, "\n"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write recipient (thirdparty concerned by request) @@ -2120,7 +2170,7 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.$CrLf; // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) - $XML_DEBITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + $XML_DEBITOR .= ' '.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .= ' '.$CrLf; $XML_DEBITOR .= ' '.round($row_somme, 2).''.$CrLf; $XML_DEBITOR .= ' '.$CrLf; @@ -2166,7 +2216,7 @@ class BonPrelevement extends CommonObject $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) - $XML_CREDITOR .= ' '.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters + $XML_CREDITOR .= ' '.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).''.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_CREDITOR .= ' '.$CrLf; if (!empty($this->sepa_xml_pti_in_ctti)) { $XML_CREDITOR .= ' ' . $CrLf; @@ -2302,6 +2352,7 @@ class BonPrelevement extends CommonObject fputs($this->file, "\n"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Write sender of request (me). @@ -2623,8 +2674,6 @@ class BonPrelevement extends CommonObject public function load_board($user, $mode) { // phpcs:enable - global $conf, $langs; - if ($user->socid) { return -1; // protection pour eviter appel par utilisateur externe } @@ -2739,7 +2788,7 @@ class BonPrelevement extends CommonObject if ($id) { $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes"; $sql .= " WHERE fk_prelevement_bons = ".((int) $id); - $sql .= " AND fk_soc = 0"; + $sql .= " AND fk_soc = 0"; // fk_soc can't be NULL $sql .= " AND fk_user IS NOT NULL"; $num = 0; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 0dbe720d1d1..85b911a4cea 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -97,27 +97,28 @@ class RejetPrelevement } /** - * Create + * Create a reject * * @param User $user User object * @param int $id Id * @param string $motif Motif - * @param int $date_rejet Date rejet + * @param int $date_rejet Date reject * @param int $bonid Bon id - * @param int $facturation Facturation - * @return void + * @param int $facturation 1=Bill the reject + * @return int Return >=0 if OK, <0 if KO */ public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) { - global $langs, $conf; + global $langs; $error = 0; $this->id = $id; $this->bon_id = $bonid; $now = dol_now(); - dol_syslog("RejetPrelevement::Create id $id"); - $bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); + dol_syslog("RejetPrelevement::Create id ".$id); + + $bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalString('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalString('PRELEVEMENT_ID_BANKACCOUNT')); $facs = $this->getListInvoices(1); require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; @@ -172,30 +173,34 @@ class RejetPrelevement $fac->fetch($facs[$i][0]); - // Make a negative payment - //$pai = new Paiement($this->db); + $amountrejected = $facs[$i][1]; + // Make a negative payment + // Amount must be an array (id of invoice -> amount) $pai->amounts = array(); - /* - * We replace the comma with a point otherwise some - * PHP installs sends only the part integer negative - */ + //var_dump($this->type);exit; + + $pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund - $pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1 : -1)); $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal - $pai->num_paiement = $fac->ref; - $pai->num_payment = $fac->ref; + $pai->num_paiement = $langs->trans('Rejection').' '.$fac->ref; + $pai->num_payment = $langs->trans('Rejection').' '.$fac->ref; $pai->id_prelevement = $this->bon_id; $pai->num_prelevement = $lipre->bon_ref; if ($pai->create($this->user) < 0) { - // we call with no_commit $error++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); } else { - $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); + // We record entry into bank + $mode = 'payment'; + if ($this->type == 'bank-transfer') { + $mode = 'payment_supplier'; + } + + $result = $pai->addPaymentToBank($user, $mode, '(InvoiceRefused)', $bankaccount, '', ''); if ($result < 0) { dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); $error++; @@ -220,9 +225,13 @@ class RejetPrelevement if ($error == 0) { dol_syslog("RejetPrelevement::Create Commit"); $this->db->commit(); + + return 1; } else { dol_syslog("RejetPrelevement::Create Rollback"); $this->db->rollback(); + + return -1; } } diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index a1fd08bc7fc..f1d9c22cc19 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -96,6 +96,7 @@ llxHeader('', $langs->trans("WithdrawalsReceipts")); if ($id > 0 || $ref) { if ($object->fetch($id, $ref) >= 0) { $head = prelevement_prepare_head($object); + print dol_get_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); $linkback = ''.$langs->trans("BackToList").''; @@ -293,8 +294,9 @@ if ($resql) { print ''; $massactionbutton = ''; + $title = ($salaryBonPl ? $langs->trans("Salaries") : ($object->type == 'bank-transfer' ? $langs->trans("SupplierInvoices") : $langs->trans("Invoices"))); - print_barre_liste(($salaryBonPl ? $langs->trans("Salaries") : $langs->trans("Invoices")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); print"\n\n"; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -308,7 +310,6 @@ if ($resql) { print_liste_field_titre(($salaryBonPl ? "AmountSalary" : "AmountInvoice"), $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre(''); print "\n"; $totalinvoices = 0; @@ -340,9 +341,8 @@ if ($resql) { print '
'; - print '\n"; if ($object->type == 'bank-transfer' && !$salaryBonPl) { @@ -376,8 +376,6 @@ if ($resql) { } print ""; - print ""; - print "\n"; $totalinvoices += $obj->total_ttc; @@ -403,7 +401,6 @@ if ($resql) { print price($totalamount_requested); print "\n"; print ''; - print ''; print "\n"; } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index aca3966f7ed..2d21dd6a3a1 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -85,7 +85,7 @@ $error = 0; if ($action == 'confirm_rejet' && $permissiontoadd) { if (GETPOST("confirm") == 'yes') { if (GETPOST('remonth', 'int')) { - $daterej = mktime(2, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $daterej = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); } if (empty($daterej)) { @@ -108,10 +108,12 @@ if ($action == 'confirm_rejet' && $permissiontoadd) { if ($lipre->fetch($id) == 0) { $rej = new RejetPrelevement($db, $user, $type); - $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int')); + $result = $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int')); - header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); - exit; + if ($result > 0) { + header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type)); + exit; + } } } else { $action = "rejet"; @@ -202,30 +204,35 @@ if ($id) { dol_print_error($db); } + // Form to record a reject if ($action == 'rejet' && $user->hasRight('prelevement', 'bons', 'credit')) { $soc = new Societe($db); $soc->fetch($lipre->socid); $rej = new RejetPrelevement($db, $user, $type); - print ''; + print ''; print ''; print ''; print ''; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'.$langs->trans("NotifyCredit").'
'; - print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); print "
  
'; print ''; - print ''; + print ''; + print ''; + print ''; //Select yes/no print ''; - print ''; //Date print ''; - print ''; @@ -236,11 +243,15 @@ if ($id) { print ''; //Facturer - print ''; - print ''; + print ''; - print '
'.$langs->trans("WithdrawalRefused").'
'.$langs->trans("WithdrawalRefused").'
'.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->name.' ?'; + print ''; print $form->selectyesno("confirm", 1, 0); print '
'.$langs->trans("RefusedData").''; + print ''; print $form->selectDate('', '', '', '', '', "confirm_rejet"); print '
'.$langs->trans("RefusedInvoicing").''; - print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : ''); + print '
'; + print $form->textwithpicto($langs->trans("RefusedInvoicing"), $langs->trans("DirectDebitRefusedInvoicingDesc")); + print ''; + print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '', 0); print '

'; + + print ''; + print '
'; //Confirm Button print '
'; @@ -274,6 +285,9 @@ if ($id) { $sql = "SELECT pf.rowid"; $sql .= " ,f.rowid as facid, f.ref as ref, f.total_ttc, f.paye, f.fk_statut"; $sql .= " , s.rowid as socid, s.nom as name"; + + $sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf"; @@ -296,6 +310,30 @@ if ($id) { if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } + + // Count total nb of records + $nbtotalofrecords = ''; + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 + $page = 0; + $offset = 0; + } + $db->free($resql); + } + + $result = $db->query($sql); + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); @@ -306,8 +344,12 @@ if ($id) { $i = 0; $urladd = "&id=".urlencode($id); + $title = $langs->trans("Bills"); + if ($type == 'bank-transfer') { + $title = $langs->trans("SupplierInvoices"); + } - print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, 0, ''); + print_barre_liste($title, $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print"\n\n"; print ''; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index baed8076f6b..30db9e40c50 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); @@ -83,14 +85,16 @@ if ($sortfield == "") { $rej = new RejetPrelevement($db, $user, $type); $line = new LignePrelevement($db); +$thirdpartystatic = new Societe($db); +$userstatic = new User($db); $hookmanager->initHooks(array('withdrawalsreceiptsrejectedlist')); // List of invoices -$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId"; -$sql .= " , s.rowid as socid, s.nom as name, p.datec"; +$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,"; +$sql .= " s.rowid as socid, s.nom as name, p.datec"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -98,19 +102,20 @@ $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND pl.fk_soc = s.rowid"; -$sql .= " AND p.entity = ".$conf->entity; +$sql .= " AND p.entity = ".((int) $conf->entity); if ($type == 'bank-transfer') { $sql .= " AND p.type = 'bank-transfer'"; } else { $sql .= " AND p.type = 'debit-order'"; } -if ($socid) { +if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } +// Add list for salaries if ($type == 'bank-transfer') { $sql .= " UNION"; - $sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId"; - $sql .= " ,u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec"; + $sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,"; + $sql .= " u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -118,7 +123,7 @@ if ($type == 'bank-transfer') { $sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND pl.fk_user = u.rowid"; - $sql .= " AND p.entity = ".$conf->entity; + $sql .= " AND p.entity = ".((int) $conf->entity); $sql .= " AND p.type = 'bank-transfer'"; if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); @@ -129,10 +134,10 @@ if ($type == 'bank-transfer') { } $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; $param = ''; @@ -147,7 +152,9 @@ if ($result) { $bon = new BonPrelevement($db); if ($num) { - while ($i < min($num, $limit)) { + $i = 0; + $maxlim = min($num, $limit); + while ($i < $maxlim) { $obj = $db->fetch_object($result); $bon->fetch($obj->bonId); @@ -157,10 +164,14 @@ if ($result) { print $line->LibStatut($obj->statut, 2).' '; print ''; print substr('000000'.$obj->rowid, -6).""; + if ($bon->checkIfSalaryBonPrelevement()) { - print '\n"; + print '\n"; } else { - print '\n"; + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + + print '\n"; } print ''; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index eb71104e0e3..310230c6e30 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -79,7 +79,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e if ($q == 0) { // We define date_start and date_end $year_end = $year_start + ($nbofyear - 1); - $month_start = GETPOST("month", 'int') ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month", 'int') ? GETPOST("month", 'int') : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $date_startmonth = $month_start; if (!GETPOST('month')) { if (!$year && $month_start > $month_current) { diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 1970440e9ad..a8c5f88e435 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -63,7 +63,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q", "int"); if (empty($q)) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced @@ -300,7 +300,7 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; $i = 0; while ($i < 12) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } @@ -350,7 +350,7 @@ if ($modecompta == 'CREANCES-DETTES') { print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country; print ''; for ($i = 0; $i < 12; $i++) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } @@ -369,7 +369,7 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; print ''; for ($i = 0; $i < 12; $i++) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } @@ -387,7 +387,7 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; $i = 0; while ($i < 12) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } @@ -437,7 +437,7 @@ if ($modecompta == 'CREANCES-DETTES') { print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country; print ''; for ($i = 0; $i < 12; $i++) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } @@ -456,7 +456,7 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; print ''; for ($i = 0; $i < 12; $i++) { - $j = $i + (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); + $j = $i + (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START); if ($j > 12) { $j -= 12; } diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 2c706827ca9..b0e9b529d5d 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -106,7 +106,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q", "int"); if (empty($q)) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index ab9728491cd..2456623f95a 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -87,7 +87,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q") ? GETPOST("q") : 0; if ($q == 0) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index e2a9cb632b0..006840cdf0f 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -110,7 +110,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q", "int") ? GETPOST("q", "int") : 0; if (empty($q)) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 902ded12bba..9cafa6d2da0 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -383,7 +383,7 @@ $now = dol_now(); $casenow = dol_print_date($now, "%Y-%m"); // Loop on each month -$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1)); +$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1)); for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $mois_modulo = $mois; // ajout if ($mois > 12) { diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 182f2c6381b..d95b2921d56 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -87,7 +87,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q", "int"); if (empty($q)) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 0da377a7f1c..7223a5458d5 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -97,7 +97,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $q = GETPOST("q", "int") ? GETPOST("q", "int") : 0; if (empty($q)) { // We define date_start and date_end - $month_start = GETPOST("month") ? GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOST("month") ? GETPOST("month") : getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); $year_end = $year_start; $month_end = $month_start; if (!GETPOST("month")) { // If month not forced diff --git a/htdocs/compta/tva/initdatesforvat.inc.php b/htdocs/compta/tva/initdatesforvat.inc.php index 983e9197960..59106f8750c 100644 --- a/htdocs/compta/tva/initdatesforvat.inc.php +++ b/htdocs/compta/tva/initdatesforvat.inc.php @@ -23,7 +23,7 @@ $now = dol_now(); $current_date = dol_getdate($now); -if (!getDolGlobalString('SOCIETE_FISCAL_MONTH_START')) { +if (!getDolGlobalInt('SOCIETE_FISCAL_MONTH_START')) { $conf->global->SOCIETE_FISCAL_MONTH_START = 1; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 25ca192e6fa..0a1877d49b6 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -781,7 +781,7 @@ class Contact extends CommonObject $info = array(); // Object classes - $info["objectclass"] = explode(',', $conf->global->LDAP_CONTACT_OBJECT_CLASS); + $info["objectclass"] = explode(',', getDolGlobalString('LDAP_CONTACT_OBJECT_CLASS')); $this->fullname = $this->getFullName($langs); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7c991630275..6b0e29a207f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -68,9 +68,9 @@ $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); // PDF -$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); +$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0)); +$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0)); $datecontrat = ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 08bb4caa932..8cbf96992c9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3413,7 +3413,7 @@ class ContratLigne extends CommonObjectLine */ public function update($user, $notrigger = 0) { - global $conf, $langs, $mysoc; + global $mysoc; $error = 0; @@ -3615,10 +3615,10 @@ class ContratLigne extends CommonObjectLine // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Mise a jour en base des champs total_xxx de ligne - * Used by migration process + * Update in database the fields total_xxx of lines + * Used by migration process * - * @return int Return integer <0 if KO, >0 if OK + * @return int Return integer <0 if KO, >0 if OK */ public function update_total() { @@ -3656,7 +3656,7 @@ class ContratLigne extends CommonObjectLine */ public function insert($notrigger = 0) { - global $conf, $user; + global $user; $error = 0; @@ -3753,8 +3753,6 @@ class ContratLigne extends CommonObjectLine public function active_line($user, $date, $date_end = '', $comment = '') { // phpcs:enable - global $langs, $conf; - $error = 0; $this->db->begin(); @@ -3813,9 +3811,6 @@ class ContratLigne extends CommonObjectLine public function close_line($user, $date_end_real, $comment = '', $notrigger = 0) { // phpcs:enable - global $langs, $conf; - - // Update object $this->date_cloture = $date_end_real; $this->date_end_real = $date_end_real; $this->user_closing_id = $user->id; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 6e375c363bd..c7de54e22e0 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -410,7 +410,7 @@ if (!$error && $massaction == 'confirm_presend') { $tmp = explode(',', $user->email_aliases); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { - $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES')); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = "SELECT rowid, label, email FROM ".MAIN_DB_PREFIX."c_email_senderprofile WHERE rowid = ".(int) $reg[1]; @@ -751,7 +751,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $result = $objecttmp->fetch($toselectid); if ($result > 0) { $listofobjectid[$toselectid] = $toselectid; - $thirdpartyid = $objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid; + $thirdpartyid = !empty($objecttmp->fk_soc) ? $objecttmp->fk_soc : $objecttmp->socid; $listofobjectthirdparties[$thirdpartyid] = $thirdpartyid; $listofobjectref[$toselectid] = $objecttmp->ref; } diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index b05e13d76eb..6fbe2440fb3 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -286,7 +286,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $tmp = explode(',', $user->email_aliases); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { - $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES')); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; @@ -328,7 +328,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $deliveryreceipt = GETPOST('deliveryreceipt'); if ($action == 'send' || $action == 'relance') { - $actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1); + $actionmsg2 = $langs->transnoentities('MailSentByTo', CMailFile::getValidAddress($from, 4, 0, 1), CMailFile::getValidAddress($sendto, 4, 0, 1)); /*if ($message) { $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto)); diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php index 854188f7d6e..96700b261da 100644 --- a/htdocs/core/ajax/pingresult.php +++ b/htdocs/core/ajax/pingresult.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2019-2023 Laurent Destailleur * * 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 @@ -16,9 +16,10 @@ */ /** - * \file htdocs/core/ajax/pingresult.php - * \brief Page called after a ping was done in js to the official dolibarr ping service. - * This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping. + * \file htdocs/core/ajax/pingresult.php + * \brief Page called after a ping was done in js to the official dolibarr ping service. + * This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping. + * You can use &forceping=1 in parameters to force the ping if the ping was already sent. */ if (!defined('NOTOKENRENEWAL')) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 295a14159cf..c8f683a86ec 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -63,7 +63,7 @@ class box_comptes extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('banque', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index df8192c2055..45404727d96 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -63,7 +63,7 @@ class box_members_by_tags extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 9bcb20b2826..4a684011139 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -63,7 +63,7 @@ class box_members_by_type extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index a961a478385..2d9d580f8b8 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -62,7 +62,7 @@ class box_members_last_modified extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 3d1e88627f2..b7eaad8cd13 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -62,7 +62,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 999640c3ae4..9a94f6f071b 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -62,7 +62,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes $this->db = $db; // disable module for such cases - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { $this->enabled = 0; // disabled for external users } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index ff01ceb810d..748c58f2381 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -63,7 +63,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->db = $db; - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); $tmpentry = array('enabled'=>((isModEnabled("product") || isModEnabled("service")) && isModEnabled('stock')), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ceb65e8cfa9..5f053ae6e18 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -311,7 +311,7 @@ class CMailFile // Add auto copy to if not already in $to (Note: Adding bcc for specific modules are also done from pages) // For example MAIN_MAIL_AUTOCOPY_TO can be 'email@example.com, __USER_EMAIL__, ...' if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) { - $listofemailstoadd = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO); + $listofemailstoadd = explode(',', getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')); foreach ($listofemailstoadd as $key => $val) { $emailtoadd = $listofemailstoadd[$key]; if (trim($emailtoadd) == '__USER_EMAIL__') { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 0f3b8628122..83f38d2a70f 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -49,6 +49,12 @@ abstract class CommonInvoice extends CommonObject */ public $subtype; + /** + * @var int Thirdparty ID + * @deprecated + * @see $socid + */ + public $fk_soc; /** * @var int Thirdparty ID */ @@ -63,6 +69,8 @@ abstract class CommonInvoice extends CommonObject */ public $date; + public $date_lim_reglement; + public $cond_reglement_id; // Id in llx_c_paiement public $cond_reglement_code; // Code in llx_c_paiement public $cond_reglement_label; @@ -1131,14 +1139,18 @@ abstract class CommonInvoice extends CommonObject } // Load the pending payment request to process (with rowid=$did) - $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_prelevement_bons"; + $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons"; $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; $sql .= " WHERE rowid = ".((int) $did); if ($type != 'bank-transfer' && $type != 'credit-transfer') { - $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one } if ($type != 'direct-debit') { - $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one + if ($$sourcetype == 'salary') { + $sql .= " AND fk_salary = ".((int) $this->id); // Add a protection to not pay another salary than current one + } else { + $sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one + } } $sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fdc1fc4bf6a..ef31fb50485 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -675,9 +675,14 @@ abstract class CommonObject public $sendtoid; /** - * @var float Amount already paid (used to show correct status) + * @var float Amount already paid from getSommePaiement() (used to show correct status) + * @deprecated Duplicate of $totalpaid */ public $alreadypaid; + /** + * @var float Amount already paid from getSommePaiement() (used to show correct status) + */ + public $totalpaid; /** * @var array Array with label of status @@ -854,6 +859,7 @@ abstract class CommonObject // Add extrafields if (!empty($extrafields->attributes[$this->table_element]['label'])) { + $datas['opendivextra'] = '
'; foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { continue; @@ -894,6 +900,7 @@ abstract class CommonObject $count++; } } + $datas['closedivextra'] = '
'; } $hookmanager->initHooks(array($this->element . 'dao')); @@ -3654,7 +3661,7 @@ abstract class CommonObject if (!empty($MODULE)) { if (!empty($conf->global->$MODULE)) { - $modsactivated = explode(',', $conf->global->$MODULE); + $modsactivated = explode(',', getDolGlobalString($MODULE)); foreach ($modsactivated as $mod) { if (isModEnabled($mod)) { return 1; // update was disabled by specific setup @@ -4533,6 +4540,9 @@ abstract class CommonObject if ($elementTable == 'commande_fournisseur_dispatch') { $fieldstatus = "status"; } + if ($elementTable == 'prelevement_bons') { + $fieldstatus = "statut"; + } if (isset($this->fields) && is_array($this->fields) && array_key_exists('status', $this->fields)) { $fieldstatus = 'status'; } @@ -6818,15 +6828,23 @@ abstract class CommonObject } } + // $new_array_options will be used for direct update, so must contains formated data for the UPDATE. + $new_array_options = $this->array_options; + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); if (!empty($attrfieldcomputed)) { if (getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) { $value = dol_eval($attrfieldcomputed, 1, 0, '2'); dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); - $this->array_options["options_".$key] = $value; + + $new_array_options["options_".$key] = $value; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } else { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } } @@ -6836,7 +6854,9 @@ abstract class CommonObject $this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel); return -1; } elseif ($value === '') { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } break; case 'double': @@ -6849,19 +6869,24 @@ abstract class CommonObject $value = null; } //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); - $this->array_options["options_".$key] = $value; + $new_array_options["options_".$key] = $value; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { - $this->array_options[$key] = null; + $new_array_options["options_".$key] = $value; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } break;*/ case 'price': - $this->array_options["options_".$key] = price2num($this->array_options["options_".$key]); + $new_array_options["options_".$key] = price2num($this->array_options["options_".$key]); + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; break; case 'password': - $new_array_options = array(); $algo = ''; if ($this->array_options["options_".$key] != '' && is_array($extrafields->attributes[$this->table_element]['param'][$attributeKey]['options'])) { // If there is an encryption choice, we use it to crypt data before insert @@ -6915,26 +6940,34 @@ abstract class CommonObject case 'date': case 'datetime': if (empty($this->array_options["options_".$key])) { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } else { - $this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]); + $new_array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]); } break; case 'datetimegmt': if (empty($this->array_options["options_".$key])) { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } else { - $this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key], 'gmt'); + $new_array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key], 'gmt'); } break; case 'boolean': if (empty($this->array_options["options_".$key])) { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } break; case 'link': if ($this->array_options["options_".$key] === '') { - $this->array_options["options_".$key] = null; + $new_array_options["options_".$key] = null; + + $this->array_options["options_".$key] = $new_array_options["options_".$key]; } break; /* @@ -6993,12 +7026,12 @@ abstract class CommonObject } } - //var_dump('linealreadyfound='.$linealreadyfound.' sql='.$sql); + //var_dump('linealreadyfound='.$linealreadyfound.' sql='.$sql); exit; if ($linealreadyfound) { if ($this->array_options["options_".$key] === null) { $sql = "UPDATE ".$this->db->prefix().$this->table_element."_extrafields SET ".$key." = null"; } else { - $sql = "UPDATE ".$this->db->prefix().$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'"; + $sql = "UPDATE ".$this->db->prefix().$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($new_array_options["options_".$key])."'"; } $sql .= " WHERE fk_object = ".((int) $this->id); diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 1125eb0cfcb..4a9d216bca2 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -171,7 +171,7 @@ class DolEditor if (!getDolGlobalString('FCKEDITOR_ENABLE_PDF')) { $pluginstodisable .= ',exportpdf'; } - if (getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS')) { + if (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 2) { $this->uselocalbrowser = 0; // Can't use browser to navigate into files. Only links with "global->MAIN_USE_ALTERNATE_TRANSLATION_FOR); + $tmpelement = explode(';', getDolGlobalString('MAIN_USE_ALTERNATE_TRANSLATION_FOR')); foreach ($tmpelement as $elementstring) { $reg = array(); preg_match('/^(.*):(.*)$/', $elementstring, $reg); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1686336db60..a81f40ebc2f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6559,7 +6559,7 @@ class Form } else { // We will use the rate defined into MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS $defaulttx = ''; - if ($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS != 'none') { + if (getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS') != 'none') { $defaulttx = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; } if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { @@ -6823,7 +6823,7 @@ class Form // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' $usecalendar = 'combo'; - if (!empty($conf->use_javascript_ajax) && (!getDolGlobalString('MAIN_POPUP_CALENDAR') || $conf->global->MAIN_POPUP_CALENDAR != "none")) { + if (!empty($conf->use_javascript_ajax) && (!getDolGlobalString('MAIN_POPUP_CALENDAR') || getDolGlobalString('MAIN_POPUP_CALENDAR') != "none")) { $usecalendar = ((!getDolGlobalString('MAIN_POPUP_CALENDAR') || getDolGlobalString('MAIN_POPUP_CALENDAR') == 'eldy') ? 'jquery' : $conf->global->MAIN_POPUP_CALENDAR); } @@ -10769,7 +10769,7 @@ class Form * @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup. * @return string Html code with the buttons */ - public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '') + public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = false, $morecss = '', $dol_openinpopup = '') { global $langs; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 52e4e3fba31..7989f5a2502 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -296,7 +296,9 @@ class FormActions print ''; // Label - print '
'; + print ''; // Date print ''; break; - case 'string': + case 'string': // This type is no more used. type is now varchar(x) print ''; break; case 'stock': diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 819afa9e43a..9e247fc1947 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -115,7 +115,7 @@ print "\n"; if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) { // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'?> - + @@ -465,7 +465,7 @@ if (!empty($morelogincontent) && is_array($morelogincontent)) { // Google Analytics // TODO Remove this, and add content into hook getLoginPageExtraOptions() instead if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) { - $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); + $tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID')); foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 25a6fac0b16..ef78b72ce1c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -497,8 +497,12 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin $coldisplay++; } } else { - print ''; - $coldisplay = $coldisplay + 3; + $colspan = 3; + if (isModEnabled('asset') && $object->element == 'invoice_supplier') { + $colspan++; + } + print ''; + $coldisplay = $coldisplay + $colspan; } if ($action == 'selectlines') { ?> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 4ad57614c28..33fc1b0d4da 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -286,7 +286,7 @@ if (!empty($morelogincontent) && is_array($morelogincontent)) { // Google Analytics // TODO Remove this, and add content into hook getPasswordForgottenPageExtraOptions() instead if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) { - $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); + $tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID')); foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 531e659a63c..5cbb4c92d69 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -327,7 +327,7 @@ if (!empty($morelogincontent) && is_array($morelogincontent)) { // Google Analytics // TODO Remove this, and add content into hook getPasswordForgottenPageExtraOptions() instead if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) { - $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); + $tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID')); foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 70923143d18..a515078bc70 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -64,7 +64,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers } // Test if event/record is qualified - if (!getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED') || !in_array($action, explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED))) { + if (!getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED') || !in_array($action, explode(',', getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')))) { // If custom actions are not set or if action not into custom actions, we can exclude action if object->elementis not valid $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol'); if (!in_array($object->element, $listofqualifiedelement)) { @@ -93,7 +93,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers || $action === 'CASHCONTROL_VALIDATE' || (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_DOWNLOAD' && $object->statut != 0) || (in_array($object->element, array('facture', 'supplier_invoice')) && $action === 'DOC_PREVIEW' && $object->statut != 0) - || (getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED') && in_array($action, explode(',', $conf->global->BLOCKEDLOG_ADD_ACTIONS_SUPPORTED))) + || (getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED') && in_array($action, explode(',', getDolGlobalString('BLOCKEDLOG_ADD_ACTIONS_SUPPORTED')))) ) { $qualified++; diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index 1c869b2d75e..5279a4c4258 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -80,7 +80,7 @@ class InterfaceEventOrganization extends DolibarrTriggers // Actions if ($action == 'PROJECT_VALIDATE') { if (getDolGlobalString('EVENTORGANIZATION_TASK_LABEL') && !empty($object->usage_organize_event)) { - $taskToDo = explode("\n", $conf->global->EVENTORGANIZATION_TASK_LABEL); + $taskToDo = explode("\n", getDolGlobalString('EVENTORGANIZATION_TASK_LABEL')); if (is_array($taskToDo) && count($taskToDo)>0) { // Load translation files required by the page $langs->loadLangs(array("eventorganization")); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 7676e26d53a..5729d136869 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -738,6 +738,9 @@ class Cronjob extends CommonObject if (empty($this->email_alert)) { $this->email_alert = ''; } + if (empty($this->datenextrun)) { + $this->datenextrun = dol_now(); + } // Check parameters // Put here code to add a control on parameters values diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 8c896d276d2..d2bbb34cfa0 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -68,7 +68,7 @@ if (empty($conf->dav->enabled)) { // Restrict API to some IPs if (getDolGlobalString('DAV_RESTRICT_ON_IP')) { - $allowedip = explode(' ', $conf->global->DAV_RESTRICT_ON_IP); + $allowedip = explode(' ', getDolGlobalString('DAV_RESTRICT_ON_IP')); $ipremote = getUserRemoteIP(); if (!in_array($ipremote, $allowedip)) { dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('DAV_RESTRICT_ON_IP')); diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 020c534a065..8253e304df9 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -43,7 +43,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index e7230f91755..126f2e66941 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -208,8 +208,8 @@ class ConferenceOrBoothAttendee extends CommonObject $this->fields['fk_soc']['type'] .= ' AND rowid IN (SELECT DISTINCT c.fk_soc FROM '.MAIN_DB_PREFIX.'categorie_societe as c WHERE c.fk_categorie='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT.')'; } if (isset($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE) - && $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE !== '' - && $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE !== '-1') { + && getDolGlobalString('EVENTORGANIZATION_FILTERATTENDEES_TYPE') !== '' + && getDolGlobalString('EVENTORGANIZATION_FILTERATTENDEES_TYPE') !== '-1') { $this->fields['fk_soc']['type'] .= ' AND client = '.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE; } diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index 9f4f69c0482..2c9e1faf250 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -158,7 +158,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') { $tmp = explode(',', $user->email_aliases); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { - $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES')); $from = trim($tmp[($reg[1] - 1)]); } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = "SELECT rowid, label, email FROM " . MAIN_DB_PREFIX . "c_email_senderprofile WHERE rowid = " . (int) $reg[1]; diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 81352fc6362..b92ded68954 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -42,7 +42,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now(), "%Y"); $year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 17a3bd5b311..dfac7dac39c 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -56,7 +56,7 @@ $result = restrictedArea($user, 'expensereport', $id, ''); $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 262289dd226..48039b936e6 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -1074,7 +1074,7 @@ if ($step == 4 && $datatoexport) { } if ($step == 5 && $datatoexport) { - if (count($array_selected) < 1) { // This occurs when going back to page after sessecion expired + if (count($array_selected) < 1) { // This occurs when going back to page after session expired // Switch to step 2 header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); exit; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index f834d32694f..c6ab74da2ae 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -45,7 +45,7 @@ if ($user->socid > 0) { $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; $object_status = GETPOST('object_status', 'intcomma'); diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 275fbb48d0a..cec0ab88d12 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1106,7 +1106,6 @@ class FactureFournisseurRec extends CommonInvoice $txlocaltax1 = empty($txlocaltax1) ? 0 : price2num($txlocaltax1); $txlocaltax2 = empty($txlocaltax2) ? 0 : price2num($txlocaltax2); - $this->multicurrency_subprice = empty($this->multicurrency_subprice) ? 0 : $this->multicurrency_subprice; $this->multicurrency_total_ht = empty($this->multicurrency_total_ht) ? 0 : $this->multicurrency_total_ht; $this->multicurrency_total_tva = empty($this->multicurrency_total_tva) ? 0 : $this->multicurrency_total_tva; $this->multicurrency_total_ttc = empty($this->multicurrency_total_ttc) ? 0 : $this->multicurrency_total_ttc; @@ -1196,6 +1195,7 @@ class FactureFournisseurRec extends CommonInvoice return -1; } } + return 0; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 26a73d35472..05f91cdb6af 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -254,7 +254,7 @@ class FactureFournisseur extends CommonInvoice public $fk_facture_source; public $fac_rec; - + public $fk_fac_rec_source; public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), @@ -934,7 +934,7 @@ class FactureFournisseur extends CommonInvoice $this->socid = $obj->fk_soc; $this->datec = $this->db->jdate($obj->datec); $this->date = $this->db->jdate($obj->datef); - $this->datep = $this->db->jdate($obj->datef); + //$this->datep = $this->db->jdate($obj->datef); $this->tms = $this->db->jdate($obj->tms); $this->libelle = $obj->label; // deprecated $this->label = $obj->label; @@ -2256,7 +2256,7 @@ class FactureFournisseur extends CommonInvoice $supplierinvoiceline->fk_remise_except = $fk_remise_except; - $supplierinvoiceline->special_code = ((string) $special_code != '' ? $special_code : $this->special_code); + $supplierinvoiceline->special_code = (string) $special_code; $supplierinvoiceline->fk_parent_line = $fk_parent_line; $supplierinvoiceline->origin = $this->origin; $supplierinvoiceline->origin_id = $origin_id; @@ -3082,7 +3082,6 @@ class FactureFournisseur extends CommonInvoice } } - $this->amount_ht = $xnbp * 100; $this->total_ht = $xnbp * 100; $this->total_tva = $xnbp * 19.6; $this->total_ttc = $xnbp * 119.6; @@ -3699,7 +3698,6 @@ class SupplierInvoiceLine extends CommonObjectLine $this->product_type = $obj->product_type; $this->product_label = $obj->product_label; $this->info_bits = $obj->info_bits; - $this->tva_npr = ($obj->info_bits & 1 == 1) ? 1 : 0; $this->fk_parent_line = $obj->fk_parent_line; $this->special_code = $obj->special_code; $this->rang = $obj->rang; @@ -3723,7 +3721,7 @@ class SupplierInvoiceLine extends CommonObjectLine */ public function delete($notrigger = 0) { - global $user, $conf; + global $user; dol_syslog(get_class($this)."::deleteline rowid=".((int) $this->id), LOG_DEBUG); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 26751c291d7..fd9e0245ad8 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -67,6 +67,11 @@ class ProductFournisseur extends Product public $desc_supplier; public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice) + /** + * @deprecated + * @see $product_id + */ + public $fk_product; public $product_id; public $product_ref; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 90446c20584..c9092bf5f0c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2751,6 +2751,7 @@ if ($action == 'create') { // Intracomm report if (isModEnabled('intracommreport')) { $langs->loadLangs(array("intracommreport")); + print ''."\n"; print ''; @@ -3328,9 +3329,9 @@ if ($action == 'create') { // Date print ''; // Default terms of the settlement @@ -3500,6 +3501,7 @@ if ($action == 'create') { // Intracomm report if (isModEnabled('intracommreport')) { $langs->loadLangs(array("intracommreport")); + print ''."\n"; print '
'.$obj->nom."'.$obj->name."'.$obj->nom."'.$thirdpartystatic->getNomUrl(1)."'.$rej->motifs[$obj->motif].''.$langs->trans("Country").''.$langs->trans("Country").''.$actioncomm->getNomUrl(0).''; + print $actioncomm->getNomUrl(0); + print ''.dol_print_date($actioncomm->datep, 'dayhour', 'tzuserrel'); diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index eef81eb9c6a..f71f1736a33 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -85,7 +85,7 @@ class FormContract // CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. if (!getDolGlobalString('CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) { $sql .= " AND (c.fk_soc=".((int) $socid)." OR c.fk_soc IS NULL)"; - } elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { + } elseif (getDolGlobalString('CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') != 'all') { $sql .= " AND (c.fk_soc IN (".$this->db->sanitize(((int) $socid).",".((int) $conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)).")"; $sql .= " OR c.fk_soc IS NULL)"; } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 2c38d45cdd1..77f0395041d 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -186,7 +186,7 @@ class FormProjets extends Form if ($socid > 0) { if (!getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) { $sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)"; - } elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. + } elseif (getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') != 'all') { // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. $sql .= " AND (p.fk_soc IN (" . $this->db->sanitize(((int) $socid) . ", " . getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) . ") OR p.fk_soc IS NULL)"; } } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 5e68dd05bd8..c5388f367b1 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -401,7 +401,7 @@ class Translate $overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang; if (!empty($conf->global->$overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2 // Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX - $tmparray = explode(',', $conf->global->$overwritekey); + $tmparray = explode(',', getDolGlobalString($overwritekey)); foreach ($tmparray as $tmp) { $tmparray2 = explode(':', $tmp); if (!empty($tmparray2[1])) { @@ -637,7 +637,7 @@ class Translate // Make some string replacement after translation $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 - $tmparray = explode(';', $conf->global->$replacekey); + $tmparray = explode(';', getDolGlobalString($replacekey)); foreach ($tmparray as $tmp) { $tmparray2 = explode(':', $tmp); $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); @@ -731,7 +731,7 @@ class Translate // Make some string replacement after translation $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 - $tmparray = explode(';', $conf->global->$replacekey); + $tmparray = explode(';', getDolGlobalString($replacekey)); foreach ($tmparray as $tmp) { $tmparray2 = explode(':', $tmp); $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); @@ -872,7 +872,7 @@ class Translate } } // We must keep only languages into MAIN_LANGUAGES_ALLOWED - if (getDolGlobalString('MAIN_LANGUAGES_ALLOWED') && !in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED))) { + if (getDolGlobalString('MAIN_LANGUAGES_ALLOWED') && !in_array($dir, explode(',', getDolGlobalString('MAIN_LANGUAGES_ALLOWED')))) { continue; } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 707104c0543..1711eb7f6a6 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1283,7 +1283,7 @@ class Utils if (!empty($from)) { $from = dol_escape_htmltag($from); } elseif (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) { - $from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL); + $from = dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')); } else { $error++; } @@ -1291,7 +1291,7 @@ class Utils if (!empty($sendto)) { $sendto = dol_escape_htmltag($sendto); } elseif (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) { - $from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL); + $from = dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')); } else { $error++; } diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 646e9ed4457..1a7454e92ca 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -516,7 +516,7 @@ interface Database * Returns the current line (as an object) for the resultset cursor * * @param resource|PgSql\Connection $resultset Handler of the desired request - * @return Object Object result line or false if KO or end of cursor + * @return Object|false Object result line or false if KO or end of cursor */ public function fetch_object($resultset); // phpcs:enable diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index d4034d9f9f4..206bac677a4 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -29,8 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/db/Database.interface.php'; */ abstract class DoliDB implements Database { - /** @var string Force subclass to implement VERSIONMIN */ - const VERSIONMIN=self::VERSIONMIN; /** @var bool|resource|mysqli|SQLite3|PgSql\Connection Database handler */ public $db; /** @var string Database type */ @@ -118,10 +116,10 @@ abstract class DoliDB implements Database * * @param string $subject string tested * @param string $pattern SQL pattern to match - * @param string $sqlstring whether or not the string being tested is an SQL expression + * @param int $sqlstring whether or not the string being tested is an SQL expression * @return string SQL string */ - public function regexpsql($subject, $pattern, $sqlstring = false) + public function regexpsql($subject, $pattern, $sqlstring = 0) { if ($sqlstring) { return "(". $subject ." REGEXP '" . $pattern . "')"; @@ -160,7 +158,7 @@ abstract class DoliDB implements Database * * @param string $stringtosanitize String to escape * @param int $allowsimplequote 1=Allow simple quotes in string. When string is used as a list of SQL string ('aa', 'bb', ...) - * @param string $allowsequals 1=Allow equals sign + * @param int $allowsequals 1=Allow equals sign * @return string String escaped */ public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0) diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 061d5fd3c95..f7ed538c274 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2023 Laurent Destailleur * * This file is a modified version of datepicker.php from phpBSM to fix some * bugs, to add new features and to dramatically increase speed. @@ -101,7 +101,7 @@ $arrayofjs = array(); $arrayofcss = array(); top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); -print ''."\n"; +print ''."\n"; // Javascript to make menu active like Jmobile did. print ' @@ -125,6 +125,28 @@ print ' padding-left: 40px; /* width = 20 for level0, 20 for level1 */ } + .getmenudiv a:hover { + text-decoration: none; + } + + .pictofixedwidth { + text-align: left; + padding-right: 10px !important; + } + + li.lilevel1 > a, li.lilevel1 > i { + padding-left: 30px !important; + } + li.lilevel2 a { + padding-left: 60px !important; + } + li.lilevel3 a { + padding-left: 90px !important; + } + li.lilevel4 a { + padding-left: 120px !important; + } + a.alilevel0, span.spanlilevel0 { background-image: url(\''.DOL_URL_ROOT.'/theme/'.urlencode($conf->theme).'/img/next.png\') !important; background-repeat: no-repeat !important;'; diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index d3403298691..2f8192a29fe 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -81,7 +81,7 @@ if ("Notification" in window) { if (Notification.permission !== "granted") { console.log("Ask Notification.permission"); Notification.requestPermission(function(result) { - console.log("result for requestPermission is "+result); + console.log("result for Notification.requestPermission is "+result); }); } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index d8d1b8428f6..529e53a13cd 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1871,7 +1871,7 @@ function showModulesExludedForExternal($modules) global $conf, $langs; $text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); - $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); // List of modules qualified for external user management + $listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // List of modules qualified for external user management $i = 0; if (!empty($modules)) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a08b6b19030..c4f8972253a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -364,6 +364,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $filearray[$key]['position'] = '999999'; // File not indexed are at end. So if we add a file, it will not replace an existing position $filearray[$key]['cover'] = 0; $filearray[$key]['acl'] = ''; + $filearray[$key]['share'] = 0; $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filearray[$key]['fullname']); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d389eddd76a..47275863ce6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1101,7 +1101,7 @@ if (!function_exists('dol_getprefix')) { global $conf; if (getDolGlobalString('MAIL_PREFIX_FOR_EMAIL_ID')) { // If MAIL_PREFIX_FOR_EMAIL_ID is set - if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { + if (getDolGlobalString('MAIL_PREFIX_FOR_EMAIL_ID') != 'SERVER_NAME') { return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; } elseif (isset($_SERVER["SERVER_NAME"])) { // If MAIL_PREFIX_FOR_EMAIL_ID is set to 'SERVER_NAME' return $_SERVER["SERVER_NAME"]; @@ -2517,7 +2517,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } else { $morehtmlstatus .= ''.$object->getLibStatut(6, 1).''; } - } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) { + } elseif (in_array($object->element, array('salary'))) { + $tmptxt = $object->getLibStatut(6, $object->alreadypaid); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { + $tmptxt = $object->getLibStatut(5, $object->alreadypaid); + } + $morehtmlstatus .= $tmptxt; + } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid $tmptxt = $object->getLibStatut(6, $object->totalpaid); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { $tmptxt = $object->getLibStatut(5, $object->totalpaid); @@ -6042,7 +6048,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ } $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) if ($rounding == -1) { - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); + $rounding = min(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), $conf->global->MAIN_MAX_DECIMALS_TOT); } $nbdecimal = $rounding; @@ -6236,9 +6242,9 @@ function price2num($amount, $rounding = '', $option = 0) } elseif ($rounding == 'MS') { $nbofdectoround = isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? $conf->global->MAIN_MAX_DECIMALS_STOCK : 5; } elseif ($rounding == 'CU') { - $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency + $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), 8); // TODO Use param of currency } elseif ($rounding == 'CT') { - $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency + $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_TOT'), 8); // TODO Use param of currency } elseif (is_numeric($rounding)) { $nbofdectoround = (int) $rounding; } @@ -6734,7 +6740,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric // '1.23' // or '1.23 (CODE)' $defaulttx = ''; - if ($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS != 'none') { + if (getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS') != 'none') { $defaulttx = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; } /*if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { @@ -7586,7 +7592,7 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false) } /** - * Sanitize a HTML to remove js and dangerous content. + * Sanitize a HTML to remove js, dangerous content and external link. * This function is used by dolPrintHTML... function for example. * * @param string $stringtoencode String to encode @@ -7707,11 +7713,30 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' if ($nblinks > getDolGlobalInt("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 1000)) { $out = 'ErrorTooManyLinksIntoHTMLString'; } - // - if (getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') || $check == 'restricthtmlnolink') { + + if (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 2 || $check == 'restricthtmlnolink') { if ($nblinks > 0) { $out = 'ErrorHTMLLinksNotAllowed'; } + } elseif (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 1) { + $nblinks = 0; + // Loop on each url in src= and url( + $pattern = '/src=["\']?(http[^"\']+)|url\(["\']?(http[^\)]+)/'; + + $matches = array(); + if (preg_match_all($pattern, $out, $matches)) { + // URLs are into $matches[1] + $urls = $matches[1]; + + // Affiche les URLs + foreach ($urls as $url) { + $nblinks++; + echo "Found url = ".$url . "\n"; + } + if ($nblinks > 0) { + $out = 'ErrorHTMLExternalLinksNotAllowed'; + } + } } return $out; @@ -10334,7 +10359,7 @@ function printCommonFooter($zone = 'private') // Google Analytics // TODO Add a hook here if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AN_ID')) { - $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); + $tmptagarray = explode(',', getDolGlobalString('MAIN_GOOGLE_AN_ID')); foreach ($tmptagarray as $tmptag) { print "\n"; print "\n"; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 7e3822d2a23..5dc4bc5b1a1 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -299,7 +299,7 @@ function isIPAllowed($iptocheck, $localurl) $errormsg = 'Error bad hostname IP (IP is a local IP). Must be an external URL.'; return $errormsg; } - if (getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP') && in_array($iptocheck, explode(',', $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP))) { + if (getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP') && in_array($iptocheck, explode(',', getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP')))) { $errormsg = 'Error bad hostname IP (IP is a local IP defined into MAIN_SECURITY_SERVER_IP). Must be an external URL.'; return $errormsg; } @@ -310,7 +310,7 @@ function isIPAllowed($iptocheck, $localurl) $errormsg = 'Error bad hostname '.$iptocheck.'. Must be a local URL.'; return $errormsg; } - if (getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP') && !in_array($iptocheck, explode(',', $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP))) { + if (getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP') && !in_array($iptocheck, explode(',', getDolGlobalString('MAIN_SECURITY_ANTI_SSRF_SERVER_IP')))) { $errormsg = 'Error bad hostname IP (IP is not a local IP defined into list MAIN_SECURITY_SERVER_IP). Must be a local URL in allowed list.'; return $errormsg; } diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 4ea746feb26..0236afaddf5 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -82,7 +82,7 @@ function dol_setcache($memoryid, $data, $expire = 0) global $dolmemcache; if (empty($dolmemcache) || !is_object($dolmemcache)) { $dolmemcache = new Memcached(); - $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $tmparray = explode(':', getDolGlobalString('MEMCACHED_SERVER')); $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); if (!$result) { return -1; @@ -103,7 +103,7 @@ function dol_setcache($memoryid, $data, $expire = 0) global $dolmemcache; if (empty($dolmemcache) || !is_object($dolmemcache)) { $dolmemcache = new Memcache(); - $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $tmparray = explode(':', getDolGlobalString('MEMCACHED_SERVER')); $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); if (!$result) { return -1; @@ -152,7 +152,7 @@ function dol_getcache($memoryid) global $m; if (empty($m) || !is_object($m)) { $m = new Memcached(); - $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $tmparray = explode(':', getDolGlobalString('MEMCACHED_SERVER')); $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); if (!$result) { return -1; @@ -177,7 +177,7 @@ function dol_getcache($memoryid) global $m; if (empty($m) || !is_object($m)) { $m = new Memcache(); - $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $tmparray = explode(':', getDolGlobalString('MEMCACHED_SERVER')); $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); if (!$result) { return -1; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b8c749a3d23..fd7fa66ba78 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -728,7 +728,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) global $conf; // Add a background image on document only if good setup of const - if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') && ($conf->global->MAIN_USE_BACKGROUND_ON_PDF != '-1')) { // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') && (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') != '-1')) { // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image $filepath = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF'); if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image @@ -1028,7 +1028,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $substitutionarray['__FROM_NAME__'] = $fromcompany->name; $substitutionarray['__FROM_EMAIL__'] = $fromcompany->email; complete_substitutions_array($substitutionarray, $outputlangs, $object); - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray, $outputlangs); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray, $outputlangs); // Make a change into HTML code to allow to include images from medias directory. // diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a3f0de2c0f3..ce1b9c4e584 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -33,9 +33,11 @@ */ function prelevement_prepare_head(BonPrelevement $object) { - global $langs, $conf, $user; + global $langs, $conf; + $salary = $object->checkIfSalaryBonPrelevement(); - $langs->load("withdrawals"); + + $langs->loadLangs(array("bills", "withdrawals")); $h = 0; $head = array(); @@ -50,8 +52,16 @@ function prelevement_prepare_head(BonPrelevement $object) $head[$h][2] = 'prelevement'; $h++; + $titleoftab = $langs->trans("Bills"); + if ($object->type == 'bank-transfer') { + $titleoftab = $langs->trans("SupplierBills"); + } + if ($salary > 0) { + $titleoftab = $langs->trans("Salaries"); + } + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id; - $head[$h][1] = ($salary <= 0 ? $langs->trans("Bills") : $langs->trans("Salaries")); + $head[$h][1] = $titleoftab; $head[$h][2] = 'invoices'; $h++; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1fb7dbdbdbf..34d8b40f939 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -227,14 +227,13 @@ function dolDecrypt($chain, $key = '') * If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash'). * * @param string $chain String to hash - * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256, '6':password_hash). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'. + * @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256, '6':password_hash). + * Use 'md5' if hash is not needed for security purpose. For security need, prefer 'auto'. * @return string Hash of string * @see getRandomPassword(), dol_verifyHash() */ function dol_hash($chain, $type = '0') { - global $conf; - // No need to add salt for password_hash if (($type == '0' || $type == 'auto') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'password_hash' && function_exists('password_hash')) { return password_hash($chain, PASSWORD_DEFAULT); @@ -249,7 +248,7 @@ function dol_hash($chain, $type = '0') return sha1($chain); } elseif ($type == '2' || $type == 'sha1md5') { return sha1(md5($chain)); - } elseif ($type == '3' || $type == 'md5') { + } elseif ($type == '3' || $type == 'md5') { // For hashing with no need of security return md5($chain); } elseif ($type == '4' || $type == 'openldap') { return dolGetLdapPasswordHash($chain, getDolGlobalString('LDAP_PASSWORD_HASH_TYPE', 'md5')); @@ -281,8 +280,6 @@ function dol_hash($chain, $type = '0') */ function dol_verifyHash($chain, $hash, $type = '0') { - global $conf; - if ($type == '0' && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'password_hash' && function_exists('password_verify')) { if (! empty($hash[0]) && $hash[0] == '$') { return password_verify($chain, $hash); @@ -365,7 +362,7 @@ function dolGetLdapPasswordHash($password, $type = 'md5') */ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0) { - global $db, $conf; + global $conf; global $hookmanager; // Define $objectid @@ -389,7 +386,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $parentfortableentity = ''; - // Fix syntax of $features param + // Fix syntax of $features param to support non standard module names. $originalfeatures = $features; if ($features == 'agenda') { $tableandshare = 'actioncomm&societe'; @@ -481,7 +478,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $feature2 = explode("|", $feature2); } - $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // Check read permission from module $readok = 1; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index c166a7053ee..6960f90d3bf 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -293,7 +293,7 @@ if (!function_exists('dol_loginfunction')) { if (getDolGlobalString('MAIN_HOME')) { $substitutionarray = getCommonSubstitutionArray($langs); complete_substitutions_array($substitutionarray, $langs); - $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs); + $texttoshow = make_substitutions(getDolGlobalString('MAIN_HOME'), $substitutionarray, $langs); $main_home = dol_htmlcleanlastbr($texttoshow); } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 644243da48c..60480d6c9cb 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -46,7 +46,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]); $id = 'mainmenu'; - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // Show personalized menus $menuArbo = new Menubase($db, 'auguria'); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7899d12259b..0d70593acae 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -51,7 +51,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]); $id = 'mainmenu'; - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); $substitarray = getCommonSubstitutionArray($langs, 0, null, null); @@ -768,7 +768,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $substitarray = getCommonSubstitutionArray($langs, 0, null, null); - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); /** * We update newmenu with entries found into database @@ -2247,7 +2247,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme 'perms'=>$user->hasRight('projet', 'lire'), 'module'=>'projet' ); - $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $listofmodulesforexternal = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); $titleboth = $langs->trans("LeadsOrProjects"); diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index 2e9be976bfc..d94334250a2 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -318,7 +318,7 @@ class doc_generic_asset_odt extends ModelePDFAsset $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template 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 4bde00a44fe..7bc818f9f7e 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -847,7 +847,7 @@ class pdf_standard_asset extends ModelePDFAsset //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 3e417bafdb3..7301d29fef3 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -324,7 +324,7 @@ class doc_generic_bom_odt extends ModelePDFBom $newfreetext = ''; $paramfreetext = 'BOM_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 3c0797dd34a..db0704d6494 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -444,7 +444,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $newfreetext = ''; $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } return pdf_pagefoot($pdf, $outputlangs, $newfreetext, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1b9c6e8cf85..015fc18fed0 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -334,7 +334,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c75e9bd773c..dddb16a3dd7 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1170,7 +1170,7 @@ class pdf_einstein extends ModelePDFCommandes //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index afd7e7f8701..a55f63c2233 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1367,7 +1367,7 @@ class pdf_eratosthene extends ModelePDFCommandes //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index bf9b6876bc1..8ffc21c69b3 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -345,7 +345,7 @@ class doc_generic_contract_odt extends ModelePDFContract $newfreetext = ''; $paramfreetext = 'CONTRACT_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $tmparray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $tmparray); } diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index f56d1cacbde..56f71ce36e8 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -653,7 +653,7 @@ class pdf_storm extends ModelePDFDeliveryOrder if (empty($hidetop)) { //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index b95dec9069f..f35415d6e0f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -332,7 +332,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $newfreetext = ''; $paramfreetext = 'EXPEDITION_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 51426d677f3..acd8bf1e262 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -908,7 +908,7 @@ class pdf_espadon extends ModelePdfExpedition if (empty($hidetop)) { //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index cdb6e9c208d..1c5aa0a29c2 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -77,7 +77,7 @@ class ExportExcel2007 extends ModeleExports */ public function __construct($db) { - global $conf, $langs; + global $langs; $this->db = $db; $this->id = 'excel2007'; // Same value then xxx in file name export_xxx.modules.php @@ -119,6 +119,18 @@ class ExportExcel2007 extends ModeleExports return $this->label; } + /** + * getDriverLabel + * + * @return string Return driver label + */ + public function getDriverLabelBis() + { + global $langs; + $langs->load("errors"); + return $langs->trans("NumberOfLinesLimited"); + } + /** * getDriverDesc * diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index c55fa7d2a61..82b8a36cb8c 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -84,6 +84,8 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac */ public function listOfAvailableExportFormat($db, $maxfilenamelength = 0) { + global $langs; + dol_syslog(get_class($this)."::listOfAvailableExportFormat"); $dir = DOL_DOCUMENT_ROOT."/core/modules/export/"; @@ -113,6 +115,11 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac $this->picto[$module->id] = $module->picto; // Driver properties $this->driverlabel[$module->id] = $module->getDriverLabel().(empty($module->disabled) ? '' : ' __(Disabled)__'); // '__(Disabled)__' is a key + if (method_exists($module, 'getDriverLabelBis')) { + if ($module->getDriverLabelBis()) { + $this->driverlabel[$module->id] .= ' ('.$module->getDriverLabelBis().')'; + } + } $this->driverdesc[$module->id] = $module->getDriverDesc(); $this->driverversion[$module->id] = $module->getDriverVersion(); // If use an external lib diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index bde4c89007b..3742801f80f 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -374,7 +374,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $newfreetext = ''; $paramfreetext = 'INVOICE_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 33ff6018c38..ed3701527c0 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1702,7 +1702,7 @@ class pdf_crabe extends ModelePDFFactures //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index d17daeb7f27..7a3e443d6ac 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2006,7 +2006,7 @@ class pdf_sponge extends ModelePDFFactures //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index efc5cb7b10f..18d38c7c63a 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -92,7 +92,7 @@ class modBlockedLog extends DolibarrModules $this->always_enabled = (!empty($conf->blockedlog->enabled) && getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') - && in_array((empty($mysoc->country_code) ? '' : $mysoc->country_code), explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY)) + && in_array((empty($mysoc->country_code) ? '' : $mysoc->country_code), explode(',', getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY'))) && $this->alreadyUsed()); // Constants diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 1d69657c239..4d9a837cf5c 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -811,7 +811,7 @@ class pdf_standard extends ModelePDFMovement //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index d92761af4ba..fe403dc402d 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -317,7 +317,7 @@ class doc_generic_mo_odt extends ModelePDFMo $newfreetext = ''; $paramfreetext = 'MRP_MO_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 88264d0f417..6d3903bd57a 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -974,7 +974,7 @@ class pdf_vinci extends ModelePDFMo //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 26cd78956e1..da4c655fd63 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -329,7 +329,7 @@ class doc_generic_product_odt extends ModelePDFProduct $newfreetext = ''; $paramfreetext = 'PRODUCT_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 6bebea8d1e3..5d28341688f 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -632,7 +632,7 @@ class pdf_standard extends ModelePDFProduct //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 0afb2ed4d90..63a85245ca7 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -366,7 +366,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $newfreetext = ''; $paramfreetext = 'PROPOSAL_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 11860db0339..5cec649c2dc 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1360,7 +1360,7 @@ class pdf_azur extends ModelePDFPropales //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 8668b79a293..db9f4da3703 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1464,7 +1464,7 @@ class pdf_cyan extends ModelePDFPropales //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } @@ -1475,7 +1475,7 @@ class pdf_cyan extends ModelePDFPropales $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter if (getDolGlobalString('MAIN_PDF_TITLE_TEXT_COLOR')) { - $arrayColorTextTitle = explode(',', $conf->global->MAIN_PDF_TITLE_TEXT_COLOR); + $arrayColorTextTitle = explode(',', getDolGlobalString('MAIN_PDF_TITLE_TEXT_COLOR')); $pdf->SetTextColor($arrayColorTextTitle[0], $arrayColorTextTitle[1], $arrayColorTextTitle[2]); } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 571af59c06f..3dd7619e4f2 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -327,7 +327,7 @@ class doc_generic_reception_odt extends ModelePdfReception $newfreetext = ''; $paramfreetext = 'RECEPTION_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php index a66bc865364..09458d884c6 100644 --- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -101,7 +101,7 @@ class modGeneratePassPerso extends ModeleGenPassword $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; $this->Ambi = array("1", "I", "l", "|", "O", "0"); - $tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN); + $tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN')); $this->length2 = $tabConf[0]; $this->NbMaj = $tabConf[1]; $this->NbNum = $tabConf[2]; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 44d77e32cb4..0a33980e694 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -218,7 +218,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode // Clean declared words if (getDolGlobalString('COMPANY_DIGITARIA_CLEAN_WORDS')) { - $cleanWords = explode(";", $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS); + $cleanWords = explode(";", getDolGlobalString('COMPANY_DIGITARIA_CLEAN_WORDS')); $codetouse = str_replace($cleanWords, "", $codetouse); } // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index c583488eb2e..0d4a9d69dcd 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -332,7 +332,7 @@ class doc_generic_stock_odt extends ModelePDFStock $newfreetext = ''; $paramfreetext = 'stock_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index a2db0a7881b..e2cb7c6c17a 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -608,7 +608,7 @@ class pdf_standard extends ModelePDFStock //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } 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 06e68169278..de7a1f65f5e 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -1131,7 +1131,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 4a5bbd80543..36ff93a744a 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -330,7 +330,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices $newfreetext = ''; $paramfreetext = 'INVOICE_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template 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 f4e01bc9f77..a6bdd688a07 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -857,7 +857,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 91e99e2f96d..5193d053b5d 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -325,7 +325,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template 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 1ac5971a3e4..9e45515a15e 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1143,7 +1143,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } 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 1fab71588e0..09604265236 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1022,7 +1022,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 021d0018fdb..4130df223c4 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -354,7 +354,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $newfreetext = ''; $paramfreetext = 'SUPPLIER_PROPOSAL_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 84b08cc5066..ee84d168da9 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1140,7 +1140,7 @@ class pdf_aurore extends ModelePDFSupplierProposal //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 7c33a7454b4..d87861f0ab9 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -1143,7 +1143,7 @@ class pdf_zenith extends ModelePDFSupplierProposal //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) { - $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR'))); } } diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 4acb3ec6a7e..c9385f44a6c 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -69,7 +69,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface 'name' => $langs->trans('SyslogFilename'), 'constant' => 'SYSLOG_FILE', 'default' => 'DOL_DATA_ROOT/dolibarr.log', - 'attr' => 'size="60"' + 'css' => 'minwidth300 maxwidth500' ) ); } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 07d83808621..d25b59ed894 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -353,7 +353,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $newfreetext = ''; $paramfreetext = 'user_FREE_TEXT'; if (!empty($conf->global->$paramfreetext)) { - $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } // Open and load template diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index f5156da7caf..88aff7cce82 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -14,15 +14,19 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { + // if $totalarray['type'] not present we consider it as number + if (empty($totalarray['type'][$i])) { + $totalarray['type'][$i] = 'real'; + } switch ($totalarray['type'][$i]) { case 'duration': print ''; - print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); + print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); print ''; - print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); + print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); print '
'.$langs->trans('IntracommReportTransportMode').''; $form->selectTransportMode(GETPOSTISSET('transport_mode_id') ? GETPOST('transport_mode_id') : $transport_mode_id, 'transport_mode_id'); print '
'; - print $form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker'); + print $form->editfieldkey("DateInvoice", 'datef', $object->date, $object, $form_permission, 'datepicker'); print ''; - print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker'); + print $form->editfieldval("Date", 'datef', $object->date, $object, $form_permission, 'datepicker'); print '
'; print ''; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; if (getDolGlobalString('MAIN_INFO_SOCIETE_TEL')) { - print ''; + print ''; } if (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) { - print ''; + print ''; } if (getDolGlobalString('MAIN_INFO_SOCIETE_WEB')) { - print ''; + print ''; } print ''; print '
'; print $langs->trans('IntracommReportTransportMode'); diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 98cdcf0a2fd..ae1827e8b2c 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -1022,6 +1022,9 @@ IMG; $matches = array(); preg_match($searchreg, $this->contentXml, $matches); $this->contentXml = preg_replace($searchreg, "", $this->contentXml); - return $matches[1]; + if ($matches) { + return $matches[1]; + } + return ""; } -} \ No newline at end of file +} diff --git a/htdocs/index.php b/htdocs/index.php index 2fca638916d..d6b588e7e5d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -97,7 +97,7 @@ if (getDolGlobalString('MAIN_MOTD')) { if (getDolGlobalString('MAIN_MOTD')) { $substitutionarray = getCommonSubstitutionArray($langs); complete_substitutions_array($substitutionarray, $langs); - $texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs); + $texttoshow = make_substitutions(getDolGlobalString('MAIN_MOTD'), $substitutionarray, $langs); print "\n\n"; print ''; // Type of Declaration - print ''; + print ''; print ''; print "
'; diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 2461ed733cb..4a6f4c0325c 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -201,3 +201,5 @@ ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN element_type varchar(50 ALTER TABLE llx_expensereport DROP INDEX idx_expensereport_fk_refuse, ADD INDEX idx_expensereport_fk_refuse(fk_user_refuse); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (1,'66','Société publique locale'); + +ALTER TABLE llx_prelevement_lignes ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; diff --git a/htdocs/install/mysql/tables/llx_prelevement_lignes.sql b/htdocs/install/mysql/tables/llx_prelevement_lignes.sql index be55cab9638..f3de4f8f780 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_lignes.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_lignes.sql @@ -32,5 +32,6 @@ create table llx_prelevement_lignes number varchar(255), cle_rib varchar(5), - note text + note text, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 6727d486d35..dacec28bd89 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -105,6 +105,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_time FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollector FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectoraction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectorfilter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -140,6 +141,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_donation FOR CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_payment_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_prelevement_lignes FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_printing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); @@ -153,7 +155,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet FOR EACH ROW CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet_task FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_projet_task_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_time FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_merge_pdf_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 5f78115113b..25b970a77da 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -27,6 +27,7 @@ include 'inc.php'; require_once $dolibarr_main_document_root.'/core/class/conf.class.php'; require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; +require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; global $langs; @@ -584,7 +585,7 @@ dolibarr_install_syslog("- step2: end"); $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance -$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); +$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only. $out = ' '; $out .= ''; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 9409ae0d40f..c234f22c7e4 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -45,17 +45,20 @@ $langs->loadLangs(array("intracommreport")); // Get Parameters $id = GETPOST('id', 'int'); $action = GETPOST('action'); -$exporttype = GETPOSTISSET('exporttype') ? GETPOST('exporttype', 'alphanohtml') : 'deb'; // DEB or DES $year = GETPOSTINT('year'); $month = GETPOSTINT('month'); $label = (string) GETPOST('label', 'alphanohtml'); -$type_declaration = (string) GETPOST('type_declaration', 'alphanohtml'); + +$exporttype = GETPOSTISSET('exporttype') ? GETPOST('exporttype', 'alphanohtml') : 'deb'; // DEB or DES +$type_declaration = (string) GETPOST('type_declaration', 'alphanohtml'); // 'introduction' or 'expedition' + $backtopage = GETPOST('backtopage', 'alpha'); $declaration = array( "deb" => $langs->trans("DEB"), "des" => $langs->trans("DES"), ); + $typeOfDeclaration = array( "introduction" => $langs->trans("Introduction"), "expedition" => $langs->trans("Expedition"), @@ -121,8 +124,8 @@ if ($permissiontodelete && $action == 'confirm_delete' && $confirm == 'yes') { if ($action == 'add' && $permissiontoadd) { $object->label = trim($label); - $object->type = trim($exporttype); - $object->type_declaration = $type_declaration; + $object->exporttype = trim($exporttype); // 'des' or 'deb' + $object->type_declaration = $type_declaration; // 'introduction' or 'expedition' //$object->subscription = (int) $subscription; // Fill array 'array_options' with data from add form @@ -272,7 +275,7 @@ if ($id > 0 && $action != 'edit') { print '
'.$langs->trans("TypeOfDeclaration").''.$object->type_declaration.'
'.$langs->trans("TypeOfDeclaration").''.$object->exporttype.'
\n"; diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 7512813ebae..bd6646ffe37 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -67,7 +67,9 @@ class IntracommReport extends CommonObject */ public $declaration_number; - public $type_declaration; // deb or des + public $exporttype; // deb or des + public $type_declaration; // 'introduction' or 'expedition' + public $numero_declaration; /** @@ -199,7 +201,7 @@ class IntracommReport extends CommonObject * * @param int $period_year Year of declaration * @param int $period_month Month of declaration - * @param string $type_declaration Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param string $type_declaration Declaration type by default - 'introduction' or 'expedition' (always 'expedition' for Des) * @return SimpleXMLElement|int */ public function getXMLDes($period_year, $period_month, $type_declaration = 'expedition') @@ -214,9 +216,8 @@ class IntracommReport extends CommonObject $declaration_des->addChild('mois_des', $period_month); $declaration_des->addChild('an_des', $period_year); - /**************Ajout des lignes de factures**************************/ + // Add invoice lines $res = $this->addItemsFact($declaration_des, $type_declaration, $period_year.'-'.$period_month, 'des'); - /********************************************************************/ $this->errors = array_unique($this->errors); @@ -231,9 +232,9 @@ class IntracommReport extends CommonObject * Add line from invoice * * @param SimpleXMLElement $declaration Reference declaration - * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) + * @param string $type Declaration type by default - 'introduction' or 'expedition' (always 'expedition' for Des) * @param int $period_reference Reference period - * @param string $exporttype deb=DEB, des=DES + * @param string $exporttype 'deb' for DEB, 'des' for DES * @return int Return integer <0 if KO, >0 if OK */ public function addItemsFact(&$declaration, $type, $period_reference, $exporttype = 'deb') @@ -297,7 +298,7 @@ class IntracommReport extends CommonObject * @param string $type Declaration type by default - introduction or expedition (always 'expedition' for Des) * @param int $period_reference Reference declaration * @param string $exporttype deb=DEB, des=DES - * @return string Return integer <0 if KO, >0 if OK + * @return string Return integer <0 if KO, >0 if OK */ public function getSQLFactLines($type, $period_reference, $exporttype = 'deb') { @@ -454,7 +455,8 @@ class IntracommReport extends CommonObject */ public function getNextDeclarationNumber() { - $sql = "SELECT MAX(numero_declaration) as max_declaration_number FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql = "SELECT MAX(numero_declaration) as max_declaration_number"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE exporttype = '".$this->db->escape($this->exporttype)."'"; $resql = $this->db->query($sql); if ($resql) { @@ -478,9 +480,10 @@ class IntracommReport extends CommonObject /** * Generate XML file * + * @param string $content_xml Content * @return void */ - public function generateXMLFile() + public function generateXMLFile($content_xml) { $name = $this->period.'.xml'; @@ -488,7 +491,7 @@ class IntracommReport extends CommonObject $fname = sys_get_temp_dir().'/'.$name; $f = fopen($fname, 'w+'); - fwrite($f, $this->content_xml); + fwrite($f, $content_xml); fclose($f); header('Content-Description: File Transfer'); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 80a064fc535..63cf440788f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -343,7 +343,7 @@ AccountingJournalType3=Purchases AccountingJournalType4=Bank AccountingJournalType5=Expense reports AccountingJournalType8=Inventory -AccountingJournalType9=Has-new +AccountingJournalType9=Retained earnings GenerationOfAccountingEntries=Generation of accounting entries ErrorAccountingJournalIsAlreadyUse=This journal is already use AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu %s - %s @@ -450,12 +450,12 @@ AccountancyClosureStep1=Step 1 : Validate and lock movements AccountancyClosureStep2=Step 2 : Close fiscal period AccountancyClosureStep3=Step 3 : Extract entries (Optional) AccountancyClosureClose=Close fiscal period -AccountancyClosureAccountingReversal=Extract entries +AccountancyClosureAccountingReversal=Extract and record "Retained earnings" entries AccountancyClosureStep3NewFiscalPeriod=Next fiscal period -AccountancyClosureGenerateClosureBookkeepingRecords=Generate "has-new" entry on the next fiscal period -AccountancyClosureSeparateAuxiliaryAccounts=When generating the "has-new" entry, detail the sub-ledger accounts +AccountancyClosureGenerateClosureBookkeepingRecords=Generate "Retained earnings" entries on the next fiscal period +AccountancyClosureSeparateAuxiliaryAccounts=When generating the "Retained earnings" entries, detail the sub-ledger accounts AccountancyClosureCloseSuccessfully=Fiscal period has been closed successfully -AccountancyClosureInsertAccountingReversalSuccessfully=Bookkeeping records has been inserted successfully +AccountancyClosureInsertAccountingReversalSuccessfully=Bookkeeping entries for "Retained earnings" has been inserted successfully ## Confirm box ConfirmMassUnletteringAuto=Bulk auto unreconcile confirmation @@ -464,7 +464,7 @@ ConfirmMassUnletteringQuestion=Are you sure you want to unreconcile the %s selec ConfirmMassDeleteBookkeepingWriting=Bulk Delete confirmation ConfirmMassDeleteBookkeepingWritingQuestion=This will delete the transaction from the accounting (all line entries related to the same transaction will be deleted). Are you sure you want to delete the %s selected entries? AccountancyClosureConfirmClose=Are you sure you want to close the current fiscal period ? You understand that closing the fiscal period is an irreversible action and will permanently block any modification or deletion of entries over this period. -AccountancyClosureConfirmAccountingReversal=Are you sure you want to accounting reversal ? +AccountancyClosureConfirmAccountingReversal=Are you sure you want to record entries for the "Retained earnings" ? ## Error SomeMandatoryStepsOfSetupWereNotDone=Some mandatory steps of setup was not done, please complete them diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ec0d628d8cf..627d2d08a1f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -679,7 +679,7 @@ Module3300Desc=A RAD (Rapid Application Development - low-code and no-code) tool Module3400Name=Social Networks Module3400Desc=Enable Social Networks fields into third parties and addresses (skype, twitter, facebook, ...). Module4000Name=HRM -Module4000Desc=Human resources management (management of department, employee contracts and feelings) +Module4000Desc=Human resources management (management of department, employee contracts, skill management and interview) Module5000Name=Multi-company Module5000Desc=Allows you to manage multiple companies Module6000Name=Inter-modules Workflow @@ -2433,4 +2433,6 @@ ConfirmDeleteExtrafield=Do you confirm deletion of the field %s ? All data saved ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices) ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines) ParametersForTestEnvironment=Parameters for test environment -TryToKeepOnly=Try to keep only %s \ No newline at end of file +TryToKeepOnly=Try to keep only %s +RecommendedForProduction=Recommended for Production +RecommendedForDebug=Recommended for Debug \ No newline at end of file diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index baba0dd75e2..63c86001b28 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -185,7 +185,7 @@ SuppliersDraftInvoices=Vendor draft invoices Unpaid=Unpaid ErrorNoPaymentDefined=Error No payment defined ConfirmDeleteBill=Are you sure you want to delete this invoice? -ConfirmValidateBill=Are you sure you want to validate this invoice with reference %s? +ConfirmValidateBill=Are you sure you want to validate this invoice with the reference %s? ConfirmUnvalidateBill=Are you sure you want to change invoice %s to draft status? ConfirmClassifyPaidBill=Are you sure you want to change invoice %s to status paid? ConfirmCancelBill=Are you sure you want to cancel invoice %s? @@ -250,12 +250,13 @@ RemainderToTake=Remaining amount to take RemainderToTakeMulticurrency=Remaining amount to take, original currency RemainderToPayBack=Remaining amount to refund RemainderToPayBackMulticurrency=Remaining amount to refund, original currency +NegativeIfExcessReceived=negative if excess received NegativeIfExcessRefunded=negative if excess refunded +NegativeIfExcessPaid=negative if excess paid Rest=Pending AmountExpected=Amount claimed ExcessReceived=Excess received ExcessReceivedMulticurrency=Excess received, original currency -NegativeIfExcessReceived=negative if excess received ExcessPaid=Excess paid ExcessPaidMulticurrency=Excess paid, original currency EscompteOffered=Discount offered (payment before term) diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index af4c6f31b24..94ca852beca 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -145,3 +145,4 @@ SelectImportFieldsSource = Choose the source file fields you want to import and MandatoryTargetFieldsNotMapped=Some mandatory target fields are not mapped AllTargetMandatoryFieldsAreMapped=All target fields that need a mandatory value are mapped ResultOfSimulationNoError=Result of simulation: No error +NumberOfLinesLimited=Number of lines limited \ No newline at end of file diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 3dc2c041c06..4d99d0439ec 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -45,7 +45,7 @@ Eval=Evaluation Evals=Evaluations NewEval=New evaluation ValidateEvaluation=Validate evaluation -ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference %s? +ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with the reference %s? EvaluationCard=Evaluation card RequiredRank=Required rank for the job profile RequiredRankShort=Required rank diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 5330cd46933..f274e22ad79 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -701,6 +701,7 @@ Response=Response Priority=Priority SendByMail=Send by email MailSentBy=Email sent by +MailSentByTo=Email sent by %s to %s NotSent=Not sent TextUsedInTheMessageBody=Email body SendAcknowledgementByMail=Send confirmation email diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 6d60b8f0fd1..dc7a05d3822 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -360,7 +360,7 @@ ProductAttributes=Variant attributes for products ProductAttributeName=Variant attribute %s ProductAttribute=Variant attribute ProductAttributeDeleteDialog=Are you sure you want to delete this attribute? All values will be deleted -ProductAttributeValueDeleteDialog=Are you sure you want to delete the value "%s" with reference "%s" of this attribute? +ProductAttributeValueDeleteDialog=Are you sure you want to delete the value "%s" with the reference "%s" of this attribute? ProductCombinationDeleteDialog=Are you sure want to delete the variant of the product "%s"? ProductCombinationAlreadyUsed=There was an error while deleting the variant. Please check it is not being used in any object ProductCombinations=Variants diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index cd5bc760585..bd135b22f13 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -34,7 +34,7 @@ StatusReceptionProcessedShort=Processed ReceptionSheet=Reception sheet ValidateReception=Validate reception ConfirmDeleteReception=Are you sure you want to delete this reception? -ConfirmValidateReception=Are you sure you want to validate this reception with reference %s? +ConfirmValidateReception=Are you sure you want to validate this reception with the reference %s? ConfirmCancelReception=Are you sure you want to cancel this reception? StatsOnReceptionsOnlyValidated=Statistics conducted on validated only receptions. Date used is date of validation of reception (planned delivery date is not always known). SendReceptionByEMail=Send reception by email diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 73c2a942fc6..357a27462a3 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -39,7 +39,7 @@ StatusSendingValidatedShort=Validated StatusSendingProcessedShort=Processed SendingSheet=Shipment sheet ConfirmDeleteSending=Are you sure you want to delete this shipment? -ConfirmValidateSending=Are you sure you want to validate this shipment with reference %s? +ConfirmValidateSending=Are you sure you want to validate this shipment with the reference %s? ConfirmCancelSending=Are you sure you want to cancel this shipment? DocumentModelMerou=Merou A5 model WarningNoQtyLeftToSend=Warning, no products waiting to be shipped. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index da42dcfd781..432c6f2c814 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -282,7 +282,7 @@ ModuleStockTransferName=Advanced Stock Transfer ModuleStockTransferDesc=Advanced management of Stock Transfer, with generation of transfer sheet StockTransferNew=New stock transfer StockTransferList=Stock transfers list -ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with reference %s ? +ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with the reference %s ? ConfirmDestock=Decrease of stocks with transfer %s ConfirmDestockCancel=Cancel decrease of stocks with transfer %s DestockAllProduct=Decrease of stocks diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index fb4ff9a9e8b..d385b587459 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -66,8 +66,9 @@ WithdrawalRefusedConfirm=Are you sure you want to enter a withdrawal rejection f RefusedData=Date of rejection RefusedReason=Reason for rejection RefusedInvoicing=Billing the rejection -NoInvoiceRefused=Do not charge the rejection -InvoiceRefused=Invoice refused (Charge the rejection to customer) +NoInvoiceRefused=Do not charge the customer for the refusal +InvoiceRefused=Charge the customer for the refusal +DirectDebitRefusedInvoicingDesc=Set a flag to say this refusal must be charged to the customer StatusDebitCredit=Status debit/credit StatusWaiting=Waiting StatusTrans=Sent diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 9c70a6a9200..8fe6da4726f 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -309,7 +309,7 @@ class MailmanSpip if (isModEnabled('adherent')) { // Synchro for members if (getDolGlobalString('ADHERENT_MAILMAN_URL')) { if ($listes == '' && getDolGlobalString('ADHERENT_MAILMAN_LISTS')) { - $lists = explode(',', $conf->global->ADHERENT_MAILMAN_LISTS); + $lists = explode(',', getDolGlobalString('ADHERENT_MAILMAN_LISTS')); } else { $lists = explode(',', $listes); } @@ -379,7 +379,7 @@ class MailmanSpip if (isModEnabled('adherent')) { // Synchro for members if (getDolGlobalString('ADHERENT_MAILMAN_UNSUB_URL')) { if ($listes == '' && getDolGlobalString('ADHERENT_MAILMAN_LISTS')) { - $lists = explode(',', $conf->global->ADHERENT_MAILMAN_LISTS); + $lists = explode(',', getDolGlobalString('ADHERENT_MAILMAN_LISTS')); } else { $lists = explode(',', $listes); } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9a98c9fc776..a0196f0c35d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3373,19 +3373,19 @@ function main_area($title = '') print '
'; if ($conf->global->MAIN_SHOW_LOGO && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') && getDolGlobalString('MAIN_INFO_SOCIETE_LOGO')) { - print ''; + print ''; } print '
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'
'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_NOM')).'
'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS')).'
'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_ZIP')).' '.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_TOWN')).'
'.$langs->trans("Phone").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'
'.$langs->trans("Phone").' : '.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_TEL')).'
'.$langs->trans("Email").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'
'.$langs->trans("Email").' : '.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')).'
'.$langs->trans("Web").' : '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB).'
'.$langs->trans("Web").' : '.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SOCIETE_WEB')).'
'."\n"; @@ -3665,10 +3665,10 @@ if (!function_exists("llxFooter")) { $forceping = GETPOST('forceping', 'alpha'); if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) { //print ''; - $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); // Do not use dol_hash(), must not change if salt changes. + $hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only. if (!getDolGlobalString('MAIN_FIRST_PING_OK_DATE') - || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) + || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && (getDolGlobalString('MAIN_FIRST_PING_OK_ID') != 'disabled')) || $forceping) { // No ping done if we are into an alpha version if (strpos('alpha', DOL_VERSION) > 0 && !$forceping) { @@ -3695,14 +3695,14 @@ if (!function_exists("llxFooter")) { ?>