mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Compare commits
74 Commits
21.0.0
...
78ca968db6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78ca968db6 | ||
|
|
a1476fd221 | ||
|
|
908880c82c | ||
|
|
3608e9b102 | ||
|
|
c2635f5242 | ||
|
|
2935a245a3 | ||
|
|
5589ed71b2 | ||
|
|
32f160355b | ||
|
|
5a61cc9393 | ||
|
|
7ed0af2a13 | ||
|
|
9e8460c3dc | ||
|
|
70f5e20572 | ||
|
|
30ecf80732 | ||
|
|
99fe044868 | ||
|
|
8ae27c3a5f | ||
|
|
5fa475a074 | ||
|
|
a16f3bdf31 | ||
|
|
dc7932700b | ||
|
|
534d4ed4bc | ||
|
|
50b90d795c | ||
|
|
3209eb4bd8 | ||
|
|
1f65548836 | ||
|
|
5de1fcca2f | ||
|
|
50afc9682b | ||
|
|
a3969c1d2c | ||
|
|
d87ebbf926 | ||
|
|
08b105502e | ||
|
|
bd2aba1a2f | ||
|
|
a4601686a6 | ||
|
|
bcf6d6a7a2 | ||
|
|
65a3b0893d | ||
|
|
92454d671f | ||
|
|
f43f2909ff | ||
|
|
60f089c015 | ||
|
|
7d898184b5 | ||
|
|
e818bf732d | ||
|
|
347bf3e4d6 | ||
|
|
b3a2257638 | ||
|
|
3b0a4c9fa9 | ||
|
|
154a25f8cb | ||
|
|
6a88d31675 | ||
|
|
f4555c4413 | ||
|
|
bc33f7e1a7 | ||
|
|
3c1b5846c9 | ||
|
|
3b5e07dca9 | ||
|
|
8927d1260a | ||
|
|
53cf9f0bf1 | ||
|
|
c0161ccead | ||
|
|
a4b1700bae | ||
|
|
f5cb64afaa | ||
|
|
a5c51589d3 | ||
|
|
b4501511c8 | ||
|
|
e18c5b9d68 | ||
|
|
d31bad82a1 | ||
|
|
bc0b0bebd3 | ||
|
|
031acacdab | ||
|
|
18725aec6b | ||
|
|
4c6955017f | ||
|
|
de40214a09 | ||
|
|
096b59913d | ||
|
|
d38b9e6248 | ||
|
|
f256deb54b | ||
|
|
7fa3474ecd | ||
|
|
ef159f919e | ||
|
|
42a1cde41a | ||
|
|
324f9631d7 | ||
|
|
2058d572d9 | ||
|
|
089fab828b | ||
|
|
fa05dc44ce | ||
|
|
5b9453e302 | ||
|
|
d81a2d060e | ||
|
|
97aaff7395 | ||
|
|
f7fe6c4f1a | ||
|
|
6f4b2a8905 |
86
.github/scripts/get_changed_php.sh
vendored
Executable file
86
.github/scripts/get_changed_php.sh
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# This script retrieves the list of changed PHP files for a pull request
|
||||
# using the GitHub API and sets two outputs:
|
||||
# - any_changed: "true" if at least one PHP file changed, "false" otherwise
|
||||
# - all_changed_files: space-separated list of changed PHP file paths
|
||||
#
|
||||
# Required environment variables:
|
||||
# GITHUB_TOKEN - GitHub token with repo access
|
||||
# GITHUB_REPOSITORY - "owner/repo"
|
||||
# GITHUB_EVENT_PATH - Path to the event JSON payload
|
||||
|
||||
# Verify required environment variables are set
|
||||
if [[ -z "${GITHUB_TOKEN:-}" ]]; then
|
||||
echo "GITHUB_TOKEN is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
|
||||
echo "GITHUB_REPOSITORY is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${GITHUB_EVENT_PATH:-}" ]]; then
|
||||
echo "GITHUB_EVENT_PATH is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract the pull request number from the event payload
|
||||
pr_number=$(jq --raw-output '.pull_request.number' "$GITHUB_EVENT_PATH")
|
||||
if [[ "$pr_number" == "null" ]]; then
|
||||
echo "Not a pull request event"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Split repository into owner and repo name
|
||||
# Split repository into owner and repo name using Bash parameter expansion
|
||||
owner="${GITHUB_REPOSITORY%%/*}" # Extract text before the first '/'
|
||||
repo="${GITHUB_REPOSITORY##*/}" # Extract text after the last '/'
|
||||
|
||||
page=1
|
||||
per_page=100
|
||||
changed_php_files=()
|
||||
|
||||
# Loop through all pages to gather changed files
|
||||
while true; do
|
||||
response=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
"https://api.github.com/repos/${owner}/${repo}/pulls/${pr_number}/files?per_page=${per_page}&page=${page}")
|
||||
|
||||
# Filter for files ending with .php and add them to the list
|
||||
mapfile -t files < <(echo "$response" | jq -r '.[] | select(.filename | test("\\.php$")) | .filename')
|
||||
changed_php_files+=("${files[@]}")
|
||||
|
||||
# Check if we have reached the last page (less than per_page results)
|
||||
count=$(echo "$response" | jq 'length')
|
||||
if (( count < per_page )); then
|
||||
break
|
||||
fi
|
||||
((page++))
|
||||
done
|
||||
|
||||
|
||||
# Build a space-separated string of changed PHP files
|
||||
# This does not cope with files that have spaces.
|
||||
# But such files do not exist in the project (at least not for the
|
||||
# files we are filtering).
|
||||
all_changed_files=$(IFS=" " ; echo "${changed_php_files[*]}")
|
||||
|
||||
|
||||
# Determine changed files flag
|
||||
if [ -z "$all_changed_files" ]; then
|
||||
any_changed="false"
|
||||
else
|
||||
any_changed="true"
|
||||
fi
|
||||
|
||||
# Set outputs for GitHub Actions if GITHUB_OUTPUT is available
|
||||
if [ -n "${GITHUB_OUTPUT:-}" ]; then
|
||||
echo "any_changed=${any_changed}" >> "$GITHUB_OUTPUT"
|
||||
echo "all_changed_files=${all_changed_files}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
# Otherwise, print the outputs
|
||||
echo "any_changed=${any_changed}"
|
||||
echo "all_changed_files=${all_changed_files}"
|
||||
fi
|
||||
14
.github/workflows/pre-commit.yml
vendored
14
.github/workflows/pre-commit.yml
vendored
@@ -14,18 +14,18 @@ jobs:
|
||||
run: sudo apt-get update && sudo apt-get install cppcheck
|
||||
if: false
|
||||
|
||||
# Checkout git sources to analyze
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The next uses the git API because there is no clone yet.
|
||||
# This is faster for a big repo.
|
||||
- name: Get all changed php files (if PR)
|
||||
id: changed-php
|
||||
uses: tj-actions/changed-files@v42
|
||||
if: github.event_name == 'pull_request'
|
||||
with:
|
||||
files: |
|
||||
**.php
|
||||
if: env.gh_event == 'pull_request'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./.github/scripts/get_changed_php.sh
|
||||
|
||||
# Checkout git sources to analyze
|
||||
- uses: actions/checkout@v4
|
||||
# Action setup-python needs a requirements.txt or pyproject.toml
|
||||
# This ensures one of them exists.
|
||||
- name: Create requirements.txt if no requirements.txt or pyproject.toml
|
||||
|
||||
35
.travis.yml
35
.travis.yml
@@ -2,9 +2,9 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see https://docs.travis-ci.com/user/languages/php/
|
||||
|
||||
# We use dist: bionic = 18.04, focal = 20.04
|
||||
# We use dist: focal = 20.04, jammy = 22.04
|
||||
os: linux
|
||||
dist: focal
|
||||
dist: jammy
|
||||
|
||||
language: generic
|
||||
|
||||
@@ -21,7 +21,7 @@ services:
|
||||
|
||||
|
||||
addons:
|
||||
mariadb: '10.5'
|
||||
mariadb: '10.6'
|
||||
|
||||
|
||||
env:
|
||||
@@ -36,10 +36,10 @@ jobs:
|
||||
include:
|
||||
- stage: PHP 7.0-8.1
|
||||
if: type = push
|
||||
php: '7.0'
|
||||
php: '7.1'
|
||||
env:
|
||||
- DB=postgresql
|
||||
- TRAVIS_PHP_VERSION=7.0
|
||||
- TRAVIS_PHP_VERSION=7.1
|
||||
- stage: PHP 7.0-8.1
|
||||
if: type = pull_request OR type = push
|
||||
php: '8.1'
|
||||
@@ -78,6 +78,9 @@ before_install:
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
|
||||
sudo apt install unzip apache2 php7.0 php7.0-cli php7.0-curl php7.0-mysql php7.0-pgsql php7.0-gd php7.0-imap php7.0-intl php7.0-ldap php7.0-xml php7.0-mbstring php7.0-xml php7.0-zip libapache2-mod-php7.0
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
|
||||
fi
|
||||
@@ -108,6 +111,9 @@ install:
|
||||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php8.1
|
||||
@@ -123,7 +129,8 @@ install:
|
||||
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
sudo chmod -R a+rwx /usr/local/bin/composer
|
||||
composer -V
|
||||
composer -n config -g vendor-dir htdocs/includes
|
||||
sudo composer -n config -g vendor-dir htdocs/includes
|
||||
sudo chmod -R a+rwx /home/travis/.config/composer
|
||||
echo
|
||||
|
||||
- |
|
||||
@@ -201,8 +208,8 @@ before_script:
|
||||
phpcs -i | head -
|
||||
# Check PHP Vardump check version
|
||||
echo "PHP Vardump check version"
|
||||
which var_dump_check
|
||||
var_dump_check --version
|
||||
which var-dump-check
|
||||
var-dump-check --version
|
||||
# Check PHPUnit version
|
||||
echo "PHPUnit version"
|
||||
which phpunit
|
||||
@@ -253,8 +260,8 @@ before_script:
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
|
||||
echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
#echo '\d llx_adherent' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
#echo '\d llx_c_country' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
|
||||
|
||||
# Create pgsql compatibility functions
|
||||
psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' < htdocs/install/pgsql/functions/functions.sql
|
||||
@@ -472,11 +479,9 @@ script:
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
if [ "$TRAVIS_PHP_VERSION" != '7.0' ]; then
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
fi
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
after_script:
|
||||
|
||||
@@ -4,7 +4,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
|
||||
***** ChangeLog for 17.0.4 compared to 17.0.3 *****
|
||||
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
|
||||
FIX: $this->newref already exists and could have been modified by a trigger but we still use a local variable for the filesystem-based renaming
|
||||
FIX: 16.0 only, backport fix for SQL error on global search product
|
||||
FIX: 17.0: deprecated field should only be a fallback
|
||||
FIX: 17.0 PHP8: supplier invoice class:
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast" />
|
||||
|
||||
<rule ref="Generic.Functions.CallTimePassByReference" />
|
||||
<!-- <rule ref="Generic.Functions.CallTimePassByReference" /> -->
|
||||
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
|
||||
|
||||
|
||||
@@ -676,7 +676,7 @@ if (count($filter) > 0) {
|
||||
} elseif ($key == 't.reconciled_option') {
|
||||
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1);
|
||||
} else {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
}
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
if (is_array($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1);
|
||||
} else {
|
||||
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,9 @@ if ($action == "set") {
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
} elseif (!$error) {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
|
||||
@@ -65,7 +65,7 @@ if (isModEnabled('ficheinter')) {
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'banks'));
|
||||
$langs->loadLangs(array('companies', 'banks', 'commercial'));
|
||||
|
||||
if (isModEnabled('contrat')) {
|
||||
$langs->load("contracts");
|
||||
|
||||
@@ -191,7 +191,6 @@ class Propal extends CommonObject
|
||||
public $fin_validite;
|
||||
|
||||
public $user_author_id;
|
||||
public $user_valid_id;
|
||||
public $user_close_id;
|
||||
|
||||
/**
|
||||
@@ -1456,7 +1455,9 @@ class Propal extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = 0;
|
||||
|
||||
$object->user_validation_id = 0;
|
||||
|
||||
$object->date = $now;
|
||||
$object->datep = $now; // deprecated
|
||||
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
|
||||
@@ -1651,7 +1652,7 @@ class Propal extends CommonObject
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
$this->user_close_id = $obj->fk_user_cloture;
|
||||
|
||||
//Incoterms
|
||||
@@ -1753,7 +1754,7 @@ class Propal extends CommonObject
|
||||
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
|
||||
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
|
||||
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
|
||||
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_user_valid = ".(!empty($this->user_validation_id) ? (int) $this->user_validation_id : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||
$sql .= " deposit_percent=".(!empty($this->deposit_percent) ? "'".$this->db->escape($this->deposit_percent)."'" : "null").",";
|
||||
@@ -2046,7 +2047,7 @@ class Propal extends CommonObject
|
||||
$this->ref = $num;
|
||||
$this->brouillon = 0;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
$this->user_valid_id = $user->id;
|
||||
$this->user_validation_id = $user->id;
|
||||
$this->datev = $now;
|
||||
|
||||
$this->db->commit();
|
||||
@@ -3321,9 +3322,7 @@ class Propal extends CommonObject
|
||||
$this->user_creation = $cuser;
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_signature) {
|
||||
|
||||
@@ -2872,7 +2872,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
// Create a purchase order
|
||||
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
|
||||
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) {
|
||||
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfProductsLines() > 0) {
|
||||
if ($usercancreatepurchaseorder) {
|
||||
print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id, '');
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ class Commande extends CommonOrder
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1507,6 +1507,9 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
foreach ($TTotalByTva as $tva => &$total) {
|
||||
if (empty($amountdeposit[$tva])) {
|
||||
$amountdeposit[$tva] = 0;
|
||||
}
|
||||
$coef = $total / $srcobject->total_ttc; // Calc coef
|
||||
$am = $amount * $coef;
|
||||
$amount_ttc_diff += $am;
|
||||
@@ -1531,6 +1534,9 @@ if (empty($reshook)) {
|
||||
if ($qualified) {
|
||||
$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
|
||||
$tva_tx = $lines[$i]->tva_tx;
|
||||
if (empty($amountdeposit[$tva_tx])) {
|
||||
$amountdeposit[$tva_tx] = 0;
|
||||
}
|
||||
$amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ class Invoices extends DolibarrApi
|
||||
* @return int
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 403 Access not allowed for login
|
||||
* @throws RestException 404
|
||||
* @throws RestException 405
|
||||
*/
|
||||
@@ -349,6 +350,9 @@ class Invoices extends DolibarrApi
|
||||
if (empty($orderid)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $orderid)) {
|
||||
throw new RestException(403, 'Access not allowed on order for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$order = new Commande($this->db);
|
||||
$result = $order->fetch($orderid);
|
||||
|
||||
@@ -979,13 +979,13 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
if (!$error && $this->fac_rec > 0) {
|
||||
foreach ($_facrec->lines as $i => $val) {
|
||||
// For line from template invoice, we use data from template invoice
|
||||
/*
|
||||
if ($_facrec->lines[$i]->fk_product) {
|
||||
$prod = new Product($this->db);
|
||||
$res = $prod->fetch($_facrec->lines[$i]->fk_product);
|
||||
}
|
||||
|
||||
// For line from template invoice, we use data from template invoice
|
||||
/*
|
||||
$tva_tx = get_default_tva($mysoc,$soc,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$soc,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
@@ -1238,7 +1238,7 @@ class Facture extends CommonInvoice
|
||||
$object->socid = $objsoc->id;
|
||||
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||
$object->fk_project = '';
|
||||
$object->fk_project = null;
|
||||
$object->fk_delivery_address = '';
|
||||
}
|
||||
|
||||
@@ -1256,6 +1256,7 @@ class Facture extends CommonInvoice
|
||||
$object->fk_user_author = $user->id;
|
||||
$object->fk_user_valid = null;
|
||||
$object->fk_facture_source = 0;
|
||||
$object->fk_fac_rec_source = null;
|
||||
$object->date_creation = '';
|
||||
$object->date_modification = '';
|
||||
$object->date_validation = '';
|
||||
@@ -5496,220 +5497,223 @@ class Facture extends CommonInvoice
|
||||
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!$error) {
|
||||
// Load event
|
||||
$res = $tmpinvoice->fetch($obj->id);
|
||||
if ($res > 0) {
|
||||
$tmpinvoice->fetch_thirdparty();
|
||||
// Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop
|
||||
$loopError = 0;
|
||||
|
||||
$outputlangs = new Translate('', $conf);
|
||||
if ($tmpinvoice->thirdparty->default_lang) {
|
||||
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(array("main", "bills"));
|
||||
} else {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
// Load event
|
||||
$res = $tmpinvoice->fetch($obj->id);
|
||||
if ($res > 0) {
|
||||
$tmpinvoice->fetch_thirdparty();
|
||||
|
||||
// Select email template
|
||||
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
|
||||
if (is_numeric($arraymessage) && $arraymessage <= 0) {
|
||||
$langs->load("errors");
|
||||
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
|
||||
return 0;
|
||||
}
|
||||
$outputlangs = new Translate('', $conf);
|
||||
if ($tmpinvoice->thirdparty->default_lang) {
|
||||
$outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(array("main", "bills"));
|
||||
} else {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
// Select email template
|
||||
$arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template));
|
||||
if (is_numeric($arraymessage) && $arraymessage <= 0) {
|
||||
$langs->load("errors");
|
||||
$this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
|
||||
// PREPARE EMAIL
|
||||
$errormesg = '';
|
||||
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice);
|
||||
|
||||
// Topic
|
||||
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice);
|
||||
|
||||
// Content
|
||||
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
|
||||
// Topic
|
||||
$sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
|
||||
// Content
|
||||
$content = $outputlangs->transnoentitiesnoconv($arraymessage->content);
|
||||
|
||||
// Recipient
|
||||
$to = array();
|
||||
if ($forcerecipient) { // If a recipient was forced
|
||||
$to = array($forcerecipient);
|
||||
} else {
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
$tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
|
||||
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
|
||||
foreach ($tmparraycontact as $data_email) {
|
||||
if (!empty($data_email['email'])) {
|
||||
$to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
|
||||
}
|
||||
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
|
||||
|
||||
// Recipient
|
||||
$to = array();
|
||||
if ($forcerecipient) { // If a recipient was forced
|
||||
$to = array($forcerecipient);
|
||||
} else {
|
||||
$res = $tmpinvoice->fetch_thirdparty();
|
||||
$recipient = $tmpinvoice->thirdparty;
|
||||
if ($res > 0) {
|
||||
$tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
|
||||
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
|
||||
foreach ($tmparraycontact as $data_email) {
|
||||
if (!empty($data_email['email'])) {
|
||||
$to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
|
||||
}
|
||||
}
|
||||
if (empty($to) && !empty($recipient->email)) {
|
||||
$to[] = $recipient->email;
|
||||
}
|
||||
if (empty($to)) {
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
|
||||
$error++;
|
||||
}
|
||||
if (empty($to) && !empty($recipient->email)) {
|
||||
$to[] = $recipient->email;
|
||||
}
|
||||
if (empty($to)) {
|
||||
$errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for invoice or customer.";
|
||||
$loopError++;
|
||||
}
|
||||
} else {
|
||||
$errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority
|
||||
$from = $arraymessage->email_from;
|
||||
}
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error && !empty($to)) {
|
||||
$this->db->begin();
|
||||
|
||||
$to = implode(',', $to);
|
||||
if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it
|
||||
$to = $to.','.$arraymessage->email_to;
|
||||
}
|
||||
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
$trackid = 'inv'.$tmpinvoice->id;
|
||||
$sendcontext = 'standard';
|
||||
|
||||
$email_tocc = '';
|
||||
if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it
|
||||
$email_tocc = $arraymessage->email_tocc;
|
||||
}
|
||||
|
||||
$email_tobcc = '';
|
||||
if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it
|
||||
$email_tobcc = $arraymessage->email_tobcc;
|
||||
}
|
||||
|
||||
//join file is asked
|
||||
$joinFile = [];
|
||||
$joinFileName = [];
|
||||
$joinFileMime = [];
|
||||
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
|
||||
$joinFile[] = DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc;
|
||||
$joinFileName[] = basename($tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc);
|
||||
}
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
|
||||
$actioncomm->note_private = $sendContent;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
$actioncomm->elementtype = 'invoice';
|
||||
$actioncomm->fk_element = $tmpinvoice->id;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
} else {
|
||||
$errormesg = $cMailFile->error.' : '.$to;
|
||||
$error++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
|
||||
$actioncomm->note_private = $errormesg;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
|
||||
$this->db->commit(); // We always commit
|
||||
}
|
||||
|
||||
if ($errormesg) {
|
||||
$errorsMsg[] = $errormesg;
|
||||
}
|
||||
} else {
|
||||
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Sender
|
||||
$from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
|
||||
if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority
|
||||
$from = $arraymessage->email_from;
|
||||
}
|
||||
if (empty($from)) {
|
||||
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
if (!$loopError && !empty($to)) {
|
||||
$this->db->begin();
|
||||
|
||||
$to = implode(',', $to);
|
||||
if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it
|
||||
$to = $to.','.$arraymessage->email_to;
|
||||
}
|
||||
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
$trackid = 'inv'.$tmpinvoice->id;
|
||||
$sendcontext = 'standard';
|
||||
|
||||
$email_tocc = '';
|
||||
if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it
|
||||
$email_tocc = $arraymessage->email_tocc;
|
||||
}
|
||||
|
||||
$email_tobcc = '';
|
||||
if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it
|
||||
$email_tobcc = $arraymessage->email_tobcc;
|
||||
}
|
||||
|
||||
//join file is asked
|
||||
$joinFile = [];
|
||||
$joinFileName = [];
|
||||
$joinFileMime = [];
|
||||
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
|
||||
$joinFile[] = DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc;
|
||||
$joinFileName[] = basename($tmpinvoice->last_main_doc);
|
||||
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc);
|
||||
}
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
|
||||
$actioncomm->note_private = $sendContent;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
$actioncomm->elementtype = 'invoice';
|
||||
$actioncomm->fk_element = $tmpinvoice->id;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
} else {
|
||||
$errormesg = $cMailFile->error.' : '.$to;
|
||||
$loopError++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
|
||||
$actioncomm->note_private = $errormesg;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
|
||||
$this->db->commit(); // We always commit
|
||||
}
|
||||
|
||||
if ($errormesg) {
|
||||
$errorsMsg[] = $errormesg;
|
||||
}
|
||||
} else {
|
||||
$errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id;
|
||||
$loopError++;
|
||||
}
|
||||
|
||||
$error += $loopError;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->output .= 'Nb of emails sent : '.$nbMailSend;
|
||||
return 0;
|
||||
} else {
|
||||
if ($error > 0) { // If there is at least an error, early return with specific message
|
||||
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
|
||||
return $error;
|
||||
}
|
||||
|
||||
$this->output .= 'Nb of emails sent : '.$nbMailSend;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -597,7 +597,7 @@ if (empty($reshook)) {
|
||||
$info_bits |= 0x01;
|
||||
}
|
||||
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('produit', 'ignore_price_min_advance'))
|
||||
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
||||
$result = -1;
|
||||
@@ -1815,7 +1815,7 @@ if ($action == 'create') {
|
||||
$moreparam = 'style="display: none;"';
|
||||
}
|
||||
print '<tr class="oddeven" '.$moreparam.'>';
|
||||
print '<td class="tdhrthin" colspan="'.($conf->margin->enabled ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
|
||||
print '<td class="tdhrthin" colspan="'.(isModEnabled('margin') ? 7 : 6).'"><hr class="opacitymedium tdhrthin"></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@@ -1828,7 +1828,7 @@ if ($action == 'create') {
|
||||
/*
|
||||
* Confirmation to delete service line of contract
|
||||
*/
|
||||
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
|
||||
if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("DeleteContractLine"), $langs->trans("ConfirmDeleteContractLine"), "confirm_deleteline", '', 0, 1);
|
||||
if ($ret == 'html') {
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr class="oddeven" height="6"><td></td></tr></table>';
|
||||
@@ -1838,7 +1838,7 @@ if ($action == 'create') {
|
||||
/*
|
||||
* Confirmation to move service toward another contract
|
||||
*/
|
||||
if ($action == 'move' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
|
||||
if ($action == 'move' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) {
|
||||
$arraycontractid = array();
|
||||
foreach ($arrayothercontracts as $contractcursor) {
|
||||
$arraycontractid[$contractcursor->id] = $contractcursor->ref;
|
||||
@@ -1942,7 +1942,9 @@ if ($action == 'create') {
|
||||
if ($objp->fk_product > 0) {
|
||||
$product = new Product($db);
|
||||
$product->fetch($objp->fk_product);
|
||||
$dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
|
||||
if (!empty($product->duration_value) && !empty($product->duration_unit)) {
|
||||
$dateactend = dol_time_plus_duree(time(), $product->duration_value, $product->duration_unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2035,7 +2037,7 @@ if ($action == 'create') {
|
||||
print '</div>';
|
||||
|
||||
// Form to add new line
|
||||
if ($user->rights->contrat->creer && ($object->statut == 0)) {
|
||||
if ($user->hasRight('contrat', 'creer') && ($object->statut == 0)) {
|
||||
$dateSelector = 1;
|
||||
|
||||
print "\n";
|
||||
@@ -2098,7 +2100,7 @@ if ($action == 'create') {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->statut == 1) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->hasRight('contrat', 'creer'))) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
||||
@@ -2107,7 +2109,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
if ($object->statut == 0 && $nbofservices) {
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
||||
@@ -2115,7 +2117,7 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
if ($object->statut == 1) {
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
||||
} else {
|
||||
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
|
||||
@@ -2175,7 +2177,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($user->hasRight('contrat', 'creer')) {
|
||||
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
@@ -2195,8 +2197,8 @@ if ($action == 'create') {
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $user->rights->contrat->lire;
|
||||
$delallowed = $user->rights->contrat->creer;
|
||||
$genallowed = $user->hasRight('contrat', 'lire');
|
||||
$delallowed = $user->hasRight('contrat', 'creer');
|
||||
|
||||
|
||||
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
@@ -3079,7 +3079,7 @@ class ContratLigne extends CommonObjectLine
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref of contract line
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >0 if OK, 0 if not found
|
||||
*/
|
||||
public function fetch($id, $ref = '')
|
||||
{
|
||||
@@ -3200,6 +3200,9 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->rang = $obj->rang;
|
||||
|
||||
$this->fetch_optionals();
|
||||
} else {
|
||||
$this->db->free($resql);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
@@ -583,7 +583,6 @@ abstract class CommonObject
|
||||
*/
|
||||
public $fk_user_modif;
|
||||
|
||||
|
||||
public $next_prev_filter;
|
||||
|
||||
/**
|
||||
@@ -605,6 +604,10 @@ abstract class CommonObject
|
||||
protected $labelStatus;
|
||||
protected $labelStatusShort;
|
||||
|
||||
/**
|
||||
* @var string output
|
||||
*/
|
||||
public $output;
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
@@ -8452,7 +8455,7 @@ abstract class CommonObject
|
||||
$("#"+child_list).hide();
|
||||
//Show mother lists
|
||||
} else if ($("#"+parent_list).val() != 0){
|
||||
$("#"+parent_list).show();
|
||||
showOptions'.$type.'(child_list, parent_list, orig_select[child_list]);
|
||||
}
|
||||
//Show the child list if the parent list value is selected
|
||||
$("select[name=\""+parent_list+"\"]").click(function() {
|
||||
|
||||
@@ -7821,6 +7821,8 @@ class Form
|
||||
if ($tmpfieldstoshow) {
|
||||
$fieldstoshow = $tmpfieldstoshow;
|
||||
}
|
||||
} else if ($objecttmp->element === 'category') {
|
||||
$fieldstoshow = 't.label';
|
||||
} else {
|
||||
// For backward compatibility
|
||||
$objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1);
|
||||
|
||||
@@ -669,6 +669,12 @@ class Notify
|
||||
'notification'
|
||||
);
|
||||
|
||||
if (! empty($mailfile->error) || ! empty($mailfile->errors)) {
|
||||
$this->error = $mailfile->error;
|
||||
$this->errors = $mailfile->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($mailfile->sendfile()) {
|
||||
if ($obj->type_target == 'touserid') {
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||
@@ -933,6 +939,12 @@ class Notify
|
||||
'notification'
|
||||
);
|
||||
|
||||
if (! empty($mailfile->error) || ! empty($mailfile->errors)) {
|
||||
$this->error = $mailfile->error;
|
||||
$this->errors = $mailfile->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($mailfile->sendfile()) {
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";
|
||||
|
||||
@@ -155,12 +155,13 @@ 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
|
||||
* @param int $allowsspace 1=Allow space char
|
||||
* @return string String escaped
|
||||
*/
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0)
|
||||
public function sanitize($stringtosanitize, $allowsimplequote = 0, $allowsequals = 0, $allowsspace = 0)
|
||||
{
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').']/i', '', $stringtosanitize);
|
||||
return preg_replace('/[^a-z0-9_\-\.,'.($allowsequals ? '=' : '').($allowsimplequote ? "\'" : '').($allowsspace ? ' ' : '').']/i', '', $stringtosanitize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -718,7 +718,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
public function escape($stringtoencode)
|
||||
{
|
||||
return pg_escape_string($stringtoencode);
|
||||
return pg_escape_string($this->db, $stringtoencode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1292,6 +1292,40 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
|
||||
// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php)
|
||||
function showOptions(child_list, parent_list) {
|
||||
var parentInput = $("select[name="+parent_list+"]");
|
||||
if (parentInput.length === 0) { // when parent extra-field is in view mode and the child is edited directly on card (on line edit)
|
||||
parentInput = $("input[name="+parent_list+"]");
|
||||
}
|
||||
if (parentInput.length > 0) {
|
||||
var val = parentInput.val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if (val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").prop("disabled", true).hide(); // hide not work with select2 element so disabled it
|
||||
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").prop('disabled', false).show(); // show not work with select2 element so enabled it
|
||||
} else {
|
||||
$("select[name=\""+child_list+"\"] option").prop("disabled", false).show(); // show not work with select2 element so enabled it
|
||||
}
|
||||
}
|
||||
}
|
||||
function setListDependencies() {
|
||||
console.log("setListDependencies");
|
||||
jQuery("select option[parent]").parent().each(function() {
|
||||
var child_list = $(this).attr("name");
|
||||
var parent = $(this).find("option[parent]:first").attr("parent");
|
||||
var infos = parent.split(":");
|
||||
var parent_list = infos[0];
|
||||
showOptions(child_list, parent_list);
|
||||
|
||||
/* Activate the handler to call showOptions on each future change */
|
||||
$("select[name=\""+parent_list+"\"]").change(function() {
|
||||
showOptions(child_list, parent_list);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
|
||||
* see: https://github.com/select2/select2/issues/5993
|
||||
@@ -1315,4 +1349,5 @@ $(document).on('select2:open', (e) => {
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
// End of lib_head.js.php
|
||||
|
||||
@@ -1030,16 +1030,35 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0,
|
||||
return 'ErrorBadParameter_num_open_day';
|
||||
}
|
||||
|
||||
//print 'num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday;
|
||||
if ($timestampStart < $timestampEnd) {
|
||||
$numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
|
||||
// --- 1. Calculate Gross Working Days ---
|
||||
// Gross working days = total days in range - non-working days (weekends & public holidays).
|
||||
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $lastday) - num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
|
||||
|
||||
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
|
||||
$nbOpenDay = ($numdays - $numholidays);
|
||||
if ($inhour == 1 && $nbOpenDay <= 3) {
|
||||
$nbOpenDay = ($nbOpenDay * 24);
|
||||
// --- 2. Apply Contextual Half-Day Deductions ---
|
||||
$halfday = (int) $halfday; // Ensure $halfday is an integer for reliable comparisons.
|
||||
|
||||
// Check if start/end days are working days just ONCE to optimize performance
|
||||
// by avoiding redundant calls to the potentially slow num_public_holiday() function.
|
||||
$isStartDayWorking = (num_public_holiday($timestampStart, $timestampStart, $country_code, 1) == 0);
|
||||
$isEndDayWorking = (num_public_holiday($timestampEnd, $timestampEnd, $country_code, 1) == 0);
|
||||
|
||||
// Deduct 0.5 if the leave starts in the afternoon of a working day.
|
||||
if (($halfday == -1 || $halfday == 2) && $isStartDayWorking) {
|
||||
$nbOpenDay -= 0.5;
|
||||
}
|
||||
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
|
||||
|
||||
// Deduct 0.5 if the leave ends in the morning of a different, working day.
|
||||
if (($halfday == 1 || $halfday == 2) && date('Y-m-d', $timestampStart) != date('Y-m-d', $timestampEnd) && $isEndDayWorking) {
|
||||
$nbOpenDay -= 0.5;
|
||||
}
|
||||
|
||||
// --- 3. Return Final Value ---
|
||||
if ($inhour == 1) {
|
||||
return $nbOpenDay * 24;
|
||||
}
|
||||
|
||||
return $nbOpenDay;
|
||||
} elseif ($timestampStart == $timestampEnd) {
|
||||
$numholidays = 0;
|
||||
if ($lastday) {
|
||||
|
||||
@@ -9819,7 +9819,12 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
|
||||
$value = preg_replace('/\s*\|\s*/', '|', $value);
|
||||
|
||||
$crits = explode(' ', $value);
|
||||
//natural mode search type 3 allow spaces into search ...
|
||||
if ($mode == 3 || $mode == -3) {
|
||||
$crits = explode(',', $value);
|
||||
} else {
|
||||
$crits = explode(' ', $value);
|
||||
}
|
||||
$res = '';
|
||||
if (!is_array($fields)) {
|
||||
$fields = array($fields);
|
||||
@@ -9880,7 +9885,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
$listofcodes .= "'".$db->escape($val)."'";
|
||||
}
|
||||
}
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1, 0, 1).")";
|
||||
$i2++; // a criteria for 1 more field was added to string
|
||||
}
|
||||
if ($mode == -3) {
|
||||
|
||||
@@ -401,6 +401,10 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
|
||||
$tableandshare = 'paiementcharge';
|
||||
$parentfortableentity = 'fk_charge@chargesociales';
|
||||
}
|
||||
if ($features == 'evaluation') {
|
||||
$features = 'hrm';
|
||||
$feature2 = 'evaluation';
|
||||
}
|
||||
|
||||
// Get more permissions checks from hooks
|
||||
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
|
||||
@@ -834,7 +838,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
$checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
$checktask = array('projet_task'); // Test for task object
|
||||
$checkhierarchy = array('expensereport', 'holiday'); // check permission among the hierarchy of user
|
||||
$checkhierarchy = array('expensereport', 'holiday', 'hrm'); // check permission among the hierarchy of user
|
||||
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
|
||||
$nocheck = array('barcode', 'stock'); // No test
|
||||
|
||||
@@ -1055,6 +1059,20 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($feature == 'hrm' && in_array('evaluation', $feature2)) {
|
||||
$useridtocheck = $object->fk_user;
|
||||
|
||||
if ($user->hasRight('hrm', 'evaluation', 'readall')) {
|
||||
// the user can view evaluations for anyone
|
||||
return true;
|
||||
}
|
||||
if (!$user->hasRight('hrm', 'evaluation', 'read')) {
|
||||
// the user can't view any evaluations
|
||||
return false;
|
||||
}
|
||||
// the user can only their own evaluations or their subordinates'
|
||||
return in_array($useridtocheck, $childids);
|
||||
}
|
||||
}
|
||||
|
||||
// For some object, we also have to check it is public or owned by user
|
||||
|
||||
@@ -253,6 +253,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
|
||||
} else {
|
||||
//var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element);
|
||||
print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element);
|
||||
print '<input type="hidden" value="' . $value . '" name="options_' . $tmpkeyextra . '" id="options_' . $tmpkeyextra . '"/>'; // it's needed when to get parent value when extra-field list depend on parent extra-field list
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@@ -267,31 +268,6 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
|
||||
print '
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
function showOptions(child_list, parent_list)
|
||||
{
|
||||
var val = $("select[name="+parent_list+"]").val();
|
||||
var parentVal = parent_list + ":" + val;
|
||||
if(val > 0) {
|
||||
$("select[name=\""+child_list+"\"] option[parent]").hide();
|
||||
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
|
||||
} else {
|
||||
$("select[name=\""+child_list+"\"] option").show();
|
||||
}
|
||||
}
|
||||
function setListDependencies() {
|
||||
jQuery("select option[parent]").parent().each(function() {
|
||||
var child_list = $(this).attr("name");
|
||||
var parent = $(this).find("option[parent]:first").attr("parent");
|
||||
var infos = parent.split(":");
|
||||
var parent_list = infos[0];
|
||||
showOptions(child_list, parent_list);
|
||||
|
||||
/* Activate the handler to call showOptions on each future change */
|
||||
$("select[name=\""+parent_list+"\"]").change(function() {
|
||||
showOptions(child_list, parent_list);
|
||||
});
|
||||
});
|
||||
}
|
||||
setListDependencies();
|
||||
});
|
||||
</script>'."\n";
|
||||
|
||||
@@ -77,9 +77,13 @@ class InterfaceNotification extends DolibarrTriggers
|
||||
dol_syslog("Trigger '".$this->name."' for action '".$action."' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$notify = new Notify($this->db);
|
||||
$notify->send($action, $object);
|
||||
$result = $notify->send($action, $object);
|
||||
|
||||
return 1;
|
||||
if ($result < 0) {
|
||||
$this->errors = array_merge($this->errors, empty($notify->error) ? array() : array($notify->error), empty($notify->errors) ? array() : $notify->errors);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -379,9 +379,11 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$message = dol_nl2br($message);
|
||||
}
|
||||
$message_customer .= '<p>'.$langs->trans('Message').' : <br><br>'.$message.'</p><br>';
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||
if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) {
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||
$message_customer .= '<p>'.$langs->trans($see_ticket).' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||
}
|
||||
|
||||
$from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->eventorganization->multidir_output[$object->entity ? $object->entity : $conf->entity]."/conferenceorbooth/".get_exdir(0, 0, 0, 1, $object);
|
||||
}
|
||||
@@ -96,7 +97,6 @@ $permissiontoadd = $user->rights->eventorganization->write; // Used by the inclu
|
||||
$permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->eventorganization->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
|
||||
@@ -96,8 +96,9 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
if (!isModEnabled('hrm')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->enti
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
$isdraft = ($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (!isModEnabled("hrm")) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@@ -62,10 +62,8 @@ $permission = $user->rights->hrm->evaluation->write;
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
//if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
//if (!$permissiontoread) accessforbidden();
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ $permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the includ
|
||||
$permissiontoread = $user->rights->hrm->evaluation->read;
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
$isdraft = $object->status == Evaluation::STATUS_DRAFT ? 1 : 0;
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
|
||||
if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the includ
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
|
||||
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
//if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
//if (!$permissiontoread) accessforbidden();
|
||||
$isdraft = (($object->status == Evaluation::STATUS_DRAFT) ? 1 : 0);
|
||||
restrictedArea($user, $object->element, $object, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
|
||||
if (empty($conf->hrm->enabled)) accessforbidden();
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -332,6 +332,8 @@ ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country;
|
||||
|
||||
ALTER TABLE llx_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255);
|
||||
ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255);
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255);
|
||||
@@ -598,3 +600,172 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
|
||||
|
||||
ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64);
|
||||
|
||||
|
||||
-- ALL tms thanks to regis (commit 111f73bd863c7120a9c13a8fc9ae227a02079cb0)
|
||||
|
||||
ALTER TABLE llx_accounting_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_bookkeeping_tmp CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_accounting_fiscalyear CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_actioncomm_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_actioncomm CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_adherent_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_advtargetemailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_type_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_asset_type CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank_account_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bank CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_blockedlog_authority CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_blockedlog CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bom_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bomline_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bom_bom CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_bordereau_cheque CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_boxes_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_budget_lines CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_budget CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_categories_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_categorie CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_email_senderprofile CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_email_templates CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_field_list CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_chargesociales CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commandedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseurdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_commande CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_comment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_const CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet_log CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contratdet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contrat_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_contrat CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_cronjob CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_c_shipment_mode CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_deplacement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_don_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_don CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_element_resources CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollectoraction CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollectorfilter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_emailcollector_emailcollector CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_entrepot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_establishment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_events CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expeditiondet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expedition_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expedition CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_ik CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport_rules CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facturedet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facturedet_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn_det_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_fourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_rec_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture_rec CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_facture CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinterdet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinter_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_fichinter CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_holiday_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_holiday CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventorydet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_inventory CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_loan_schedule CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_localtax CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing_cibles CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing_unsubscribe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_menu CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_mo_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_mo CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mrp_production CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_notify_def CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_notify CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_online_signatures CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_opensurvey_comments CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_opensurvey_user_studs CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiementcharge CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiementfourn CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_paiement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_donation CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_expensereport CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_loan CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_salary_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_salary CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_payment_various CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_pos_cash_fence CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_printing CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_batch CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_customer_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_fournisseur_price_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_fournisseur_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_lot_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_lot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_price_by_qty CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_price CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_stock_entrepot CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_product_stock CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_task_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_projet_task CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal_merge_pdf_product CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_propal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_reception_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_reception CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_resource_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_resource CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_account CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_address CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_contacts CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_prices CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_remise CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_remise_supplier CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_societe CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_socpeople_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_socpeople CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_stock_mouvement CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_subscription CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposaldet_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposal_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_supplier_proposal CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_ticket_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_ticket CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_tva CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_employment CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_usergroup_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_usergroup CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user_rib CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_user CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website_extrafields CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website_page CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_website CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_zapier_hook CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
@@ -185,13 +185,13 @@ class modMyModule extends DolibarrModules
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'supplier_invoice' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in sale order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'supplier_order' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'supplier_payment' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
|
||||
@@ -307,7 +307,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac
|
||||
}
|
||||
}
|
||||
|
||||
if (!$updateoftaskdone) { // Check to update progress if no update were done on task.
|
||||
if (!$updateoftaskdone && GETPOSTISSET($taskid.'progress')) { // Check to update progress if no update were done on task.
|
||||
$object->fetch($taskid);
|
||||
//var_dump($object->progress);
|
||||
//var_dump(GETPOST($taskid . 'progress', 'int')); exit;
|
||||
|
||||
@@ -718,6 +718,7 @@ class User extends CommonObject
|
||||
'mo' => 'mrp',
|
||||
'order' => 'commande',
|
||||
'produit' => 'product',
|
||||
'productlot' => 'produit',
|
||||
'project' => 'projet',
|
||||
'propale' => 'propal',
|
||||
'shipping' => 'expedition',
|
||||
|
||||
@@ -303,6 +303,42 @@ class DateLibTest extends PHPUnit\Framework\TestCase
|
||||
$result=num_open_day($date1, $date2, 'XX', 1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(3, $result, 'NumOpenDay for XX when saturday + sunday are working days'); // 3 opened day, 0 closes (even if country unknown)
|
||||
|
||||
// Define specific dates for these tests
|
||||
$date_friday_4 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // Friday
|
||||
$date_saturday_5 = dol_mktime(0, 0, 0, 1, 5, 2013, 'gmt'); // Saturday
|
||||
$date_monday_7 = dol_mktime(0, 0, 0, 1, 7, 2013, 'gmt'); // Monday
|
||||
$date_friday_11 = dol_mktime(0, 0, 0, 1, 11, 2013, 'gmt'); // Following Friday
|
||||
|
||||
// Case 1: Weekend Boundary (Friday morning -> Saturday morning)
|
||||
// Expected: 1 day. No half-day deduction for end date on a non-working day.
|
||||
// $starthalfday = 'morning', $endhalfday = 'morning' -> $halfday = 1
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
|
||||
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
|
||||
$result = num_open_day($date_friday_4, $date_saturday_5, 0, 1, 1, 'FR');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1, $result, 'Case 1: Friday morning to Saturday morning should be 1 day');
|
||||
|
||||
// Case 2: Full week with half-day (Friday morning -> Following Friday morning)
|
||||
// Expected: 5.5 days.
|
||||
// $starthalfday = 'morning', $endhalfday = 'morning' -> $halfday = 1
|
||||
$result = num_open_day($date_friday_4, $date_friday_11, 0, 1, 1, 'FR');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(5.5, $result, 'Case 2: Friday morning to next Friday morning should be 5.5 days');
|
||||
|
||||
// Case 3: Single Half-Day (Monday afternoon)
|
||||
// Expected: 0.5 days.
|
||||
// $starthalfday = 'afternoon' -> $halfday = -1
|
||||
$result = num_open_day($date_monday_7, $date_monday_7, 0, 1, -1, 'FR');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0.5, $result, 'Case 3: A single Monday afternoon should be 0.5 days');
|
||||
|
||||
// Case 4: Standard Leave (Monday morning -> Friday evening)
|
||||
// Expected: 5 days.
|
||||
// $starthalfday = 'morning', $endhalfday = 'evening' -> $halfday = 0
|
||||
$result = num_open_day($date_monday_7, $date_friday_11, 0, 1, 0, 'FR');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(5, $result, 'Case 4: Monday morning to Friday evening should be 5 days');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user