';
From fdcb9674d8470419daddb3c1b970113117f6a46b Mon Sep 17 00:00:00 2001
From: John BOTELLA
Date: Sun, 24 Oct 2021 02:09:49 +0200
Subject: [PATCH 068/490] Remove prints
---
htdocs/core/class/html.formsetup.class.php | 38 +++++++++++-----------
htdocs/langs/en_US/admin.lang | 1 +
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index 095cf0d8887..27b0e3fb615 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -69,7 +69,7 @@ class formSetup{
$out.= ' '.$this->langs->trans("Value").' ';
$out.= '';
- foreach ($this->arrayOfParameters as $const => $item) {
+ foreach ($this->arrayOfParameters as $item) {
$out.= $this->generateLineOutput($item, $edit);
}
@@ -98,10 +98,10 @@ class formSetup{
$out.= '';
if($edit){
- $item->generateInputField();
+ $out.= $item->generateInputField();
}
else{
- $item->generateOutputField();
+ $out.= $item->generateOutputField();
}
if(!empty($item->errors)){
@@ -125,7 +125,6 @@ class formSetup{
public function addItemsFromParamsArray($params){
if(!array($params)){ return false; }
-
foreach ($params as $confKey => $param){
$this->addItemFromParams($confKey, $param); // todo manage error
}
@@ -139,7 +138,7 @@ class formSetup{
*/
public function addItemFromParams($confKey, $params){
- if(empty($confKey) || !empty($params['type'])){ return false; }
+ if(empty($confKey) || empty($params['type'])){ return false; }
/*
* Exemple from old module builder setup page
@@ -155,13 +154,14 @@ class formSetup{
$item = new formSetupItem($this->db);
$item->type = $params['type'];
+ $item->confKey = $confKey;
if(!empty($params['enabled'])) {
$item->enabled = $params['enabled'];
}
if(!empty($params['css'])){
- $item->enabled = $params['css'];
+ $item->cssClass = $params['css'];
}
$this->arrayOfParameters[$item->confKey] = $item;
@@ -233,7 +233,7 @@ class formSetupItem
public function getNameText(){
if(!empty($this->nameText)){ return $this->nameText; }
- return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : '');
+ return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey',$this->confKey));
}
public function generateInputField(){
@@ -313,7 +313,7 @@ class formSetupItem
$this->form->select_produits($selected, $this->confKey, '', 0);
}
} else {
- $out.= ' ';
+ $out.= ' ';
}
return $out;
@@ -347,11 +347,11 @@ class formSetupItem
$out = '';
if ($this->type == 'textarea') {
- print dol_nl2br($conf->global->{$this->confKey});
+ $out.= dol_nl2br($conf->global->{$this->confKey});
} elseif ($this->type== 'html') {
- print $conf->global->{$this->confKey};
+ $out.= $conf->global->{$this->confKey};
} elseif ($this->type == 'yesno') {
- print ajax_constantonoff($this->confKey);
+ $out.= ajax_constantonoff($this->confKey);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
@@ -362,7 +362,7 @@ class formSetupItem
if ($template<0) {
$this->setErrors($formmail->errors);
}
- print $this->langs->trans($template->label);
+ $out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
$c = new Categorie($this->db);
$result = $c->fetch($conf->global->{$this->confKey});
@@ -374,27 +374,27 @@ class formSetupItem
foreach ($ways as $way) {
$toprint[] = 'color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . ' ';
}
- print '' . implode(' ', $toprint) . ' ';
+ $out.= '' . implode(' ', $toprint) . ' ';
} elseif (preg_match('/thirdparty_type/', $this->type)) {
if ($conf->global->{$this->confKey}==2) {
- print $this->langs->trans("Prospect");
+ $out.= $this->langs->trans("Prospect");
} elseif ($conf->global->{$this->confKey}==3) {
- print $this->langs->trans("ProspectCustomer");
+ $out.= $this->langs->trans("ProspectCustomer");
} elseif ($conf->global->{$this->confKey}==1) {
- print $this->langs->trans("Customer");
+ $out.= $this->langs->trans("Customer");
} elseif ($conf->global->{$this->confKey}==0) {
- print $this->langs->trans("NorProspectNorCustomer");
+ $out.= $this->langs->trans("NorProspectNorCustomer");
}
} elseif ($this->type == 'product') {
$product = new Product($this->db);
$resprod = $product->fetch($conf->global->{$this->confKey});
if ($resprod > 0) {
- print $product->ref;
+ $out.= $product->ref;
} elseif ($resprod < 0) {
$this->setErrors($product->errors);
}
} else {
- print $conf->global->{$this->confKey};
+ $out.= $conf->global->{$this->confKey};
}
return $out;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index f75ba12abe5..96fba681373 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -2198,3 +2198,4 @@ SkinAndColors=Skin and colors
IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sales tax
IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sales tax
PDF_USE_1A=Generate PDF with PDF/A-1b format
+MissingTranslationForConfKey = Missing translation for %s
From 61576dad539cc363fa3efdfbb55e9f9512cb5cf7 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Sun, 24 Oct 2021 00:17:18 +0000
Subject: [PATCH 069/490] Fixing style errors.
---
htdocs/core/class/html.formsetup.class.php | 73 ++++++++++++----------
1 file changed, 39 insertions(+), 34 deletions(-)
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index 27b0e3fb615..70dd11e47ae 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -19,7 +19,8 @@
/**
* This class help you create setup render
*/
-class formSetup{
+class formSetup
+{
/**
* @var DoliDB Database handler.
@@ -48,10 +49,9 @@ class formSetup{
$this->db = $db;
$this->form = new Form($this->db);
- if($outputLangs){
+ if ($outputLangs) {
$this->langs = $outputLangs;
- }
- else{
+ } else {
$this->langs = $langs;
}
}
@@ -59,7 +59,8 @@ class formSetup{
/**
* @return string
*/
- public function generateOutput($edit = false){
+ public function generateOutput($edit = false)
+ {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@@ -82,7 +83,8 @@ class formSetup{
* @param bool $edit
* @return string
*/
- public function generateLineOutput($item, $edit = false){
+ public function generateLineOutput($item, $edit = false)
+ {
$out = '';
if ($item->enabled==1) {
@@ -97,14 +99,13 @@ class formSetup{
$out.= '';
- if($edit){
+ if ($edit) {
$out.= $item->generateInputField();
- }
- else{
+ } else {
$out.= $item->generateOutputField();
}
- if(!empty($item->errors)){
+ if (!empty($item->errors)) {
// TODO : move set event message in a methode to be called by cards not by this class
setEventMessages(null, $item->errors, 'errors');
}
@@ -122,10 +123,11 @@ class formSetup{
* @param array $params
* @
*/
- public function addItemsFromParamsArray($params){
+ public function addItemsFromParamsArray($params)
+ {
- if(!array($params)){ return false; }
- foreach ($params as $confKey => $param){
+ if (!array($params)) { return false; }
+ foreach ($params as $confKey => $param) {
$this->addItemFromParams($confKey, $param); // todo manage error
}
}
@@ -136,9 +138,10 @@ class formSetup{
* @param string $confKey
* @param array $params
*/
- public function addItemFromParams($confKey, $params){
+ public function addItemFromParams($confKey, $params)
+ {
- if(empty($confKey) || empty($params['type'])){ return false; }
+ if (empty($confKey) || empty($params['type'])) { return false; }
/*
* Exemple from old module builder setup page
@@ -156,11 +159,11 @@ class formSetup{
$item->type = $params['type'];
$item->confKey = $confKey;
- if(!empty($params['enabled'])) {
+ if (!empty($params['enabled'])) {
$item->enabled = $params['enabled'];
}
- if(!empty($params['css'])){
+ if (!empty($params['css'])) {
$item->cssClass = $params['css'];
}
@@ -168,7 +171,6 @@ class formSetup{
return true;
}
-
}
@@ -226,20 +228,23 @@ class formSetupItem
$this->confKey = $confKey;
}
- public function getHelpText(){
- if(!empty($this->helpText)){ return $this->helpText; }
+ public function getHelpText()
+ {
+ if (!empty($this->helpText)) { return $this->helpText; }
return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');
}
- public function getNameText(){
- if(!empty($this->nameText)){ return $this->nameText; }
- return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey',$this->confKey));
+ public function getNameText()
+ {
+ if (!empty($this->nameText)) { return $this->nameText; }
+ return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
}
- public function generateInputField(){
+ public function generateInputField()
+ {
global $conf, $user;
- if(!empty($this->fieldOverride)){
+ if (!empty($this->fieldOverride)) {
return $this->fieldOverride;
}
@@ -324,23 +329,24 @@ class formSetupItem
* add error
* @param array|string $errors
*/
- public function setErrors($errors){
- if(is_array($errors)){
- if(!empty($errors)){
- foreach ($errors as $error){
+ public function setErrors($errors)
+ {
+ if (is_array($errors)) {
+ if (!empty($errors)) {
+ foreach ($errors as $error) {
$this->setErrors($error);
}
}
- }
- elseif(!empty($errors)){
+ } elseif (!empty($errors)) {
$this->errors[] = $errors;
}
}
- public function generateOutputField(){
+ public function generateOutputField()
+ {
global $conf, $user;
- if(!empty($this->fieldOverride)){
+ if (!empty($this->fieldOverride)) {
return $this->fieldOverride;
}
@@ -399,5 +405,4 @@ class formSetupItem
return $out;
}
-
}
From 3fae8d1756c5653f295194a5c40eac7900716de8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:25:35 +0200
Subject: [PATCH 070/490] fix warnings
---
htdocs/eventorganization/conferenceorbooth_list.php | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 0deb1707cfc..198f169a390 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -421,7 +421,7 @@ if ($projectid > 0) {
// Show message
$message = 'entity : "");
- $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...'));
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').' ';
print $message;
print " ";
@@ -433,7 +433,7 @@ if ($projectid > 0) {
//print '';
print ' ';
$linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id);
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
+ $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
$linksuggest .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print ' ';
@@ -450,7 +450,7 @@ if ($projectid > 0) {
//print '';
print '
';
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_new.php?id='.((int) $project->id).'&type=global';
- $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5');
+ $encodedsecurekey = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY').'conferenceorbooth'.((int) $project->id), 'md5');
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
//print '';
//print '
';
@@ -698,6 +698,7 @@ print '
';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
+ $searchkey = (empty($search[$key]) ? '' : $search[$key]);
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@@ -710,11 +711,11 @@ foreach ($object->fields as $key => $val) {
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
- print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $searchkey, $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
- print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
+ print $object->showInputField($val, $key, $searchkey, '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- print ' ';
+ print ' ';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
From 6d2cedb439088c2951946a1cb4a696aa8543f6ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:33:54 +0200
Subject: [PATCH 071/490] Fix Undefined array key
Fix Undefined array key 1 in htdocs/core/lib/project.lib.php on line 314
---
htdocs/core/lib/project.lib.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index bbc6da6a7e4..c66bcdfc2d8 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -311,7 +311,7 @@ function project_prepare_head(Project $project, $moreparam = '')
}
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id;
- $head[$h][1] .= $langs->trans("Events");
+ $head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
From 6b3916a7b303b2e8a41eede658809ebc491b9bae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:46:58 +0200
Subject: [PATCH 072/490] fix warnings in ticket list
---
htdocs/ticket/list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 2566ee81073..97bcef197e6 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -390,7 +390,7 @@ foreach ($search as $key => $val) {
}
continue;
}
- $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
+ $mode_search = ((!empty($object->fields[$key]) && ($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))) ? 1 : 0);
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], $mode_search);
}
@@ -560,7 +560,7 @@ if ($projectid > 0 || $project_ref) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
From 13f04053a1194f3dfe6117da56693db409d5cbe0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:48:30 +0200
Subject: [PATCH 073/490] fix warnings in ticket list
---
htdocs/ticket/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 97bcef197e6..1b3e035e37d 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -560,7 +560,7 @@ if ($projectid > 0 || $project_ref) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if (!empty($object->thirdparty) && $object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
From d240a9f7748869a4ceb11880f2b8f5af65fa5dfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 09:59:30 +0200
Subject: [PATCH 074/490] fix warnings in ticket list
---
htdocs/projet/card.php | 4 ++--
htdocs/projet/contact.php | 4 ++--
htdocs/projet/document.php | 2 +-
htdocs/projet/element.php | 6 +++---
htdocs/projet/note.php | 4 ++--
htdocs/projet/tasks.php | 4 ++--
htdocs/projet/tasks/time.php | 6 +++---
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 432fc888d65..091d20c24d6 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -1006,13 +1006,13 @@ if ($action == 'create' && $user->rights->projet->creer) {
$morehtmlref .= dol_escape_htmltag($object->title);
// Thirdparty
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : ';
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 68d12df3bcd..48f12e23ec4 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -294,13 +294,13 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index df31724d07c..9ac87b46084 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -134,7 +134,7 @@ if ($object->id > 0) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 252dafddb5d..66288159f39 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -164,7 +164,7 @@ if ($id == '' && $ref == '') {
exit();
}
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
@@ -216,13 +216,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " te.rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 9fee6615c40..3c32bd528a4 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -33,7 +33,7 @@ $action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
@@ -100,7 +100,7 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 666f7d8343a..80d39cf08d4 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -550,13 +550,13 @@ if ($id > 0 || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index d171d130a41..4bb5ab8e503 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -719,7 +719,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'));
- $param = ($mode == 'mine' ? '&mode=mine' : '');
+ $param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : '');
// Project card
@@ -729,13 +729,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
// Title
$morehtmlref .= $projectstatic->title;
// Thirdparty
- if ($projectstatic->thirdparty->id > 0) {
+ if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
From cc374e9eb18b660f0d9b45c99af34f677b39ee35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:02:12 +0200
Subject: [PATCH 075/490] fix warnings in ticket list
---
htdocs/core/boxes/box_project.php | 4 ++--
htdocs/core/boxes/box_task.php | 4 ++--
htdocs/core/boxes/box_validated_projects.php | 2 +-
htdocs/core/lib/security.lib.php | 2 +-
htdocs/eventorganization/conferenceorbooth_card.php | 2 +-
htdocs/eventorganization/conferenceorbooth_contact.php | 2 +-
htdocs/eventorganization/conferenceorbooth_document.php | 2 +-
htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +-
htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +-
htdocs/projet/class/project.class.php | 4 ++--
htdocs/projet/class/projectstats.class.php | 4 ++--
htdocs/projet/class/task.class.php | 4 ++--
htdocs/projet/comment.php | 4 ++--
htdocs/projet/document.php | 2 +-
htdocs/projet/ganttview.php | 4 ++--
htdocs/projet/info.php | 4 ++--
htdocs/projet/list.php | 4 ++--
htdocs/projet/note.php | 2 +-
htdocs/projet/tasks/comment.php | 2 +-
htdocs/projet/tasks/contact.php | 2 +-
htdocs/projet/tasks/document.php | 2 +-
htdocs/projet/tasks/list.php | 4 ++--
htdocs/projet/tasks/note.php | 2 +-
htdocs/projet/tasks/task.php | 2 +-
htdocs/ticket/card.php | 2 +-
htdocs/ticket/list.php | 2 +-
26 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php
index f14ab699690..63a4e90cdd0 100644
--- a/htdocs/core/boxes/box_project.php
+++ b/htdocs/core/boxes/box_project.php
@@ -94,7 +94,7 @@ class box_project extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -102,7 +102,7 @@ class box_project extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql .= " AND p.fk_statut = 1"; // Only open projects
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index 0c349ad3e4c..e86a1206902 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -145,7 +145,7 @@ class box_task extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -168,7 +168,7 @@ class box_task extends ModeleBoxes
$sql .= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
$sql .= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
$sql .= " AND p.usage_task = 1 ";
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/core/boxes/box_validated_projects.php b/htdocs/core/boxes/box_validated_projects.php
index 3f2b2cdc221..574ee7b7d80 100644
--- a/htdocs/core/boxes/box_validated_projects.php
+++ b/htdocs/core/boxes/box_validated_projects.php
@@ -101,7 +101,7 @@ class box_validated_projects extends ModeleBoxes
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index fbd2651d4b3..e6d2d2aa74f 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -304,7 +304,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'projet') {
- if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) {
+ if (!$user->rights->projet->lire && empty($user->rights->projet->all->lire)) {
$readok = 0;
$nbko++;
}
diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index 1c544f4f7c4..8fa1f1ec288 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -200,7 +200,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php
index 0c05f0c1946..6f921848881 100644
--- a/htdocs/eventorganization/conferenceorbooth_contact.php
+++ b/htdocs/eventorganization/conferenceorbooth_contact.php
@@ -181,7 +181,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php
index 8b064c12b72..4c403332feb 100644
--- a/htdocs/eventorganization/conferenceorbooth_document.php
+++ b/htdocs/eventorganization/conferenceorbooth_document.php
@@ -138,7 +138,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index 101bc10a0aa..e38bdd954f3 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -235,7 +235,7 @@ if (!empty($withproject)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 12d62e0ab76..a5c9c308c6f 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -412,7 +412,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 8da82f45201..aa823dc44d6 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -2015,7 +2015,7 @@ class Project extends CommonObject
//$socid=$user->socid;
$projectsListId = null;
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
}
@@ -2107,7 +2107,7 @@ class Project extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE";
$sql .= " p.entity IN (".getEntity('project').")";
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
$sql .= "AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php
index 1439ecd5f20..efd8ecc3424 100644
--- a/htdocs/projet/class/projectstats.class.php
+++ b/htdocs/projet/class/projectstats.class.php
@@ -158,7 +158,7 @@ class ProjectStats extends Stats
// Get list of project id allowed to user (in a string list separated by coma)
$object = new Project($this->db);
$projectsListId = '';
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $user->socid);
}
@@ -183,7 +183,7 @@ class ProjectStats extends Stats
$sqlwhere[] = " t.fk_opp_status IN (".$this->db->sanitize($this->status).")";
}
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sqlwhere[] = " t.rowid IN (".$this->db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 7e84683d5b3..dac2afa4834 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -2077,7 +2077,7 @@ class Task extends CommonObject
$sql .= " AND p.fk_statut = 1";
$sql .= " AND t.fk_projet = p.rowid";
$sql .= " AND (t.progress IS NULL OR t.progress < 100)"; // tasks to do
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
@@ -2148,7 +2148,7 @@ class Task extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';
$sql .= " AND t.fk_projet = p.rowid"; // tasks to do
- if ($mine || !$user->rights->projet->all->lire) {
+ if ($mine || empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php
index 3d57f9657b1..52a1f581df8 100644
--- a/htdocs/projet/comment.php
+++ b/htdocs/projet/comment.php
@@ -103,13 +103,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 9ac87b46084..db1f63fe8de 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -140,7 +140,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index 0aea36fe635..9c20aa562d7 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -116,13 +116,13 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) {
// Title
$morehtmlref .= $object->title;
// Thirdparty
- if ($object->thirdparty->id > 0) {
+ if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index b8c6ae046cf..c0afe5d1370 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -128,13 +128,13 @@ $morehtmlref = '';
// Title
$morehtmlref .= $object->title;
// Thirdparty
-if ($object->thirdparty->id > 0) {
+if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
// Define a complementary filter for search of next/prev ref.
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index a5f14431eda..444dc6d525f 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -357,7 +357,7 @@ $title = $langs->trans("Projects");
// Get list of project id allowed to user (in a string list separated by comma)
$projectsListId = '';
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$projectsListId = $object->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
@@ -421,7 +421,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').')';
if (!empty($conf->categorie->enabled)) {
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_PROJECT, "p.rowid", $search_category_array);
}
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users
}
// No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php
index 3c32bd528a4..2ee52d3a247 100644
--- a/htdocs/projet/note.php
+++ b/htdocs/projet/note.php
@@ -106,7 +106,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php
index 415e735fae6..a2bbba52305 100644
--- a/htdocs/projet/tasks/comment.php
+++ b/htdocs/projet/tasks/comment.php
@@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 2727f7f0d02..753ccc9b419 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -196,7 +196,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 3787f5b5f6a..a1e708b6a46 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -151,7 +151,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index e1ed162f9c2..53b1a85e889 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -273,7 +273,7 @@ if ($id) {
}
// Get list of project id allowed to user (in a string list separated by coma)
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
}
//var_dump($projectsListId);
@@ -357,7 +357,7 @@ if ($search_task_user > 0) {
}
$sql .= " WHERE t.fk_projet = p.rowid";
$sql .= " AND p.entity IN (".getEntity('project').')';
-if (!$user->rights->projet->all->lire) {
+if (empty($user->rights->projet->all->lire)) {
$sql .= " AND p.rowid IN (".$db->sanitize($projectsListId ? $projectsListId : '0').")"; // public and assigned to projects, or restricted to company for external users
}
if (is_object($projectstatic) && $projectstatic->id > 0) {
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index 4f5ebdbd6bb..3d1ec610b48 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -142,7 +142,7 @@ if ($object->id > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 312e6b11389..62714c72216 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -235,7 +235,7 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 8abba0c8cf1..18e46d9750d 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -859,7 +859,7 @@ if ($action == 'create' || $action == 'presend') {
// Ref
print ''.$langs->trans('Ref').' ';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
$projectstat->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 1b3e035e37d..76e2208ba0b 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -566,7 +566,7 @@ if ($projectid > 0 || $project_ref) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->projet->all->lire) {
+ if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
From 7b62f5a4e4d76198ae1d122c3b94e4565c4bb7a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:42:24 +0200
Subject: [PATCH 076/490] fix warning
---
htdocs/ticket/contact.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index bee8358e5aa..73efc14a038 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -146,7 +146,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
print dol_get_fiche_end();
}
- if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) {
+ if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
$object->next_prev_filter = "te.fk_user_assign = '".$user->id."'";
} elseif ($user->socid > 0) {
$object->next_prev_filter = "te.fk_soc = '".$user->socid."'";
From a718ec4a7449d4a2f45669db5f2148c6468ed36b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 10:44:50 +0200
Subject: [PATCH 077/490] Update document.php
---
htdocs/ticket/document.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php
index 0daac15e765..aa83b7c1038 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -80,7 +80,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id && empty($user->rights->ticket->manage)) {
accessforbidden();
}
From 6abd4cc1200abf01c927c349d53b43381c623f1c Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas
Date: Sun, 24 Oct 2021 11:38:45 +0200
Subject: [PATCH 078/490] Fix #8716 : tasks were not shown in ecm auto tree
---
htdocs/core/ajax/ajaxdirpreview.php | 8 +++++++-
htdocs/core/class/html.formfile.class.php | 20 +++++++++++++++++---
htdocs/ecm/index_auto.php | 2 ++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 09292dd4991..917a9786ab2 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -205,12 +205,14 @@ if ($type == 'directory') {
'product',
'tax',
'project',
+ 'project_task',
'fichinter',
'user',
'expensereport',
'holiday',
'recruitment-recruitmentcandidature',
'banque',
+ 'chequereceipt',
'mrp-mo'
);
@@ -243,6 +245,8 @@ if ($type == 'directory') {
$upload_dir = $conf->tax->dir_output;
} elseif ($module == 'project') {
$upload_dir = $conf->projet->dir_output;
+ } elseif ($module == 'project_task') {
+ $upload_dir = $conf->projet->dir_output;
} elseif ($module == 'fichinter') {
$upload_dir = $conf->ficheinter->dir_output;
} elseif ($module == 'user') {
@@ -255,8 +259,10 @@ if ($type == 'directory') {
$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
} elseif ($module == 'banque') {
$upload_dir = $conf->bank->dir_output;
+ } elseif ($module == 'chequereceipt') {
+ $upload_dir = $conf->bank->dir_output.'/checkdeposits';
} elseif ($module == 'mrp-mo') {
- $upload_dir = $conf->mrp->dir_output.'/mo';
+ $upload_dir = $conf->mrp->dir_output;
} else {
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index b5d96a7f1e2..fcca60dad78 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1645,6 +1645,9 @@ class FormFile
} elseif ($modulepart == 'project') {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object_instance = new Project($this->db);
+ } elseif ($modulepart == 'project_task') {
+ include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
+ $object_instance = new Task($this->db);
} elseif ($modulepart == 'fichinter') {
include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$object_instance = new Fichinter($this->db);
@@ -1663,6 +1666,9 @@ class FormFile
} elseif ($modulepart == 'banque') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object_instance = new Account($this->db);
+ } elseif ($modulepart == 'chequereceipt') {
+ include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
+ $object_instance = new RemiseCheque($this->db);
} elseif ($modulepart == 'mrp-mo') {
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object_instance = new Mo($this->db);
@@ -1717,14 +1723,19 @@ class FormFile
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'invoice_supplier') {
preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
- $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
+ $ref = (isset($reg[1]) ? $reg[1] : '');
+ if (is_numeric($ref)) {
$id = $ref;
$ref = '';
}
- } elseif ($modulepart == 'user' || $modulepart == 'holiday') {
+ } elseif ($modulepart == 'user') {
// $ref may be also id with old supplier invoices
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
+ } elseif ($modulepart == 'project_task') {
+ // $ref of task is the sub-directory of the project
+ $reg = explode("/", $relativefile);
+ $ref = (isset($reg[1]) ? $reg[1] : '');
} elseif (in_array($modulepart, array(
'invoice',
'propal',
@@ -1734,11 +1745,14 @@ class FormFile
'contract',
'product',
'project',
+ 'project_task',
'fichinter',
'expensereport',
'recruitment-recruitmentcandidature',
'mrp-mo',
- 'banque'))) {
+ 'banque',
+ 'chequereceipt',
+ 'holiday'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : '');
} else {
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index d54dcf14d1e..acce421fb9a 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -341,6 +341,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->projet->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
+ $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
}
if (!empty($conf->ficheinter->enabled)) {
$langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
@@ -353,6 +354,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->banque->enabled)) {
$langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
+ $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
}
if (!empty($conf->mrp->enabled)) {
$langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));
From dc32350ee71f126f2c95a851584dfe8002dff2f1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:02:45 +0200
Subject: [PATCH 079/490] Code comment
---
htdocs/core/modules/modPropale.class.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php
index 83e2b5a0402..eb589fc1759 100644
--- a/htdocs/core/modules/modPropale.class.php
+++ b/htdocs/core/modules/modPropale.class.php
@@ -23,7 +23,7 @@
/**
* \defgroup propale Module commercial proposals
- * \brief Module pour gerer la tenue de propositions commerciales
+ * \brief Module to manage commercial proposals
* \file htdocs/core/modules/modPropale.class.php
* \ingroup propale
* \brief Description and activation file for the module customer proposal
@@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modPropale extends DolibarrModules
{
-
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
From 55d30884b8e892c3c5bc3a2744363ff1adbd5c77 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:15:01 +0200
Subject: [PATCH 080/490] Remove strange code
---
htdocs/core/class/notify.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 7128a6cf01d..a88f673405c 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -116,7 +116,7 @@ class Notify
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'touser') {
unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
+ //$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
@@ -124,7 +124,7 @@ class Notify
foreach ($listofnotiftodo as $val) {
if ($val['type'] == 'tofixedemail') {
unset($listofnotiftodo[$val['email']]);
- $listofnotiftodo = array_merge($listofnotiftodo);
+ //$listofnotiftodo = array_merge($listofnotiftodo);
}
}
}
From 50df842417cac9240036872ab923c58ed48667bf Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 13:18:06 +0200
Subject: [PATCH 081/490] Doc
---
ChangeLog | 1 +
1 file changed, 1 insertion(+)
diff --git a/ChangeLog b/ChangeLog
index 3f5fad835f7..1c0e96fc27c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@ For users:
NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
+NEW: Add option to disable globaly some notifications emails.
NEW: #18326 Workflow: Close order on shipment closing.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
From ede0c60e2e5add07107e665f4fc8dbf3f72c386a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 13:50:22 +0200
Subject: [PATCH 082/490] fix not defined
---
htdocs/projet/tasks/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 53b1a85e889..512b0adc7d0 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -604,7 +604,7 @@ print ' ';
print ' ';
print ' ';
print ' ';
-print ' ';
+// print ' ';
print ' ';
// Show description of content
From 3765a89283a815bc4f30cef1359fcaaf26922af3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 13:57:04 +0200
Subject: [PATCH 083/490] fix warnings in task list
---
htdocs/projet/tasks/list.php | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 53b1a85e889..1d7d967c20c 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -67,8 +67,9 @@ $search_task_user = GETPOST('search_task_user', 'int');
$search_task_progress = GETPOST('search_task_progress');
$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe');
+$search_opp_status = GETPOST("search_opp_status", 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = (GETPOSTISSET('mode') && GETPOST('mode', 'alpha') == 'mine') ? 1 : 0;
if ($mine) {
$search_task_user = $user->id; $mine = 0;
}
@@ -346,7 +347,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid";
}
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
if ($search_project_user > 0) {
@@ -864,7 +865,29 @@ if (!empty($arrayfields['t.billed']['checked'])) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+$totalarray['val'] = array();
+$totalarray['val']['t.planned_workload'] = 0;
+$totalarray['val']['t.duration_effective'] = 0;
+$totalarray['val']['t.progress'] = 0;
+$totalarray['val']['t.budget_amount'] = 0;
+$totalarray['totalplannedworkload'] = 0;
+$totalarray['totaldurationeffective'] = 0;
+$totalarray['totaldurationdeclared'] = 0;
+$totalarray['totaltobillfield'] = array();
+$totalarray['totalbilledfield'] = 0;
+$totalarray['totalbudget_amountfield'] = 0;
+$totalarray['totalbudgetamount'] = 0;
+$totalarray['totaltobill'] = 0;
+$totalarray['totalbilled'] = 0;
+$parameters = array(
+ 'arrayfields'=>$arrayfields,
+ 'param'=>$param,
+ 'sortfield'=>$sortfield,
+ 'sortorder'=>$sortorder,
+ 'totalarray' => $totalarray,
+);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) {
@@ -887,7 +910,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
}
$i = 0;
-$totalarray = array();
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@@ -1148,7 +1170,7 @@ while ($i < min($num, $limit)) {
}
$totalarray['val']['t.budget_amount'] += $obj->budget_amount;
if (!$i) {
- $totalarray['totalbudget_amount'] = $totalarray['nbfield'];
+ $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
}
$totalarray['totalbudgetamount'] += $obj->budget_amount;
print ' ';
@@ -1269,7 +1291,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
print ''.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).' ';
} elseif ($totalarray['totalbilledfield'] == $i) {
print ''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).' ';
- } elseif ($totalarray['totalbudget_amount'] == $i) {
+ } elseif ($totalarray['totalbudget_amountfield'] == $i) {
print ''.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).' ';
} else {
print ' ';
From 5ef5075f8fb4ea705be1971e6e56f44b380ddbbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:00:05 +0200
Subject: [PATCH 084/490] fix warnings in task list
---
htdocs/projet/tasks/list.php | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 1d7d967c20c..fa9d18bf2a5 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -69,9 +69,10 @@ $search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe');
$search_opp_status = GETPOST("search_opp_status", 'alpha');
-$mine = (GETPOSTISSET('mode') && GETPOST('mode', 'alpha') == 'mine') ? 1 : 0;
+$mine = GETPOST('mode', 'alpha') == 'mine' ? 1 : 0;
if ($mine) {
- $search_task_user = $user->id; $mine = 0;
+ $search_task_user = $user->id;
+ $mine = 0;
}
$search_date_startday = GETPOST('search_date_startday', 'int');
@@ -882,11 +883,11 @@ $totalarray['totalbudgetamount'] = 0;
$totalarray['totaltobill'] = 0;
$totalarray['totalbilled'] = 0;
$parameters = array(
- 'arrayfields'=>$arrayfields,
- 'param'=>$param,
- 'sortfield'=>$sortfield,
- 'sortorder'=>$sortorder,
- 'totalarray' => $totalarray,
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
From ad3297b0ef15d5b4864b16890ce931c527fb8591 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 14:01:23 +0200
Subject: [PATCH 085/490] Use of MAIN_FIRST_PING_OK_ID = 'disabled' works when
forcing reinstall.
---
htdocs/install/step2.php | 2 +-
htdocs/main.inc.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php
index f95cb218561..9754ae78762 100644
--- a/htdocs/install/step2.php
+++ b/htdocs/install/step2.php
@@ -571,7 +571,7 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
-$out = ' ';
+$out = ' global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= ''.$langs->trans("MakeAnonymousPing").' ';
$out .= '';
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 07ab0949a10..a588937e2bf 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3214,7 +3214,7 @@ if (!function_exists("llxFooter")) {
print "\n\n";
} elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) { // Cookie is set when we uncheck the checkbox in the installation wizard.
// MAIN_LAST_PING_KO_DATE
- // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent
+ // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent (this month)
if (!empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && !$forceping) {
print "\n\n";
} else {
From 5f198c78a9ca21795438302055277f7f5b109cd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:08:44 +0200
Subject: [PATCH 086/490] fix warnings in task list
---
htdocs/projet/tasks/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index fa9d18bf2a5..b40031f5f25 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -636,7 +636,7 @@ if ($search_all) {
print ''.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
';
}
-$morehtmlfilter = '';
+$moreforfilter = '';
// Filter on categories
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
From 8db7989aa711d41acf2bd9b2b6168ed03256ea9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:18:43 +0200
Subject: [PATCH 087/490] fix warnings in commande list
---
htdocs/commande/list.php | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 503c125b59c..b0685b8b64b 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1345,10 +1345,25 @@ if ($resql) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
+ $totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 'c.total_ht' => 0,
+ 'c.total_tva' => 0,
+ 'c.total_ttc' => 0,
+ ),
+ 'pos' => array(),
+ );
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array(
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
+ );
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) {
@@ -1388,7 +1403,6 @@ if ($resql) {
$generic_product = new Product($db);
$userstatic = new User($db);
$i = 0;
- $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
From 4ab759b067178dda42a17bc4f52c919c9cd92a51 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 14:23:35 +0200
Subject: [PATCH 088/490] Fix check/uncheck of ping
---
htdocs/install/step2.php | 14 +++++++++++---
htdocs/main.inc.php | 1 +
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php
index 9754ae78762..b3d59b2e741 100644
--- a/htdocs/install/step2.php
+++ b/htdocs/install/step2.php
@@ -570,6 +570,11 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
+// Force here a value we need after because master.inc.php is not loaded into step2.
+// This code must be similar with the one into main.inc.php
+$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
+
+$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
$out = ' global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= ''.$langs->trans("MakeAnonymousPing").' ';
@@ -577,12 +582,15 @@ $out .= ''.$langs->trans("MakeAnonymousPing").'';
$out .= '';
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index a588937e2bf..2e9f0558421 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3206,6 +3206,7 @@ if (!function_exists("llxFooter")) {
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
//print '';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
+
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|| $forceping) {
From 8cd4b0bc83ef9f3d007bfbd68ec095a4c0225757 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:25:05 +0200
Subject: [PATCH 089/490] fix warnings in task list
---
htdocs/projet/tasks/list.php | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index b40031f5f25..eefa1f05a5a 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -863,25 +863,27 @@ if (!empty($arrayfields['t.tobill']['checked'])) {
if (!empty($arrayfields['t.billed']['checked'])) {
print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
}
+// Hook fields
+$totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 't.planned_workload' => 0,
+ 't.duration_effective' => 0,
+ 't.progress' => 0,
+ 't.budget_amount' => 0,
+ ),
+ 'totalplannedworkload' => 0,
+ 'totaldurationeffective' => 0,
+ 'totaldurationdeclared' => 0,
+ 'totaltobillfield' => 0,
+ 'totalbilledfield' => 0,
+ 'totalbudget_amountfield' => 0,
+ 'totalbudgetamount' => 0,
+ 'totaltobill' => 0,
+ 'totalbilled' => 0,
+);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
-// Hook fields
-$totalarray = array();
-$totalarray['nbfield'] = 0;
-$totalarray['val'] = array();
-$totalarray['val']['t.planned_workload'] = 0;
-$totalarray['val']['t.duration_effective'] = 0;
-$totalarray['val']['t.progress'] = 0;
-$totalarray['val']['t.budget_amount'] = 0;
-$totalarray['totalplannedworkload'] = 0;
-$totalarray['totaldurationeffective'] = 0;
-$totalarray['totaldurationdeclared'] = 0;
-$totalarray['totaltobillfield'] = array();
-$totalarray['totalbilledfield'] = 0;
-$totalarray['totalbudget_amountfield'] = 0;
-$totalarray['totalbudgetamount'] = 0;
-$totalarray['totaltobill'] = 0;
-$totalarray['totalbilled'] = 0;
$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
From db44f4082b37c720ea41dc05c3da063cb56ee51f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:26:43 +0200
Subject: [PATCH 090/490] fix warnings in task list
---
htdocs/projet/tasks/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index eefa1f05a5a..efb74f1036d 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -863,7 +863,6 @@ if (!empty($arrayfields['t.tobill']['checked'])) {
if (!empty($arrayfields['t.billed']['checked'])) {
print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
}
-// Hook fields
$totalarray = array(
'nbfield' => 0,
'val' => array(
@@ -884,6 +883,7 @@ $totalarray = array(
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
+// Hook fields
$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
From 677ac4635d25ab99d9ce98cbdb5be039f85286bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 14:34:47 +0200
Subject: [PATCH 091/490] fix warnings in propal list
---
htdocs/comm/propal/list.php | 22 ++++++++++++++-------
htdocs/core/class/html.formpropal.class.php | 1 +
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 3535ae0cde1..1ccbd22d511 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -1383,10 +1383,24 @@ if ($resql) {
if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
+ $totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 'p.total_ht' => 0,
+ 'p.total_tva' => 0,
+ 'p.total_ttc' => 0,
+ ),
+ );
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array(
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
+ );
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
@@ -1412,12 +1426,6 @@ if ($resql) {
$now = dol_now();
$i = 0;
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- $totalarray['val'] = array();
- $totalarray['val']['p.total_ht'] = 0;
- $totalarray['val']['p.total_tva'] = 0;
- $totalarray['val']['p.total_ttc'] = 0;
$typenArray = null;
while ($i < min($num, $limit)) {
diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php
index b78ff5cfa8e..2773ece2569 100644
--- a/htdocs/core/class/html.formpropal.class.php
+++ b/htdocs/core/class/html.formpropal.class.php
@@ -104,6 +104,7 @@ class FormPropal
print ' ';
}
+ $i = 0;
foreach ($listofstatus as $key => $obj) {
if ($excludedraft) {
if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') {
From ead9b396c6bc6d04a6c3d5c0ff05b6f03cba9474 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 16:02:59 +0200
Subject: [PATCH 092/490] fix warning
---
htdocs/compta/paiement/cheque/card.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 9b235926421..33e14407dd6 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Juanjo Menent
* Copyright (C) 2013 Philippe Grand
* Copyright (C) 2015-2016 Alexandre Spangaro
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -388,7 +388,7 @@ if ($action == 'new') {
$i = 0;
while ($obj = $db->fetch_object($resql)) {
$accounts[$obj->bid] = $obj->label;
- $lines[$obj->bid][$i]["date"] = $db->jdate($obj->date);
+ $lines[$obj->bid][$i]["date"] = $db->jdate($obj->datec);
$lines[$obj->bid][$i]["amount"] = $obj->amount;
$lines[$obj->bid][$i]["emetteur"] = $obj->emetteur;
$lines[$obj->bid][$i]["numero"] = $obj->num_chq;
@@ -398,6 +398,7 @@ if ($action == 'new') {
$lines[$obj->bid][$i]["label"] = $obj->transactionlabel;
$lines[$obj->bid][$i]["paymentid"] = $obj->paymentid;
$lines[$obj->bid][$i]["paymentref"] = $obj->paymentref;
+ $lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date);
$i++;
}
@@ -468,6 +469,7 @@ if ($action == 'new') {
print '';
$paymentstatic->id = $value["paymentid"];
$paymentstatic->ref = $value["paymentref"];
+ $paymentstatic->date = $value["paymentdate"];
if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1);
} else {
From c21593a5ab23508be39eb8b52b8937e967ca8466 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 16:28:18 +0200
Subject: [PATCH 093/490] fix search
---
htdocs/compta/bank/bankentries_list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index eabe47e54ca..25245bac7d2 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -8,7 +8,7 @@
* Copyright (C) 2016 Juanjo Menent
* Copyright (C) 2017-2019 Alexandre Spangaro
* Copyright (C) 2018 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2021 Gauthier VERDOL
*
* This program is free software; you can redistribute it and/or modify
@@ -1050,7 +1050,7 @@ if ($resql) {
print ' ';
}
if (!empty($arrayfields['bu.label']['checked'])) {
- print ' ';
+ print ' ';
}
if (!empty($arrayfields['ba.ref']['checked'])) {
print '';
From b8250be2372b0ef8eee1f1314eef891816584432 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 16:35:42 +0200
Subject: [PATCH 094/490] css for toolitp
---
htdocs/core/js/lib_foot.js.php | 6 +++---
htdocs/core/lib/functions.lib.php | 4 ++--
htdocs/theme/eldy/global.inc.php | 23 +++++++++++++++++++++++
htdocs/theme/md/style.css.php | 24 ++++++++++++++++++++++++
4 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index 1de4fef0176..997132ca132 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -258,12 +258,12 @@ print '
window.getSelection().removeAllRanges();
/* Show message */
- var lastchild = this.parentNode.lastChild;
+ var lastchild = this.parentNode.lastChild; /* .parentNode is clipboardCP and last child is clipboardCPText */
var tmp = lastchild.innerHTML
if (succeed) {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'
\';
} else {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'
\';
}
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
});
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 98a879410b0..7ee19214c64 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -10520,9 +10520,9 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
$tag = 'span'; // Using div does not work when using the js copy code.
if ($texttoshow) {
- $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
+ $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
} else {
- $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
+ $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
}
return $result;
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 366e9322dde..91736813d15 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -6879,6 +6879,29 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #f8f8fa;
+ color: #888;
+ border: 1px solid #E0E0E0;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 5px;
+ padding-right: 5px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.9em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 51e625438fd..1acc8e26ed1 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -6717,6 +6717,30 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #EEE;
+ color: 888;
+ border: 1px solid #DDD;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 4px;
+ padding-right: 4px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.95em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
From de312cf8b4512b88b9e4cd0b6c4256c9cb64ae6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 16:39:57 +0200
Subject: [PATCH 095/490] Update bankentries_list.php
---
htdocs/compta/bank/bankentries_list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index 25245bac7d2..6c03fd7b725 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -68,7 +68,7 @@ $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
-if ($fielvalue) {
+if ($fieldvalue) {
if ($user->socid) {
$socid = $user->socid;
}
From f6cd0818b3418a74a0864cc2e5794fc1cdffbc51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 16:47:01 +0200
Subject: [PATCH 096/490] fix warnings in bankentrie list
---
htdocs/compta/bank/bankentries_list.php | 39 +++++++++++++------------
htdocs/compta/bank/line.php | 2 ++
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index eabe47e54ca..ebf4e23dc58 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -64,11 +64,12 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
+$massaction = GETPOST('massaction', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
-if ($fielvalue) {
+if ($fieldvalue) {
if ($user->socid) {
$socid = $user->socid;
}
@@ -97,6 +98,8 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
+$optioncss = GETPOST('optioncss', 'alpha');
+$toselect = GETPOST('toselect', 'array');
$num_releve = GETPOST("num_releve", "alpha");
if (empty($dateop)) {
$dateop = -1;
@@ -222,7 +225,7 @@ if (empty($reshook)) {
$objectclass = 'Account';
$objectlabel = 'BankTransaction';
$permissiontoread = $user->rights->banque->lire;
- $permissiontodelete = $user->rights->banque->supprimer;
+ $permissiontodelete = $user->rights->banque->modifier;
$uploaddir = $conf->bank->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -484,6 +487,11 @@ if ($optioncss != '') {
if ($action == 'reconcile') {
$param .= '&action=reconcile';
}
+$totalarray = array(
+ 'nbfield' => 0,
+ 'totalcred' => 0,
+ 'totaldeb' => 0,
+);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -574,7 +582,7 @@ if ($search_bid > 0) {
}
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql .= " ".MAIN_DB_PREFIX."bank as b";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
}
$sql .= " WHERE b.fk_account = ba.rowid";
@@ -732,7 +740,7 @@ $resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
- $arrayofselected = is_array($toselect) ? $toselect : array();
+ $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array();
// List of mass actions available
$arrayofmassactions = array(
@@ -759,7 +767,9 @@ if ($resql) {
print ' ';
print ' ';
print ' ';
- print ' ';
+ if (!empty($view)) {
+ print ' ';
+ }
print ' ';
print ' ';
print ' ';
@@ -939,6 +949,7 @@ if ($resql) {
}
}
+ $morehtml = '';
/*$morehtml = '';
$morehtml .= '
'.$langs->trans("Page")." "; // ' Page ';
$morehtml .= '
';
@@ -1050,7 +1061,7 @@ if ($resql) {
print '
';
}
if (!empty($arrayfields['bu.label']['checked'])) {
- print '
';
+ print '
';
}
if (!empty($arrayfields['ba.ref']['checked'])) {
print '
';
@@ -1160,7 +1171,6 @@ if ($resql) {
// Loop on each record
$sign = 1;
- $totalarray = array();
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid);
@@ -1296,18 +1306,10 @@ if ($resql) {
$backgroundcolor = "class='oddeven'";
} else {
if ($objp->amount < 0) {
- if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR1)) {
- $color = '#fca955';
- } else {
- $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1;
- }
+ $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
$backgroundcolor = 'style="background: '.$color.';"';
} else {
- if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) {
- $color = '#7fdb86';
- } else {
- $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2;
- }
+ $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
$backgroundcolor = 'style="background: '.$color.';"';
}
}
@@ -1333,7 +1335,7 @@ if ($resql) {
$titletoshow = '';
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction
- if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
+ if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
$labeltoshow = $langs->trans($reg[1]);
} else {
if ($objp->label == '(payment_salary)') {
@@ -1357,6 +1359,7 @@ if ($resql) {
} elseif ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment
+ $paymentstatic->date = $db->jdate($objp->do);
print ' '.$paymentstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index 5567678c366..76c0046884f 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
+$socid = 0;
if ($user->socid) {
$socid = $user->socid;
}
@@ -568,6 +569,7 @@ if ($result) {
// Bank line
print ' '.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
+ $arrayselected = array();
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print " ";
}
From 71541fa299cb3ad8da02b6eefb564c827db5c2f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 16:52:02 +0200
Subject: [PATCH 097/490] fix warnings in bankentrie list
---
htdocs/compta/bank/bankentries_list.php | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index ebf4e23dc58..8fd2f9552f8 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -214,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
+ $toselect = '';
$search_account = "";
if ($id > 0 || !empty($ref)) {
@@ -224,14 +225,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (empty($reshook)) {
$objectclass = 'Account';
$objectlabel = 'BankTransaction';
- $permissiontoread = $user->rights->banque->lire;
- $permissiontodelete = $user->rights->banque->modifier;
+ $permissiontoread = !empty($user->rights->banque->lire);
+ $permissiontodelete = !empty($user->rights->banque->modifier);
$uploaddir = $conf->bank->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
// Conciliation
-if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate
+if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && !empty($user->rights->banque->consolidate)
&& (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
$error = 0;
@@ -313,7 +314,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
}
-if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) {
+if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) {
$error = 0;
if (price2num(GETPOST("addcredit")) > 0) {
@@ -373,7 +374,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) {
}
}
-if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) {
+if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->banque->modifier)) {
$accline = new AccountLine($db);
$result = $accline->fetch(GETPOST("rowid", "int"));
$result = $accline->delete($user);
@@ -843,7 +844,7 @@ if ($resql) {
}
// Form to add a transaction with no invoice
- if ($user->rights->banque->modifier && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
+ if (!empty($user->rights->banque->modifier) && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
print load_fiche_titre($langs->trans("AddBankRecordLong"), '', '');
print '';
From b1555bc4fc27d62784e05aef0768f674ea577ef8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 17:06:37 +0200
Subject: [PATCH 098/490] fix set categories for bank line
---
htdocs/compta/bank/line.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index 76c0046884f..f86c50f31cc 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -570,6 +570,11 @@ if ($result) {
print ''.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
$arrayselected = array();
+ $c = new Categorie($db);
+ $cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE);
+ foreach ($cats as $cat) {
+ $arrayselected[] = $cat->id;
+ }
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print " ";
}
From 10d35ee4aa9c7a9d36369122468fdc4d763e2cab Mon Sep 17 00:00:00 2001
From: ptibogxiv
Date: Sun, 24 Oct 2021 17:40:44 +0200
Subject: [PATCH 099/490] Fix excluded member display in takepos
---
htdocs/takepos/invoice.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 3b40d726a77..016f9c48c51 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -1159,7 +1159,7 @@ $( document ).ready(function() {
$result = $adh->fetch('', '', $invoice->socid);
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
- if (empty($adh->statut)) {
+ if (empty($adh->statut) || $adh->statut = -2) {
$s .= "";
}
$s .= $adh->getFullName($langs);
@@ -1175,7 +1175,7 @@ $( document ).ready(function() {
$s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
}
}
- if (empty($adh->statut)) {
+ if (empty($adh->statut) || $adh->statut = -2) {
$s .= " ";
}
} else {
From 68979578d9218ffc434f46ed8a6c6b24d81efcb9 Mon Sep 17 00:00:00 2001
From: ptibogxiv
Date: Sun, 24 Oct 2021 17:56:41 +0200
Subject: [PATCH 100/490] Update invoice.php
---
htdocs/takepos/invoice.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 016f9c48c51..df17e376f65 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -1159,7 +1159,7 @@ $( document ).ready(function() {
$result = $adh->fetch('', '', $invoice->socid);
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
- if (empty($adh->statut) || $adh->statut = -2) {
+ if (empty($adh->statut) || $adh->statut == -2) {
$s .= "";
}
$s .= $adh->getFullName($langs);
@@ -1175,7 +1175,7 @@ $( document ).ready(function() {
$s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
}
}
- if (empty($adh->statut) || $adh->statut = -2) {
+ if (empty($adh->statut) || $adh->statut == -2) {
$s .= " ";
}
} else {
From 72a665b90199afdf670cfc4e64a2569bd29511e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 19:19:32 +0200
Subject: [PATCH 101/490] fix warning
---
htdocs/core/tpl/commonfields_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php
index 53f846c1713..29bf3943cea 100644
--- a/htdocs/core/tpl/commonfields_view.tpl.php
+++ b/htdocs/core/tpl/commonfields_view.tpl.php
@@ -156,7 +156,7 @@ foreach ($object->fields as $key => $val) {
if ($val['type'] == 'text') {
print ' wordbreak';
}
- if ($val['cssview']) {
+ if (!empty($val['cssview'])) {
print ' '.$val['cssview'];
}
print '">';
From b322ae383ba4e29561b61056a12067ba1434e691 Mon Sep 17 00:00:00 2001
From: ptibogxiv
Date: Sun, 24 Oct 2021 19:21:51 +0200
Subject: [PATCH 102/490] Update invoice.php
---
htdocs/takepos/invoice.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index df17e376f65..65ac3d2d0d3 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -1159,7 +1159,7 @@ $( document ).ready(function() {
$result = $adh->fetch('', '', $invoice->socid);
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
- if (empty($adh->statut) || $adh->statut == -2) {
+ if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED ) {
$s .= "";
}
$s .= $adh->getFullName($langs);
@@ -1175,7 +1175,7 @@ $( document ).ready(function() {
$s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
}
}
- if (empty($adh->statut) || $adh->statut == -2) {
+ if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED) {
$s .= " ";
}
} else {
From 03a8c5f0cbd80972b6ff7ddcf09aa0d0d3a43688 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sun, 24 Oct 2021 19:21:58 +0200
Subject: [PATCH 103/490] Update commonfields_edit.tpl.php
---
htdocs/core/tpl/commonfields_edit.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index abf3144de8f..39103fdbb0a 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -86,7 +86,7 @@ foreach ($object->fields as $key => $val) {
$value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key;
}
//var_dump($val.' '.$key.' '.$value);
- if ($val['noteditable']) {
+ if (!empty($val['noteditable'])) {
print $object->showOutputField($val, $key, $value, '', '', '', 0);
} else {
if ($key == 'lang') {
From 595760e97d2aab20baf82299c484063ff5ab231a Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Mon, 25 Oct 2021 09:36:12 +0200
Subject: [PATCH 104/490] Lib Modif
---
.../emailcollector/lib/emailcollector.lib.php | 129 ++++++++++++++++++
1 file changed, 129 insertions(+)
diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php
index fe4a5f1b19c..9b63bbea66a 100644
--- a/htdocs/emailcollector/lib/emailcollector.lib.php
+++ b/htdocs/emailcollector/lib/emailcollector.lib.php
@@ -85,3 +85,132 @@ function emailcollectorPrepareHead($object)
return $head;
}
+
+/**
+ * Récupère les parties d'un message
+ * @param object $structure structure du message
+ * @return object|boolean parties du message|false en cas d'erreur
+ */
+function getParts($structure)
+{
+ return isset($structure->parts) ? $structure->parts : false;
+}
+
+/**
+ * Tableau définissant la pièce jointe
+ * @param object $part partie du message
+ * @return object|boolean définition du message|false en cas d'erreur
+ */
+function getDParameters($part)
+{
+ return $part->ifdparameters ? $part->dparameters : false;
+}
+
+/**
+ * Récupère les pièces d'un mail donné
+ * @param integer $jk numéro du mail
+ * @param object $mbox object connection imaap
+ * @return array type, filename, pos
+ */
+function getAttachments($jk, $mbox)
+{
+ $structure = imap_fetchstructure($mbox, $jk);
+ $parts = getParts($structure);
+ $fpos = 2;
+ $attachments = array();
+ $nb = count($parts);
+ if ($parts && $nb) {
+ for ($i = 1; $i < $nb; $i++) {
+ $part = $parts[$i];
+
+ if ($part->ifdisposition && strtolower($part->disposition) == "attachment") {
+ $ext = $part->subtype;
+ $params = getDParameters($part);
+
+ if ($params) {
+ $filename = $part->dparameters[0]->value;
+ $filename = imap_utf8($filename);
+ $attachments[] = array('type' => $part->type, 'filename' => $filename, 'pos' => $fpos);
+ }
+ }
+ $fpos++;
+ }
+ }
+ return $attachments;
+}
+
+/**
+ * Récupère la contenu de la pièce jointe par rapport a sa position dans un mail donné
+ * @param integer $jk numéro du mail
+ * @param integer $fpos position de la pièce jointe
+ * @param integer $type type de la pièce jointe
+ * @param object $mbox object connection imaap
+ * @return mixed data
+ */
+function getFileData($jk, $fpos, $type, $mbox)
+{
+ $mege = imap_fetchbody($mbox, $jk, $fpos);
+ $data = getDecodeValue($mege, $type);
+
+ return $data;
+}
+
+/**
+ * Sauvegarde de la pièce jointe dans le dossier défini avec un nom unique
+ * @param string $path chemin de sauvegarde dui fichier
+ * @param string $filename nom du fichier
+ * @param mixed $data contenu à sauvegarder
+ * @return string emplacement du fichier
+ **/
+function saveAttachment($path, $filename, $data)
+{
+ global $lang;
+ $tmp = explode('.', $filename);
+ $ext = array_pop($tmp);
+ $filename = implode('.', $tmp);
+ if (!file_exists($path)) {
+ if (dol_mkdir($path) < 0) {
+ return -1;
+ }
+ }
+
+ $i = 1;
+ $filepath = $path . $filename . '.' . $ext;
+
+ while (file_exists($filepath)) {
+ $filepath = $path . $filename . '(' . $i . ').' . $ext;
+ $i++;
+ }
+ file_put_contents($filepath, $data);
+ return $filepath;
+}
+
+/**
+ * Décode le contenu du message
+ * @param string $message message
+ * @param integer $coding type de contenu
+ * @return message décodé
+ **/
+function getDecodeValue($message, $coding)
+{
+ switch ($coding) {
+ case 0: //text
+ case 1: //multipart
+ $message = imap_8bit($message);
+ break;
+ case 2: //message
+ $message = imap_binary($message);
+ break;
+ case 3: //application
+ case 5: //image
+ case 6: //video
+ case 7: //other
+ $message = imap_base64($message);
+ break;
+ case 4: //audio
+ $message = imap_qprint($message);
+ break;
+ }
+
+ return $message;
+}
From bba6daf98404e41dc35cd5bab47d047269782b00 Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Mon, 25 Oct 2021 09:37:10 +0200
Subject: [PATCH 105/490] class Modif
---
.../class/emailcollector.class.php | 160 +++++++++++++++++-
1 file changed, 159 insertions(+), 1 deletion(-)
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 0a52969f9f6..050a6ca1ae2 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -1897,7 +1897,165 @@ class EmailCollector extends CommonObject
}
}
}
- } elseif ($operation['type'] == 'project') {
+ } elseif ($operation['type'] == 'recordjoinpiece') {
+ $pj = getAttachments($imapemail, $connection);
+ foreach ($pj as $key => $val) {
+ $data[$val['filename']] = getFileData($imapemail, $val['pos'], $val['type'], $connection);
+ }
+ if (count($pj) > 0) {
+ $sql = "SELECT rowid as id FROM " . MAIN_DB_PREFIX . "user WHERE email LIKE '%" . $from . "%'";
+ $resql = $this->db->query($sql);
+ if ($resql->num_rows == 0) {
+ $this->errors = 'User Not allowed to add documents';
+ }
+ $arrayobject = array(
+ 'propale' => array('table' => 'propal',
+ 'fields' => array('ref'),
+ 'class' => 'comm/propal/class/propal.class.php',
+ 'object' => 'Propal'),
+ 'holiday' => array('table' => 'holiday',
+ 'fields' => array('ref'),
+ 'class' => 'holiday/class/holiday.class.php',
+ 'object' => 'Holiday'),
+ 'expensereport' => array('table' => 'expensereport',
+ 'fields' => array('ref'),
+ 'class' => 'expensereport/class/expensereport.class.php',
+ 'object' => 'ExpenseReport'),
+ 'recruitment/recruitmentjobposition' => array('table' => 'recruitment_recruitmentjobposition',
+ 'fields' => array('ref'),
+ 'class' => 'recruitment/class/recruitmentjobposition.class.php',
+ 'object' => 'RecruitmentJobPosition'),
+ 'recruitment/recruitmentjobposition' => array('table' => 'recruitment_recruitmentcandidature',
+ 'fields' => array('ref'),
+ 'class' => 'recruitment/class/recruitmentcandidature.class.php',
+ 'object' => ' RecruitmentCandidature'),
+ 'societe' => array('table' => 'societe',
+ 'fields' => array('code_client', 'code_fournisseur'),
+ 'class' => 'societe/class/societe.class.php',
+ 'object' => 'Societe'),
+ 'commande' => array('table' => 'commande',
+ 'fields' => array('ref'),
+ 'class' => 'commande/class/commande.class.php',
+ 'object' => 'Commande'),
+ 'expedition' => array('table' => 'expedition',
+ 'fields' => array('ref'),
+ 'class' => 'expedition/class/expedition.class.php',
+ 'object' => 'Expedition'),
+ 'contract' => array('table' => 'contrat',
+ 'fields' => array('ref'),
+ 'class' => 'contrat/class/contrat.class.php',
+ 'object' => 'Contrat'),
+ 'fichinter' => array('table' => 'fichinter',
+ 'fields' => array('ref'),
+ 'class' => 'fichinter/class/fichinter.class.php',
+ 'object' => 'Fichinter'),
+ 'ticket' => array('table' => 'ticket',
+ 'fields' => array('ref'),
+ 'class' => 'ticket/class/ticket.class.php',
+ 'object' => ' Ticket'),
+ 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord',
+ 'fields' => array('ref'),
+ 'class' => 'knowledgemanagement/class/knowledgemanagement.class.php',
+ 'object' => 'KnowledgeRecord'),
+ 'supplier_proposal' => array('table' => 'supplier_proposal',
+ 'fields' => array('ref'),
+ 'class' => 'supplier_proposal/class/supplier_proposal.class.php',
+ 'object' => 'SupplierProposal'),
+ 'fournisseur/commande' => array('table' => 'commande_fournisseur',
+ 'fields' => array('ref', 'ref_supplier'),
+ 'class' => 'fourn/class/fournisseur.commande.class.php',
+ 'object' => 'SupplierProposal'),
+ 'facture' => array('table' => 'facture',
+ 'fields' => array('ref'),
+ 'class' => 'compta/facture/class/facture.class.php',
+ 'object' => 'Facture'),
+ 'fournisseur/facture' => array('table' => 'facture_fourn',
+ 'fields' => array('ref', ref_client),
+ 'class' => 'fourn/class/fournisseur.facture.class.php',
+ 'object' => 'FactureFournisseur'),
+ 'produit' => array('table' => 'product',
+ 'fields' => array('ref'),
+ 'class' => 'product/class/product.class.php',
+ 'object' => 'Product'),
+ 'productlot' => array('table' => 'product_lot',
+ 'fields' => array('batch'),
+ 'class' => 'product/stock/class/productlot.class.php',
+ 'object' => 'Productlot'),
+ 'projet' => array('table' => 'projet',
+ 'fields' => array('ref'),
+ 'class' => 'projet/class/projet.class.php',
+ 'object' => 'Project'),
+ 'projet_task' => array('table' => 'projet_task',
+ 'fields' => array('ref'),
+ 'class' => 'projet/class/task.class.php',
+ 'object' => 'Task'),
+ 'ressource' => array('table' => 'resource',
+ 'fields' => array('ref'),
+ 'class' => 'ressource/class/dolressource.class.php',
+ 'object' => 'Dolresource'),
+ 'bom' => array('table' => 'bom_bom',
+ 'fields' => array('ref'),
+ 'class' => 'bom/class/bom.class.php',
+ 'object' => 'BOM'),
+ 'mrp' => array('table' => 'mrp_mo',
+ 'fields' => array('ref'),
+ 'class' => 'mrp/class/mo.class.php',
+ 'object' => 'Mo'),
+ );
+
+ $hookmanager->initHooks(array('emailcolector'));
+ $parameters = array('arrayobject' => $arrayobject);
+ $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
+ if ($reshook > 0) $arrayobject = $hookmanager->resArray;
+
+ $resultobj = array();
+
+ foreach ($arrayobject as $key => $objectdesc) {
+ $sql = 'SELECT DISTINCT t.rowid ';
+ $sql .= ' FROM ' . MAIN_DB_PREFIX . $objectdesc['table'] . ' AS t';
+ $sql .= ' WHERE ';
+ foreach ($objectdesc['fields'] as $field) {
+ $sql .= "'" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $field . ", '%') OR ";
+ }
+ $sql = substr($sql, 0, -4);
+
+ $ressqlobj = $this->db->query($sql);
+ if ($ressqlobj) {
+ while ($obj = $this->db->fetch_object($ressqlobj)) {
+ $resultobj[$key][] = $obj->rowid;
+ }
+ }
+ }
+ $dirs = array();
+ foreach ($resultobj as $mod => $ids) {
+ $moddesc = $arrayobject[$mod];
+ $elementpath = $mod;
+ dol_include_once($moddesc['class']);
+ $objectmanaged = new $moddesc['object']($this->db);
+ foreach ($ids as $val) {
+ $res = $objectmanaged->fetch($val);
+ if ($res) {
+ $path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
+ $dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
+ } else {
+ $this->errors = 'object not found';
+ }
+ }
+ }
+ foreach ($dirs as $target) {
+ foreach ($data as $filename => $content) {
+ $prefix = $this->actions[$this->id]['actionparam'];
+
+ $resr = saveAttachment($target, $prefix . '_' . $filename, $content);
+ if ($resr == -1) {
+ $this->errors = 'Doc not saved';
+ }
+ }
+ }
+ } else {
+ $this->errors = 'no joined piece';
+ }
+ }elseif ($operation['type'] == 'project') {
// Create project / lead
$projecttocreate = new Project($this->db);
From 74ec7c68a29e98a1cd0d0337abb8c7435da670ac Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Mon, 25 Oct 2021 09:37:51 +0200
Subject: [PATCH 106/490] card Modif
---
htdocs/admin/emailcollector_card.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index be3ab2d63c1..dca93b9a506 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -583,6 +583,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$arrayoftypes = array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
+ 'recordjoinpiece'=>$langs->trans('recordjoinpieceonobject'),
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) {
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
From 3236d04ca46e457646e628955df579c4d5dd3917 Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Mon, 25 Oct 2021 09:44:21 +0200
Subject: [PATCH 107/490] card Modif
---
htdocs/emailcollector/class/emailcollector.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 050a6ca1ae2..729762be327 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -2055,7 +2055,7 @@ class EmailCollector extends CommonObject
} else {
$this->errors = 'no joined piece';
}
- }elseif ($operation['type'] == 'project') {
+ } elseif ($operation['type'] == 'project') {
// Create project / lead
$projecttocreate = new Project($this->db);
From 28c5b105baefe9a8872f92c1fe285d9d9ce548ee Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Mon, 25 Oct 2021 11:20:28 +0200
Subject: [PATCH 108/490] FIX: remove two lines of javascript referring to DOM
elements that no longer exist in Dolibarr (form#move_event)
---
htdocs/comm/action/pertype.php | 1 -
htdocs/comm/action/peruser.php | 1 -
2 files changed, 2 deletions(-)
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index 08cef7dd80a..9a88c4f18a2 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -377,7 +377,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
- $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= ''."\n";
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 0d1567ee274..dc546141aca 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
- $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= ''."\n";
From 940c69b46d9f2c90e349090c4d91e976a4fd0fca Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 25 Oct 2021 12:09:17 +0200
Subject: [PATCH 109/490] Clean code
---
htdocs/core/bookmarks_page.php | 126 +++++++++++++++++++++++++++++++++
htdocs/main.inc.php | 6 +-
2 files changed, 128 insertions(+), 4 deletions(-)
create mode 100644 htdocs/core/bookmarks_page.php
diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php
new file mode 100644
index 00000000000..05ae866463f
--- /dev/null
+++ b/htdocs/core/bookmarks_page.php
@@ -0,0 +1,126 @@
+
+ *
+ * This file is a modified version of datepicker.php from phpBSM to fix some
+ * bugs, to add new features and to dramatically increase speed.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/bookmarks_page.php
+ * \brief File to return a page with the complete list of bookmarks (all search input fields)
+ */
+
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', 1);
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1);
+}
+//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', 1);
+}
+//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
+
+require_once '../main.inc.php';
+
+if (GETPOST('lang', 'aZ09')) {
+ $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
+}
+
+$langs->load("main");
+
+$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
+$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
+
+
+/*
+ * View
+ */
+
+$title = $langs->trans("Bookmarks");
+
+// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
+$head = ''."\n";
+$arrayofjs = array();
+$arrayofcss = array();
+top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
+
+
+
+print ''."\n";
+print '';
+//print '
';
+
+$nbofsearch = 0;
+
+// Instantiate hooks of thirdparty module
+$hookmanager->initHooks(array('bookmarks'));
+
+// Define $bookmarks
+$bookmarks = '';
+
+
+$arrayresult = array();
+//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
+
+$i = 0;
+$accesskeyalreadyassigned = array();
+foreach ($arrayresult as $key => $val) {
+ $tmp = explode('?', $val['url']);
+ $urlaction = $tmp[0];
+ $keysearch = 'search_all';
+
+ $accesskey = '';
+ if (!$accesskeyalreadyassigned[$val['label'][0]]) {
+ $accesskey = $val['label'][0];
+ $accesskeyalreadyassigned[$accesskey] = $accesskey;
+ }
+
+ //$bookmarks .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1));
+
+ $i++;
+}
+
+
+// Execute hook printSearchForm
+$parameters = array('bookmarks'=>$bookmarks);
+$reshook = $hookmanager->executeHooks('printBookmarks', $parameters); // Note that $action and $object may have been modified by some hooks
+if (empty($reshook)) {
+ $bookmarks .= $hookmanager->resPrint;
+} else {
+ $bookmarks = $hookmanager->resPrint;
+}
+
+
+print "\n";
+print "\n";
+print '
';
+print '';
+print ''."\n";
+print '
';
+print "\n\n";
+
+print '
';
+print '