diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 3cffed355fa..67b4b346b6c 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -18,9 +18,10 @@ filter:
- dev/*
- doc/*
- documents/*
- - htdocs/includes/*
- node_modules/*
- test/*
+ dependency_paths:
+ - htdocs/includes/*
paths:
- htdocs/*
- scripts/*
diff --git a/.travis.yml b/.travis.yml
index 44d784ea091..a260c31e3f3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -93,23 +93,26 @@ install:
echo
- |
- echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
+ echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then
composer -n require phpunit/phpunit ^5 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
+ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
composer -n require phpunit/phpunit ^6 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
+ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
+ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
fi
# phpunit 9 is required for php 8
@@ -117,6 +120,7 @@ install:
composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
+ php-parallel-lint/php-var-dump-check ~0.4 \
squizlabs/php_codesniffer ^3
fi
echo
@@ -166,6 +170,10 @@ before_script:
which phpcs
phpcs --version | head -
phpcs -i | head -
+ # Check PHP Vardump check version
+ echo "PHP Vardump check version"
+ which var_dump_check
+ var_dump_check --version
# Check PHPUnit version
echo "PHPUnit version"
which phpunit
@@ -297,6 +305,17 @@ script:
set +e
echo
+- |
+ echo "Checking missing debug"
+ # Ensure we catch errors
+ set -e
+ # Exclusions are defined in the ruleset.xml file
+ if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
+ var-dump-check --extensions php --tracy --exclude htdocs/includes --exclude test/ --exclude htdocs/public/test/ --exclude htdocs/core/lib/functions.lib.php .
+ fi
+ set +e
+ echo
+
- |
export INSTALL_FORCED_FILE=htdocs/install/install.forced.php
echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation"
diff --git a/ChangeLog b/ChangeLog
index f4945b44df0..37957f61c1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@ For users:
NEW: PHP 8.1 compatibility
NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays
+NEW: Can show ZATCA QRCode on PDFs
NEW: #17123 added ExtraFields for Stock Mouvement
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
NEW: #20653 edit discount pourcentage for all lines in one shot
@@ -405,8 +406,9 @@ NEW: Increase size of params of actions for emailcollector
NEW: Invoice list - Use complete country select field with EEC or not
NEW: mass action delete, no more break if at least one object has child
NEW: mass action paid on customer invoice list
-NEW: massaction validate on supplier orders list
-NEW: Mass action send email to all attendees of an event.
+NEW: mass action validate on supplier orders list
+NEW: mass action send email to all attendees of an event
+NEW: mass action to switch status on sale / on purchase of a product
NEW: expense reports: conf to pre-fill start/end dates with bounds of current month
NEW: Option "Add a link on the PDF to make the online payment"
NEW: More options to generate PDF (show Frame option, width of picture option)
@@ -427,7 +429,7 @@ NEW: when multiple order linked to facture, show list into note.
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
NEW: Editing a page in website module keep old page with name .back
NEW: External backups can be downloaded from the "About info page".
-NEW: Add massaction to switch status on sale / on purchase of a product.
+
Modules
@@ -435,36 +437,49 @@ NEW: Stable module Knowledge Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Development of module Partnership Management
+OLD: module SimplePOS has been completely removed -> use TakePOS
For developers:
---------------
+API:
+NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
+NEW: add API /approve and /makeOrder for purchase orders
+NEW: API for knowledgemanagement
+NEW: API get list of legal form of business
+NEW: API list of staff units
+NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
+
+Hook:
+NEW: add hook 'beforeBodyClose'
+NEW: add hook 'hookGetEntity'
+NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
+NEW: add hook 'printUnderHeaderPDFline' on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
+NEW: add hookmanager on note pages
+NEW: hook after rank update
+NEW: 'printFieldListFrom' hook call on several lists
+
+ModuleBuilder:
+NEW: add the property "copytoclipboard" in modulebuilder
+NEW: Use lang selector when using a field key 'lang' in modulebuilder
+
+Options:
+NEW: add options MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
+
+Trigger:
+NEW: add action trigger for member excluded
+
+
NEW: Introduce method hasRight
NEW: Can use textarea field into a confirm popup.
NEW: Can use the result_mode of mysqli driver. Save memory for list count
-NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
-NEW: Add API /approve and /makeOrder for purchase orders.
-NEW: add action trigger for member excluded
-NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
-NEW: Add code codebar column on serial/lot structure
-NEW: Add date_valid and date_approve columns in the list of supplier orders
-NEW: add hook `beforeBodyClose`
-NEW: Add hook hookGetEntity.
-NEW: add hookmanager on note pages
-NEW: add hook 'menuLeftMenuItems' to filter the leftmenu items
-NEW: Add the property "copytoclipboard" in modulebuilder
-NEW: api for knowledgemanagement
-NEW: API get list of legal form of business
-NEW: API list of staff units
-NEW: hook after rank update
-NEW: printFieldListFrom hook call on several lists
-NEW: Use lang selector when using a field key 'lang' in modulebuilder
+NEW: add code codebar column on serial/lot structure
+NEW: add date_valid and date_approve columns in the list of supplier orders
NEW: we need to be able to put more filters on deleteByParentField() function
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
NEW: Experimental feature to manage user sessions in database
-NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
-NEW: Add hook printUnderHeaderPDFline on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
+
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
@@ -1321,7 +1336,6 @@ NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM
NEW: introducing new modal boxes in TakePOS
NEW: keep TakePOS terminal when login/logout
NEW: link on balance to the ledger
-NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector
NEW: manage errors on update extra fields in ticket card
NEW: mass-actions for the event list view
NEW: more filter for "View change logs"
diff --git a/README.md b/README.md
index 5559613eaa2..c476f14a8cc 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
-- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_DoliWamp)
+- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp))
- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian)
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt
index 204988c5442..cbfecbbc19f 100644
--- a/dev/dolibarr_changes.txt
+++ b/dev/dolibarr_changes.txt
@@ -275,6 +275,13 @@ RESTLER:
with
$loaders = array_unique(static::$rogueLoaders, SORT_REGULAR);
+
+* Replace CommentParser.php line 423
+ elseif (count($value) && is_numeric($value[0]))
+
+ with
+
+ elseif (count($value) && isset($value[0]) && is_numeric($value[0]))
+With swagger 2 provided into /explorer:
diff --git a/dev/setup/git/hooks/pre-commit b/dev/setup/git/hooks/pre-commit
index 51b7c5cf4e9..55295b4d656 100644
--- a/dev/setup/git/hooks/pre-commit
+++ b/dev/setup/git/hooks/pre-commit
@@ -7,7 +7,7 @@
# To run the fix manually: cd ~/git/dolibarr; phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true "fileordir"
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
-STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
+STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep -v '/includes/'| grep \\\\.php`
DIRPHPCS=""
AUTOFIX=1
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index 6d7d92ce22b..583b12368dc 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -81,22 +81,22 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
-if ($conf->banque->enabled) {
+if (!empty($conf->banque->enabled)) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
}
-if ($conf->don->enabled) {
+if (!empty($conf->don->enabled)) {
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
}
-if ($conf->adherent->enabled) {
+if (!empty($conf->adherent->enabled)) {
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
}
-if ($conf->loan->enabled) {
+if (!empty($conf->loan->enabled)) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
-if ($conf->societe->enabled) {
+if (!empty($conf->societe->enabled)) {
$list_account[] = '---Deposits---';
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
}
@@ -246,7 +246,7 @@ foreach ($list_account as $key) {
}
}
-if ($conf->societe->enabled) {
+if (!empty($conf->societe->enabled)) {
print '
\n";
- // Empty line is the first line of $object->linesmvt
- // So we must get the first line (the empty one) and put it at the end of the array
- // in order to display it correctly to the user
- $empty_line = array_shift($object->linesmvt);
- $object->linesmvt[]= $empty_line;
+ // Add an empty line if there is not yet
+ if (!empty($object->linesmvt[0])) {
+ $tmpline = $object->linesmvt[0];
+ if (!empty($tmpline->numero_compte)) {
+ $line = new BookKeepingLine();
+ $object->linesmvt[] = $line;
+ }
+ }
foreach ($object->linesmvt as $line) {
print '
';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index ce0714d5651..2ee947bf720 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -204,7 +204,8 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
unset($arrayfields['t.lettering_code']);
}
-$listofformat = AccountancyExport::getType();
+$accountancyexport = new AccountancyExport($db);
+$listofformat = $accountancyexport->getType();
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
if (empty($listofformat[$formatexportset])) {
$formatexportset = 1;
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 128b14fa800..c8c4099e67e 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -11,6 +11,7 @@
* Copyright (C) 2017-2019 Frédéric France
* Copyright (C) 2017 André Schild
* Copyright (C) 2020 Guillaume Alexandre
+ * Copyright (C) 2022 Joachim Kueter
*
* 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
@@ -34,6 +35,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
/**
@@ -93,11 +95,13 @@ class AccountancyExport
*/
public function __construct(DoliDB $db)
{
- global $conf;
+ global $conf, $hookmanager;
$this->db = $db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
+
+ $hookmanager->initHooks(array('accountancyexport'));
}
/**
@@ -105,9 +109,9 @@ class AccountancyExport
*
* @return array of type
*/
- public static function getType()
+ public function getType()
{
- global $langs;
+ global $langs, $hookmanager;
$listofexporttypes = array(
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
@@ -132,6 +136,10 @@ class AccountancyExport
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
+ // allow modules to define export formats
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes);
+
ksort($listofexporttypes, SORT_NUMERIC);
return $listofexporttypes;
@@ -168,7 +176,12 @@ class AccountancyExport
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
);
- return $formatcode[$type];
+ global $hookmanager;
+ $code = $formatcode[$type];
+ $parameters = array('type' => $type);
+ $reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code);
+
+ return $code;
}
/**
@@ -176,11 +189,11 @@ class AccountancyExport
*
* @return array of type
*/
- public static function getTypeConfig()
+ public function getTypeConfig()
{
global $conf, $langs;
- return array(
+ $exporttypes = array(
'param' => array(
self::$EXPORT_TYPE_CONFIGURABLE => array(
'label' => $langs->trans('Modelcsv_configurable'),
@@ -265,6 +278,11 @@ class AccountancyExport
'txt' => $langs->trans("txt")
),
);
+
+ global $hookmanager;
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('getTypeConfig', $parameters, $exporttypes);
+ return $exporttypes;
}
@@ -350,7 +368,13 @@ class AccountancyExport
$this->exportiSuiteExpert($TData);
break;
default:
- $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
+ global $hookmanager;
+ $parameters = array('format' => $formatexportset);
+ // file contents will be created in the hooked function via print
+ $reshook = $hookmanager->executeHooks('export', $parameters, $TData);
+ if ($reshook != 1) {
+ $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
+ }
break;
}
}
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 28c35016054..8cccef2d342 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -741,11 +741,11 @@ class AccountingAccount extends CommonObject
global $hookmanager;
// Instantiate hooks for external modules
- $hookmanager->initHooks(array('accoutancyBindingCalculation'));
+ $hookmanager->initHooks(array('accountancyBindingCalculation'));
- // Execute hook accoutancyBindingCalculation
+ // Execute hook accountancyBindingCalculation
$parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount'=>$accountingAccount, $type);
- $reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
+ $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$const_name = '';
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 1a43a999ea1..992b885f272 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -606,9 +606,13 @@ class BookKeeping extends CommonObject
if (empty($this->credit)) {
$this->credit = 0;
}
+ if (empty($this->montant)) {
+ $this->montant = 0;
+ }
$this->debit = price2num($this->debit, 'MT');
$this->credit = price2num($this->credit, 'MT');
+ $this->montant = price2num($this->montant, 'MT');
$now = dol_now();
@@ -1661,11 +1665,10 @@ class BookKeeping extends CommonObject
$this->doc_date = $this->db->jdate($obj->doc_date);
$this->doc_ref = $obj->doc_ref;
$this->doc_type = $obj->doc_type;
- $this->date_creation = $obj->date_creation;
- $this->date_modification = $obj->date_modification;
- $this->date_export = $obj->date_export;
- $this->date_validation = $obj->date_validated;
- $this->date_validation = $obj->date_validation;
+ $this->date_creation = $this->db->jdate($obj->date_creation);
+ $this->date_modification = $this->db->jdate($obj->date_modification);
+ $this->date_export = $this->db->jdate($obj->date_export);
+ $this->date_validation = $this->db->jdate($obj->date_validation);
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__.$this->error, LOG_ERR);
@@ -1883,7 +1886,7 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
- $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 18277eb6751..99ae0bd845b 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -86,7 +86,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
print ''.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."\n";
print " ";
-} elseif ($conf->accounting->enabled) {
+} elseif (!empty($conf->accounting->enabled)) {
$step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index e46b508512d..d350e2243a2 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -38,7 +38,7 @@ $validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
@@ -75,7 +75,7 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
// Security check
-if (empty($conf->accounting->enabled)) {
+if (!isModEnabled('accounting')) {
accessforbidden();
}
if ($user->socid > 0) {
diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php
index ed2453ef793..80092ea96a5 100644
--- a/htdocs/adherents/admin/member.php
+++ b/htdocs/adherents/admin/member.php
@@ -108,7 +108,7 @@ if ($action == 'set_default') {
$res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
- if ($conf->facture->enabled) {
+ if (isModEnabled('facture')) {
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
@@ -241,10 +241,10 @@ $arraychoices = array('0'=>$langs->trans("None"));
if (!empty($conf->banque->enabled)) {
$arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
}
-if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
$arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
}
-if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) {
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '
';
@@ -256,7 +256,7 @@ print '
';
print "
\n";
// Use vat for invoice creation
-if ($conf->facture->enabled) {
+if (isModEnabled('facture')) {
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)) {
- $selected = 1;
+ if (!empty($arrayfields['d.import_key']['checked'])) {
+ 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)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print '
";
}
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index d01b160ca31..ab4f0c7def0 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2022 Charlene Benke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -359,47 +360,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$linkback = ''.$langs->trans("BackToList").'';
$morehtmlref = '
';
}
@@ -1778,7 +1777,7 @@ if ($action == 'create' && $usercancreate) {
// TODO How record was recorded OrderMode (llx_c_input_method)
// Project
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$langs->load("projects");
print '
';
print '
'.$langs->trans("Project").'
';
@@ -2246,7 +2245,7 @@ if ($action == 'create' && $usercancreate) {
$morehtmlref .= ' ('.$langs->trans("OtherOrders").')';
}
// Project
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
if ($usercancreate) {
@@ -2383,7 +2382,7 @@ if ($action == 'create' && $usercancreate) {
print '
';
// Shipping Method
- if (!empty($conf->expedition->enabled)) {
+ if (isModEnabled('expedition')) {
print '
';
}
// TODO ICS is not used with bank transfer !
- if ($conf->paymentbybanktransfer->enabled) {
+ if (isModEnabled('paymentbybanktransfer')) {
print '
';
- $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
+ $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// TODO Replace this by an include with same code to show already done payment visible in invoice card
print '
';
$linkback = ''.$langs->trans("BackToList").'';
-$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '
';
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 082a485f817..93c8dea0a3e 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
@@ -112,7 +112,7 @@ $arrayfields = array(
'cs.fk_type' =>array('label'=>"Type", 'checked'=>1, 'position'=>30),
'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>40),
'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>50),
- 'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>60, 'enable'=>(!empty($conf->projet->enabled))),
+ 'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>60, 'enable'=>(!empty($conf->project->enabled))),
'cs.fk_user' =>array('label'=>"Employee", 'checked'=>1, 'position'=>70),
'cs.fk_mode_reglement' =>array('checked'=>-1, 'position'=>80, 'label'=>"DefaultPaymentMode"),
'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>100),
@@ -191,7 +191,7 @@ $formother = new FormOther($db);
$bankstatic = new Account($db);
$formsocialcontrib = new FormSocialContrib($db);
$chargesociale_static = new ChargeSociales($db);
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
$projectstatic = new Project($db);
}
@@ -199,7 +199,7 @@ llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
}
$sql .= " c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
@@ -209,7 +209,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
$sql .= " ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (cs.fk_account = ba.rowid)";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)';
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
@@ -223,7 +223,7 @@ if ($search_ref) {
if ($search_label) {
$sql .= natural_search("cs.libelle", $search_label);
}
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
if ($search_project_ref != '') {
$sql .= natural_search("p.ref", $search_project_ref);
}
@@ -259,7 +259,7 @@ if ($search_typeid > 0) {
$sql .= " AND cs.fk_type = ".((int) $search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, cs.fk_account, c.libelle, c.accountancy_code, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
$sql .= ", p.rowid, p.ref, p.title";
}
$sql .= $db->order($sortfield, $sortorder);
@@ -560,7 +560,7 @@ while ($i < min($num, $limit)) {
$chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label;
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$projectstatic->id = $obj->project_id;
$projectstatic->ref = $obj->project_ref;
$projectstatic->title = $obj->project_label;
diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php
index cf9d0cbdec5..8ede1c3b502 100644
--- a/htdocs/compta/sociales/note.php
+++ b/htdocs/compta/sociales/note.php
@@ -25,7 +25,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-if (!empty($conf->projet->enabled)) {
+if (!empty($conf->project->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@@ -93,7 +93,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
// Project
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' : ';
if (!empty($object->fk_project)) {
@@ -113,7 +113,9 @@ if ($id > 0 || !empty($ref)) {
// ------------------------------------------------------------
$linkback = ''.$langs->trans("BackToList").'';
- //$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+ //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
+
+ $morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php
index 43e9d5d4668..d2646d241ea 100644
--- a/htdocs/compta/sociales/payments.php
+++ b/htdocs/compta/sociales/payments.php
@@ -137,7 +137,7 @@ print '';
$sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
-$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
+$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
@@ -253,7 +253,7 @@ if (!$resql) {
$i = 0;
$total = 0;
$totalnb = 0;
-$totalpaye = 0;
+$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@@ -346,8 +346,8 @@ while ($i < min($num, $limit)) {
// Paid
print '
';
- if ($obj->totalpaye) {
- print ''.price($obj->totalpaye).'';
+ if ($obj->totalpaid) {
+ print ''.price($obj->totalpaid).'';
}
print '
';
@@ -8431,12 +8439,13 @@ class Form
/**
* Show linked object block.
*
- * @param CommonObject $object Object we want to show links to
- * @param string $morehtmlright More html to show on right of title
- * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
- * @return int <0 if KO, >=0 if OK
+ * @param CommonObject $object Object we want to show links to
+ * @param string $morehtmlright More html to show on right of title
+ * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
+ * @param string $title Title
+ * @return int <0 if KO, >=0 if OK
*/
- public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false)
+ public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false, $title = 'RelatedObjects')
{
global $conf, $langs, $hookmanager;
global $bc, $action;
@@ -8455,7 +8464,7 @@ class Form
$nbofdifferenttypes = count($object->linkedObjects);
print '';
- print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '', 0, 0, 'showlinkedobjectblock');
+ print load_fiche_titre($langs->trans($title), $morehtmlright, '', 0, 0, 'showlinkedobjectblock');
print '
';
@@ -8493,13 +8502,13 @@ class Form
// To work with non standard path
if ($objecttype == 'facture') {
$tplpath = 'compta/'.$element;
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
continue; // Do not show if module disabled
}
} elseif ($objecttype == 'facturerec') {
$tplpath = 'compta/facture';
$tplname = 'linkedobjectblockForRec';
- if (empty($conf->facture->enabled)) {
+ if (!isModEnabled('facture')) {
continue; // Do not show if module disabled
}
} elseif ($objecttype == 'propal') {
@@ -8526,11 +8535,6 @@ class Form
if (empty($conf->expedition->enabled)) {
continue; // Do not show if module disabled
}
- } elseif ($objecttype == 'mo') {
- $tplpath = 'mrp/mo';
- if (empty($conf->mrp->enabled)) {
- continue; // Do not show if module disabled
- }
} elseif ($objecttype == 'ficheinter') {
$tplpath = 'fichinter';
if (empty($conf->ficheinter->enabled)) {
@@ -8629,23 +8633,62 @@ class Form
}
$possiblelinks = array(
- 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
- 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
- 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
- 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
+ 'propal'=>array(
+ 'enabled'=>(!empty($conf->propal->enabled) ? $conf->propal->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToProposal',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
+ 'order'=>array(
+ 'enabled'=>(!empty($conf->commande->enabled) ? $conf->commande->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToOrder',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
+ 'invoice'=>array(
+ 'enabled'=>isModEnabled('facture'),
+ 'perms'=>1,
+ 'label'=>'LinkToInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
+ 'invoice_template'=>array(
+ 'enabled'=>isModEnabled('facture'),
+ 'perms'=>1,
+ 'label'=>'LinkToTemplateInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array(
- 'enabled'=>$conf->contrat->enabled,
+ 'enabled'=>(!empty($conf->contrat->enabled) ? $conf->contrat->enabled : 0),
'perms'=>1,
'label'=>'LinkToContract',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
- 'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
- 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
- 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
- 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
- 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
- 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
+ 'fichinter'=>array(
+ 'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToIntervention',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
+ 'supplier_proposal'=>array(
+ 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierProposal',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
+ 'order_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierOrder',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
+ 'invoice_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0),
+ 'perms'=>1, 'label'=>'LinkToSupplierInvoice',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
+ 'ticket'=>array(
+ 'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToTicket',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
+ 'mo'=>array(
+ 'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToMo',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
);
}
@@ -9332,16 +9375,16 @@ class Form
/**
* Return select list of groups
*
- * @param string $selected Id group preselected
- * @param string $htmlname Field name in form
- * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
- * @param string $exclude Array list of groups id to exclude
- * @param int $disabled If select list must be disabled
- * @param string $include Array list of groups id to include
- * @param int $enableonly Array list of groups id to be enabled. All other must be disabled
- * @param string $force_entity '0' or Ids of environment to force
- * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
- * @param string $morecss More css to add to html component
+ * @param string $selected Id group preselected
+ * @param string $htmlname Field name in form
+ * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
+ * @param string|array $exclude Array list of groups id to exclude
+ * @param int $disabled If select list must be disabled
+ * @param string|array $include Array list of groups id to include
+ * @param int $enableonly Array list of groups id to be enabled. All other must be disabled
+ * @param string $force_entity '0' or Ids of environment to force
+ * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
+ * @param string $morecss More css to add to html component
* @return string
* @see select_dolusers()
*/
@@ -9396,7 +9439,6 @@ class Form
if ($resql) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
- $out .= ajax_combobox($htmlname);
$out .= '';
@@ -9438,6 +9480,8 @@ class Form
$out .= '';
}
$out .= '';
+
+ $out .= ajax_combobox($htmlname);
} else {
dol_print_error($this->db);
}
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index fac32e62e5e..242c1476736 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -226,7 +226,7 @@ class FormActions
}
$newcardbutton = '';
- if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) {
+ if (isModEnabled('agenda') && !empty($user->rights->agenda->myactions->create)) {
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&token='.newToken().'&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog', 'tzuser')).'&origin='.urlencode($typeelement).'&originid='.((int) $object->id).((!empty($object->socid) && $object->socid > 0) ? '&socid='.((int) $object->socid) : ((!empty($socid) && $socid > 0) ? '&socid='.((int) $socid) : '')).($projectid > 0 ? '&projectid='.((int) $projectid) : '').($taskid > 0 ? '&taskid='.((int) $taskid) : '').'&backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
}
@@ -259,7 +259,6 @@ class FormActions
}
$ref = $actioncomm->getNomUrl(1, -1);
- $label = $actioncomm->getNomUrl(0, 36);
print '
';
+
+ return $texte;
+ }
+
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $conf, $db, $langs, $mysoc;
+
+ $object = new StockTransfer($db);
+ $object->initAsSpecimen();
+
+ /*$old_code_client = $mysoc->code_client;
+ $old_code_type = $mysoc->typent_code;
+ $mysoc->code_client = 'CCCCCCCCCC';
+ $mysoc->typent_code = 'TTTTTTTTTT';*/
+
+ $numExample = $this->getNextValue($object);
+
+ /*$mysoc->code_client = $old_code_client;
+ $mysoc->typent_code = $old_code_type;*/
+
+ if (!$numExample) {
+ $numExample = $langs->trans('NotConfigured');
+ }
+ return $numExample;
+ }
+
+ /**
+ * Return next free value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Value if KO, <0 if KO
+ */
+ public function getNextValue($object)
+ {
+ global $db, $conf;
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+
+ // We get cursor rule
+ $mask = $conf->global->STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK;
+
+ if (!$mask) {
+ $this->error = 'NotConfigured';
+ return 0;
+ }
+
+ $date = $object->date;
+
+ $numFinal = get_next_value($db, $mask, 'stocktransfer_stocktransfer', 'ref', '', null, $date);
+
+ return $numFinal;
+ }
+}
diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
new file mode 100644
index 00000000000..6a6c7c556e6
--- /dev/null
+++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
@@ -0,0 +1,154 @@
+
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2021 Gauthier VERDOL
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
+ * \ingroup stocktransfer
+ * \brief File of class to manage StockTransfer numbering rules standard
+ */
+require_once DOL_DOCUMENT_ROOT . '/core/modules/stocktransfer/modules_stocktransfer.php';
+
+
+/**
+ * Class to manage customer order numbering rules standard
+ */
+class mod_stocktransfer_standard extends ModeleNumRefStockTransfer
+{
+ /**
+ * Dolibarr version of the loaded document
+ * @var string
+ */
+ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+
+ public $prefix = 'ST';
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * @var string name
+ */
+ public $name = 'standard';
+
+
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+ return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+ }
+
+
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix."0501-0001";
+ }
+
+
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated($object)
+ {
+ global $conf, $langs, $db;
+
+ $coyymm = ''; $max = '';
+
+ $posindice = strlen($this->prefix) + 6;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql .= " FROM ".MAIN_DB_PREFIX."stocktransfer_stocktransfer";
+ $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+ if ($object->ismultientitymanaged == 1) {
+ $sql .= " AND entity = ".$conf->entity;
+ } elseif ($object->ismultientitymanaged == 2) {
+ // TODO
+ }
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $row = $db->fetch_row($resql);
+ if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
+ }
+ if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
+ $langs->load("errors");
+ $this->error = $langs->trans('ErrorNumRefModel', $max);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Return next free value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Value if KO, <0 if KO
+ */
+ public function getNextValue($object)
+ {
+ global $db, $conf;
+
+ // first we get the max value
+ $posindice = strlen($this->prefix) + 6;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql .= " FROM ".MAIN_DB_PREFIX."stocktransfer_stocktransfer";
+ $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+ if ($object->ismultientitymanaged == 1) {
+ $sql .= " AND entity = ".$conf->entity;
+ } elseif ($object->ismultientitymanaged == 2) {
+ // TODO
+ }
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
+ } else {
+ dol_syslog("mod_stocktransfer_standard::getNextValue", LOG_DEBUG);
+ return -1;
+ }
+
+ //$date=time();
+ $date = $object->date_creation;
+ $yymm = strftime("%y%m", $date);
+
+ if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max + 1);
+
+ dol_syslog("mod_stocktransfer_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
+ return $this->prefix.$yymm."-".$num;
+ }
+}
diff --git a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php
new file mode 100644
index 00000000000..3da0a0ae644
--- /dev/null
+++ b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php
@@ -0,0 +1,151 @@
+
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2004 Eric Seigne
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2006 Andre Cianfarani
+ * Copyright (C) 2012 Juanjo Menent
+ * Copyright (C) 2014 Marcos García
+ * Copyright (C) 2021 Gauthier VERDOL
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/stocktransfer/modules_stocktransfer.php
+ * \ingroup stocktransfer
+ * \brief File that contains parent class for stocktransfers document models and parent class for stocktransfers numbering models
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
+
+
+/**
+ * Parent class for documents models
+ */
+abstract class ModelePDFStockTransfer extends CommonDocGenerator
+{
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ global $conf;
+
+ $type = 'stocktransfer';
+ $list = array();
+
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ $list = getListOfModels($db, $type, $maxfilenamelength);
+
+ return $list;
+ }
+}
+
+
+
+/**
+ * Parent class to manage numbering of StockTransfer
+ */
+abstract class ModeleNumRefStockTransfer
+{
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Returns the default description of the numbering template
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("stocktransfer@stocktransfer");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Returns an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("stocktransfer@stocktransfer");
+ return $langs->trans("NoExample");
+ }
+
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @param Object $object Object we need next value for
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated($object)
+ {
+ return true;
+ }
+
+ /**
+ * Returns next assigned value
+ *
+ * @param Object $object Object we need next value for
+ * @return string Valeur
+ */
+ public function getNextValue($object)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
+
+ /**
+ * Returns version of numbering module
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+
+ if ($this->version == 'development') return $langs->trans("VersionDevelopment");
+ if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans("NotAvailable");
+ }
+}
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 e64f0ab632d..6b47240016f 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -154,6 +154,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->option_credit_note = 1; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
+ $this->watermark = '';
// Get source company
$this->emetteur = $mysoc;
@@ -204,7 +205,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
/**
* Function to build pdf onto disk
*
- * @param Object $object Object to generate
+ * @param SupplierProposal $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@@ -228,6 +229,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
+ // Show Draft Watermark
+ if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
+ $this->watermark = $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK;
+ }
+
$nblines = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
@@ -1283,11 +1289,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
- // Show Draft Watermark
- if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
- pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK);
- }
-
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@@ -1495,6 +1496,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
{
global $conf;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
- return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
+ return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
}
}
diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php
index 940f9a165d9..e99e16ef649 100644
--- a/htdocs/core/modules/syslog/mod_syslog_file.php
+++ b/htdocs/core/modules/syslog/mod_syslog_file.php
@@ -173,7 +173,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
$this->lastTime = $now;
}
- $message = strftime("%Y-%m-%d %H:%M:%S", time()).$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident > 0 ?str_pad('', $this->ident, ' ') : '').$content['message'];
+ $message = dol_print_date(dol_now('gmt'), 'standard', 'gmt').$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident > 0 ?str_pad('', $this->ident, ' ') : '').$content['message'];
fwrite($filefd, $message."\n");
fclose($filefd);
@chmod($logfile, octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 0c744e165d3..7b47c4676a6 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2022 Charlene Benke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,11 +59,11 @@ if ($action == 'presend') {
// Define output language
$outputlangs = $langs;
$newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
- $newlang = GETPOST('lang_id', 'aZ09');
- }
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
+ if (GETPOST('lang_id', 'aZ09')) {
+ $newlang = GETPOST('lang_id', 'aZ09');
+ }
}
if (!empty($newlang)) {
@@ -212,7 +213,14 @@ if ($action == 'presend') {
$formmail->setSubstitFromObject($object, $langs);
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
- $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : '';
+ $substitutionarray['__CHECK_READ__'] = "";
+ if (is_object($object) && is_object($object->thirdparty)) {
+ $checkRead= 'global->MAILING_EMAIL_UNSUBSCRIBE_KEY)?urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY):"");
+ $checkRead.='" width="1" height="1" style="width:1px;height:1px" border="0"/>';
+ $substitutionarray['__CHECK_READ__'] = $checkRead;
+ }
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
$substitutionarray['__CONTACTCIVNAME__'] = '';
$parameters = array(
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index 39103fdbb0a..1439ce73afe 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -63,9 +63,11 @@ foreach ($object->fields as $key => $val) {
}
print '';
print '
';
- }
- // Status
- if (!empty($arrayfields['f.fk_statut']['checked'])) {
- print '
';
- $tmp = $objectstatic->LibStatut(0); // To load $this->statuts_short
- $liststatus = $objectstatic->statuts_short;
- if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
- unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
- }
- print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
- print '
';
- }
- // Fields of detail line
- if (!empty($arrayfields['fd.description']['checked'])) {
- print '
';
- }
- if (!empty($arrayfields['fd.date']['checked'])) {
- print '
';
- }
- if (!empty($arrayfields['fd.duree']['checked'])) {
- print '
';
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
+
+// Fields from hook
+$parameters = array('arrayfields'=>$arrayfields);
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+if (!empty($arrayfields['f.datec']['checked'])) {
+ // Date creation
+ print '
';
+}
+// Status
+if (!empty($arrayfields['f.fk_statut']['checked'])) {
+ print '
';
+ $tmp = $objectstatic->LibStatut(0); // To load $this->statuts_short
+ $liststatus = $objectstatic->statuts_short;
+ if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
+ unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
}
+ print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
+ print '
';
+}
+// Fields of detail line
+if (!empty($arrayfields['fd.description']['checked'])) {
+ 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;
@@ -755,35 +857,52 @@ if ($resql) {
print '';
}
print '
\n";
-
- $total += $obj->duree;
- $i++;
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- // Show total line
- include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+ print ''."\n";
- $db->free($resql);
+ $total += $obj->duree;
+ $i++;
+}
- $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
- $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '
'."\n";
- print '
';
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
- print "\n";
+// If no record found
+if ($num == 0) {
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) {
+ if (!empty($val['checked'])) {
+ $colspan++;
+ }
+ }
+ print '
'.$langs->trans("NoRecordFound").'
';
+}
+$db->free($resql);
+
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
+print '
'."\n";
+
+ // Common attributes
+ //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
+ //unset($object->fields['fk_project']); // Hide field already shown in banner
+ //unset($object->fields['fk_soc']); // Hide field already shown in banner
+
+ $object->fields['fk_soc']['visible']=0; // Already available in banner
+ $object->fields['fk_project']['visible']=0; // Already available in banner
+ include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
+
+ // Incoterms
+ if (!empty($conf->incoterm->enabled)) {
+ print '
';
+ // Other attributes. Fields from hook formObjectOptions and Extrafields.
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
+
+ print '
';
+ // Batch number
+ if ($conf->productbatch->enabled) {
+ print '
';
+ print '';
+ print '
';
+ }
+
+ $formproduct->loadWarehouses(); // Pour charger la totalité des entrepôts
+
+ // On stock ceux qui ne doivent pas être proposés dans la liste
+ $TExcludedWarehouseSource=array();
+ if (!empty($object->fk_warehouse_source)) {
+ $source_ent = new Entrepot($db);
+ $source_ent->fetch($object->fk_warehouse_source);
+ foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
+ if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
+ }
+ }
+
+ // On stock ceux qui ne doivent pas être proposés dans la liste
+ $TExcludedWarehouseDestination=array();
+ if (!empty($object->fk_warehouse_destination)) {
+ $dest_ent = new Entrepot($db);
+ $dest_ent->fetch($object->fk_warehouse_destination);
+ foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
+ if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
+ }
+ }
+
+ // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
+ $formproduct->cache_warehouses=array();
+ // In warehouse
+ print '
';
+
+ // On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
+ $formproduct->cache_warehouses=array();
+ // Out warehouse
+ print '
'."\n";
+
+
+// Detect if we need a fetch on each output line
+$needToFetchEachLine = 0;
+if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
+ if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
+ }
+}
+
+
+// Loop on record
+// --------------------------------------------------------------------
+$i = 0;
+$totalarray = array();
+while ($i < ($limit ? min($num, $limit) : $num)) {
+ $obj = $db->fetch_object($resql);
+ if (empty($obj)) break; // Should not happen
+
+ // Store properties in $object
+ $object->setVarsFromFetchObj($obj);
+
+ // Show here line of result
+ print '
';
+ if (!$i) $totalarray['nbfield']++;
+ if (!empty($val['isameasure'])) {
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
+ $totalarray['val']['t.'.$key] += $object->$key;
+ }
+ }
+ }
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Action column
+ 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($object->id, $arrayofselected)) $selected = 1;
+ print '';
+ }
+ print '
';
+ if (!$i) $totalarray['nbfield']++;
+
+ print '
'."\n";
+
+ $i++;
+}
+
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
+// If no record found
+if ($num == 0) {
+ $colspan = 1;
+ foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
+ print '
'.$langs->trans("NoRecordFound").'
';
+}
+
+
+$db->free($resql);
+
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
+print '
'."\n";
+print '
'."\n";
+
+print '
'."\n";
+
+if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
+ $hidegeneratedfilelistifempty = 1;
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
+
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+ $formfile = new FormFile($db);
+
+ // Show list of available documents
+ $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+ $urlsource .= str_replace('&', '&', $param);
+
+ $filedir = $diroutputmassaction;
+ $genallowed = $permissiontoread;
+ $delallowed = $permissiontoadd;
+
+ print $formfile->showdocuments('massfilesarea_stocktransfer', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_note.php b/htdocs/product/stock/stocktransfer/stocktransfer_note.php
new file mode 100644
index 00000000000..1932b685e24
--- /dev/null
+++ b/htdocs/product/stock/stocktransfer/stocktransfer_note.php
@@ -0,0 +1,162 @@
+
+ * Copyright (C) 2021 Gauthier VERDOL
+ * Copyright (C) ---Put here your own copyright and developer email---
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file stocktransfer_note.php
+ * \ingroup stocktransfer
+ * \brief Car with notes on StockTransfer
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
+if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
+if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
+if (!$res) die("Include of main fails");
+
+require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
+require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("stocks", "companies"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+// Initialize technical objects
+$object = new StockTransfer($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('stocktransfernote', 'globalcard')); // Note that conf->hooks_modules contains array
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Security check - Protection if external user
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$result = restrictedArea($user, 'stocktransfer', $id);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
+
+$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
+$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
+
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
+$help_url = '';
+llxHeader('', $langs->trans('ModuleStockTransferName'), $help_url);
+
+if ($id > 0 || !empty($ref)) {
+ $object->fetch_thirdparty();
+
+ $head = stocktransferPrepareHead($object);
+
+ print dol_get_fiche_head($head, 'note', $langs->trans("StockTransfer"), -1, $object->picto);
+
+ // Object card
+ // ------------------------------------------------------------
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ $morehtmlref = '
\n";
- $extralabelslines = $extrafields->attributes[$line->table_element];
- //Display lines extrafields
- if (is_array($extralabelslines) && count($extralabelslines) > 0) {
+ // Display lines for extrafields of the Reception line
+ // $line is a 'CommandeFournisseurLigne', $dispatchLines contains values of Reception lines so properties of CommandeFournisseurDispatch
+ if (!empty($extrafields)) {
+ //var_dump($line);
$colspan = 5;
if ($conf->productbatch->enabled) {
$colspan += 3;
}
+ $recLine = new CommandeFournisseurDispatch($db);
$srcLine = new CommandeFournisseurLigne($db);
- $line = new CommandeFournisseurDispatch($db);
-
- $extrafields->fetch_name_optionals_label($srcLine->table_element);
- $extrafields->fetch_name_optionals_label($line->table_element);
-
$srcLine->id = $line->id;
$srcLine->fetch_optionals(); // fetch extrafields also available in orderline
- $line->fetch_optionals();
- if (empty($line->array_options) && !empty($dispatchLines[$indiceAsked]['array_options'])) {
- $line->array_options = $dispatchLines[$indiceAsked]['array_options'];
+ if (empty($recLine->array_options) && !empty($dispatchLines[$indiceAsked]['array_options'])) {
+ $recLine->array_options = $dispatchLines[$indiceAsked]['array_options'];
}
- $line->array_options = array_merge($line->array_options, $srcLine->array_options);
+ $recLine->array_options = array_merge($recLine->array_options, $srcLine->array_options);
- print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked);
+ print $recLine->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1);
}
$indiceAsked++;
@@ -1383,7 +1381,7 @@ if ($action == 'create') {
// Thirdparty
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
// Project
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
if (0) { // Do not change on reception
@@ -1669,7 +1667,8 @@ if ($action == 'create') {
print ' ';
print '
';
- print '
';
+ print '
';
+ print '';
print '
';
// #
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
@@ -1734,6 +1733,7 @@ if ($action == 'create') {
print '
';
}
print "
\n";
+ print '';
$var = false;
@@ -1799,9 +1799,10 @@ if ($action == 'create') {
$arrayofpurchaselinealreadyoutput = array();
// Loop on each product to send/sent. Warning: $lines must be sorted by ->fk_commandefourndet (it is a regroupment key on output)
+ print '';
for ($i = 0; $i < $num_prod; $i++) {
print ''; // id of order line
- 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($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print '
';
if ($key == 'status') {
print $object->getLibStatut(5);
} elseif ($key == 'rowid') {
@@ -789,15 +837,17 @@ while ($i < $imaxinloop) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
- 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($object->id, $arrayofselected)) {
- $selected = 1;
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ 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($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
}
- print '';
+ print '
';
}
- print '';
if (!$i) {
$totalarray['nbfield']++;
}
@@ -826,7 +876,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
-$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '
'."\n";
diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php
index d35edaa3b91..c6fedf6fcea 100644
--- a/htdocs/recruitment/recruitmentcandidature_note.php
+++ b/htdocs/recruitment/recruitmentcandidature_note.php
@@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
*/
// Project
- /*if (! empty($conf->projet->enabled))
+ /*if (! empty($conf->project->enabled))
{
$langs->load("projects");
$morehtmlref .= $langs->trans('Project') . ' ';
diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php
index b4d943584cd..f028f2f8243 100644
--- a/htdocs/recruitment/recruitmentindex.php
+++ b/htdocs/recruitment/recruitmentindex.php
@@ -331,11 +331,11 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@@ -402,11 +402,11 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
$sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
- if ($conf->societe->enabled && empty($user->rights->societe->client->voir) && !$socid) {
+ if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php
index 45c84005743..07cecb0070e 100644
--- a/htdocs/recruitment/recruitmentjobposition_agenda.php
+++ b/htdocs/recruitment/recruitmentjobposition_agenda.php
@@ -150,7 +150,7 @@ if ($object->id > 0) {
$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
*/
// Project
- if (!empty($conf->projet->enabled)) {
+ if (!empty($conf->project->enabled)) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($permissiontoadd) {
@@ -217,7 +217,7 @@ if ($object->id > 0) {
print '
';
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
print ''.$langs->trans("AddAction").'';
} else {
@@ -227,7 +227,7 @@ if ($object->id > 0) {
print '
';
foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
$titlealt = 'default';
diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php
index 05079d263a9..d9b3d3127f9 100644
--- a/htdocs/societe/partnership.php
+++ b/htdocs/societe/partnership.php
@@ -1,6 +1,7 @@
* Copyright (C) 2021 NextGestion
+ * Copyright (C) 2022 Charlene Benke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -180,25 +181,25 @@ if ($id > 0) {
print '
';
if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
- print '
'.$langs->trans('Prefix').'
'.$societe->prefix_comm.'
';
+ print '
'.$langs->trans('Prefix').'
'.$object->prefix_comm.'
';
}
- if ($societe->client) {
+ if ($object->client) {
print '
';
} else {
// if social network is not active but value exist we do not want to loose it
- print '';
+ print '';
}
}
}
@@ -2536,7 +2544,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// User color
- if (!empty($conf->agenda->enabled)) {
+ if (isModEnabled('agenda')) {
print '
'.$langs->trans("ColorUser").'
';
print '
';
if ($caneditfield) {
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index cb76b25cc5a..c073937b048 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -2805,13 +2805,6 @@ class User extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
-
- /*
- $hookmanager->initHooks(array('userdao'));
- $parameters=array('id'=>$this->id);
- $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
- if ($reshook > 0) $linkclose = $hookmanager->resPrint;
- */
}
$linkstart .= $linkclose.'>';
@@ -2926,7 +2919,7 @@ class User extends CommonObject
*/
public function getLibStatut($mode = 0)
{
- return $this->LibStatut(isset($this->statut) ? $this->statut : $this->status, $mode);
+ return $this->LibStatut(isset($this->statut) ? (int) $this->statut : (int) $this->status, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -2971,7 +2964,18 @@ class User extends CommonObject
$return = '
';
+ $label .= Form::showphoto('userphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); // Force height to 60 so we total height of tooltip can be calculated and collision can be managed
+ //$label .= '
';
-
+print ' ';
if ($user->admin) {
print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
@@ -340,7 +340,7 @@ if ($result) {
$obj = $db->fetch_object($result);
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
- if (empty($modules[$obj->module])) {
+ if (!isset($obj->module) || empty($modules[$obj->module])) {
$i++;
continue;
}
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index 9e1d791a626..b6ffd948bd6 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -915,7 +915,7 @@ if (!empty($id) || !empty($ref)) {
print 'id.'">'.img_delete().'';
print '
';
print '
';
- if ($productCombinations || $massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ if (!empty($productCombinations) || $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($prodstatic->id, $arrayofselected)) {
$selected = 1;
diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php
index f70a990ee95..14af2e88b3f 100644
--- a/htdocs/webservices/admin/index.php
+++ b/htdocs/webservices/admin/index.php
@@ -108,7 +108,7 @@ $webservices = array(
'supplier_invoice' => '!empty($conf->fournisseur->enabled)',
'actioncomm' => '!empty($conf->agenda->enabled)',
'category' => '!empty($conf->categorie->enabled)',
- 'project' => '!empty($conf->projet->enabled)',
+ 'project' => '!empty($conf->project->enabled)',
'other' => ''
);
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index bb46729145c..0a342d1ad62 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -1209,7 +1209,7 @@ class Website extends CommonObject
}
// Load sql record
- $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two
+ $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1, 0, 0, 1); // The maxrowid of table is searched into this function two
if ($runsql <= 0) {
$this->errors[] = 'Failed to load sql file '.$sqlfile;
$error++;
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index a170a2b777e..0a58c0bcf44 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2790,6 +2790,7 @@ if (!GETPOST('hide_websitemenu')) {
$htmltext .= '