';
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index b711a65d25a..f15f8c74743 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -118,6 +118,7 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
$projectRequired = $conf->projet->enabled && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED);
+$fileRequired = !empty($conf->global->EXPENSEREPORT_FILE_IS_REQUIRED);
if ($object->id > 0) {
// Check current user can read this expense report
@@ -1157,6 +1158,12 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors');
}
+ // If no file associated
+ if ($fileRequired && $fk_ecm_files == 0) {
+ $error++;
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
+ }
+
if (!$error) {
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index c0a48b97222..93e20b06afe 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -151,7 +151,6 @@ $sqlusedforexport = '';
$head = array();
$upload_dir = $conf->export->dir_temp.'/'.$user->id;
-//$usefilters=($conf->global->MAIN_FEATURES_LEVEL > 1);
$usefilters = 1;
// Security check
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
old mode 100644
new mode 100755
index ee1f768b60b..a6cf0cb232d
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1,4 +1,4 @@
-
* Copyright (C) 2004-2020 Laurent Destailleur
* Copyright (C) 2004 Christophe Combelles
@@ -2563,11 +2563,11 @@ if ($action == 'create') {
}
// Confirmation set paid
- if ($action == 'paid' && $resteapayer <= 0) {
+ if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1);
}
- if ($action == 'paid' && $resteapayer > 0) {
+ if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) {
$close = array();
// Code
$i = 0;
@@ -2721,8 +2721,12 @@ if ($action == 'create') {
}
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
$facusing = new FactureFournisseur($db);
- $facusing->fetch($object->fk_facture_source);
- print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
+ if ($object->fk_facture_source > 0) {
+ $facusing->fetch($object->fk_facture_source);
+ print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
+ } else {
+ print ' ('.$langs->transnoentities("CorrectedInvoiceNotFound").')';
+ }
}
$facidavoir = $object->getListIdAvoirFromInvoice();
@@ -3496,14 +3500,17 @@ if ($action == 'create') {
}
// Classify paid
- if (($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
- || ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && empty($discount->id))
+ if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && (
+ ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $object->type != FactureFournisseur::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
+ ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
+ ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer)))
+ )
) {
print 'id.'&action=paid">'.$langs->trans('ClassifyPaid').'';
}
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
- if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0) {
+ if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $object->total_ttc != $resteapayer)) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print ''.$langs->trans('ClassifyPaidPartially').'';
diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php
index 6986d75d630..b11b795723c 100644
--- a/htdocs/holiday/document.php
+++ b/htdocs/holiday/document.php
@@ -349,7 +349,7 @@ if ($object->id) {
$permissiontoadd = $user->rights->holiday->write;
$permtoedit = $user->rights->holiday->write;
$param = '&id='.$object->id;
- $relativepathwithnofile = $modulepart.'/'.dol_sanitizeFileName($object->ref).'/';
+ $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
$savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php
index a268f1b30be..115571bb6ba 100644
--- a/htdocs/hrm/class/evaluationdet.class.php
+++ b/htdocs/hrm/class/evaluationdet.class.php
@@ -111,7 +111,7 @@ class Evaluationline extends CommonObject
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
'fk_skill' => array('type'=>'integer:Skill:hrm/class/skill.class.php:1', 'label'=>'Skill', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_evaluation' => array('type'=>'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label'=>'Evaluation', 'enabled'=>'1', 'position'=>3, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
- 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,),
+ 'rankorder' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>'1', 'position'=>4, 'notnull'=>1, 'visible'=>1,),
'required_rank' => array('type'=>'integer', 'label'=>'requiredRank', 'enabled'=>'1', 'position'=>5, 'notnull'=>1, 'visible'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
);
diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php
index 1fb90b907db..c3acdd0982e 100644
--- a/htdocs/hrm/class/skilldet.class.php
+++ b/htdocs/hrm/class/skilldet.class.php
@@ -104,7 +104,7 @@ class Skilldet extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
- 'rank' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,),
+ 'rankorder' => array('type'=>'integer', 'label'=>'rank', 'enabled'=>'1', 'position'=>2, 'notnull'=>0, 'visible'=>2,),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>0,),
diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql
new file mode 100644
index 00000000000..d3a0b38afa9
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_element_tag.key.sql
@@ -0,0 +1,21 @@
+-- ============================================================================
+-- Copyright (C) 2021 Maxime Kohlhaas
+--
+-- 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 .
+--
+-- ============================================================================
+
+ALTER TABLE llx_element_tag ADD UNIQUE INDEX idx_element_tag_uk (fk_categorie, fk_element);
+
+ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql
new file mode 100644
index 00000000000..d43ced98130
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_element_tag.sql
@@ -0,0 +1,25 @@
+-- ============================================================================
+-- Copyright (C) 2021 Maxime Kohlhaas
+--
+-- 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 .
+--
+-- ============================================================================
+
+create table llx_element_tag
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ fk_categorie integer NOT NULL,
+ fk_element integer NOT NULL,
+ import_key varchar(14)
+)ENGINE=innodb;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index c1f3231c737..25bc42046a9 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -523,7 +523,6 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
//print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers.
setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings');
- //if ($conf->global->MAIN_FEATURES_LEVEL >= 1) setEventMessages('Unset POST and GET params by CSRF protection in main.inc.php (Token provided was not generated by the previous page).'." \n".'$_SERVER[REQUEST_URI] = '.$_SERVER['REQUEST_URI'].' $_SERVER[REQUEST_METHOD] = '.$_SERVER['REQUEST_METHOD'].' GETPOST(token) = '.GETPOST('token', 'alpha').' $_SESSION[token] = '.$_SESSION['token'], null, 'warnings');
if (isset($_POST['id'])) $savid = ((int) $_POST['id']);
unset($_POST);
//unset($_POST['action']); unset($_POST['massaction']);
@@ -1437,8 +1436,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
print ''."\n"; // Do not index
print ''."\n"; // Scale for mobile device
print ''."\n";
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- print ''."\n";
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
+ print ''."\n";
}
// Favicon
$favicon = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png';
@@ -1628,11 +1627,6 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
} else {
print ''."\n";
}
- /*if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED'))
- {
- if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print ''."\n";
- else print ''."\n";
- }*/
if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
print ''."\n";
} else {
@@ -1842,8 +1836,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
$appli .= " ".DOL_VERSION;
}
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- $appli .= " ".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
+ $appli .= " ".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 536eb0546cc..2f272ceca1c 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -833,7 +833,7 @@ print '';
print '
';
if (!empty($conf->expedition->enabled)) {
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
print '
';
-if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // What is this for ?
+if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ?
print '
';
print img_picto('', 'bank_account').' ';
@@ -446,15 +446,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code
print '
';
}
-// Warehouse for automatic decrement
-//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment
-//{
-// print '