From b7c0594ab73a51a872806c33b7848fa2a87ecdcf Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 21 Oct 2021 23:28:58 +0200 Subject: [PATCH 001/171] FIX ISSUE DB_ERROR_SYNTAX-#18921 --- htdocs/ticket/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 6991516ede8..0d0e97336cd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '') { + if ($search[$key] != '' && !empty($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } @@ -609,9 +609,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { - foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if (is_array($val) && count($val)) { + foreach ($val as $skey) { + $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } } else { $param .= '&search_'.$key.'='.urlencode($search[$key]); From 763cb29c0c3a845d48ec8fa3b794d5b3926f6ac6 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 24 Oct 2021 00:26:28 +0200 Subject: [PATCH 002/171] Check that the value is not an array --- 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 0d0e97336cd..4caffd173c3 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '' && !empty($val)) { + if ($search[$key] != '' && !is_array($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } From dc3bfcfb87e90aa6a2f3e1a937ed8bd494e1b62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 22 Nov 2021 19:57:26 +0100 Subject: [PATCH 003/171] can modify tooltip by reference --- htdocs/bom/class/bom.class.php | 4 ++-- htdocs/bookmarks/class/bookmark.class.php | 2 +- htdocs/categories/class/categorie.class.php | 12 +++++++++++- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/mailing/class/mailing.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 12 +++++++++++- htdocs/commande/class/commande.class.php | 12 +++++++++++- htdocs/compta/bank/class/paymentvarious.class.php | 2 +- .../compta/cashcontrol/class/cashcontrol.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../prelevement/class/bonprelevement.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/delivery/class/delivery.class.php | 12 +++++++++++- htdocs/don/class/don.class.php | 12 +++++++++++- htdocs/don/class/paymentdonation.class.php | 11 ++++++++++- htdocs/ecm/class/ecmdirectory.class.php | 11 ++++++++++- htdocs/ecm/class/ecmfiles.class.php | 12 +++++++++++- .../emailcollector/class/emailcollector.class.php | 2 +- .../class/emailcollectoraction.class.php | 2 +- .../class/emailcollectorfilter.class.php | 2 +- .../class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 13 +++++++++++-- htdocs/expensereport/class/expensereport.class.php | 11 ++++++++++- .../class/paymentexpensereport.class.php | 12 ++++++++++-- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 11 ++++++++++- htdocs/fourn/class/fournisseur.facture.class.php | 11 ++++++++++- htdocs/fourn/class/fournisseur.product.class.php | 11 ++++++++++- htdocs/fourn/class/paiementfourn.class.php | 11 ++++++++++- htdocs/holiday/class/holiday.class.php | 11 ++++++++++- htdocs/hrm/class/establishment.class.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/evaluationdet.class.php | 2 +- htdocs/hrm/class/job.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- htdocs/hrm/class/skilldet.class.php | 2 +- htdocs/hrm/class/skillrank.class.php | 2 +- .../class/knowledgerecord.class.php | 2 +- htdocs/loan/class/loan.class.php | 11 ++++++++++- htdocs/loan/class/paymentloan.class.php | 11 ++++++++++- .../modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/partnership/class/partnership_type.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- .../product/class/productfournisseurprice.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/reception/class/reception.class.php | 12 +++++++++++- .../class/recruitmentcandidature.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/resource/class/dolresource.class.php | 11 ++++++++++- htdocs/salaries/class/salary.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- .../class/supplier_proposal.class.php | 11 ++++++++++- htdocs/ticket/class/cticketcategory.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- htdocs/user/class/usergroup.class.php | 2 +- htdocs/workstation/class/workstation.class.php | 2 +- htdocs/zapier/class/hook.class.php | 2 +- 63 files changed, 261 insertions(+), 66 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fd8d4a19a75..3a89c97bd26 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -838,7 +838,7 @@ class BOM extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('bomdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; @@ -1444,7 +1444,7 @@ class BOMLine extends CommonObjectLine global $action, $hookmanager; $hookmanager->initHooks(array('bomlinedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 9a5b3a53c20..39bb06c2ada 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -344,7 +344,7 @@ class Bookmark extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('mybookmarkdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9a449d63700..380e7f686c2 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1612,7 +1612,7 @@ class Categorie extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '') { - global $langs; + global $langs, $hookmanager; $result = ''; $label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label); @@ -1640,6 +1640,16 @@ class Categorie extends CommonObject if ($withpicto != 2) { $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; } + + global $action; + $hookmanager->initHooks(array('categoriedao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3e2520f43da..eb8dbef2f6e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1662,7 +1662,7 @@ class ActionComm extends CommonObject global $action; $hookmanager->initHooks(array('actiondao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index cb900f7ac7b..3ec97f09cda 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -740,7 +740,7 @@ class Mailing extends CommonObject global $action; $hookmanager->initHooks(array('emailingdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2f055f54a42..2d82595c2f1 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3557,7 +3557,7 @@ class Propal extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -3678,6 +3678,16 @@ class Propal extends CommonObject } } + global $action; + $hookmanager->initHooks(array('propaldao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + return $result; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 9b315698527..3da5b7c0428 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3654,7 +3654,7 @@ class Commande extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $conf, $langs, $user; + global $conf, $langs, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -3755,6 +3755,16 @@ class Commande extends CommonOrder } } + global $action; + $hookmanager->initHooks(array('orderdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + return $result; } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d88676563d6..cdcd26490a3 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -721,7 +721,7 @@ class PaymentVarious extends CommonObject global $action; $hookmanager->initHooks(array('variouspayment')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 5308c8df1d6..63dae3a3a1c 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -466,7 +466,7 @@ class CashControl extends CommonObject global $action; $hookmanager->initHooks(array('cashfencedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 649b7b0c093..8846d0bcc14 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1558,7 +1558,7 @@ class Facture extends CommonInvoice global $action, $hookmanager; $hookmanager->initHooks(array('invoicedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index a8836d215b2..a0911f92acb 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1329,7 +1329,7 @@ class BonPrelevement extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('banktransferdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fa1dfb93c7a..908625b2825 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1487,7 +1487,7 @@ class Contact extends CommonObject global $action; $hookmanager->initHooks(array('contactdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index fe8edd30ea4..10771ec5228 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2041,7 +2041,7 @@ class Contrat extends CommonObject global $action; $hookmanager->initHooks(array('contractdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 6bfe3a33dd7..ccf197c7092 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -725,7 +725,7 @@ class Delivery extends CommonObject */ public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -757,6 +757,16 @@ class Delivery extends CommonObject $result .= ' '; } $result .= $linkstart.$this->ref.$linkend; + + global $action; + $hookmanager->initHooks(array('deliverydao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 7ca70a31aa2..ea8e53da2a0 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -899,7 +899,7 @@ class Don extends CommonObject */ public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1) { - global $conf, $langs; + global $conf, $langs, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -940,6 +940,16 @@ class Don extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('dondao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + return $result; } diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index b5775ce18ac..f1028146397 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -661,7 +661,7 @@ class PaymentDonation extends CommonObject */ public function getNomUrl($withpicto = 0, $maxlen = 0) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -684,6 +684,15 @@ class PaymentDonation extends CommonObject } } + global $action; + $hookmanager->initHooks(array('paymentdonationdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } } diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 03413a56eb1..7381beb6fea 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -474,7 +474,7 @@ class EcmDirectory extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $more = '', $notooltip = 0) { - global $langs; + global $langs, $hookmanager; $result = ''; //$newref=str_replace('_',' ',$this->ref); @@ -506,6 +506,15 @@ class EcmDirectory extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('ecmdirectorydao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 6c2b8fc4023..9121ddacd0e 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -831,7 +831,7 @@ class EcmFiles extends CommonObject { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $menumanager, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -868,6 +868,16 @@ class EcmFiles extends CommonObject } } $result .= $linkstart.$this->ref.$linkend; + + global $action; + $hookmanager->initHooks(array('ecmfilesdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 729762be327..8874f086b2a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -563,7 +563,7 @@ class EmailCollector extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectordao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index bd044f37d0f..eaa4b0737b9 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -389,7 +389,7 @@ class EmailCollectorAction extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectoractiondao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index d926a8bf14f..a99c5198d72 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -363,7 +363,7 @@ class EmailCollectorFilter extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('emailcollectorfilterdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index ac9e465b43b..46c13fd33c5 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -601,7 +601,7 @@ class ConferenceOrBooth extends ActionComm global $action, $hookmanager; $hookmanager->initHooks(array('conferenceorboothdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 96131aa5946..bdd81660a12 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -855,7 +855,7 @@ class ConferenceOrBoothAttendee extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('conferenceorboothattendeedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8ef7be75f52..0e79ab05428 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1778,7 +1778,7 @@ class Expedition extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf; + global $langs, $conf, $hookmanager; $result = ''; $label = ''.$langs->trans("Shipment").''; @@ -1823,8 +1823,17 @@ class Expedition extends CommonObject if ($withpicto != 2) { $result .= $this->ref; } - $result .= $linkend; + $result .= $linkend; + global $action; + $hookmanager->initHooks(array('shippingdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 877a7c79ade..9a0a6f1949c 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1639,7 +1639,7 @@ class ExpenseReport extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf; + global $langs, $conf, $hookmanager; $result = ''; @@ -1708,6 +1708,15 @@ class ExpenseReport extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('expensereportdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 48adeab929d..e21e34de971 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -628,7 +628,7 @@ class PaymentExpenseReport extends CommonObject */ public function getNomUrl($withpicto = 0, $maxlen = 0) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -651,7 +651,15 @@ class PaymentExpenseReport extends CommonObject $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; } } - + global $action; + $hookmanager->initHooks(array('paymentexpensereportdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 297e03fa379..22746014c8d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -816,7 +816,7 @@ class Fichinter extends CommonObject global $action; $hookmanager->initHooks(array('interventiondao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b68ef199db..24ae04ea204 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -787,7 +787,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; @@ -869,6 +869,15 @@ class CommandeFournisseur extends CommonOrder } } + global $action; + $hookmanager->initHooks(array('supplierorderdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a1db1826684..b70f35674ec 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2478,7 +2478,7 @@ class FactureFournisseur extends CommonInvoice */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; @@ -2597,6 +2597,15 @@ class FactureFournisseur extends CommonInvoice } } + global $action; + $hookmanager->initHooks(array('supplierinvoicedao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 5b523d8d7e8..3f4f853a4f5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1087,7 +1087,7 @@ class ProductFournisseur extends Product */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $db, $conf, $langs; + global $db, $conf, $langs, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -1222,6 +1222,15 @@ class ProductFournisseur extends Product $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + global $action; + $hookmanager->initHooks(array('supplierproductdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index fa58139b7e7..812f7ff570b 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -593,7 +593,7 @@ class PaiementFourn extends Paiement */ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0, $morecss = '') { - global $langs; + global $langs, $conf, $hookmanager; $result = ''; @@ -638,6 +638,15 @@ class PaiementFourn extends Paiement } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('supplierpaymentdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 89760c4d1ac..1a204ab9155 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1237,7 +1237,7 @@ class Holiday extends CommonObject */ public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1, $notooltip = 0) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -1273,6 +1273,15 @@ class Holiday extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('holidaydao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 88e93f1398f..2a2c4e4b3dd 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -506,7 +506,7 @@ class Establishment extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('establishmentdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 75dc03cc6f2..02c69bc4e01 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -808,7 +808,7 @@ class Evaluation extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('evaluationdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 115571bb6ba..0ca56d84e60 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -780,7 +780,7 @@ class Evaluationline extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('evaluationlinedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index fc94f4ba6ae..c7f2e1a5f6b 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -814,7 +814,7 @@ class Job extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('jobdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 26298c31aa7..aa4b320ba56 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -788,7 +788,7 @@ class Position extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('positiondao')); - $parameters = array('id' => $this->id, 'getnomurl' => $result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 478b267ac1f..84d8143d0e5 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -831,7 +831,7 @@ class Skill extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('jobdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index c3acdd0982e..acda6908002 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -768,7 +768,7 @@ class Skilldet extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('skilldetdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index a07015ef763..1aac86842b8 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -807,7 +807,7 @@ class SkillRank extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('skillrankdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index a152a693343..7e662372fa2 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -791,7 +791,7 @@ class KnowledgeRecord extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('knowledgerecorddao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index ec9ce00b7e9..2530ffcecfe 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -556,7 +556,7 @@ class Loan extends CommonObject */ public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $conf, $langs; + global $conf, $langs, $hookmanager; $result = ''; @@ -606,6 +606,15 @@ class Loan extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('loandao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 841ffa7b373..f998b3f1077 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -617,7 +617,7 @@ class PaymentLoan extends CommonObject */ public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1) { - global $langs, $conf; + global $langs, $conf, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -654,6 +654,15 @@ class PaymentLoan extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('loanpaymentdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 6e5d6efcff4..d84fbfad843 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -836,7 +836,7 @@ class MyObject extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('myobjectdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index cdad4e71968..e5c7d354aa4 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1072,7 +1072,7 @@ class Mo extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('modao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 4981dde2b45..c0656e4fa3c 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1035,7 +1035,7 @@ class Partnership extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('partnershipdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 6916d95e4f3..5b6ed5e5378 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -434,7 +434,7 @@ class PartnershipType extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('myobjectdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1d4a5926b6e..fc7bfd1444b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4930,7 +4930,7 @@ class Product extends CommonObject global $action; $hookmanager->initHooks(array('productdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index d82d1784938..84262e13c66 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -642,7 +642,7 @@ class ProductFournisseurPrice extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('productfournisseurpricedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index fe36b6364fc..ea80bd3fa46 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -760,7 +760,7 @@ class Entrepot extends CommonObject global $action; $hookmanager->initHooks(array('warehousedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip'=> $notooltip); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip'=> $notooltip); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6d8b54d1954..164f289b94e 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1264,7 +1264,7 @@ class Project extends CommonObject global $action; $hookmanager->initHooks(array('projectdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 954e7f192cd..13d49111bea 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1116,7 +1116,7 @@ class Reception extends CommonObject */ public function getNomUrl($withpicto = 0, $option = 0, $max = 0, $short = 0, $notooltip = 0) { - global $conf, $langs; + global $conf, $langs, $hookmanager; $result = ''; $label = img_picto('', $this->picto).' '.$langs->trans("Reception").''; $label .= '
'.$langs->trans('Ref').': '.$this->ref; @@ -1149,6 +1149,16 @@ class Reception extends CommonObject $result .= ' '; } $result .= $linkstart.$this->ref.$linkend; + + global $action; + $hookmanager->initHooks(array('receptiondao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index f05f1389e75..e93e9af1178 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -762,7 +762,7 @@ class RecruitmentCandidature extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('recruitmentcandidaturedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 3b52e5b4fa6..bc46b40f186 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -863,7 +863,7 @@ class RecruitmentJobPosition extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('recruitmentjobpositiondao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index a0f80d7b27c..81c0c04ebce 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -933,7 +933,7 @@ class Dolresource extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $conf, $langs; + global $conf, $langs, $hookmanager; $result = ''; $label = img_picto('', $this->picto).' '.$langs->trans("Resource").''; @@ -986,6 +986,15 @@ class Dolresource extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('dolresourcedao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 454a94bcf1f..fbf13ee6a39 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -550,7 +550,7 @@ class Salary extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('salarypayment')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 22276cc7bee..4edecfdbf00 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2721,7 +2721,7 @@ class Societe extends CommonObject $hookmanager->initHooks(array('thirdpartydao')); $parameters = array( 'id'=>$this->id, - 'getnomurl'=>$result, + 'getnomurl' => &$result, 'withpicto '=> $withpicto, 'option'=> $option, 'maxlen'=> $maxlen, diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 9c84e2c2e89..b4e85080090 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2462,7 +2462,7 @@ class SupplierProposal extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -2546,6 +2546,15 @@ class SupplierProposal extends CommonObject } } + global $action; + $hookmanager->initHooks(array('supplierpropaldao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 37142a0d278..cfaab7f3768 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -709,7 +709,7 @@ class CTicketCategory extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('cticketcategorydao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 18cfb950619..f2142df4914 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2719,7 +2719,7 @@ class User extends CommonObject global $action; $hookmanager->initHooks(array('userdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index b1b3175aaa9..b59f437d8c0 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -785,7 +785,7 @@ class UserGroup extends CommonObject global $action; $hookmanager->initHooks(array('groupdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index f66f2c51f49..529108981b3 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -814,7 +814,7 @@ class Workstation extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('workstationdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index c3b9147a46d..e27658838bd 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -565,7 +565,7 @@ class Hook extends CommonObject $hookmanager->initHooks(array('hookdao')); $parameters = array( 'id' => $this->id, - 'getnomurl' => $result, + 'getnomurl' => &$result, ); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); From c01cc0c2124c681bfb3682660c3aeba2a1278c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 22 Nov 2021 20:06:51 +0100 Subject: [PATCH 004/171] can modify tooltip by reference --- htdocs/accountancy/class/accountingaccount.class.php | 11 ++++++++++- htdocs/accountancy/class/accountingjournal.class.php | 11 ++++++++++- htdocs/accountancy/class/bookkeeping.class.php | 11 ++++++++++- htdocs/asset/class/asset.class.php | 11 ++++++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 730e52c805a..ad2ab87ae62 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -464,7 +464,7 @@ class AccountingAccount extends CommonObject */ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '') { - global $langs, $conf; + global $langs, $conf, $hookmanager; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; if (!empty($conf->dol_no_mouse_hover)) { @@ -549,6 +549,15 @@ class AccountingAccount extends CommonObject if ($withpicto != 2) { $result .= $linkstart . $label_link . $linkend; } + global $action; + $hookmanager->initHooks(array('accountingjournaldao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 376178b45ba..24e42c367aa 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -221,7 +221,7 @@ class AccountingJournal extends CommonObject */ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -276,6 +276,15 @@ class AccountingJournal extends CommonObject } $result .= $linkend; + global $action; + $hookmanager->initHooks(array('accountingjournaldao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9cda04f6155..c6acc50ba3e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -460,7 +460,7 @@ class BookKeeping extends CommonObject { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $menumanager, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -512,6 +512,15 @@ class BookKeeping extends CommonObject $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + global $action; + $hookmanager->initHooks(array('bookkeepingdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index e5ec21bfa6d..5772da8c0cf 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -307,7 +307,7 @@ class Asset extends CommonObject { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $menumanager, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips @@ -361,6 +361,15 @@ class Asset extends CommonObject $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + global $action; + $hookmanager->initHooks(array('assetdao')); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From e562bf5b1cb9c2d98867a69a21f2a3cd25b9c034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 22 Nov 2021 20:08:21 +0100 Subject: [PATCH 005/171] can modify tooltip by reference --- htdocs/accountancy/class/accountingaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index ad2ab87ae62..3ee51f5ad32 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -550,7 +550,7 @@ class AccountingAccount extends CommonObject $result .= $linkstart . $label_link . $linkend; } global $action; - $hookmanager->initHooks(array('accountingjournaldao')); + $hookmanager->initHooks(array('accountingaccountdao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 9e667e015597258eb2003ed067b0956017281431 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 9 Feb 2022 15:55:21 +0100 Subject: [PATCH 006/171] NEW Needed nets bom --- htdocs/bom/bom_net_needs.php | 354 +++++++++++++++++++++++++++++++++ htdocs/bom/class/bom.class.php | 55 +++++ htdocs/bom/lib/bom.lib.php | 5 + htdocs/langs/en_US/mrp.lang | 3 + 4 files changed, 417 insertions(+) create mode 100644 htdocs/bom/bom_net_needs.php diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php new file mode 100644 index 00000000000..399aa8aa739 --- /dev/null +++ b/htdocs/bom/bom_net_needs.php @@ -0,0 +1,354 @@ + + * Copyright (C) 2019 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 + * 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/bom/bom_net_needs.php + * \ingroup bom + * \brief Page to create/edit/view bom + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("mrp", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + + + +// Initialize technical objects +$object = new BOM($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// Initialize array of search criterias +$search_all = GETPOST("search_all", 'alpha'); +$search = array(); +foreach ($object->fields as $key => $val) { + if (GETPOST('search_'.$key, 'alpha')) { + $search[$key] = GETPOST('search_'.$key, 'alpha'); + } +} + +if (empty($action) && empty($id) && empty($ref)) { + $action = 'view'; +} + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +if ($object->id > 0) { + $object->calculateCosts(); +} + + + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft); + +$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; + + +/* + * Actions + */ + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + $error = 0; + + $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/bom/bom_net_needs.php?id='.($id > 0 ? $id : '__ID__'); + } + } + } + if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + else $object->getNetNeeds($TChildBom, 1); + +} + + +/* + * View + */ + +$form = new Form($db); +$formfile = new FormFile($db); + + +$title = $langs->trans('BOM'); +$help_url ='EN:Module_BOM'; +llxHeader('', $title, $help_url); + + +// Part to edit record +if (($id || $ref) && $action == 'edit') { + print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print dol_get_fiche_head(); + + //$object->fields['keyfield']['disabled'] = 1; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $head = bomPrepareHead($object); + print dol_get_fiche_head($head, 'net_needs', $langs->trans("BillOfMaterials"), -1, 'bom'); + + $formconfirm = ''; + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + $keyforbreak = 'duration'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + print ''; + print ''; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'; + print '
'; + print '
'; + + print '
'; + + print dol_get_fiche_end(); + + + + /* + * Lines + */ + print ''; + print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if(! empty($TChildBom)) { + if($action == 'treeview') { + foreach($TChildBom as $fk_bom => $TProduct) { + $repeatChar = ' '; + if(! empty($TProduct['bom'])) { + if($TProduct['parentid'] != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + if(! empty($TProduct['product'])) { + foreach($TProduct['product'] as $fk_product => $TInfos) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if($fk_bom != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + } + else { + foreach($TChildBom as $fk_product => $qty) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + print ''; + print '
'.$langs->trans('Product'); + if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; + print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; + } + print ''.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); + print ' '; + print img_picto('', 'folder-open'); + print ''; + print ''.$TProduct['qty'].'
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].''.$prod->stock_reel.''.$prod->stock_theorique.'
'.$prod->getNomUrl(1).''.$qty.''.$prod->stock_reel.''.$prod->stock_theorique.'
'; + + + + /* + * ButAction + */ + print '
'."\n"; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + + if(empty($reshook)) { + if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + else print ''.$langs->trans("BackToStandardView").''."\n"; + } + + print '
'; + + + ?> + + + + close(); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5f732c47300..7acc2749fad 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,6 +1085,7 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); + $line->childBom[] = $bom_child; $this->total_cost += $bom_child->total_cost; } else { $this->error = $bom_child->error; @@ -1101,6 +1102,55 @@ class BOM extends CommonObject } } } + + /** + * Get Net needs by product + * + * @param array $TNetNeeds + * @param int $qty + * @return void + */ + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } + else { + $TNetNeeds[$line->fk_product] += $line->qty*$qty; + } + } + } + } + + /** + * Get Net needs Tree by product or bom + * + * @param array $TNetNeeds + * @param int $qty + * @param int $level + * @return void + */ + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) { + $TNetNeeds[$childBom->id]['bom'] = $childBom; + $TNetNeeds[$childBom->id]['parentid'] = $this->id; + $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; + $TNetNeeds[$childBom->id]['level'] = $level; + $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); + } + } + else { + $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; + $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; + } + } + } + } + } @@ -1227,6 +1277,11 @@ class BOMLine extends CommonObjectLine public $unit_cost = 0; + /** + * @var Bom array of Bom in line + */ + public $childBom = array(); + /** * Constructor * diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 805ba304c1d..954959d5d7a 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -84,6 +84,11 @@ function bomPrepareHead($object) $head[$h][2] = 'card'; $h++; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_net_needs.php?id=".$object->id; + $head[$h][1] = $langs->trans("BOMNetNeeds"); + $head[$h][2] = 'net_needs'; + $h++; + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; if (!empty($object->note_private)) { diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 74bed0d9186..ca902380935 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -107,3 +107,6 @@ THMEstimatedHelp=This rate makes it possible to define a forecast cost of the it BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines +BOMNetNeeds=Net Needs +DisplayInTreeStructure=Display in tree structure +BackToStandardView=Back to standard view \ No newline at end of file From 2260276bed0c7d02a480efa7b395daf580dd9287 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:09:36 +0100 Subject: [PATCH 007/171] add tooltip --- htdocs/bom/bom_net_needs.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 399aa8aa739..dcd6764d74a 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -220,6 +220,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* * Lines */ + $text_stock_options = $langs->trans("RealStockDesc").'
'; + $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'
'; + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); + print ''; print "\n"; print ''; @@ -230,8 +240,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if(! empty($TChildBom)) { if($action == 'treeview') { From 7cf94486098fbdcedada47441e85f6eff4d20d5a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Feb 2022 09:22:53 +0000 Subject: [PATCH 008/171] Fixing style errors. --- htdocs/bom/bom_net_needs.php | 43 ++++++++++++++++------------------ htdocs/bom/class/bom.class.php | 29 +++++++++++------------ 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index dcd6764d74a..e9f408498f0 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -110,9 +110,8 @@ if (empty($reshook)) { } } } - if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); else $object->getNetNeeds($TChildBom, 1); - } @@ -234,7 +233,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print "\n"; print ''; print ''; print ''; print ''; - if(! empty($TChildBom)) { - if($action == 'treeview') { - foreach($TChildBom as $fk_bom => $TProduct) { + if (! empty($TChildBom)) { + if ($action == 'treeview') { + foreach ($TChildBom as $fk_bom => $TProduct) { $repeatChar = ' '; - if(! empty($TProduct['bom'])) { - if($TProduct['parentid'] != $object->id) print ''; + if (! empty($TProduct['bom'])) { + if ($TProduct['parentid'] != $object->id) print ''; else print ''; print ''; print ''; } - if(! empty($TProduct['product'])) { - foreach($TProduct['product'] as $fk_product => $TInfos) { + if (! empty($TProduct['product'])) { + foreach ($TProduct['product'] as $fk_product => $TInfos) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; - if($fk_bom != $object->id) print ''; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; + if ($fk_bom != $object->id) print ''; else print ''; print ''; print ''; @@ -276,13 +275,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } } - } - else { - foreach($TChildBom as $fk_product => $qty) { + } else { + foreach ($TChildBom as $fk_product => $qty) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; print ''; print ''; print ''; @@ -297,18 +295,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea - /* - * ButAction - */ + /* + * ButAction + */ print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if($reshook < 0) { + if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if(empty($reshook)) { - if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + if (empty($reshook)) { + if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; else print ''.$langs->trans("BackToStandardView").''."\n"; } @@ -356,7 +354,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); - } - else { + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } else { $TNetNeeds[$line->fk_product] += $line->qty*$qty; } } @@ -1131,26 +1131,25 @@ class BOM extends CommonObject * @param int $level * @return void */ - public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { - if(! empty($this->lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) { + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) { $TNetNeeds[$childBom->id]['bom'] = $childBom; $TNetNeeds[$childBom->id]['parentid'] = $this->id; $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; $TNetNeeds[$childBom->id]['level'] = $level; $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); } - } - else { + } else { $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; } } } } - } From dd0202de47a702d9ad100c66c2250c8d7b78d9e4 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:46:04 +0100 Subject: [PATCH 009/171] fix comment doc --- htdocs/bom/class/bom.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 75cf0e3a65e..17d17edad8d 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1106,8 +1106,8 @@ class BOM extends CommonObject /** * Get Net needs by product * - * @param array $TNetNeeds - * @param int $qty + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed * @return void */ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) @@ -1126,9 +1126,9 @@ class BOM extends CommonObject /** * Get Net needs Tree by product or bom * - * @param array $TNetNeeds - * @param int $qty - * @param int $level + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed + * @param int $level level of recursivity * @return void */ public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) From cd955930b6ead7a8bcd2e99623d6917bdd06401c Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 15:00:55 +0100 Subject: [PATCH 010/171] change bt link --- htdocs/bom/bom_net_needs.php | 39 +++--------------------------------- htdocs/langs/en_US/mrp.lang | 4 ++-- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index e9f408498f0..4b2d5cdecab 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -128,36 +128,6 @@ $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); -// Part to edit record -if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print dol_get_fiche_head(); - - //$object->fields['keyfield']['disabled'] = 1; - - print '
'.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.$langs->trans('Product'); - if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + if (! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } @@ -243,12 +242,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); print ' '; @@ -260,13 +259,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].'
'.$prod->getNomUrl(1).''.$qty.'
'."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - - print ''; -} // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { @@ -214,7 +184,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); + $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); + $viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); + print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes'); /* * Lines @@ -304,12 +277,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - - if (empty($reshook)) { - if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; - else print ''.$langs->trans("BackToStandardView").''."\n"; - } - print ''; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index ca902380935..4dc74122ea9 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -108,5 +108,5 @@ BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines BOMNetNeeds=Net Needs -DisplayInTreeStructure=Display in tree structure -BackToStandardView=Back to standard view \ No newline at end of file +TreeStructure=Tree structure +GroupByProduct=Group by product \ No newline at end of file From d819d427c303c74b31695131a2e73045675fddba Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 16:46:19 +0100 Subject: [PATCH 011/171] FIX sort amount ht --- htdocs/compta/stats/cabyprodserv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index ba09d7e6551..67267288b7a 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -375,7 +375,7 @@ if ($modecompta == 'CREANCES-DETTES') $_SERVER["PHP_SELF"], "amount", "", - $classslink, + $paramslink, 'class="right"', $sortfield, $sortorder From fc36849093a7dc1ac5880069d1fb0709ad5f9902 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Feb 2022 17:31:55 +0100 Subject: [PATCH 012/171] css --- htdocs/theme/eldy/global.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e1532b338b6..147cd2fe8f9 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -259,7 +259,8 @@ input:invalid, select:invalid, input.--error , select.--error { section.setupsection { padding: 20px; - background-color: var(--colorbacktitle1); + /* background-color: var(--colorbacktitle1); */ + background-color: #f0f0f0; border-radius: 5px; } From 39bd5dd6dce2b5eb8e380c6ce7724a107411515f Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:08:39 +0100 Subject: [PATCH 013/171] ticket config : add TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND option to config panel --- htdocs/admin/ticket.php | 27 ++++++++++++++++++++++++--- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/ticket.lang | 3 +++ htdocs/langs/fr_FR/main.lang | 1 + htdocs/langs/fr_FR/ticket.lang | 3 +++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f4e5b4f3fad..1805f5de34d 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -178,8 +178,14 @@ if ($action == 'setvarother') { $error++; } - $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } @@ -470,7 +476,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Other"), '', ''); +print load_fiche_titre($langs->trans("Workflow"), '', ''); print ''; print ''; @@ -479,6 +485,21 @@ print ''; print ''; print "\n"; +// Auto mark ticket read when created from backoffice +print ''; +print ''; +print ''; +print ''; + // Auto assign ticket at user who created it print ''; print ''; @@ -1518,20 +1536,21 @@ if ($id > 0) { // Date start - end print ''; @@ -1972,7 +1991,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -1985,7 +2005,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index c69d396cf26..3de00e9cb6f 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -201,7 +201,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -214,7 +215,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 72e50d9292d..81df122f1a9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -545,7 +545,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode); //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; + $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); } @@ -812,17 +813,17 @@ if ($resql) { // event->datep and event->datef must be GMT date. if ($event->fulldayevent) { - // TODO... - $event->datep = $db->jdate($obj->datep); - $event->datef = $db->jdate($obj->datep2); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz + $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); } else { // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) - $event->datep = $db->jdate($obj->datep); - $event->datef = $db->jdate($obj->datep2); + $event->datep = $db->jdate($obj->datep, 'tzserver'); + $event->datef = $db->jdate($obj->datep2, 'tzserver'); } //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); - //var_dump($obj->datep); - //var_dump($event->datep); + //var_dump($obj->id.' '.$obj->datep.' '.dol_print_date($obj->datep, 'dayhour', 'gmt')); + //var_dump($obj->id.' '.$event->datep.' '.dol_print_date($event->datep, 'dayhour', 'gmt')); $event->type_code = $obj->type_code; $event->type_label = $obj->type_label; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index de961b5517e..e2b412e15db 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -693,7 +693,7 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; //$param='month='.$monthshown.'&year='.$year; -$hourminsec = '100000'; +$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; @@ -953,7 +953,12 @@ while ($i < min($num, $limit)) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { print ''; } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index d0ca6416390..068dba8c50a 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -383,7 +383,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -396,7 +397,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); From c552030b69863a34404e3e00d3045ff4d7e95818 Mon Sep 17 00:00:00 2001 From: Marc GUENNEUGUES Date: Fri, 11 Feb 2022 15:18:38 +0100 Subject: [PATCH 025/171] Fix urlencode breaking links in Market Place page --- htdocs/admin/dolistore/class/dolistore.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 546ef1d57a6..f672cf05a52 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -267,9 +267,9 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { - $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image); - $images = ''; - $images .= ''; + $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image)); + $images = ''; + $images .= ''; } else { $images = ''; } @@ -277,11 +277,11 @@ class Dolistore // free or pay ? if ($product->price > 0) { $price = '

'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'

'; - $download_link = ''; + $download_link = ''; } else { $price = '

'.$langs->trans('Free').'

'; - $download_link = ''; - $download_link .= '

'; + $download_link = ''; + $download_link .= '

'; } // Set and check version From b623b88674a6dab395d3397e467b3084ccfd0542 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 18:06:39 +0100 Subject: [PATCH 026/171] css --- htdocs/admin/confexped.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index b218a245c99..c2ca271e5ea 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -107,7 +107,7 @@ print '
'; print ''; print ''; @@ -376,20 +437,6 @@ if ($mode == 'overwrite') { } if ($mode == 'searchkey') { - $langcode = GETPOSTISSET('langcode') ? GETPOST('langcode') : $langs->defaultlang; - - $newlang = new Translate('', $conf); - $newlang->setDefaultLang($langcode); - - $newlangfileonly = new Translate('', $conf); - $newlangfileonly->setDefaultLang($langcode); - - $recordtoshow = array(); - - // Search modules dirs - $modulesdir = dolGetModulesDirs(); - - $nbtotaloffiles = 0; $nbempty = 0; /*var_dump($langcode); var_dump($transkey); @@ -403,41 +450,10 @@ if ($mode == 'searchkey') { if (empty($transvalue)) { $nbempty++; } + if ($action == 'search' && ($nbempty > 999)) { // 999 to disable this setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings'); } else { - // Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root) - $i = 0; - foreach ($modulesdir as $keydir => $tmpsearchdir) { - $searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/' - - // Directory of translation files - $dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels - $dir_lang_osencoded = dol_osencode($dir_lang); - - $filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1); - foreach ($filearray as $file) { - $tmpfile = preg_replace('/.lang/i', '', basename($file['name'])); - $moduledirname = (basename(dirname(dirname($dir_lang)))); - - $langkey = $tmpfile; - if ($i > 0) { - $langkey .= '@'.$moduledirname; - } - //var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey); - - $result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite - $result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only - if ($result < 0) { - print 'Failed to load language file '.$tmpfile.'
'."\n"; - } else { - $nbtotaloffiles++; - } - //print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records
'."\n"; - } - $i++; - } - // Now search into translation array foreach ($newlang->tab_translate as $key => $val) { if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) { @@ -532,8 +548,12 @@ if ($mode == 'searchkey') { break; } print ''; + print ''."\n"; +print 'global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'>'."\n"; // Address print ''."\n"; + print 'global->MAIN_INFO_OPENINGHOURS_MONDAY) ? ' autofocus="autofocus"' : '').'>'."\n"; print ''; + $totalarray['nbfield'] = 0; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { From 5d90a0072823b43b9964d9a68a32c3b7871205f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 19:26:16 +0100 Subject: [PATCH 042/171] Debug v15 --- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2d46ee2a239..4bf8a0e7219 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -199,7 +199,7 @@ function societe_prepare_head(Societe $object) if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) { $nbBankAccount = 0; $foundonexternalonlinesystem = 0; - $langs->load("banks"); + $langs->load("bills"); $title = $langs->trans("PaymentModes"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fc163933b47..9fed70a1fe1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3643,7 +3643,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', - 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building', + 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', 'multicurrency', @@ -3669,7 +3669,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring', 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'uncheck', 'user-cog', 'vat', 'website', 'workstation', + 'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'conferenceorbooth', 'eventorganization' ))) { $fakey = $pictowithouttext; From dce996a53f53c2a095f2a32e28d477d36e26a518 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 17:33:45 +0100 Subject: [PATCH 043/171] Reponsive --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7f09e111a23..92997b7a0e6 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -516,7 +516,7 @@ if ($result) { } print ''; - print ''; + print ''; print ''; @@ -665,7 +665,7 @@ if ($result) { print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; - print ''; + print ''; + print ''; // Found accounts print ''; - print ''; + print ''; print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; - print ''; print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; + $cursormonth = $j; + if ($cursormonth > 12) { + $cursormonth -= 12; + } + $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); + + print ''; } print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 893f448bbf8..a44c819aa78 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -294,7 +294,7 @@ Balancing=Balancing FicheVentilation=Binding card GeneralLedgerIsWritten=Transactions are written in the Ledger GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be journalized. If there is no other error message, this is probably because they were already journalized. -NoNewRecordSaved=No more record to journalize +NoNewRecordSaved=No more record to transfer ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account ChangeBinding=Change the binding Accounted=Accounted in ledger From 9173eec8acb186c8683025307730fc1ea58922bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 23:02:43 +0100 Subject: [PATCH 054/171] Fix input lost --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 98ab414a8c3..3bf563c82f7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -612,7 +612,7 @@ if ($id > 0 || $ref) { $default_vat = $object->tva_tx; } } - $vattosuggest = (GETPOST("tva_tx") ?vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : '')); + $vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : '')); $vattosuggest = preg_replace('/\s*\(.*\)$/', '', $vattosuggest); print ''; print ''; From 533bf15b869fda5bd14d8c0797e320560b8254b0 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 15 Feb 2022 09:54:40 +0100 Subject: [PATCH 055/171] NEW add triiger and event on totally received status --- htdocs/reception/class/reception.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7efcb2360dc..bb54a8164cd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -640,9 +640,18 @@ class Reception extends CommonObject if ($status < 0) { $error++; } else { - $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); - if (!$ret) { - $error++; + $trigger_key = ''; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { + $ret = $this->commandeFournisseur->Livraison($user, dol_now(), 'tot', ''); + if ($ret < 0) { + $error++; + $this->errors = array_merge($this->errors, $this->commandeFournisseur->errors); + } + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur', $trigger_key); + if ($ret < 0) { + $error++; + } } } From af0000d568ca1cb552c3eece2d91a3e99a1402b9 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Tue, 15 Feb 2022 09:51:28 +0100 Subject: [PATCH 056/171] Fixes expensereport downloads --- htdocs/core/lib/security.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4a20fbf96f2..ccdfa261fc8 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -892,8 +892,10 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl } if ($feature == 'expensereport') { $useridtocheck = $object->fk_user_author; - if (!in_array($useridtocheck, $childids)) { - return false; + if (!$user->rights->expensereport->readall) { + if (!in_array($useridtocheck, $childids)) { + return false; + } } } } From 6c6c854eae8553c7abb416dfb53caeb7f1d0ff70 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:23:43 +0100 Subject: [PATCH 057/171] fix parent line on create with origin --- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e00ff6a1763..640b990a3cb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -401,7 +401,7 @@ if (empty($reshook)) } // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d3e5a0062b0..a219da84bd4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1220,7 +1220,7 @@ if (empty($reshook)) $object->lines[] = $line; // insert new line in current object // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } @@ -1666,7 +1666,7 @@ if (empty($reshook)) } // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } From 34d2e0b8b406a01c103df1498a3af995550931ec Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 15 Feb 2022 10:29:42 +0100 Subject: [PATCH 058/171] FIX : Fixed sub bom costs problems --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index cbd730e5d23..6f748df22e4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - + $object->calculateCosts(); print ''; print ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5f732c47300..4bdf349eae5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,7 +1085,7 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); - $this->total_cost += $bom_child->total_cost; + $this->total_cost += $bom_child->total_cost * $line->qty; } else { $this->error = $bom_child->error; return -2; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index b72ed043581..14cfd22c39e 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -180,6 +180,7 @@ if ($action == 'selectlines') { print ''; // Select of all the sub-BOM lines +// From this pont to the end of the file, we only take care of sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; $sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; $resql = $object->db->query($sql); @@ -191,7 +192,9 @@ if ($resql) { $sub_bom_product->fetch($obj->fk_product); $sub_bom = new BOM($object->db); - $sub_bom->fetch($obj->fk_bom_child); + if(!empty($obj->fk_bom_child)){ + $sub_bom->fetch($obj->fk_bom_child); + } $sub_bom_line = new BOMLine($object->db); $sub_bom_line->fetch($obj->rowid); @@ -233,20 +236,23 @@ if ($resql) { // Efficiency print ''; - // Cost price if it's defined - if ($sub_bom_product->cost_price > 0) { - print ''; - $total_cost+= $sub_bom_product->cost_price * $line->qty; + if(!empty($sub_bom->id)){ + $sub_bom->calculateCosts(); + print ''; + $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + } elseif ($sub_bom_product->cost_price > 0) { + print ''; + $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''; - $total_cost.= $sub_bom_product->pmp * $line->qty; + print ''; + $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id; $resql_supplier_price = $object->db->query($sql_supplier_price); if ($resql_supplier_price) { $obj = $object->db->fetch_object($resql_supplier_price); - $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty; + $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; print ''; $total_cost+= $line_cost; From 01ef9b64eebecc2660495a48a74bb7fd5b369a55 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:34:10 +0100 Subject: [PATCH 059/171] fix parent line on create with no originid --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 53bf6dd29f2..983e3ae8205 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1054,7 +1054,7 @@ class Commande extends CommonOrder return -1; } // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63a7b2f8e21..4caa61e1aad 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -790,7 +790,7 @@ class Facture extends CommonInvoice $result = $newinvoiceline->insert(); // Defined the new fk_parent_line - if ($result > 0 && $newinvoiceline->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } From 288c58e533fe10186c3a83d6ac89ab1d96d3370f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 10:41:21 +0100 Subject: [PATCH 060/171] fix parent line on propal --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3766c7ba1a1..907236b8b9a 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1213,7 +1213,7 @@ class Propal extends CommonObject break; } // Defined the new fk_parent_line - if ($result > 0 && $line->product_type == 9) { + if ($result > 0) { $fk_parent_line = $result; } } From 885d188be341e8187f626074b7f52535973f4847 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 15 Feb 2022 10:41:55 +0100 Subject: [PATCH 061/171] use of require_once --- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 88d7e46506d..675f6e4397f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class // for other modules if (!empty($conf->categorie->enabled)) { - dol_include_once('/categories/class/categorie.class.php'); + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } //dol_include_once('/othermodule/class/otherobject.class.php'); From c90f9b5681bf037fe55da449092fa8235bb77694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 10:51:06 +0100 Subject: [PATCH 062/171] add hook in order tooltip --- htdocs/commande/class/commande.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c315a4fcd61..bcc25dbea6f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2016-2018 Ferran Marcet - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021-2022 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 @@ -3764,6 +3764,15 @@ class Commande extends CommonOrder } } + global $action; + $hookmanager->initHooks(array('orderdao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From b2815c4973f7ace9403d7979a0aa84580096ae67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 10:53:33 +0100 Subject: [PATCH 063/171] add hook in propal tooltip --- htdocs/comm/propal/class/propal.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1c532e26147..7b35cbd1148 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3690,6 +3690,15 @@ class Propal extends CommonObject } } + global $action; + $hookmanager->initHooks(array('propaldao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 11fc0da398b29bd2ce80e91957c6566f7ed8d1f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:00:05 +0100 Subject: [PATCH 064/171] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3ba9a23db08..f0e3a126cab 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2021 Josep Lluís Amador * @@ -873,6 +873,15 @@ class CommandeFournisseur extends CommonOrder } } + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 09c9b28b572a0503dbc00a992e41e94f0f6018ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:02:22 +0100 Subject: [PATCH 065/171] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index bcc25dbea6f..46fdfb3f983 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3765,7 +3765,7 @@ class Commande extends CommonOrder } global $action; - $hookmanager->initHooks(array('orderdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From a6a1e3886aef9d067980f20d92d39981a91db46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:03:50 +0100 Subject: [PATCH 066/171] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7b35cbd1148..f634ac1991b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3691,7 +3691,7 @@ class Propal extends CommonObject } global $action; - $hookmanager->initHooks(array('propaldao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 71d2d6194f1289391abfd22ba0e02f6df340b00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:06:49 +0100 Subject: [PATCH 067/171] Update categorie.class.php --- htdocs/categories/class/categorie.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5ffed2e5e4b..4112f3661dc 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2022 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 @@ -1640,6 +1640,15 @@ class Categorie extends CommonObject if ($withpicto != 2) { $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; } + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 85d158d30282913c5ba1ef9c7a6e863298262c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:09:07 +0100 Subject: [PATCH 068/171] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d12ad16194..96ddc6284aa 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015 Marcos García - * Copyright (C) 2015-2020 Frédéric France + * Copyright (C) 2015-2022 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART @@ -2282,7 +2282,15 @@ class Adherent extends CommonObject $result .= ''; } } - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From ed4622790edc6cc0f9e1f82b9f26b44d1ddd5688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:10:02 +0100 Subject: [PATCH 069/171] Update asset.class.php --- htdocs/asset/class/asset.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index e5ec21bfa6d..22570431b48 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -360,7 +360,15 @@ class Asset extends CommonObject } $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 0e664cc9694bd75af03641d148101e0d6ac011d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Feb 2022 11:12:08 +0100 Subject: [PATCH 070/171] Fix API call from ajax --- htdocs/api/index.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d19754f9c35..869dacc5cc0 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) { define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']); } +// Response for preflight requests (used by browser when into a CORS context) +if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); + header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); + http_response_code(204); + exit; +} + // When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool. if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); } +// When we request url to get an API, we accept Cross site so we can make js API call inside another website +if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) { + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); + header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); +} $res = 0; if (!$res && file_exists("../main.inc.php")) { @@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && foreach ($listofendpoints as $endpointrule) { $tmparray = explode(':', $endpointrule); - if ($classfile == $tmparray[0] && $tmparray[1] == 1) { + if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) { $endpointisallowed = true; break; } From 710e97038981468bd537f2554cfaf1d4afe169bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:13:22 +0100 Subject: [PATCH 071/171] Update facture-rec.class.php --- htdocs/compta/facture/class/facture-rec.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 047a66a78b9..8263a0b15b2 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1440,7 +1440,15 @@ class FactureRec extends CommonInvoice $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From c474ee216fd67a43bd5d13c08bc3c4527adc8fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:15:34 +0100 Subject: [PATCH 072/171] Update expedition.class.php --- htdocs/expedition/class/expedition.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 837c82be361..ad6699eae66 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2020 Lenin Rivas * * This program is free software; you can redistribute it and/or modify @@ -1824,7 +1824,15 @@ class Expedition extends CommonObject $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 0feb6e82755a71ae027648e72d4a5a5546a855d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:18:14 +0100 Subject: [PATCH 073/171] Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 1167453af44..29f5148d01a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2814,7 +2814,15 @@ class FactureFournisseur extends CommonInvoice $result .= ''; } } - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 502aa1b14b481395ab5fa24bc54870351c625e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 11:21:40 +0100 Subject: [PATCH 074/171] Update paiement.class.php --- htdocs/compta/paiement/class/paiement.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 2a8522ab05b..9459d55741f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1209,7 +1209,15 @@ class Paiement extends CommonObject $result .= ($this->ref ? $this->ref : $this->id); } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 82b3d89923f1a78605dad5e83b32eda66670808b Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 15 Feb 2022 11:31:09 +0100 Subject: [PATCH 075/171] FIX wieght is loose if it's comma on combinations --- htdocs/variants/combinations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 933d379e48a..0b08bd00758 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -235,7 +235,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( exit(); } - $prodcomb->variation_weight = $weight_impact; + $prodcomb->variation_weight = price2num($weight_impact); // for conf PRODUIT_MULTIPRICES if ($conf->global->PRODUIT_MULTIPRICES) { From 95c0e72956ef241d18d131b87205a05593c55aee Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 15 Feb 2022 11:37:24 +0100 Subject: [PATCH 076/171] Fix barcode viewimage regression on yogosha8628 --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index dee62999cf4..7f34bdb6a18 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -230,7 +230,7 @@ $original_file = str_replace('..\\', '/', $original_file); $refname = basename(dirname($original_file)."/"); // Check that file is allowed for view with viewimage.php -if (!dolIsAllowedForPreview($original_file)) { +if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) { accessforbidden('This file is not qualified for preview', 0, 0, 1); } From ebada46a07c48705ffcc662a70758005561e2281 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 15 Feb 2022 12:14:48 +0100 Subject: [PATCH 077/171] fix context for createfromclone --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4caa61e1aad..55471afeccf 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -755,6 +755,9 @@ class Facture extends CommonInvoice foreach ($this->lines as $i => $val) { $newinvoiceline = $this->lines[$i]; + + $newinvoiceline->context = $this->context; + $newinvoiceline->fk_facture = $this->id; $newinvoiceline->origin = $this->lines[$i]->element; From 50853205bb7c29ead426b49d8ec905447c9dad2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Feb 2022 16:43:47 +0100 Subject: [PATCH 078/171] Support placeholder on multiselect components --- htdocs/core/class/html.form.class.php | 11 +++++++++-- htdocs/core/customreports.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 5 ++++- htdocs/theme/md/style.css.php | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 70bf1eeb2df..32319e46cef 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8126,8 +8126,15 @@ class Form } $out .= '};'."\n"; $out .= '$(document).ready(function () { - $(\'#'.$htmlname.'\').'.$tmpplugin.'({ - dir: \'ltr\', + $(\'#'.$htmlname.'\').'.$tmpplugin.'({'; + if ($placeholder) { + $out .= ' + placeholder: { + id: \'-1\', + text: \''.dol_escape_js($placeholder).'\' + },'; + } + $out .= ' dir: \'ltr\', // Specify format function for dropdown item formatResult: formatResult, templateResult: formatResult, /* For 4.0 */ diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index dcedf1405f8..3a4ab5d1a75 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -431,8 +431,8 @@ if ($object->isextrafieldmanaged) { } } } -print '
'.$langs->trans("Measures").'
'; -print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1); // Fill the array $arrayofmeasures with possible fields +print '
'; +print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2890d29e0e8..7eb552517ee 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5932,7 +5932,7 @@ input.select2-input { color: #FFF !important; } .select2-container .select2-selection--multiple { - min-height: 30px !important; + min-height: 28px !important; } .select2-container--default .select2-selection--multiple .select2-selection__choice { margin-top: 5px !important; @@ -6045,6 +6045,9 @@ input.select2-input { background-color: #ddd; margin-top: 4px !important; } +.select2-selection--multiple input.select2-search__field { + border-bottom: none !important; +} .select2-search__field { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7879368eee3..da706095e17 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1197,6 +1197,17 @@ div.divsearchfield { padding-left: 4px; } +.caretleftaxis { + margin-left: -13px; + margin-top: -1px; + position: absolute; +} +.caretdownaxis { + margin-left: -12px; + margin-top: 0; + position: absolute; +} + browser->layout == 'phone') { @@ -5843,6 +5854,10 @@ input.select2-input { color: #FFF !important; } +.select2-container .select2-selection--multiple { + min-height: 28px !important; +} + .select2-container--default .select2-selection--multiple .select2-selection__choice { border: 1px solid #e4e4e4; } @@ -5920,6 +5935,9 @@ input.select2-input { border-right: none; border-radius: 0 !important; } +.select2-selection--multiple input.select2-search__field { + border-bottom: none !important; +} .select2-search__field { outline: none; From 7341e7ed0768f7fa97bcf310475304673a87982a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 17:06:04 +0100 Subject: [PATCH 079/171] Update don.class.php --- htdocs/don/class/don.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index cbd5a386354..ecafc925f37 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -953,7 +953,15 @@ class Don extends CommonObject $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 9dc2cc82cb364efb4af3ab66b98913a262767df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 17:07:43 +0100 Subject: [PATCH 080/171] Update supplier_proposal.class.php --- .../class/supplier_proposal.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 057b32e89ca..c852de8402e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify @@ -2553,7 +2553,15 @@ class SupplierProposal extends CommonObject $result .= ''; } } - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From ef04ce1e05b302379fbf09875ee7ac54f08c6cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 17:10:32 +0100 Subject: [PATCH 081/171] Update fichinterrec.class.php --- htdocs/fichinter/class/fichinterrec.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index ee385cbc7a4..79207efdd8f 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -653,6 +653,15 @@ class FichinterRec extends Fichinter if ($withpicto != 2) { $result .= $link.$this->ref.$linkend; } + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From d546e11fbae549309311309dd8c4c2f1c3eb20a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 17:13:08 +0100 Subject: [PATCH 082/171] Update chargesociales.class.php --- .../compta/sociales/class/chargesociales.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 431f0bcba72..79743b93056 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2016-2020 Frédéric France + * Copyright (C) 2016-2022 Frédéric France * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL * @@ -625,7 +625,15 @@ class ChargeSociales extends CommonObject $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } From 0ba912b1e50260fc3ed3d96bc201c98d1c0a22f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 18:14:44 +0100 Subject: [PATCH 083/171] add missing global --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/asset/class/asset.class.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 2 +- .../compta/sociales/class/chargesociales.class.php | 2 +- htdocs/don/class/don.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 12 ++++++++++-- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/holiday/class/holiday.class.php | 12 ++++++++++-- .../class/supplier_proposal.class.php | 2 +- 15 files changed, 33 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 96ddc6284aa..fd43660ab8a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2164,7 +2164,7 @@ class Adherent extends CommonObject */ public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0) { - global $conf, $langs; + global $conf, $langs, $hookmanager; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) { $withpictoimg = 0; diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 22570431b48..4c09f616f06 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -305,7 +305,7 @@ class Asset extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $db, $conf, $langs; + global $db, $conf, $langs, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4112f3661dc..f6e9dcc73cf 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1612,7 +1612,7 @@ class Categorie extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '') { - global $langs; + global $langs, $hookmanager; $result = ''; $label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f634ac1991b..025247417aa 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3569,7 +3569,7 @@ class Propal extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 46fdfb3f983..f2efbac0b4e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3663,7 +3663,7 @@ class Commande extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $conf, $langs, $user; + global $conf, $langs, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 8263a0b15b2..139f95c9463 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1388,7 +1388,7 @@ class FactureRec extends CommonInvoice */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1) { - global $langs; + global $langs, $hookmanager; $result = ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 79743b93056..0c062f24e7a 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -560,7 +560,7 @@ class ChargeSociales extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1) { - global $langs, $conf, $user, $form; + global $langs, $conf, $user, $form, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index ecafc925f37..c0f2f537135 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -913,7 +913,7 @@ class Don extends CommonObject */ public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1) { - global $conf, $langs; + global $conf, $langs, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index ad6699eae66..037f0ea89de 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1778,7 +1778,7 @@ class Expedition extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf; + global $langs, $conf, $hookmanager; $result = ''; $label = ''.$langs->trans("Shipment").''; diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 79207efdd8f..3653d84247d 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -628,7 +628,7 @@ class FichinterRec extends Fichinter */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '') { - global $langs; + global $langs, $hookmanager; $result = ''; $label = $langs->trans("ShowInterventionModel").': '.$this->ref; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f0e3a126cab..b346bcba5e1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -791,7 +791,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 57717c6f186..45871da689f 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1377,7 +1377,7 @@ class FactureFournisseurRec extends CommonInvoice */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -1429,7 +1429,15 @@ class FactureFournisseurRec extends CommonInvoice $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 29f5148d01a..5cc2fc32f1f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2696,7 +2696,7 @@ class FactureFournisseur extends CommonInvoice */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 29e7c41bb5f..a65894542bd 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1270,7 +1270,7 @@ class Holiday extends CommonObject */ public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1, $notooltip = 0) { - global $langs; + global $langs, $hookmanager; $result = ''; @@ -1305,7 +1305,15 @@ class Holiday extends CommonObject $result .= $this->ref; } $result .= $linkend; - + global $action; + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } return $result; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index c852de8402e..36bd0d3440c 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2470,7 +2470,7 @@ class SupplierProposal extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips From c8640f329e5e5741d9a79b523e84cdb4d141659c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 18:31:05 +0100 Subject: [PATCH 084/171] add missing global --- htdocs/asset/class/asset.class.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/mailing/class/mailing.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/class/productfournisseurprice.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- htdocs/workstation/class/workstation.class.php | 2 +- htdocs/zapier/class/hook.class.php | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 4c09f616f06..916fb376526 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -362,7 +362,7 @@ class Asset extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f6e9dcc73cf..e85d9864407 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1642,7 +1642,7 @@ class Categorie extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 19273648827..103fea28731 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1669,7 +1669,7 @@ class ActionComm extends CommonObject global $action; $hookmanager->initHooks(array('actiondao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 8050b85f180..588faa392e3 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -740,7 +740,7 @@ class Mailing extends CommonObject global $action; $hookmanager->initHooks(array('emailingdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 025247417aa..7db6fc034df 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3692,7 +3692,7 @@ class Propal extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bb3f2ae035d..589d09ce1e7 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1488,7 +1488,7 @@ class Contact extends CommonObject global $action; $hookmanager->initHooks(array('contactdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index b2c9543453b..61ff119d0c2 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2042,7 +2042,7 @@ class Contrat extends CommonObject global $action; $hookmanager->initHooks(array('contractdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 037f0ea89de..8490fa67753 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1826,7 +1826,7 @@ class Expedition extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 2401791bb5f..8c51d667f9e 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -788,7 +788,7 @@ class Position extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('positiondao')); - $parameters = array('id' => $this->id, 'getnomurl' => $result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 8b1635273cd..a2f03a64e41 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -791,7 +791,7 @@ class KnowledgeRecord extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('knowledgerecorddao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index ca9de1cc5ab..ac934439934 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -836,7 +836,7 @@ class MyObject extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('myobjectdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 29db4bcb669..2da1672e089 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1072,7 +1072,7 @@ class Mo extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('modao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 562c622e214..8e61663d339 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4943,7 +4943,7 @@ class Product extends CommonObject global $action; $hookmanager->initHooks(array('productdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 54919ac0be6..ef9b2a49117 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -642,7 +642,7 @@ class ProductFournisseurPrice extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('productfournisseurpricedao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 36bd0d3440c..4a055b5afa4 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2555,7 +2555,7 @@ class SupplierProposal extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 3fed177d95c..af622481e28 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -814,7 +814,7 @@ class Workstation extends CommonObject global $action, $hookmanager; $hookmanager->initHooks(array('workstationdao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index c3b9147a46d..e27658838bd 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -565,7 +565,7 @@ class Hook extends CommonObject $hookmanager->initHooks(array('hookdao')); $parameters = array( 'id' => $this->id, - 'getnomurl' => $result, + 'getnomurl' => &$result, ); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); From dad73b755eca9e5ebfd832fe9d517298346941d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 18:46:41 +0100 Subject: [PATCH 085/171] fix merge --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/asset/class/asset.class.php | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fd43660ab8a..b82ab4c428f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2284,7 +2284,7 @@ class Adherent extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 792bbaa4696..d07b785a474 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -360,14 +360,8 @@ class Asset extends CommonObject } $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); -<<<<<<< HEAD global $action; $hookmanager->initHooks(array($this->element . 'dao')); -======= - - global $action; - $hookmanager->initHooks(array('assetdao')); ->>>>>>> hookgetnomurl $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 935482ee2228b54fd4d6bc7034fbe2b88fd1771e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 15 Feb 2022 19:04:18 +0100 Subject: [PATCH 086/171] uniformize --- htdocs/accountancy/class/accountingaccount.class.php | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 2 +- htdocs/asset/class/asset.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/compta/sociales/class/chargesociales.class.php | 2 +- htdocs/delivery/class/delivery.class.php | 2 +- htdocs/don/class/paymentdonation.class.php | 2 +- htdocs/ecm/class/ecmdirectory.class.php | 2 +- htdocs/ecm/class/ecmfiles.class.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/expensereport/class/paymentexpensereport.class.php | 2 +- htdocs/fichinter/class/fichinterrec.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- htdocs/fourn/class/fournisseur.product.class.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/loan/class/loan.class.php | 2 +- htdocs/loan/class/paymentloan.class.php | 2 +- htdocs/reception/class/reception.class.php | 2 +- htdocs/resource/class/dolresource.class.php | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index e0d1ede11fd..ac943180b58 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -562,7 +562,7 @@ class AccountingAccount extends CommonObject $result .= $linkstart . $label_link . $linkend; } global $action; - $hookmanager->initHooks(array('accountingaccountdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 1d7ceeec860..58eeb2afd2b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -513,7 +513,7 @@ class BookKeeping extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action; - $hookmanager->initHooks(array('bookkeepingdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index d07b785a474..916fb376526 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -307,7 +307,7 @@ class Asset extends CommonObject { global $db, $conf, $langs, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager, $hookmanager; + global $menumanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f2efbac0b4e..6d05a052923 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3766,7 +3766,7 @@ class Commande extends CommonOrder global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 139f95c9463..ae264f7a813 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1442,7 +1442,7 @@ class FactureRec extends CommonInvoice $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 9459d55741f..23230c4175d 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1211,7 +1211,7 @@ class Paiement extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 0c062f24e7a..caa04146264 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -627,7 +627,7 @@ class ChargeSociales extends CommonObject $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index ccf197c7092..3241461ace1 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -759,7 +759,7 @@ class Delivery extends CommonObject $result .= $linkstart.$this->ref.$linkend; global $action; - $hookmanager->initHooks(array('deliverydao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index f1028146397..0f8db03597d 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -685,7 +685,7 @@ class PaymentDonation extends CommonObject } global $action; - $hookmanager->initHooks(array('paymentdonationdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 7381beb6fea..f99a567a314 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -507,7 +507,7 @@ class EcmDirectory extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('ecmdirectorydao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 9121ddacd0e..2f9bf4c41e5 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -870,7 +870,7 @@ class EcmFiles extends CommonObject $result .= $linkstart.$this->ref.$linkend; global $action; - $hookmanager->initHooks(array('ecmfilesdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 18126980d1b..be49b0a8c0c 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1710,7 +1710,7 @@ class ExpenseReport extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('expensereportdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 2b17f4f8603..5f9e9f17e6f 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -661,7 +661,7 @@ class PaymentExpenseReport extends CommonObject } } global $action; - $hookmanager->initHooks(array('paymentexpensereportdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 3653d84247d..fa97cf3e8a5 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -655,7 +655,7 @@ class FichinterRec extends Fichinter } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 45871da689f..c8f0ad75536 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1431,7 +1431,7 @@ class FactureFournisseurRec extends CommonInvoice $result .= $linkend; global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index c289307c69f..cb9416e3da2 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1228,7 +1228,7 @@ class ProductFournisseur extends Product //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action; - $hookmanager->initHooks(array('supplierproductdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 822ddf2cbe4..75984c94f99 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -640,7 +640,7 @@ class PaiementFourn extends Paiement $result .= $linkend; global $action; - $hookmanager->initHooks(array('supplierpaymentdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 2530ffcecfe..7edaefb45b2 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -607,7 +607,7 @@ class Loan extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('loandao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index f998b3f1077..ae31a8314aa 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -655,7 +655,7 @@ class PaymentLoan extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('loanpaymentdao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 46e89a5ac4c..741ba107e89 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1150,7 +1150,7 @@ class Reception extends CommonObject $result .= $linkstart.$this->ref.$linkend; global $action; - $hookmanager->initHooks(array('receptiondao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index b6c8586ac61..8ea35d43c33 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -987,7 +987,7 @@ class Dolresource extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('dolresourcedao')); + $hookmanager->initHooks(array($this->element . 'dao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 453871bf38ef3cece0f9efa9c2ae25fae342240d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Feb 2022 23:01:14 +0100 Subject: [PATCH 087/171] css --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/customreports.php | 6 +++--- htdocs/theme/eldy/global.inc.php | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 32319e46cef..a590e786bc1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9753,8 +9753,8 @@ class Form $ret .= '
'; //$ret .= ''; - $ret .= ''; - $ret .= ''; + $ret .= ''; + $ret .= ''; //$ret .= $langs->trans("Filters"); $ret .= ''; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 3a4ab5d1a75..f1616feb21b 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -431,21 +431,21 @@ if ($object->isextrafieldmanaged) { } } } -print '
'; +print '
'; print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields print '
'; // XAxis print '
'; -print '
'; +print '
'; print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields print '
'; // Group by print '
'; -print '
'; +print '
'; print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields print '
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7eb552517ee..5ce837e160c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -205,6 +205,7 @@ div.tabBar input, div.tabBar input.flat, div.tabBar textarea, div.tabBar textare .divadvancedsearchfieldcompinput { background: #fff; border-bottom: solid 1px var(--inputbordercolor); + border-radius: 3px; } input[name=duration_value], input[name=durationhour] { @@ -1040,6 +1041,7 @@ div.divsearchfield { padding-: 0; border-bottom: solid 1px var(--inputbordercolor); height: 24px; + border-radius: 3px; } .search_component_searchtext { padding-top: 2px; From 8b0280a9d2e656549f4164d3b857b515b4956f33 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 16 Feb 2022 10:26:44 +0100 Subject: [PATCH 088/171] add missing entity check on list of withdraws on index of paymentbybanktransfert --- htdocs/compta/paymentbybanktransfer/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 78425398017..1cb47d1c1dc 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -182,6 +182,7 @@ $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " WHERE p.type = 'bank-transfer'"; +$sql .= " AND p.entity IN (".getEntity('invoice').")"; $sql .= " ORDER BY datec DESC"; $sql .= $db->plimit($limit); From ff8dcdc4b7436d3ea206f471ab27aa9224462a67 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 16 Feb 2022 10:52:20 +0100 Subject: [PATCH 089/171] manage details of prelevment line for bank transfer --- htdocs/compta/prelevement/line.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index ccb60486c76..3e3ecb8e0ba 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -268,12 +268,20 @@ if ($id) $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql .= " , ".MAIN_DB_PREFIX."facture as f"; + if ($type == 'bank-transfer') { + $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f"; + } else { + $sql .= " , ".MAIN_DB_PREFIX."facture as f"; + } $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND f.fk_soc = s.rowid"; - $sql .= " AND pf.fk_facture = f.rowid"; + if ($type == 'bank-transfer') { + $sql .= " AND pf.fk_facture_fourn = f.rowid"; + } else { + $sql .= " AND pf.fk_facture = f.rowid"; + } $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND pl.rowid=".$id; if ($socid) $sql .= " AND s.rowid = ".$socid; From 7e17167fafbd87fa561150e1ba02038c7ac31228 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 16 Feb 2022 11:45:29 +0100 Subject: [PATCH 090/171] NEW total mark rate in list --- htdocs/comm/propal/list.php | 19 +++++++++++++++++-- htdocs/commande/list.php | 17 ++++++++++++++++- htdocs/compta/facture/list.php | 17 ++++++++++++++++- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index e4cc6a37c1c..3e790bf6448 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1486,8 +1486,11 @@ if ($resql) { ) { $with_margin_info = true; } + $total_ht = 0; + $total_margin = 0; - while ($i < min($num, $limit)) { + $last_num = min($num, $limit); + while ($i < $last_num) { $obj = $db->fetch_object($resql); $objectstatic->id = $obj->rowid; @@ -1541,6 +1544,8 @@ if ($resql) { if ($with_margin_info === true) { $objectstatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($objectstatic); + $total_ht += $obj->total_ht; + $total_margin += $marginInfo['total_margin']; } print '
'; @@ -1959,7 +1964,7 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; } - $totalarray['val']['total_margin'] += $marginInfo['total_margin']; + $totalarray['val']['total_margin'] = $total_margin; } // Total margin rate if (!empty($arrayfields['total_margin_rate']['checked'])) { @@ -1974,6 +1979,16 @@ if ($resql) { if (!$i) { $totalarray['nbfield']++; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $last_num - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } } // Extra fields diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 35abd34728a..27391d7a901 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1463,8 +1463,11 @@ if ($resql) { ) { $with_margin_info = true; } + $total_ht = 0; + $total_margin = 0; - while ($i < min($num, $limit)) { + $last_num = min($num, $limit); + while ($i < $last_num) { $obj = $db->fetch_object($resql); $notshippable = 0; @@ -1510,6 +1513,8 @@ if ($resql) { if ($with_margin_info === true) { $generic_commande->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($generic_commande); + $total_ht += $obj->total_ht; + $total_margin += $marginInfo['total_margin']; } print ''; @@ -1879,6 +1884,16 @@ if ($resql) { if (!$i) { $totalarray['nbfield']++; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; + } + if ($i >= $last_num - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } } // Extra fields diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3e28fd05932..5914e37e425 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1651,8 +1651,11 @@ if ($resql) { ) { $with_margin_info = true; } + $total_ht = 0; + $total_margin = 0; - while ($i < min($num, $limit)) { + $last_num = min($num, $limit); + while ($i < $last_num) { $obj = $db->fetch_object($resql); $datelimit = $db->jdate($obj->datelimite); @@ -1740,6 +1743,8 @@ if ($resql) { if ($with_margin_info === true) { $facturestatic->fetch_lines(); $marginInfo = $formmargin->getMarginInfosArray($facturestatic); + $total_ht += $obj->total_ht; + $total_margin += $marginInfo['total_margin']; } print '= $last_num - 1) { + if (!empty($total_ht)) { + $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); + } else { + $totalarray['val']['total_mark_rate'] = ''; + } + } } // Extra fields From 60ada5fe7226a02692954c762114e33d4d509011 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 14:06:16 +0100 Subject: [PATCH 091/171] Can filter on status purchase on list of products --- htdocs/core/class/html.form.class.php | 13 +++++++++---- htdocs/product/ajax/products.php | 5 +++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a590e786bc1..23dd88d3151 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2219,9 +2219,10 @@ class Form * 'warehouseinternal' = count products from warehouses for internal correct/transfer only * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @param string $nooutput No print, return the output into a string + * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase * @return void|string */ - public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0) + public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1) { // phpcs:enable global $langs, $conf; @@ -2261,7 +2262,7 @@ class Form } } // mode=1 means customers products - $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; + $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; //Price by customer if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { $urloption .= '&socid='.$socid; @@ -2357,7 +2358,7 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } } else { - $out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus); + $out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus, $status_purchase); } if (empty($nooutput)) { @@ -2453,9 +2454,10 @@ class Form * 'warehouseopen' = count products from open warehouses, * 'warehouseclosed' = count products from closed warehouses, * 'warehouseinternal' = count products from warehouses for internal correct/transfer only + * @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase * @return array Array of keys for json */ - public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '') + public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1) { // phpcs:enable global $langs, $conf; @@ -2593,6 +2595,9 @@ class Form } elseif ($status >= 0) { $sql .= " AND p.tosell = ".((int) $status); } + if ($status_purchase >= 0) { + $sql .= " AND p.tobuy = ".((int) $status_purchase); + } // Filter by product type if (strval($filtertype) != '') { $sql .= " AND p.fk_product_type = ".((int) $filtertype); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 32c4c83378c..74fa53dccb8 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -51,7 +51,8 @@ $htmlname = GETPOST('htmlname', 'aZ09'); $socid = GETPOST('socid', 'int'); $type = GETPOST('type', 'int'); $mode = GETPOST('mode', 'int'); -$status = ((GETPOST('status', 'int') >= 0) ? GETPOST('status', 'int') : - 1); +$status = ((GETPOST('status', 'int') >= 0) ? GETPOST('status', 'int') : - 1); // status buy when mode = customer , status purchase when mode = supplier +$status_purchase = ((GETPOST('status_purchase', 'int') >= 0) ? GETPOST('status_purchase', 'int') : - 1); // status purchase when mode = customer $outjson = (GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0); $price_level = GETPOST('price_level', 'int'); $action = GETPOST('action', 'aZ09'); @@ -260,7 +261,7 @@ if ($action == 'fetch' && !empty($id)) { } if (empty($mode) || $mode == 1) { // mode=1: customer - $arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus); + $arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase); } elseif ($mode == 2) { // mode=2: supplier $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, 0, $alsoproductwithnosupplierprice); } From 69266ae61fe22ab96a264e219812869d061bf97d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 14:11:48 +0100 Subject: [PATCH 092/171] Fix text --- htdocs/modulebuilder/template/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 45c5e4b51eb..03cf25d74f4 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -28,10 +28,10 @@ There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module- ### From the ZIP file and GUI interface -- If you get the module in a zip file (like when downloading it from the market place [Dolistore](https://www.dolistore.com)), go into -menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file. +If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)), +go into menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file. -Note: If this screen tell you there is no custom directory, check your setup is correct: +Note: If this screen tell you that there is no "custom" directory, check that your setup is correct: - In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented: @@ -58,7 +58,7 @@ Note: If this screen tell you there is no custom directory, check your setup is ### From a GIT repository -- Clone the repository in ```$dolibarr_main_document_root_alt/mymodule``` +Clone the repository in ```$dolibarr_main_document_root_alt/mymodule``` ```sh cd ....../custom From 4a343247b0f328ca17401615847977376210d453 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 14:34:32 +0100 Subject: [PATCH 093/171] Return a 404 http code when CSRF protection fails --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8dd5c45642f..303ed94576e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -510,6 +510,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( print $langs->trans("ErrorGoBackAndCorrectParameters"); die; } else { + http_response_code(403); if (defined('CSRFCHECK_WITH_TOKEN')) { dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (CSRFCHECK_WITH_TOKEN protection) in main.inc.php. Token not provided.", LOG_WARNING); print "Access to a page that needs a token (constant CSRFCHECK_WITH_TOKEN is defined) is refused by CSRF protection in main.inc.php. Token not provided.\n"; From 1a41232181e9d7802f0edabe4e9285fd9f2b6c07 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:24:35 +0100 Subject: [PATCH 094/171] add vacant position option --- htdocs/hrm/class/position.class.php | 77 ++++++++++++++++++++++++++++- htdocs/hrm/position_list.php | 4 ++ htdocs/langs/fr_FR/hrm.lang | 2 + 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 2401791bb5f..f3cc82f92fe 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -109,7 +109,7 @@ class Position extends CommonObject 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), - 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,), + 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), @@ -842,7 +842,80 @@ class Position extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } - /** + /** + * Return HTML string to put an input field into a page + * Code very similar with showInputField of extra fields + * + * @param array $val Array of properties for field to show + * @param string $key Key of attribute + * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @return string + */ + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) + { + global $langs; + + if($key == 'fk_user') + { + $vacantId = $keyprefix.$key.'vacant'.$keysuffix; + + $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + $out.= ''; + + ?> + + fk_user == 0) + { + return $langs->trans("VacantPosition"); + } + return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + } + + + /** * Load the info information in the object * * @param int $id Id of object diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index d6ed72c2612..0e0f561ebb2 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -270,6 +270,10 @@ foreach ($search as $key => $val) { } } } +$vacant = GETPOST('vacant', 'alphanohtml') === 'on'; +if($vacant) { + $sql .= ' AND t.fk_user = 0'; +} if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index d47596fe95e..fd0bddcc2eb 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -79,3 +79,5 @@ NoEval=Aucune évaluation effectuée pour cet employé HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau HighestRank=Plus haut niveau SkillComparison=Comparaison des compétences +VacantPosition=Poste vacant +VacantCheckboxHelper=Cocher cette option affichera le(s) poste(s) comme non pourvu(s) From 7868aa305b8e0cea98f4dc01101f10107b9c5d57 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:48:23 +0100 Subject: [PATCH 095/171] fix filter --- htdocs/hrm/position_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 0e0f561ebb2..11e6d3c9abf 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -270,7 +270,7 @@ foreach ($search as $key => $val) { } } } -$vacant = GETPOST('vacant', 'alphanohtml') === 'on'; +$vacant = GETPOST('search_fk_uservacant', 'alphanohtml') === 'on'; if($vacant) { $sql .= ' AND t.fk_user = 0'; } From dbcbda642a3531f3c115a8f0e26fef5aa725d658 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:53:06 +0100 Subject: [PATCH 096/171] fix sticker 1 --- htdocs/hrm/class/position.class.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f3cc82f92fe..bc74f96cee9 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -855,22 +855,20 @@ class Position extends CommonObject * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @return string */ - public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) - { + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) { global $langs; - if($key == 'fk_user') - { + if($key == 'fk_user') { $vacantId = $keyprefix.$key.'vacant'.$keysuffix; $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); - $out.= ''; + $out .= ''; ?> fk_user == 0) - { + if($key == 'fk_user' && $this->fk_user == 0) { return $langs->trans("VacantPosition"); } return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); From 98c50f531ce0e34e3b08cd467c8a9dcbc5ad1a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 16 Feb 2022 15:57:39 +0100 Subject: [PATCH 097/171] translation string instead of error message text --- htdocs/langs/en_US/productbatch.lang | 2 ++ htdocs/langs/fr_FR/productbatch.lang | 1 + htdocs/product/stock/class/mouvementstock.class.php | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 763af20c6b4..a4215a1d7d4 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -41,3 +41,5 @@ QCFrequency=Quality control frequency (in days) #Traceability - qc status OutOfOrder=Out of order InWorkingOrder=In working order + +CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one. diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index 40c8b0be477..e0a0749e927 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -42,3 +42,4 @@ HideLots=Masquer les lots #Traceability - qc status OutOfOrder=Hors d'usage InWorkingOrder=En état de marche +CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui n’existe plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre. diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 8a66e535ca2..4976530eb5e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -842,7 +842,9 @@ class MouvementStock extends CommonObject */ private function createBatch($dluo, $qty) { - global $user; + global $user, $langs; + + $langs->load('productbatch'); $pdluo = new Productbatch($this->db); @@ -853,7 +855,7 @@ class MouvementStock extends CommonObject $result = $pdluo->fetch($dluo); if (empty($pdluo->id)) { // We didn't find the line. May be it was deleted before by a previous move in same transaction. - $this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.'; + $this->error = $langs->trans('CantMoveNonExistantSerial'); $this->errors[] = $this->error; $result = -2; } From 038298a638f88200d11688b1624cf987b5005de8 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:10:48 +0100 Subject: [PATCH 098/171] change button and add title --- htdocs/hrm/job_agenda.php | 13 ++++--------- htdocs/langs/fr_FR/hrm.lang | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 6bfafcc1269..0685ccdba9a 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -189,18 +189,13 @@ if ($object->id > 0) { } - print '
'; - if (!empty($conf->agenda->enabled)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; - } else { - print ''.$langs->trans("AddAction").''; - } + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } } - print '
'; - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { @@ -211,7 +206,7 @@ if ($object->id > 0) { } - //print load_fiche_titre($langs->trans("ActionsOnJob"), '', ''); + print load_fiche_titre($langs->trans("ActionsOnJob"), $newcardbutton, ''); // List of all actions $filters = array(); diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index d47596fe95e..cab3c7c11af 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -79,3 +79,4 @@ NoEval=Aucune évaluation effectuée pour cet employé HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau HighestRank=Plus haut niveau SkillComparison=Comparaison des compétences +ActionsOnJob=Événements sur cet emploi \ No newline at end of file From 1f2659d4114e6c715aa6ec0450c482bf77f5319d Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:26:57 +0100 Subject: [PATCH 099/171] insert precommit --- htdocs/hrm/job_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 0685ccdba9a..08da46fadf8 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -217,6 +217,6 @@ if ($object->id > 0) { } } -// End of page +//End of page llxFooter(); $db->close(); From 5f09ac61b2df1ac06111affeb5406ff79ae831ef Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:27:47 +0100 Subject: [PATCH 100/171] insert precommit1 --- htdocs/hrm/job_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 08da46fadf8..0685ccdba9a 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -217,6 +217,6 @@ if ($object->id > 0) { } } -//End of page +// End of page llxFooter(); $db->close(); From 30d3a782dea288fe7dcc305e3e2cf49841e0fb64 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:30:54 +0100 Subject: [PATCH 101/171] precommit stickler --- htdocs/hrm/class/position.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index bc74f96cee9..2bba18c131a 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -1141,7 +1141,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; class PositionLine extends CommonObjectLine { // To complete with content of an object PositionLine - // We should have a field rowid, fk_position and position + // We should have a field rowid , fk_position and position /** * @var int Does object support extrafields ? 0=No, 1=Yes From a9496220b58d493ebdd14058cf5ece8ed7d4b4ca Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 16 Feb 2022 16:43:52 +0100 Subject: [PATCH 102/171] Fix : warnings php 8.0 --- htdocs/modulebuilder/index.php | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4e66e655f5e..60f23cbee1a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -46,6 +46,9 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); +$sortfield=GETPOST('sortfield', 'alpha'); +$sortorder=GETPOST('sortorder', 'alpha'); + $module = GETPOST('module', 'alpha'); $tab = GETPOST('tab', 'aZ09'); $tabobj = GETPOST('tabobj', 'alpha'); @@ -2296,7 +2299,7 @@ if ($module == 'initmodule') { print_liste_field_titre("Condition", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print "
\n"; - if (is_array($dicts) && is_array($dicts['tabname'])) { + if (!empty($dicts) && is_array($dicts) && !empty($dicts['tabname']) && is_array($dicts['tabname'])) { $i = 0; $maxi = count($dicts['tabname']); while ($i < $maxi) { @@ -2778,25 +2781,25 @@ if ($module == 'initmodule') { $propname = $propkey; $proplabel = $propval['label']; $proptype = $propval['type']; - $proparrayofkeyval = $propval['arrayofkeyval']; + $proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:''; $propnotnull = $propval['notnull']; - $propdefault = $propval['default']; - $propindex = $propval['index']; - $propforeignkey = $propval['foreignkey']; + $propdefault = !empty($propval['default'])?$propval['default']:''; + $propindex = !empty($propval['index'])?$propval['index']:''; + $propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:''; $propposition = $propval['position']; $propenabled = $propval['enabled']; $propvisible = $propval['visible']; - $propnoteditable = $propval['noteditable']; - $propsearchall = $propval['searchall']; - $propisameasure = $propval['isameasure']; - $propcss = $propval['css']; - $propcssview = $propval['cssview']; - $propcsslist = $propval['csslist']; - $prophelp = $propval['help']; - $propshowoncombobox = $propval['showoncombobox']; + $propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0; + $propsearchall = !empty($propval['searchall'])?$propval['searchall']:0; + $propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0; + $propcss = !empty($propval['css'])?$propval['css']:''; + $propcssview = !empty($propval['cssview'])?$propval['cssview']:''; + $propcsslist = !empty($propval['csslist'])?$propval['csslist']:''; + $prophelp = !empty($propval['help'])?$propval['help']:''; + $propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0; //$propdisabled=$propval['disabled']; - $propvalidate = $propval['validate']; - $propcomment = $propval['comment']; + $propvalidate = !empty($propval['validate'])?$propval['validate']:0; + $propcomment = !empty($propval['comment'])?$propval['comment']:''; print ''; From 7ed6ca6ec629cea1e545d1cffb81c119a63753a0 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 21 Oct 2021 23:28:58 +0200 Subject: [PATCH 103/171] FIX ISSUE DB_ERROR_SYNTAX-#18921 --- htdocs/ticket/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 6991516ede8..0d0e97336cd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '') { + if ($search[$key] != '' && !empty($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } @@ -609,9 +609,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { - foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if (is_array($val) && count($val)) { + foreach ($val as $skey) { + $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } } else { $param .= '&search_'.$key.'='.urlencode($search[$key]); From aa2a57ff95404990a6494ed2f185352c91140030 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 24 Oct 2021 00:26:28 +0200 Subject: [PATCH 104/171] Check that the value is not an array --- 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 0d0e97336cd..4caffd173c3 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '' && !empty($val)) { + if ($search[$key] != '' && !is_array($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } From 1ede8a30b2bc708caf3f1289cd3796b87d1cbf24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 17:49:05 +0100 Subject: [PATCH 105/171] Missing NOSESSION --- htdocs/modulebuilder/template/myobject_card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 180ece04fa8..bacb2f988dc 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -42,6 +42,7 @@ //if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification +//if (! defined('NOSESSION')) define('NOSESSION', '1'); // Disable session // Load Dolibarr environment $res = 0; From dfcc49d466cc69a357fe4f39c2dfa033d4f47497 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 20:50:27 +0100 Subject: [PATCH 106/171] Doc --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0ba8fbbc769..6435acb2877 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -723,7 +723,7 @@ class Reception extends CommonObject /** * Get status from all dispatched lines * - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, Status of reception if OK */ public function getStatusDispatch() { From 690a91d54666dcb1c7a99a224039b2c60e034af8 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 14 Feb 2022 18:07:18 +0100 Subject: [PATCH 107/171] NEW automatically set totally received status in reception --- htdocs/reception/class/reception.class.php | 97 +++++++++++++++++++++- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 382cc5be9b6..7efcb2360dc 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -635,11 +635,15 @@ class Reception extends CommonObject } } - // Change status of order to "reception in process" - $ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur'); - - if (!$ret) { + // Change status of order to "reception in process" or "totally received" + $status = $this->getStatusDispatch(); + if ($status < 0) { $error++; + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); + if (!$ret) { + $error++; + } } if (!$error && !$notrigger) { @@ -707,7 +711,92 @@ class Reception extends CommonObject } } + /** + * Get status from all dispatched lines + * + * @return int <0 if KO, >0 if OK + */ + public function getStatusDispatch() + { + global $conf; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; + + $status = CommandeFournisseur::STATUS_RECEIVED_PARTIALLY; + + if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) { + if (empty($this->commandeFournisseur)) { + $this->commandeFournisseur = null; + $this->fetch_origin(); + if (empty($this->commandeFournisseur->lines)) { + $res = $this->commandeFournisseur->fetch_lines(); + if ($res < 0) return $res; + } + } + + $qty_received = array(); + $qty_wished = array(); + + $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); + $filter = array('t.fk_commande'=>$this->origin_id); + if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { + $filter['t.status'] = 1; // Restrict to lines with status validated + } + + $ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter); + if ($ret < 0) { + $this->error = $supplierorderdispatch->error; + $this->errors = $supplierorderdispatch->errors; + return $ret; + } else { + // build array with quantity received by product in all supplier orders (origin) + foreach ($supplierorderdispatch->lines as $dispatch_line) { + $qty_received[$dispatch_line->fk_product] += $dispatch_line->qty; + } + + // qty wished in order supplier (origin) + foreach ($this->commandeFournisseur->lines as $origin_line) { + // exclude lines not qualified for reception + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $origin_line->product_type > 0) { + continue; + } + + $qty_wished[$origin_line->fk_product] += $origin_line->qty; + } + + // compare array + $diff_array = array_diff_assoc($qty_received, $qty_wished); // Warning: $diff_array is done only on common keys. + $keys_in_wished_not_in_received = array_diff(array_keys($qty_wished), array_keys($qty_received)); + $keys_in_received_not_in_wished = array_diff(array_keys($qty_received), array_keys($qty_wished)); + + if (count($diff_array) == 0 && count($keys_in_wished_not_in_received) == 0 && count($keys_in_received_not_in_wished) == 0) { // no diff => mean everything is received + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } elseif (!empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED)) { + // set totally received if more products received than ordered + $close = 0; + + if (count($diff_array) > 0) { + // there are some difference between the two arrays + // scan the array of results + foreach ($diff_array as $key => $value) { + // if the quantity delivered is greater or equal to ordered quantity + if ($qty_received[$key] >= $qty_wished[$key]) { + $close++; + } + } + } + + if ($close == count($diff_array)) { + // all the products are received equal or more than the ordered quantity + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } + } + } + } + + return $status; + } /** * Add an reception line. From 9b1d800311d3043552bedefbd3bc52186243e78a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 15 Feb 2022 09:54:40 +0100 Subject: [PATCH 108/171] NEW add triiger and event on totally received status --- htdocs/reception/class/reception.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7efcb2360dc..bb54a8164cd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -640,9 +640,18 @@ class Reception extends CommonObject if ($status < 0) { $error++; } else { - $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); - if (!$ret) { - $error++; + $trigger_key = ''; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { + $ret = $this->commandeFournisseur->Livraison($user, dol_now(), 'tot', ''); + if ($ret < 0) { + $error++; + $this->errors = array_merge($this->errors, $this->commandeFournisseur->errors); + } + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur', $trigger_key); + if ($ret < 0) { + $error++; + } } } From 131ae92cc672c5ced53512477bd3b1267f976573 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 21:05:23 +0100 Subject: [PATCH 109/171] FIX #20063 --- htdocs/core/class/html.form.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 23dd88d3151..811ad017c4d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7384,10 +7384,17 @@ class Form $objecttmp = null; + // Example of value for $objectdec: + // Bom:bom/class/bom.class.php:0:t.status=1 + // Bom:bom/class/bom.class.php:0:t.status=1:ref + // Bom:bom/class/bom.class.php:0:(t.status:=:1):ref $InfoFieldList = explode(":", $objectdesc, 4); $vartmp = $InfoFieldList[3]; - $InfoFieldList[4] = preg_replace('/^.*:(\w*)$/', '\1', $vartmp); // take the sort field - $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field + $reg = array(); + if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { + $InfoFieldList[4] = $reg[1]; // take the sort field + } + $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field $classname = $InfoFieldList[0]; $classpath = $InfoFieldList[1]; From 1c8c98ac0f22b61ffcd05b4a672fa92d9329df2d Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 17 Feb 2022 09:53:36 +0100 Subject: [PATCH 110/171] fix ticket public interface: When sending an email to the customer, If a custom URL had been provided for ticket public interface, the link provided in the email did lead to the index of the public interface. We want it to lead to /view.php --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 29ec7983930..31b44f39b18 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -211,7 +211,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket', 2)).'/view.php?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; From aea9c2e4275de16ae066fd03ca77d16f7e65391a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 17 Feb 2022 10:22:58 +0100 Subject: [PATCH 111/171] Fix : fix php 8.0 warnings --- htdocs/adherents/agenda.php | 3 +++ htdocs/adherents/card.php | 1 + htdocs/adherents/subscription.php | 2 ++ htdocs/core/tpl/login.tpl.php | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index cb942ba3176..9132dae5802 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -65,6 +65,9 @@ if (GETPOST('actioncode', 'array')) { } $search_agenda_label = GETPOST('search_agenda_label'); +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$objcanvas = null; + // Security check $result = restrictedArea($user, 'adherent', $id); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a2e3779d52b..caf2bbe61d6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -55,6 +55,7 @@ $id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; $typeid = GETPOST('typeid', 'int'); $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); +$ref = GETPOST('ref', 'alpha'); if (!empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ac2555b4deb..5f578869e6e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -40,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'other')); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c07e01570c2..70f4f51290c 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) $_SERVER['CONTENT_LENGTH']; +$size = (int) !empty($_SERVER['CONTENT_LENGTH'])?$_SERVER['CONTENT_LENGTH']:0; if ($size > 10000) { http_response_code(413); $langs->loadLangs(array("errors", "install")); From 13cfe858f23d5b132597206c5ca674f5fe27a8f4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 17 Feb 2022 09:53:02 +0000 Subject: [PATCH 112/171] Fixing style errors. --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 6f748df22e4..f6e40b511f1 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $object->calculateCosts(); + $object->calculateCosts(); print ''; print ''; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 14cfd22c39e..8040310ea53 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -192,9 +192,9 @@ if ($resql) { $sub_bom_product->fetch($obj->fk_product); $sub_bom = new BOM($object->db); - if(!empty($obj->fk_bom_child)){ + if (!empty($obj->fk_bom_child)) { $sub_bom->fetch($obj->fk_bom_child); - } + } $sub_bom_line = new BOMLine($object->db); $sub_bom_line->fetch($obj->rowid); @@ -236,11 +236,11 @@ if ($resql) { // Efficiency print ''; - if(!empty($sub_bom->id)){ - $sub_bom->calculateCosts(); - print ''; + if (!empty($sub_bom->id)) { + $sub_bom->calculateCosts(); + print ''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; - } elseif ($sub_bom_product->cost_price > 0) { + } elseif ($sub_bom_product->cost_price > 0) { print ''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined From 1ad8700810096cb8b5964a7cdda14881f965ce45 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 17 Feb 2022 11:08:23 +0100 Subject: [PATCH 113/171] empty commit to force travis try rebuild From 67cb2683248785499a3a4380cc13cc6f78cf918d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 11:33:34 +0100 Subject: [PATCH 114/171] Update example conf file with force_install_lockinstall --- htdocs/conf/conf.php.example | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 6bf2873b50c..8cd46352ac9 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -321,6 +321,15 @@ $dolibarr_cron_allow_cli='0'; // // $php_session_save_handler=''; +// force_install_lockinstall +// If this value is set to a value, it forces the creation of a file install.lock once an upgrade process into a new version end. +// The value is the octal value of permission to set on created file. +// The file install.lock prevents the use of the migration process another time. You will have to delete it manually for +// next upgrade. +// Default value: '0' +// Example: '444'; +// $force_install_lockinstall='440'; + //################## From bb08341dc3a5029e8cc988b5962a90e47d7a67aa Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 17 Feb 2022 18:34:23 +0800 Subject: [PATCH 115/171] to disable the default pdf generation --- htdocs/fourn/class/fournisseur.commande.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ed978010a33..8a0e0de299e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3132,18 +3132,19 @@ class CommandeFournisseur extends CommonOrder $outputlangs->load("products"); if (!dol_strlen($modele)) { - $modele = 'muscadet'; - + $modele = ''; if ($this->model_pdf) { $modele = $this->model_pdf; } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } - - $modelpath = "core/modules/supplier_order/doc/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + if (empty($modele)) { + return 0; + } else { + $modelpath = "core/modules/supplier_order/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } } /** From c529af90c66ae1271fda99c4c102c007db538b90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 12:06:48 +0100 Subject: [PATCH 116/171] Fix trans --- htdocs/admin/tools/dolibarr_export.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 4f6977ffb41..092f3a57170 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -546,6 +546,7 @@ print ''; print ''; +$title = $langs->trans("BackupZipWizard"); print "
\n"; print "\n"; @@ -564,7 +565,7 @@ print ''; print '
'; -print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard")); +print load_fiche_titre($title); print '
'; $prefix = 'documents'; From 85327f28b0ad0cb2c1e958f461ef0d41f462f479 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:12:24 +0100 Subject: [PATCH 117/171] Update login.tpl.php --- htdocs/core/tpl/login.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 70f4f51290c..27356c96795 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) !empty($_SERVER['CONTENT_LENGTH'])?$_SERVER['CONTENT_LENGTH']:0; +$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']); if ($size > 10000) { http_response_code(413); $langs->loadLangs(array("errors", "install")); From 2e744a4517cf59fd939856ac1d97e7d054511c6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:18:22 +0100 Subject: [PATCH 118/171] Update create_ticket.php --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 31b44f39b18..1c9ca3aafe0 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -211,7 +211,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket', 2)).'/view.php?track_id='.$object->track_id; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; From 68beafe599c0e91f5c8777d2e402eaf2a357e952 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:24:44 +0100 Subject: [PATCH 119/171] Removed useless indexes --- htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql index b82e75d85d6..c5a451e030f 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql @@ -17,9 +17,7 @@ ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity); -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity); -ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_soc (fk_soc); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_user_author (fk_user_author); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_projet (fk_projet); From c20d82499920c1c0028d681700e7b80770e884ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:30:18 +0100 Subject: [PATCH 120/171] Tables of module ticket are create only when module is enabled. --- htdocs/core/modules/modTicket.class.php | 5 +++++ .../tables/{llx_ticket.key.sql => llx_ticket-ticket.key.sql} | 0 .../mysql/tables/{llx_ticket.sql => llx_ticket-ticket.sql} | 0 ...afields.key.sql => llx_ticket_extrafields-ticket.key.sql} | 0 ...ket_extrafields.sql => llx_ticket_extrafields-ticket.sql} | 0 5 files changed, 5 insertions(+) rename htdocs/install/mysql/tables/{llx_ticket.key.sql => llx_ticket-ticket.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket.sql => llx_ticket-ticket.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket_extrafields.key.sql => llx_ticket_extrafields-ticket.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket_extrafields.sql => llx_ticket_extrafields-ticket.sql} (100%) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..50922ed884e 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -320,6 +320,11 @@ class modTicket extends DolibarrModules { global $conf, $langs; + $result = $this->_load_tables('/install/mysql/tables/', 'ticket'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Permissions $this->remove($options); diff --git a/htdocs/install/mysql/tables/llx_ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.key.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql From b393a1277fbd4c7c8661ed43008d928a343bab4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:50:21 +0100 Subject: [PATCH 121/171] Update 14.0.0-15.0.0.sql --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 69d7c93af5f..b57d995c251 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -507,8 +507,8 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); --- Delete old mexican legal forms -DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); +-- We do not delete old mexican legal forms because they may have been used. User will have to insert the new one manually not inserted because of conflict if he need them. +--DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); From 39bb854ef877d29e814a42b73899841e90851c0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:57:45 +0100 Subject: [PATCH 122/171] Update ticket.php --- htdocs/admin/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index e6a6208324e..fc8a5e8e0b9 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -478,7 +478,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Workflow"), '', ''); +print load_fiche_titre($langs->trans("Other"), '', ''); print '
'.$langs->trans("TicketsAutoReadTicket").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND); +} +print ''; +print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help'); +print '
'.$langs->trans("TicketsAutoAssignTicket").''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2d850927782..2867c7b853b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -517,6 +517,7 @@ or=or Other=Other Others=Others OtherInformations=Other information +Workflow=Workflow Quantity=Quantity Qty=Qty ChangedBy=Changed by diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index d38358eb74d..222efad8ba2 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. +TicketsAutoReadTicket=Automatically mark the ticket as read +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. + # # Index & list page # diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 63c5192a01f..12778f337dd 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -517,6 +517,7 @@ or=ou Other=Autre Others=Autres OtherInformations=Autre information +Workflow=Processus de travail Quantity=Quantité Qty=Qté ChangedBy=Modifié par diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 91850194533..bc51a7627fd 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Envoyer un ou des emails lorsqu’un nouveau TicketsPublicNotificationNewMessageHelp=Envoyer un (des) courriel(s) lorsqu’un nouveau message est ajouté à partir de l’interface publique (à l’utilisateur désigné ou au courriel de notification (mise à jour) et/ou au courriel de notification) TicketPublicNotificationNewMessageDefaultEmail=Emails de notifications à (mise à jour) TicketPublicNotificationNewMessageDefaultEmailHelp=Envoyez un email à cette adresse email pour chaque nouveau message de notifications si le ticket n'a pas d'utilisateur assigné ou si l'utilisateur n'a pas d'email connu. +TicketsAutoReadTicket=Automatiquement marquer le ticket comme lu +TicketsAutoReadTicketHelp=Automatiquement marquer le ticket comme lu s'il est créé depuis le backoffice. + # # Index & list page # From c5d1310373a4a7f41806a412c66986a6e3cc84b3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:23:58 +0100 Subject: [PATCH 014/171] handle workflow constants in appropriate category --- htdocs/admin/ticket.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 1805f5de34d..e6a6208324e 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -143,6 +143,20 @@ if ($action == 'updateMask') { } } +if ($action == 'setvarworkflow') { + $param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } +} + if ($action == 'setvarother') { $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); @@ -177,18 +191,6 @@ if ($action == 'setvarother') { if (!($res > 0)) { $error++; } - - $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - - $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } } @@ -473,7 +475,7 @@ print '
'; if (!$conf->use_javascript_ajax) { print '
'; print ''; - print ''; + print ''; } print load_fiche_titre($langs->trans("Workflow"), '', ''); From 4c5ddcf0300a59b1b50f388299e73d3014ce3f88 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:57:28 +0100 Subject: [PATCH 015/171] ticket config: add constant TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND to admin panel --- htdocs/core/modules/modTicket.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..6091a245bfa 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -106,7 +106,8 @@ class modTicket extends DolibarrModules $this->const = array( 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), - 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0) + 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0) ); From 664860863ee4463327a146a9095f9fad5b9de5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 10 Feb 2022 17:59:12 +0100 Subject: [PATCH 016/171] correct warehouse document location --- htdocs/product/stock/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 440e082e8ff..80be3c923ec 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -944,7 +944,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { $delallowed = $usercancreate; $modulepart = 'stock'; - print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; print '
'; From 30d7f807e49a553673d3053b16ae759963129a2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Feb 2022 21:03:10 +0100 Subject: [PATCH 017/171] Fix url --- htdocs/comm/propal/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 746075ab51e..45a4d2fdb57 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2543,7 +2543,7 @@ if ($action == 'create') { if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) || ($object->statut == Propal::STATUS_DRAFT && !empty($conf->global->PROPAL_ENABLE_NEGATIVE) && count($object->lines) > 0)) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print ''.$langs->trans('Validate').''; } else { print ''.$langs->trans('Validate').''; } @@ -2555,7 +2555,7 @@ if ($action == 'create') { }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } // ReOpen @@ -2578,7 +2578,7 @@ if ($action == 'create') { // Create a sale order if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } } @@ -2586,7 +2586,7 @@ if ($action == 'create') { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) { if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { if ($usercancreatepurchaseorder) { - print ''.$langs->trans("AddPurchaseOrder").''; + print ''.$langs->trans("AddPurchaseOrder").''; } } } @@ -2595,7 +2595,7 @@ if ($action == 'create') { if (!empty($conf->service->enabled) && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); - print ''.$langs->trans("AddIntervention").''; + print ''.$langs->trans("AddIntervention").''; } } @@ -2604,14 +2604,14 @@ if ($action == 'create') { $langs->load("contracts"); if ($usercancreatecontract) { - print ''.$langs->trans('AddContract').''; + print ''.$langs->trans('AddContract').''; } } // Create an invoice and classify billed if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); From 88a33c730a6a977d2310a32e8c2ec2297da9a28e Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Fri, 11 Feb 2022 02:01:25 -0600 Subject: [PATCH 018/171] FIX #20042 Update Mexican legal entities --- .../mysql/data/llx_c_forme_juridique.sql | 25 ++++++++++++++----- .../install/mysql/migration/14.0.0-15.0.0.sql | 23 +++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 7af5d28df8c..a1293084a52 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -302,12 +302,25 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1); -- Mexique -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', 'Sociedad en nombre colectivo', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', 'Sociedad en comandita simple', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', 'Sociedad de responsabilidad limitada', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', 'Sociedad anónima', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', 'Sociedad en comandita por acciones', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', 'Sociedad cooperativa', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); -- Luxembourg INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14001', 'Entreprise individuelle', 1); diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 7be62695d50..69d7c93af5f 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -506,3 +506,26 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); + +-- Delete old mexican legal forms +DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); + +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); From 27df3cc02c39de48dfa9be5ac505f38696712cab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 11:20:36 +0100 Subject: [PATCH 019/171] FIX events on several days may missing the last day in calendar view. FIX the drag and drop was not available on some events --- htdocs/comm/action/index.php | 55 ++++++++++++++++++++++++------- htdocs/core/db/DoliDB.class.php | 4 +-- htdocs/core/js/dst.js | 3 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 4d6a032492f..72e50d9292d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -808,8 +808,18 @@ if ($resql) { $event->id = $obj->id; $event->ref = $event->id; - $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin - $event->datef = $db->jdate($obj->datep2); + $event->fulldayevent = $obj->fulldayevent; + + // event->datep and event->datef must be GMT date. + if ($event->fulldayevent) { + // TODO... + $event->datep = $db->jdate($obj->datep); + $event->datef = $db->jdate($obj->datep2); + } else { + // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) + $event->datep = $db->jdate($obj->datep); + $event->datef = $db->jdate($obj->datep2); + } //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); //var_dump($obj->datep); //var_dump($event->datep); @@ -829,7 +839,6 @@ if ($resql) { $event->fetch_userassigned(); // This load $event->userassigned $event->priority = $obj->priority; - $event->fulldayevent = $obj->fulldayevent; $event->location = $obj->location; $event->transparency = $obj->transparency; $event->fk_element = $obj->fk_element; @@ -869,25 +878,43 @@ if ($resql) { $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); + + $daycursorend = $event->date_end_in_calendar; + $anneeend = dol_print_date($daycursorend, '%Y', 'tzuserrel'); + $moisend = dol_print_date($daycursorend, '%m', 'tzuserrel'); + $jourend = dol_print_date($daycursorend, '%d', 'tzuserrel'); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich //var_dump($annee.'-'.$mois.'-'.$jour); + //print 'annee='.$annee.' mois='.$mois.' jour='.$jour.'
'; // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz + /* + print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'
'; + print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'
'; + */ do { //if ($event->id==408) - //print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'tzuserrel').' - '.dol_print_date($event->datep, 'dayhour', 'tzuserrel').' '.dol_print_date($event->datef, 'dayhour', 'tzuserrel').'
'; $eventarray[$daykey][] = $event; $j++; $daykey += 60 * 60 * 24; - if ($daykey > $event->date_end_in_calendar) { + //if ($daykey > $event->date_end_in_calendar) { + if ($daykey > $daykeyend) { $loop = false; } } while ($loop); - + //var_dump($eventarray); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } @@ -1816,12 +1843,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cssclass .= " unmovable"; } elseif ($event->type_code == 'ICALEVENT') { $cssclass .= " unmovable"; - } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { - $tmpyearend = date('Y', $event->date_end_in_calendar); - $tmpmonthend = date('m', $event->date_end_in_calendar); - $tmpdayend = date('d', $event->date_end_in_calendar); + } elseif ($event->date_start_in_calendar && $event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { + // If the event is on several days + $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel'); + $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel'); + $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel'); + //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend); if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) { - $cssclass .= " unmovable"; + $cssclass .= " unmovable unmovable-mustusefirstdaytodrag"; + } else { + $cssclass .= ' movable cursormove'; } } else { if ($user->rights->agenda->allactions->create || diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 4476228d509..f23a66bbee4 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -302,8 +302,8 @@ abstract class DoliDB implements Database /** * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 + * 19700101020000 -> 3600 with server TZ = +1 and $gm='tzserver' + * 19700101020000 -> 7200 whaterver is server TZ if $gm='gmt' * * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) * @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ diff --git a/htdocs/core/js/dst.js b/htdocs/core/js/dst.js index 83d4abd5f08..8433ada72a9 100644 --- a/htdocs/core/js/dst.js +++ b/htdocs/core/js/dst.js @@ -26,7 +26,8 @@ $(document).ready(function () { var timezone = jstz.determine(); - + console.log("Timezone detected for user: "+timezone.name()); + // Detect and save TZ and DST var rightNow = new Date(); var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d89fd437a2d..fc163933b47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2560,11 +2560,11 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto', { global $conf; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; - //print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'
'; if ($gm === 'auto') { $gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); } + //print 'gm:'.$gm.' gm === auto:'.($gm === 'auto').'
';exit; // Clean parameters if ($hour == -1 || empty($hour)) { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 338d2bd1a19..a4d38166112 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -127,7 +127,7 @@ $(document).ready(function () { - + From 455247565d68132add664def71a36fc19f418024 Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Fri, 11 Feb 2022 11:40:45 +0100 Subject: [PATCH 020/171] FIX wrong user author --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c8b381280b1..3d1637019e9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -875,8 +875,8 @@ class Societe extends CommonObject $sql .= ", name_alias"; $sql .= ", entity"; $sql .= ", datec"; - $sql .= ", fk_typent"; $sql .= ", fk_user_creat"; + $sql .= ", fk_typent"; $sql .= ", canvas"; $sql .= ", status"; $sql .= ", ref_ext"; From b84fd3ec3df42e8df698797431d03c173aa148c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 12:46:45 +0100 Subject: [PATCH 021/171] Clean code --- htdocs/admin/agenda_xcal.php | 9 ++++++++ htdocs/comm/action/class/actioncomm.class.php | 6 ++--- htdocs/core/lib/xcal.lib.php | 22 +++++++++---------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 0166769660a..ce36d97d06a 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -164,6 +164,9 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl1'); $message .= '
'; @@ -173,6 +176,9 @@ $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl2'); $message .= '
'; @@ -182,6 +188,9 @@ $urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity. $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl3'); $message .= '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8dd0d9febbe..1e640f7afbe 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1952,14 +1952,14 @@ class ActionComm extends CommonObject $event = array(); $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type'] = $type; + $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered if (is_numeric($this->db->jdate($obj->datep2))) { - $dateend = $this->db->jdate($obj->datep2) - - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); } else { - // use start date as fall-back to avoid import erros on empty end date + // use start date as fall-back to avoid pb with empty end date on ICS readers $dateend = $datestart; } diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index fcd1660985b..74b5f711da9 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) $created = $event["created"]; $modified = $event["modified"]; $assignedUsers = $event["assignedUsers"]; + //print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt'); // Format $summary = format_cal($format, $summary); @@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // Date must be GMT dates // Current date - fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n"); // Start date $prefix = ""; - $startdatef = dol_print_date($startdate, "dayhourxcard", true); + $startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt'); if ($fulldayevent) { // Local time $prefix = ";VALUE=DATE"; - $startdatef = dol_print_date($startdate, "dayxcard", false); + $startdatef = dol_print_date($startdate, "dayxcard", 'gmt'); } fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); @@ -208,7 +209,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { - $enddate = dol_time_plus_duree($startdate, 1, "d"); + $enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event) } } else { if (empty($enddate)) { @@ -217,14 +218,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } $prefix = ""; - $enddatef = dol_print_date($enddate, "dayhourxcard", true); + $enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt'); if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", false); - - // Local time - //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); @@ -256,11 +254,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } if ($created) { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n"); } if ($modified) { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n"); } fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); @@ -270,7 +268,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); - fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n"); fwrite($calfileh, "END:VJOURNAL\n"); } From 32af067e1e48bd94d5aaff32d1254cde44567213 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 13:01:29 +0100 Subject: [PATCH 022/171] Code comment --- htdocs/core/lib/xcal.lib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 74b5f711da9..97ada3e3d4f 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -209,7 +209,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { - $enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event) + // We add 1 day needed for full day event (DTEND must be next day after event). + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." + $enddate = dol_time_plus_duree($startdate, 1, "d"); } } else { if (empty($enddate)) { @@ -222,7 +225,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) + // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); From 89ffe5baba701eecdc592e67f96935768faefdc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 14:07:10 +0100 Subject: [PATCH 023/171] Clean code for param of dol_stringtotime() --- htdocs/core/lib/date.lib.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d4028e2196b..237adc9447a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -357,18 +357,18 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu * Convert a string date into a GM Timestamps date * Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string. * - * @param string $string Date in a string - * YYYYMMDD - * YYYYMMDDHHMMSS - * YYYYMMDDTHHMMSSZ - * YYYY-MM-DDTHH:MM:SSZ (RFC3339) - * DD/MM/YY or DD/MM/YYYY (deprecated) - * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) - * @param int $gm 1 =Input date is GM date, - * 0 =Input date is local date using PHP server timezone - * @return int Date as a timestamp - * 19700101020000 -> 7200 with gm=1 - * 19700101000000 -> 0 with gm=1 + * @param string $string Date in a string + * YYYYMMDD + * YYYYMMDDHHMMSS + * YYYYMMDDTHHMMSSZ + * YYYY-MM-DDTHH:MM:SSZ (RFC3339) + * DD/MM/YY or DD/MM/YYYY (deprecated) + * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) + * @param int|string $gm 'gmt' or 1 =Input date is GM date, + * 'tzserver' or 0 =Input date is date using PHP server timezone + * @return int Date as a timestamp + * 19700101020000 -> 7200 with gm=1 + * 19700101000000 -> 0 with gm=1 * * @see dol_print_date(), dol_mktime(), dol_getdate() */ @@ -408,7 +408,14 @@ function dol_stringtotime($string, $gm = 1) $string = preg_replace('/([^0-9])/i', '', $string); $tmp = $string.'000000'; - $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), ($gm ? 1 : 0)); + // Clean $gm + if ($gm === 1) { + $gm = 'gmt'; + } elseif (empty($gm) || $gm === 'tzserver') { + $gm = 'tzserver'; + } + + $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); return $date; } From 271e9da425bfa0b4c0d731339d12b3dd1b60ac72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 15:15:50 +0100 Subject: [PATCH 024/171] Add option MAIN_STORE_FULL_EVENT_IN_GMT to fix TZ pb with full day event --- htdocs/comm/action/card.php | 65 ++++++++++++++++++---------- htdocs/comm/action/document.php | 6 ++- htdocs/comm/action/index.php | 17 ++++---- htdocs/comm/action/list.php | 16 +++++-- htdocs/resource/element_resource.php | 6 ++- 5 files changed, 73 insertions(+), 37 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 627c2f0ce51..4a00894d26b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -76,11 +76,14 @@ if ($complete == 'na' || $complete == -2) { } if ($fulldayevent) { - $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + //print $db->idate($datep); exit; } else { - $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); + $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } // Security check @@ -252,8 +255,15 @@ if (empty($reshook) && $action == 'add') { $percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters - $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } // Check parameters if (!$datef && $percentage == 100) { @@ -513,8 +523,16 @@ if (empty($reshook) && $action == 'update') { $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + // Clean parameters + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1005,11 +1023,11 @@ if ($action == 'create') { $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep)); if (GETPOST('datep', 'int', 1)) { - $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); + $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser'); } $datef = ($datef ? $datef : $object->datef); if (GETPOST('datef', 'int', 1)) { - $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0); + $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser'); } if (empty($datef) && !empty($datep)) { if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) { @@ -1024,16 +1042,16 @@ if ($action == 'create') { print ''.$langs->trans("DateActionEnd").''; print '
'; if (GETPOST("afaire") == 1) { - print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo" + print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo" } else { - print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart'); + print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); } print '     -     '; //print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } else { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } print '
'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); if (GETPOST("afaire") == 1) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print '
'; - print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } $late = 0; if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) { $late = 1; @@ -967,7 +972,12 @@ while ($i < min($num, $limit)) { // End date if (!empty($arrayfields['a.datep2']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } print ''.$langs->trans("SendingsAbility").''; print ''; -print $langs->trans("Required"); +print ''.img_picto($langs->trans("Required"), 'switch_on').''; /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; From eff2fc1e9ef9a409022145f146e1128e4c4ad14f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 18:19:50 +0100 Subject: [PATCH 027/171] Complete option MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1e3e878dad5..692cf35c3b1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1106,13 +1106,13 @@ class Form } print '
'.$langcode.''.$key.''; + $titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':
'.($langsenfileonly->tab_translate[$key] ? $langsenfileonly->trans($key) : ''.$langs->trans("None").''); + print ''; print dol_escape_htmltag($val); - print '
'; + print ''; + print ''; if (!empty($newlangfileonly->tab_translate[$key])) { if ($val != $newlangfileonly->tab_translate[$key]) { // retrieve rowid From 1097111706fda094e6ee4adffb7f9cb509245d0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 16:37:08 +0100 Subject: [PATCH 037/171] Fix autofocus --- htdocs/admin/accountant.php | 2 +- htdocs/admin/openinghours.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index e0e01cab328..693170862e9 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -119,7 +119,7 @@ print '
'.$langs-> // Name print '
'; -print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index a0f02fe99ac..b18ebd0c05f 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -97,7 +97,7 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') { print '
'; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); From d5e5e8d4363c0fb7bcfbaaac134e5ee098cc0f11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 16:49:41 +0100 Subject: [PATCH 038/171] Debug v15 --- htdocs/admin/delais.php | 20 ++++++++++--------- htdocs/admin/pdf.php | 2 +- htdocs/admin/pdf_other.php | 2 +- htdocs/core/boxes/box_members_by_type.php | 1 + .../box_members_subscriptions_by_year.php | 1 + htdocs/langs/en_US/admin.lang | 5 +++-- htdocs/langs/en_US/boxes.lang | 2 +- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 4 ++++ 9 files changed, 24 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 229fb3e2291..2ae77b03d07 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -222,7 +222,8 @@ if ($action == 'edit') { print ''; print ''; - print ''; + print ''; + print ''; foreach ($modules as $module => $delays) { if (!empty($conf->$module->enabled)) { @@ -230,7 +231,7 @@ if ($action == 'edit') { $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); print ''; print ''; - print ''; } } @@ -242,10 +243,10 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("LateWarningAfter").'
'.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; + print ''.$langs->trans('Delays_'.$delay['code']).''; print ' '.$langs->trans("days").'
'; - print ''; + print ''; print ''; - print ''; @@ -256,7 +257,7 @@ if ($action == 'edit') { */ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").''; + print ''.$langs->trans("MAIN_DISABLE_METEO").''; print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); print '
'; - print ''; + print ''; foreach ($modules as $module => $delays) { if (!empty($conf->$module->enabled)) { @@ -276,7 +277,7 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'; - print ''; + print ''; print ''; print ''; print ''; // Currency @@ -471,7 +471,7 @@ if ($action == 'create') { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").''; @@ -301,7 +302,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE } else { $str_mode_enabled = $str_mode_percentage; } - print ''.$str_mode_enabled.''; + print '
'.$str_mode_enabled.''; print ''; print '

'; @@ -451,8 +452,9 @@ if ($action == 'edit') { print $form->buttonsSaveCancel("Save", ''); print ''; } else { - print '
'; + print '

'; + print ''.$langs->trans("Modify").''; + print '
'; } // End of page diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 18a4ca0825f..33f8f5b87f2 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -249,7 +249,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); $head = pdf_admin_prepare_head(); -print dol_get_fiche_head($head, 'general', $langs->trans("PDF"), -1, 'pdf'); +print dol_get_fiche_head($head, 'general', '', -1, ''); print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
\n"; print "
\n"; diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index f42c49a4bfe..72acf7fbf4f 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -84,7 +84,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); $head = pdf_admin_prepare_head(); -print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf'); +print dol_get_fiche_head($head, 'other', '', -1, ''); $tooltiptext = ''; print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."
\n"; diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 0a5e4548e3f..d7ab444f2da 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -244,6 +244,7 @@ class box_members_by_type extends ModeleBoxes ); } else { $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', 'td' => 'class="liste_total"', 'text' => $langs->trans("Total") ); diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index e7bf916d236..479d2424f09 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -196,6 +196,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes ); } else { $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', 'td' => 'class="liste_total"', 'text' => $langs->trans("Total"), ); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 80e40c12a1b..3506f024eea 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1187,7 +1187,7 @@ BankModuleNotActive=Bank accounts module not enabled ShowBugTrackLink=Show the link "%s" ShowBugTrackLinkDesc=Keep empty to not display this link, use value 'github' for the link to the Dolibarr project or define directly an url 'https://...' Alerts=Alerts -DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for: +DelaysOfToleranceBeforeWarning=Displaying a warning alert for... DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element. Delays_MAIN_DELAY_ACTIONS_TODO=Planned events (agenda events) not completed Delays_MAIN_DELAY_PROJECT_TO_CLOSE=Project not closed in time @@ -2217,4 +2217,5 @@ NoDeployedModulesFoundWithThisSearchCriteria=No modules found for these search c API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first -PreviousHash=Previous hash \ No newline at end of file +PreviousHash=Previous hash +LateWarningAfter="Late" warning after \ No newline at end of file diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 710d49bfab6..2ace1eb97e1 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -23,7 +23,7 @@ BoxLastMembersSubscriptions=Latest member subscriptions BoxFicheInter=Latest interventions BoxCurrentAccounts=Open accounts balance BoxTitleMemberNextBirthdays=Birthdays of this month (members) -BoxTitleMembersByType=Members by type +BoxTitleMembersByType=Members by type and status BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastProducts=Products/Services: last %s modified diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 147cd2fe8f9..b7d12216c6a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5886,6 +5886,7 @@ span#select2-taskid-container[title^='--'] { } span.select2.select2-container.select2-container--default { + text-align: initial; global->THEME_SHOW_BORDER_ON_INPUT)) { ?> border-left: none; border-top: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a207e128cc1..37864c1562c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6039,6 +6039,10 @@ span#select2-boxbookmark-container, span#select2-boxcombo-container { overflow: hidden; } +span.select2.select2-container.select2-container--default { + text-align: initial; +} + /* ============================================================================== */ /* For categories */ From 9349e2df7cffc0fb631651655f44f8c36a57bb89 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 21:11:45 +0100 Subject: [PATCH 039/171] FIX Accountancy - Order by accounting account on summary page --- htdocs/accountancy/customer/index.php | 1 + htdocs/accountancy/expensereport/index.php | 1 + htdocs/accountancy/supplier/index.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index a88524ec5d4..c233134f562 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -403,6 +403,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 0e3bda39521..2d9c8ac4f1c 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -188,6 +188,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); $resql = $db->query($sql); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 585121f7c36..9ea8fd0a307 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -300,6 +300,7 @@ $sql .= " AND ffd.product_type <= 2"; $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('htdocs/accountancy/supplier/index.php'); $resql = $db->query($sql); From 15b7f37027c0591a18b5c223abe8173de8ee1524 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 Feb 2022 09:08:58 +0100 Subject: [PATCH 040/171] FIX missing default or current value --- htdocs/compta/bank/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 73edd31755d..62b97f6d100 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -358,7 +358,7 @@ if ($action == 'create') { // Type print '
'.$langs->trans("AccountType").''; - $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'alpha') : Account::TYPE_CURRENT, 'type'); + $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type'); print '
'; print '
'; - $type = GETPOST('type'); + $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''; @@ -857,7 +857,7 @@ if ($action == 'create') { // Type print ''; print ''; // Currency @@ -1002,7 +1002,8 @@ if ($action == 'create') { print '
'.$langs->trans("AccountType").''; - $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'alpha') : $object->type), 'type'); + $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type'); print '
'; - if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) { + $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value + if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print '
'; //print '
'; From a3c1c707a438bdfac186f2317e514cdab9fe0e06 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Feb 2022 12:09:57 +0100 Subject: [PATCH 041/171] Close #19930 : tag management in KM list --- htdocs/categories/class/categorie.class.php | 3 +- .../knowledgerecord_list.php | 63 ++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5ffed2e5e4b..c5da89a2c49 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -185,7 +185,8 @@ class Categorie extends CommonObject 'contact' => 'socpeople', 'account' => 'bank_account', // old for bank account 'project' => 'projet', - 'warehouse'=> 'entrepot' + 'warehouse'=> 'entrepot', + 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord' ); /** diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index aed45b1db26..88d7e46506d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; // for other modules +if (!empty($conf->categorie->enabled)) { + dol_include_once('/categories/class/categorie.class.php'); +} //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page @@ -51,6 +54,13 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $id = GETPOST('id', 'int'); +$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array'); +$searchCategoryKnowledgemanagementOperator = 0; +if (GETPOSTISSET('formfilteraction')) { + $searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int'); +} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { + $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; +} // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -186,6 +196,10 @@ if (empty($reshook)) { || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $searchCategoryKnowledgemanagementOperator = 0; + $searchCategoryKnowledgemanagementList = array(); + } // Mass actions $objectclass = 'KnowledgeRecord'; @@ -229,9 +243,12 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', ',', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -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 (t.rowid = ef.fk_object)"; } +if (!empty($searchCategoryKnowledgemanagementList) || !empty($catid)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_knowledgemanagement as ck ON t.rowid = ck.fk_knowledgemanagement"; // We'll need this table joined to the select in order to filter by categ +} // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -270,6 +287,32 @@ foreach ($search as $key => $val) { } } } +//Search for tag/category +$searchCategoryKnowledgemanagementSqlList = array(); +if ($searchCategoryKnowledgemanagementOperator == 1) { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie = ".$db->escape($searchCategoryKnowledgemanagement); + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} else { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "t.rowid IN (SELECT fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")"; + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} + if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -379,6 +422,11 @@ $arrayofmassactions = array( if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + +if ($user->rights->knowledgemanagement->knowledgerecord->write) { + $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); +} + if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } @@ -418,6 +466,18 @@ $moreforfilter = ''; $moreforfilter.= $langs->trans('MyFilter') . ': '; $moreforfilter.= '';*/ +// Filter on categories +$moreforfilter = ''; +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + $moreforfilter .= '
'; + $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"'); + $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1); + $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -'; + $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300'); + $moreforfilter .= ' '; + $moreforfilter .= '
'; +} + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook if (empty($reshook)) { @@ -547,6 +607,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print '
'.$objp->tva_intra.''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 56f904e79ef..ee591df5413 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -631,7 +631,7 @@ if ($result) { print $product_static->getNomUrl(1); } if ($product_static->label) { - print '
'.$product_static->label.''; + print '
'.dol_escape_htmltag($product_static->label).''; } print '
'.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index b7d0a0423f3..ff52fd77bd6 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -521,7 +521,7 @@ if ($result) { } print ''.$objp->tva_intra.''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; From ff17fe5ae73ca79c641fe2988c919bb68e4e2744 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 18:03:29 +0100 Subject: [PATCH 044/171] Fix reponsive --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 92997b7a0e6..931b5e6420c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -516,7 +516,7 @@ if ($result) { } print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index ee591df5413..80b7bdf2217 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -665,7 +665,7 @@ if ($result) { print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ff52fd77bd6..9f769ae13b4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -521,7 +521,7 @@ if ($result) { } print ''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 9faac9ee1c7..24d0ed08a0a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -672,7 +672,7 @@ if ($result) { print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; From 05bd37a9216688dc2d09830d00b006a83879a897 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 15:30:45 +0100 Subject: [PATCH 045/171] Fix menu "New" when using paranoiac MAIN_SECURITY_CSRF_WITH_TOKEN = 3 --- htdocs/barcode/printsheet.php | 10 +++++----- htdocs/main.inc.php | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 5128cd56164..8663d50e66a 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -374,24 +374,24 @@ jQuery(document).ready(function() { '; // Checkbox to select from free text -print ' '.$langs->trans("FillBarCodeTypeAndValueManually").'   '; +print ''; print '
'; if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)) { - print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; + print ''; print '
'; print '
'; $form->select_produits(GETPOST('productid', 'int'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1); - print '   '; + print '   '; print '
'; } if (!empty($user->rights->societe->lire)) { - print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'   '; + print ''; print '
'; print '
'; print $form->select_company(GETPOST('socid', 'int'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); - print '   '; + print '   '; print '
'; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d3d18a3e1c1..287185515e2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -475,7 +475,9 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions and mass actions are processed as sensitive. - $sensitiveget = true; + if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'file_manager'))) { // We exclude the case action='create' and action='file_manager' that are legitimate + $sensitiveget = true; + } } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) { // Few GET actions coded with a &token into url are processed as sensitive. $arrayofactiontoforcetokencheck = array( From 562c3cf9585bae4489730d9c753caad607c4c3bc Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 14 Feb 2022 14:15:38 +0100 Subject: [PATCH 046/171] FIX : There's no field "ref" in llx_facture_fourn_rec table --- htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql index b3065fdb5d6..b82e75d85d6 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql @@ -16,7 +16,7 @@ -- ============================================================================ -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (ref, entity); +ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity); ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement); From 3305965c854cda61e9742e9b5ede6b7002c6d4d9 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 14 Feb 2022 15:04:12 +0100 Subject: [PATCH 047/171] FIX : Error with selectForForms function --- htdocs/core/class/html.form.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 09225f97158..b29093d7176 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7379,10 +7379,7 @@ class Form $objecttmp = null; - $InfoFieldList = explode(":", $objectdesc, 4); - $vartmp = $InfoFieldList[3]; - $InfoFieldList[4] = preg_replace('/^.*:(\w*)$/', '\1', $vartmp); // take the sort field - $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field + $InfoFieldList = explode(":", $objectdesc); $classname = $InfoFieldList[0]; $classpath = $InfoFieldList[1]; From 3ebdb891339540d496498fb33a5d8c084df1d656 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 14 Feb 2022 15:11:26 +0100 Subject: [PATCH 048/171] fix pdf_mucadet --- .../doc/pdf_muscadet.modules.php | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 4a27b58f8ae..45df637fc51 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1151,26 +1151,28 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; - if ($this->emetteur->logo) - { - if (is_readable($logo)) - { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { + if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir . '/logos/thumbs/' . $this->emetteur->logo_small; + } else { + $logo = $logodir . '/logos/' . $this->emetteur->logo; + } + if (is_readable($logo)) { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); + } + } else { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - else - { - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - else - { - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); From 96c7a9f77c912d493df09d0dd4f52070e4240521 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 14 Feb 2022 15:16:36 +0100 Subject: [PATCH 049/171] fix pdf_cornas --- .../supplier_order/doc/pdf_cornas.modules.php | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 657160a9a1b..b63708dfa40 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1235,26 +1235,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; - if ($this->emetteur->logo) - { - if (is_readable($logo)) - { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { + if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } + if (is_readable($logo)) { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); + } + } else { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - else - { - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - else - { - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); From 384e1d515b5b15323a280b85002f86c5c6e16ac7 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 14 Feb 2022 18:07:18 +0100 Subject: [PATCH 050/171] NEW automatically set totally received status in reception --- htdocs/reception/class/reception.class.php | 97 +++++++++++++++++++++- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 382cc5be9b6..7efcb2360dc 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -635,11 +635,15 @@ class Reception extends CommonObject } } - // Change status of order to "reception in process" - $ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur'); - - if (!$ret) { + // Change status of order to "reception in process" or "totally received" + $status = $this->getStatusDispatch(); + if ($status < 0) { $error++; + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); + if (!$ret) { + $error++; + } } if (!$error && !$notrigger) { @@ -707,7 +711,92 @@ class Reception extends CommonObject } } + /** + * Get status from all dispatched lines + * + * @return int <0 if KO, >0 if OK + */ + public function getStatusDispatch() + { + global $conf; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; + + $status = CommandeFournisseur::STATUS_RECEIVED_PARTIALLY; + + if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) { + if (empty($this->commandeFournisseur)) { + $this->commandeFournisseur = null; + $this->fetch_origin(); + if (empty($this->commandeFournisseur->lines)) { + $res = $this->commandeFournisseur->fetch_lines(); + if ($res < 0) return $res; + } + } + + $qty_received = array(); + $qty_wished = array(); + + $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); + $filter = array('t.fk_commande'=>$this->origin_id); + if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { + $filter['t.status'] = 1; // Restrict to lines with status validated + } + + $ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter); + if ($ret < 0) { + $this->error = $supplierorderdispatch->error; + $this->errors = $supplierorderdispatch->errors; + return $ret; + } else { + // build array with quantity received by product in all supplier orders (origin) + foreach ($supplierorderdispatch->lines as $dispatch_line) { + $qty_received[$dispatch_line->fk_product] += $dispatch_line->qty; + } + + // qty wished in order supplier (origin) + foreach ($this->commandeFournisseur->lines as $origin_line) { + // exclude lines not qualified for reception + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $origin_line->product_type > 0) { + continue; + } + + $qty_wished[$origin_line->fk_product] += $origin_line->qty; + } + + // compare array + $diff_array = array_diff_assoc($qty_received, $qty_wished); // Warning: $diff_array is done only on common keys. + $keys_in_wished_not_in_received = array_diff(array_keys($qty_wished), array_keys($qty_received)); + $keys_in_received_not_in_wished = array_diff(array_keys($qty_received), array_keys($qty_wished)); + + if (count($diff_array) == 0 && count($keys_in_wished_not_in_received) == 0 && count($keys_in_received_not_in_wished) == 0) { // no diff => mean everything is received + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } elseif (!empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED)) { + // set totally received if more products received than ordered + $close = 0; + + if (count($diff_array) > 0) { + // there are some difference between the two arrays + // scan the array of results + foreach ($diff_array as $key => $value) { + // if the quantity delivered is greater or equal to ordered quantity + if ($qty_received[$key] >= $qty_wished[$key]) { + $close++; + } + } + } + + if ($close == count($diff_array)) { + // all the products are received equal or more than the ordered quantity + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } + } + } + } + + return $status; + } /** * Add an reception line. From 81c2631b00c2aeef1e1318917900f80a7ba33734 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Mon, 14 Feb 2022 20:06:42 +0100 Subject: [PATCH 051/171] FIX Andorra needs Code Banque --- htdocs/compta/bank/class/account.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a852e351f22..fe7c32d09f8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1503,10 +1503,10 @@ class Account extends CommonObject { $country_code = $this->getCountryCode(); - if (in_array($country_code, array('AD', 'FR', 'ES', 'GA', 'IT', 'NC'))) { + if (in_array($country_code, array('FR', 'ES', 'GA', 'IT', 'NC'))) { return 1; // France, Spain, Gabon, ... - Not valid for CH } - if (in_array($country_code, array('AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) { + if (in_array($country_code, array('AD', 'AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) { return 2; // Australia, England... } return 0; From b6879d795325848876a61c8c8975ba142b9af77a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 22:38:45 +0100 Subject: [PATCH 052/171] css --- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/journal/bankjournal.php | 2 +- .../accountancy/journal/expensereportsjournal.php | 2 +- htdocs/accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/langs/en_US/accountancy.lang | 14 +++++++------- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 02c4d210496..925ab8c9ae3 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -171,7 +171,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S print $s; print "
\n"; } - if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + if (!empty($conf->expensereport->enabled)) { $step++; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}'); $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 49d379802fb..2530454d056 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1057,7 +1057,7 @@ if (empty($action) || $action == 'view') { } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 96ab150dd24..c80586fa3d0 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -521,7 +521,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 34ba4ae6337..8b1ac0d3de3 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -774,7 +774,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index ad1b7501a91..884c56ee6f2 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -716,7 +716,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8bc4b54a090..893f448bbf8 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -62,24 +62,24 @@ MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscrip AccountancyArea=Accounting area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year... -AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making the journalization (writing record in Journals and General ledger) +AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you automaticaly the correct default accounting account when transferring data in accounting AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... -AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s +AccountancyAreaDescJournalSetup=STEP %s: Check content of your journal list from menu %s AccountancyAreaDescChartModel=STEP %s: Check that a model of chart of account exists or create one from menu %s AccountancyAreaDescChart=STEP %s: Select and|or complete your chart of account from menu %s AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. -AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. +AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of Expense report. For this, use the menu entry %s. AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. -AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expenses (miscellaneous taxes). For this, use the menu entry %s. +AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for Taxes (special expenses). For this, use the menu entry %s. AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s. AccountancyAreaDescSubscription=STEP %s: Define default accounting accounts for member subscription. For this, use the menu entry %s. AccountancyAreaDescMisc=STEP %s: Define mandatory default account and default accounting accounts for miscellaneous transactions. For this, use the menu entry %s. AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s. AccountancyAreaDescBank=STEP %s: Define accounting accounts and journal code for each bank and financial accounts. For this, use the menu entry %s. -AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s. +AccountancyAreaDescProd=STEP %s: Define accounting accounts on your Products/Services. For this, use the menu entry %s. AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s. AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the Ledger. For this, go into menu %s, and click into button %s. @@ -112,7 +112,7 @@ MenuAccountancyClosure=Closure MenuAccountancyValidationMovements=Validate movements ProductsBinding=Products accounts TransferInAccounting=Transfer in accounting -RegistrationInAccounting=Registration in accounting +RegistrationInAccounting=Recording in accounting Binding=Binding to accounts CustomersVentilation=Customer invoice binding SuppliersVentilation=Vendor invoice binding @@ -120,7 +120,7 @@ ExpenseReportsVentilation=Expense report binding CreateMvts=Create new transaction UpdateMvts=Modification of a transaction ValidTransaction=Validate transaction -WriteBookKeeping=Register transactions in accounting +WriteBookKeeping=Record transactions in accounting Bookkeeping=Ledger BookkeepingSubAccount=Subledger AccountBalance=Account balance diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b7d12216c6a..7f4a12c888d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -724,6 +724,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 37864c1562c..fa7676e8573 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -874,6 +874,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } From 54bf8ed1edd1c66f0eba7f5a72ce92fa522ebb04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 22:53:24 +0100 Subject: [PATCH 053/171] Fix link --- htdocs/accountancy/expensereport/index.php | 20 +++++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 37abd56a21d..93419ce3cc4 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -199,7 +199,25 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - print '
'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + if (!empty($tmp['mday'])) { + $param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear; + $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; + $param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year']; + print ''; + } + print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)); + if (!empty($tmp['mday'])) { + print ''; + } + print ''.$langs->trans("Total").'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$sub_bom_line->efficiency.''.price($sub_bom_product->cost_price * $line->qty).''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->pmp * $line->qty).''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''.price($line_cost).'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$sub_bom_line->efficiency.''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'
'; print ''; From 21ebedc755df6fe81534bbde73d6d7ef49911e6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 20:10:09 +0100 Subject: [PATCH 123/171] Fix trans --- htdocs/langs/en_US/ticket.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 222efad8ba2..38b199f7260 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,8 +136,8 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. -TicketsAutoReadTicket=Automatically mark the ticket as read -TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. +TicketsAutoReadTicket=Automatically mark the ticket as read (when created from backoffice) +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. When ticket is create from the public interface, ticket remains with the status "Not Read". # # Index & list page From 4fb651817ed2d8429f5c4b9711de253b4c6d40c9 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 20:27:19 +0100 Subject: [PATCH 124/171] Update README http://pad.asp-software.org/padgen.php --- build/pad/README | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pad/README b/build/pad/README index 3cbc171686c..241d27d01c2 100644 --- a/build/pad/README +++ b/build/pad/README @@ -1,6 +1,7 @@ README (English) ################################################## Building PAD files +http://pad.asp-software.org/padgen.php ################################################## This directory contains files and docs used to build From 3ad95d55a5beb4718afa5d0471f31c64e773fa8d Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 20:36:07 +0100 Subject: [PATCH 125/171] Update dolibarr.pl return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); $ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : --- build/perl/virtualmin/dolibarr.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 8b6a9888db0..b5bacf59356 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); +return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); } sub script_dolibarr_release @@ -400,6 +400,8 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", + $ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" : From b013c9a15f7d6e2266fc41d2c542b421e2830aba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 20:37:39 +0100 Subject: [PATCH 126/171] Fix duplicate div --- htdocs/core/lib/functions.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9fed70a1fe1..7be3f5e3351 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2011,7 +2011,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if (empty($phototoshow)) { // Show No photo link (picto of object) - $morehtmlleft .= '
'; if ($object->element == 'action') { $width = 80; $cssclass = 'photorefcenter'; @@ -2029,8 +2028,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $morehtmlleft .= '
'; $morehtmlleft .= $nophoto; $morehtmlleft .= '
'; - - $morehtmlleft .= '
'; } } } From 9fd34b264fd20808ed136e11e2b96b8a5e9709e1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 21:05:23 +0100 Subject: [PATCH 127/171] Update README https://doxygen.dolibarr.org/ --- dev/examples/code/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/examples/code/README b/dev/examples/code/README index b7c31558de5..bf3dd3f4969 100644 --- a/dev/examples/code/README +++ b/dev/examples/code/README @@ -5,4 +5,4 @@ This directory contains samples of code to use Dolibarr business classes to buil external interfaces that need to read/update data from/into Dolibarr. You can also have a look at the Dolibarr doxygen doc that describes all files and classes: -http://www.dolibarr.org/html_doxygen/index.html +https://doxygen.dolibarr.org/ From b01fbba039311d15eeca3e961bf0d5bbfc724a7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 23:41:31 +0100 Subject: [PATCH 128/171] Fix packages --- build/rpm/dolibarr_fedora.spec | 1 - build/rpm/dolibarr_generic.spec | 1 - build/rpm/dolibarr_mandriva.spec | 1 - build/rpm/dolibarr_opensuse.spec | 1 - 4 files changed, 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index dc23cff5486..27130244d00 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -166,7 +166,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index a446a7bd5d6..aeddd5526f8 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -247,7 +247,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 78d90080258..a1e4dffc781 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -163,7 +163,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index edae0126653..aed2d76ed29 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -174,7 +174,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm From c32cc660a364617c2cac6412e270d70d80952530 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 18 Feb 2022 08:16:56 +0800 Subject: [PATCH 129/171] Update list.php --- htdocs/fourn/commande/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index eb13ead4fbd..72fc7a7439c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1274,9 +1274,7 @@ if ($resql) { $projectstatic = new Project($db); $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val'] = array(); + $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array()); $totalarray['val']['cf.total_ht'] = 0; $totalarray['val']['cf.total_ttc'] = 0; while ($i < min($num, $limit)) { From 7a457478d5fe213596bdd784d0c936a785abd82b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 18 Feb 2022 08:23:12 +0100 Subject: [PATCH 130/171] Fix : add missing formobjectoptions hook on 3 cards --- htdocs/compta/prelevement/card.php | 9 ++++++++- htdocs/loan/card.php | 5 +++++ htdocs/opensurvey/card.php | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d4311abe112..a076299b4cd 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -238,7 +238,14 @@ if ($id > 0 || $ref) { $modulepart = 'paymentbybanktransfer'; } print ''.$relativepath.''; - print '
'; + print ''; + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; print ''; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 88701e35166..4bc539c1ff0 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -618,6 +618,11 @@ if ($id > 0) { } print ''; + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print ''; diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 773571b7b1c..3f822679350 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -54,6 +54,9 @@ if ($result <= 0) { exit; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('surveycard', 'globalcard')); + $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -338,6 +341,11 @@ if ($action != 'edit') { print ''; +// Other attributes +$parameters = array(); +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print ''; From 3f109aa911e50c9f2f0257fc02131ed3d773863a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 18 Feb 2022 09:24:12 +0100 Subject: [PATCH 131/171] FIX Accountancy - On manual transaction with multicompany - Function transformTransaction can validate & delete transaction of an other entity --- .../accountancy/class/bookkeeping.class.php | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 43dcce8c646..5635df3c8e7 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -331,7 +331,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features + $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -736,7 +736,7 @@ class BookKeeping extends CommonObject $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (null !== $ref) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { @@ -881,7 +881,7 @@ class BookKeeping extends CommonObject } $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); } @@ -1037,7 +1037,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if ($showAlreadyExportMovements == 0) { $sql .= " AND t.date_export IS NULL"; } @@ -1157,7 +1157,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); } @@ -1454,7 +1454,7 @@ class BookKeeping extends CommonObject */ public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0) { - global $langs; + global $conf, $langs; if (empty($delyear) && empty($journal)) { $this->error = 'ErrorOneFieldRequired'; @@ -1475,7 +1475,7 @@ class BookKeeping extends CommonObject if (!empty($journal)) { $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; } - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features // Exclusion of validated entries at the time of deletion $sql .= " AND date_validated IS NULL"; @@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE piece_num = ".(int) $piecenum; $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resql = $this->db->query($sql); @@ -1636,7 +1636,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1674,9 +1674,9 @@ class BookKeeping extends CommonObject global $conf; $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features - dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getNextNumMvt sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1717,7 +1717,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1780,7 +1780,7 @@ class BookKeeping extends CommonObject $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; $sql .= " date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); @@ -1836,6 +1836,8 @@ class BookKeeping extends CommonObject */ public function transformTransaction($direction = 0, $piece_num = '') { + global $conf; + $error = 0; $this->db->begin(); @@ -1855,14 +1857,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1870,7 +1872,7 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } } elseif ($direction == 1) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1885,14 +1887,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1947,7 +1949,7 @@ class BookKeeping extends CommonObject $sql .= " AND aa.active = 1"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = ".((int) $pcgver); - $sql .= " AND ab.entity IN (".getEntity('accountancy').")"; + $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $sql .= " ORDER BY account_number ASC"; dol_syslog(get_class($this)."::select_account", LOG_DEBUG); @@ -2011,7 +2013,7 @@ class BookKeeping extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; - $sql .= " AND aa.entity IN (".getEntity('accountancy').")"; + $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -2051,7 +2053,7 @@ class BookKeeping extends CommonObject $sql .= " AND asy.rowid = ".((int) $pcgver); $sql .= " AND aa.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; - $sql .= " WHERE aa.entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); From 12c825ba84e4402b0ae329064db182423ed2cadc Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 18 Feb 2022 10:50:00 +0100 Subject: [PATCH 132/171] fix rounding for price and display currency --- htdocs/core/class/extrafields.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f8e5726d344..c0dc9c6a96f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1679,7 +1679,8 @@ class ExtraFields } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { - $value = price($value, 0, $langs, 0, 0, -1); + $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); + } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); From b5afa2777422e3ee8b207b79f9592925f9d89ce4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Feb 2022 10:09:38 +0000 Subject: [PATCH 133/171] Fixing style errors. --- htdocs/core/class/extrafields.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index c0dc9c6a96f..7a449f3e7ea 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1680,7 +1680,6 @@ class ExtraFields //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); - } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); From aec2579c41b23213ed427fb99188fb695e771df3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 12:22:53 +0100 Subject: [PATCH 134/171] Clean code --- htdocs/projet/admin/website.php | 27 ------------- htdocs/recruitment/admin/public_interface.php | 38 ------------------- 2 files changed, 65 deletions(-) diff --git a/htdocs/projet/admin/website.php b/htdocs/projet/admin/website.php index 1af6b72c196..25497fef436 100644 --- a/htdocs/projet/admin/website.php +++ b/htdocs/projet/admin/website.php @@ -111,33 +111,6 @@ if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) { print $enabledisablehtml; print ''; -/* -print '
'; - -if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) { - print '
'; - - print ''; - - print ''; - print ''; - print ''; - print "\n"; - - // param - print '\n"; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "
'; - - print '
'; - print ''; - print '
'; -} -*/ print dol_get_fiche_end(); diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php index 3d431d026bc..b091cdea7a0 100644 --- a/htdocs/recruitment/admin/public_interface.php +++ b/htdocs/recruitment/admin/public_interface.php @@ -126,44 +126,6 @@ if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { print ''.$langs->trans("Value").''; print "\n"; - // Force Type - $adht = new AdherentType($db); - print ''; - print $langs->trans("ForceMemberType"); - print ''; - $listofval = array(); - $listofval += $adht->liste_array(); - $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; - print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0); - print "\n"; - - // Amount - print ''; - print $langs->trans("DefaultAmount"); - print ''; - print ''; - print "\n"; - - // Can edit - print ''; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "\n"; - - // Jump to an online payment page - print ''; - print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); - print ''; - $listofval = array(); - $listofval['-1'] = $langs->trans('No'); - $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; - if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox'; - if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal'; - if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe'; - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); - print "\n"; - print ''; print '
'; From 3ab2308124757a12ef70f459e7d723708baefc86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 12:36:05 +0100 Subject: [PATCH 135/171] Clean code --- htdocs/public/eventorganization/attendee_new.php | 10 ---------- htdocs/public/members/new.php | 1 + htdocs/public/payment/newpayment.php | 8 ++++---- htdocs/public/payment/paymentok.php | 13 ++++++++++++- htdocs/public/project/suggestbooth.php | 10 ---------- htdocs/public/project/suggestconference.php | 10 ---------- 6 files changed, 17 insertions(+), 35 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index b350ece39f4..55303bcb00e 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -19,16 +19,6 @@ * \file htdocs/public/eventorganization/attendee_new.php * \ingroup project * \brief Example of form to subscribe to an event - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6589f2a17d0..055ffec56f9 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,6 +30,7 @@ * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 5158e294fb2..d25e14288f8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -481,7 +481,7 @@ if ($action == 'dopayment') { // Called when choosing Stripe mode. -// When using the Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. +// When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. // When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge. if ($action == 'charge' && !empty($conf->stripe->enabled)) { $amountstripe = $amount; @@ -728,7 +728,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { } } - // When using the PaymentIntent API architecture + // When using the PaymentIntent API architecture (mode set on by default into conf.class.php) if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { $service = 'StripeTest'; $servicestatus = 0; @@ -793,8 +793,8 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { $remoteip = getUserRemoteIP(); $_SESSION["onlinetoken"] = $stripeToken; - $_SESSION["FinalPaymentAmt"] = $amount; - $_SESSION["currencyCodeType"] = $currency; + $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. + $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. $_SESSION["paymentType"] = ''; $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index c822bfcdf96..ea86f28a894 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -417,7 +417,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { // Security protection: - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount (if free amount is allowed, no need to check) if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. $typeid = $object->typeid; @@ -440,6 +440,17 @@ if ($ispaymentok) { } } + // Security protection: + if (!empty($conf->global->MEMBER_MIN_AMOUNT)) { + if ($FinalPaymentAmt < $conf->global->MEMBER_MIN_AMOUNT) { + $error++; + $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.$conf->global->MEMBER_MIN_AMOUNT.'). May be a hack to try to pay a different amount ?'; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + dol_syslog("Failed to validate member (amount lower than minimum): ".$errmsg, LOG_ERR, 0, '_payment'); + } + } + // Security protection: if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one $error++; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index c0bcdc751c6..39c2a57700e 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestbooth.php * \ingroup member * \brief Example of form to suggest a booth - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index f2a919c0aa2..b97777c3a9a 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestconference.php * \ingroup member * \brief Example of form to suggest a conference - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { From 8a0ee772d3d722f446f9fa253805934426b638c3 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 18 Feb 2022 13:10:38 +0100 Subject: [PATCH 136/171] add GitHub INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); --- htdocs/install/mysql/data/llx_c_socialnetworks.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_socialnetworks.sql b/htdocs/install/mysql/data/llx_c_socialnetworks.sql index 5bfbcf090d9..468086291fc 100644 --- a/htdocs/install/mysql/data/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/data/llx_c_socialnetworks.sql @@ -36,6 +36,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1); From dee5d8f9e865a051617c23162b75bd6174fad059 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 13:45:28 +0100 Subject: [PATCH 137/171] Standardize name of button --- .../core/modules/barcode/mod_barcode_product_standard.php | 2 +- htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php | 2 +- .../modules/commande/doc/doc_generic_order_odt.modules.php | 2 +- .../expedition/doc/doc_generic_shipment_odt.modules.php | 2 +- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 2 +- .../modules/member/doc/doc_generic_member_odt.class.php | 2 +- htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php | 2 +- .../modules/product/doc/doc_generic_product_odt.modules.php | 2 +- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- .../modules/project/doc/doc_generic_project_odt.modules.php | 2 +- .../project/task/doc/doc_generic_task_odt.modules.php | 2 +- .../propale/doc/doc_generic_proposal_odt.modules.php | 2 +- .../reception/doc/doc_generic_reception_odt.modules.php | 2 +- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 2 +- htdocs/core/modules/societe/mod_codeclient_elephant.php | 2 +- htdocs/core/modules/societe/mod_codecompta_aquarium.php | 2 +- htdocs/core/modules/societe/mod_codecompta_digitaria.php | 2 +- .../modules/stock/doc/doc_generic_stock_odt.modules.php | 2 +- .../doc/doc_generic_supplier_order_odt.modules.php | 2 +- .../doc/doc_generic_supplier_proposal_odt.modules.php | 2 +- .../modules/ticket/doc/doc_generic_ticket_odt.modules.php | 2 +- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 2 +- .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 2 +- .../mymodule/doc/doc_generic_myobject_odt.modules.php | 2 +- .../doc/doc_generic_recruitmentjobposition_odt.modules.php | 2 +- htdocs/societe/admin/societe.php | 6 +++--- 26 files changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index a0197f18cd3..c101001af4c 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -109,7 +109,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode //$texte.= ''.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):'; $texte .= ''.$langs->trans("Mask").':'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 463cbc46a24..761aae99142 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -152,7 +152,7 @@ class doc_generic_bom_odt extends ModelePDFBom $texte .= $conf->global->BOM_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index b98d403d8f7..c59d1c40ee9 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2dd33bab141..a916bcc534f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index b8bfcdc16ac..9c0088bd398 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 4f1c20a464e..91d2248fb48 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -155,7 +155,7 @@ class doc_generic_member_odt extends ModelePDFMember $texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 07f5d5d1890..1df69d7ae53 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_mo_odt extends ModelePDFMo $texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 7fff122ec57..c1f6769579a 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -157,7 +157,7 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 40b1f324cdd..ff724ab209d 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -119,7 +119,7 @@ class mod_codeproduct_elephant extends ModeleProductCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index bad6a369ba6..d653ed760a6 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -450,7 +450,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 1fd0f9c23ee..7849e46edbe 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -417,7 +417,7 @@ class doc_generic_task_odt extends ModelePDFTask $texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e636645f6c8..e2e3ffd2a21 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -161,7 +161,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 7fde8e26c82..f8fd829591d 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -153,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception $texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index aaa9c03c6e7..3a62eb22937 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -143,7 +143,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte .= ''; $texte .= ''; $texte .= '  '; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6079120a305..0142457cd40 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -135,7 +135,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index ff5d737872a..4d1d01db682 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -103,7 +103,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 217e027d152..dddd01a602d 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -126,7 +126,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index c3e26e591c7..1fb120d4d29 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -156,7 +156,7 @@ class doc_generic_stock_odt extends ModelePDFStock $texte .= $conf->global->STOCK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 436622d6451..68caf286682 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $texte .= $conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 04f6ed49012..c79ee188213 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 86b9d44ad9b..d69da78aacc 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -151,7 +151,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $texte .= $conf->global->TICKET_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 656eb88ecaa..353d35fc182 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $conf->global->USER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index e1c83023df9..7ba82f5825e 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 8040c13d606..689503f0dee 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index e818a0816a9..e2b7c545aa9 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -158,7 +158,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $texte .= $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 193dfc43cad..236551c1c2e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -780,7 +780,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; - print ''; + print ''; print ""; } print ''; @@ -801,7 +801,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; - print ''; + print ''; print ""; } print ''; @@ -905,7 +905,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; print ''; - print ''; + print ''; print ''; print ''; } From 694ea8830bb6744e0f1be81c870a8d2d5b29e28d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 13:46:12 +0100 Subject: [PATCH 138/171] Fix missing name and type into template --- htdocs/adherents/admin/member.php | 86 ++++++++++--------- .../modules/member/doc/pdf_standard.class.php | 26 ++++++ 2 files changed, 73 insertions(+), 39 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 39587521c4d..2b6a0838fe1 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -196,6 +196,9 @@ print '
'; print ''; print ''; + +// Mains options + print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); print '
'; @@ -286,51 +289,15 @@ print '
'; print '
'; -print '
'; - - -/* - * Edit info of model document - */ -$constantes = array( - 'ADHERENT_CARD_TYPE', - //'ADHERENT_CARD_BACKGROUND', - 'ADHERENT_CARD_HEADER_TEXT', - 'ADHERENT_CARD_TEXT', - 'ADHERENT_CARD_TEXT_RIGHT', - 'ADHERENT_CARD_FOOTER_TEXT' -); - -print load_fiche_titre($langs->trans("MembersCards"), '', ''); - -$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; -$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; -$helptext .= '__YEAR__, __MONTH__, __DAY__'; - -form_constantes($constantes, 0, $helptext); print '
'; -/* - * Edit info of model document - */ -$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT'); - -print load_fiche_titre($langs->trans("MembersTickets"), '', ''); - -$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; -$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; -$helptext .= '__YEAR__, __MONTH__, __DAY__'; - -form_constantes($constantes, 0, $helptext); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); // Defined model definition table $def = array(); -$sql = "SELECT nom"; +$sql = "SELECT nom as name"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = '".$db->escape($type)."'"; $sql .= " AND entity = ".$conf->entity; @@ -339,14 +306,15 @@ if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); + $obj = $db->fetch_object($resql); + array_push($def, $obj->name); $i++; } } else { dol_print_error($db); } + print load_fiche_titre($langs->trans("MembersDocModules"), '', ''); print '
'; @@ -460,6 +428,46 @@ foreach ($dirmodels as $reldir) { print ''; print '
'; + +/* + * Edit info of model document + */ +$constantes = array( + 'ADHERENT_CARD_TYPE', + //'ADHERENT_CARD_BACKGROUND', + 'ADHERENT_CARD_HEADER_TEXT', + 'ADHERENT_CARD_TEXT', + 'ADHERENT_CARD_TEXT_RIGHT', + 'ADHERENT_CARD_FOOTER_TEXT' +); + +print load_fiche_titre($langs->trans("MembersCards"), '', ''); + +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; +$helptext .= '__YEAR__, __MONTH__, __DAY__'; + +form_constantes($constantes, 0, $helptext); + +print '
'; + + +/* + * Edit info of model document + */ +$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT'); + +print load_fiche_titre($langs->trans("MembersTickets"), '', ''); + +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; +$helptext .= '__YEAR__, __MONTH__, __DAY__'; + +form_constantes($constantes, 0, $helptext); + + print "
"; print dol_get_fiche_end(); diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 15f3260c4d2..d39afdd9420 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -33,6 +33,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php'; */ class pdf_standard extends CommonStickerGenerator { + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Translations + $langs->loadLangs(array("main", "bills")); + + $this->db = $db; + $this->name = "standard"; + $this->description = $langs->trans('PDFStandard'); + //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + + $this->type = 'html'; + } /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) From 61e91656e0073a31296c2961692d9cae06d09f76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 14:14:34 +0100 Subject: [PATCH 139/171] FIX setup of member module FIX generation of business cards --- htdocs/adherents/admin/member.php | 9 +++++++++ htdocs/core/class/commonobject.class.php | 3 +-- htdocs/core/lib/admin.lib.php | 5 +++-- htdocs/core/modules/member/doc/pdf_standard.class.php | 6 +++--- htdocs/langs/en_US/admin.lang | 3 ++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 2b6a0838fe1..d51dd8ef730 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -429,6 +429,14 @@ print ''; print ''; + +/* +TODO Use a global form instead of embeded form into table +print '
'; +print ''; +print ''; +*/ + /* * Edit info of model document */ @@ -467,6 +475,7 @@ $helptext .= '__YEAR__, __MONTH__, __DAY__'; form_constantes($constantes, 0, $helptext); +//print '
'; print "
"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8ab59689976..8dabc902e5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5292,8 +5292,7 @@ abstract class CommonObject $sav_charset_output = $outputlangs->charset_output; if (in_array(get_class($this), array('Adherent'))) { - $arrayofrecords = array(); // The write_file of templates of adherent class need this var - $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards', $moreparams); } else { $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 448677002df..a068f5fb5f5 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1627,6 +1627,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu if (empty($strictw3c)) { print "\n".'
'; print ''; + print ''; } print ''; @@ -1733,7 +1734,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu // Submit if (empty($strictw3c)) { print ''; - print ''; + print ''; print ""; } @@ -1748,7 +1749,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu print ''; if (!empty($strictw3c) && $strictw3c == 1) { - print '
'; + print '
'; print "
\n"; } } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index d39afdd9420..0fc13cbe134 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -50,14 +50,14 @@ class pdf_standard extends CommonStickerGenerator global $conf, $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills")); + $langs->loadLangs(array("main", "admin")); $this->db = $db; $this->name = "standard"; - $this->description = $langs->trans('PDFStandard'); + $this->description = $langs->trans('TemplateforBusinessCards'); //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - $this->type = 'html'; + $this->type = 'pdf-various-sizes'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3506f024eea..5af3fe19592 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2218,4 +2218,5 @@ API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first PreviousHash=Previous hash -LateWarningAfter="Late" warning after \ No newline at end of file +LateWarningAfter="Late" warning after +TemplateforBusinessCards=Template for a business card in different size \ No newline at end of file From 30cde100ffd55c0f513434cb06f79c515cd18a0b Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Fri, 18 Feb 2022 14:41:29 +0100 Subject: [PATCH 140/171] trad us --- htdocs/langs/en_US/hrm.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index c571ec6ca8a..ab3628026c5 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -79,3 +79,6 @@ NoEval=No evaluation done for this employee HowManyUserWithThisMaxNote=Number of users with this rank HighestRank=Highest rank SkillComparison=Skill comparison +ActionsOnJob=Events on this job +VacantPosition=job vacancy +VacantCheckboxHelper=Checking this option will show unfilled positions (job vacancy) From e41e0f069a5d2be4041e7df58a769c2d47b3e14f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:09:52 +0100 Subject: [PATCH 141/171] Fix creator in PDF. Add log to help to find strange bug --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 9 +++++++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 ++++++-- htdocs/langs/en_US/members.lang | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index b9ceb3e346b..0760b85c65c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -366,7 +366,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -374,10 +374,14 @@ class pdf_crabe extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -386,7 +390,7 @@ class pdf_crabe extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -814,6 +818,7 @@ class pdf_crabe extends ModelePDFFactures $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } + dol_syslog("bottomlasttab=".$bottomlasttab." this->page_hauteur=".$this->page_hauteur." heightforinfotot=".$heightforinfotot." heightforfreetext=".$heightforfreetext." heightforfooter=".$heightforfooter); // Display info area $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1666545891..910790db51f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -367,7 +367,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -375,10 +375,14 @@ class pdf_sponge extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -387,7 +391,7 @@ class pdf_sponge extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 9605e7a8df7..8646c40b98f 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -159,7 +159,7 @@ HTPasswordExport=htpassword file generation NoThirdPartyAssociatedToMember=No third party associated with this member MembersAndSubscriptions=Members and Contributions MoreActions=Complementary action on recording -MoreActionsOnSubscription=Complementary action, suggested by default when recording a contribution +MoreActionsOnSubscription=Complementary action suggested by default when recording a contribution, also done automatially on online payment of a contribution MoreActionBankDirect=Create a direct entry on bank account MoreActionBankViaInvoice=Create an invoice, and a payment on bank account MoreActionInvoiceOnly=Create an invoice with no payment From 87a5defbd32d655aa211a7b053d0cade849192ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:11:54 +0100 Subject: [PATCH 142/171] Comment --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a0793e914e9..8a5f8166106 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2329,7 +2329,7 @@ class Societe extends CommonObject /** * Return array of sales representatives * - * @param User $user Object user + * @param User $user Object user (not used) * @param int $mode 0=Array with properties, 1=Array of id. * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb' * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'; From f4f03d03f22c28b258efe855014006353ec2b1ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:23:13 +0100 Subject: [PATCH 143/171] Fix link --- htdocs/core/boxes/box_members_last_subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 930b4d3a874..39ae0140ca4 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -142,7 +142,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', - 'text' => $staticmember->getNomUrl(-1, 32, 'subscription'), + 'text' => $staticmember->getNomUrl(-1, 32, 'card'), 'asis' => 1, ); From cd9c1acafece00cdc1098c310a3395fcfaf6a01e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 16:09:23 +0100 Subject: [PATCH 144/171] Fix missing token --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 287185515e2..3f8da14338b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3213,6 +3213,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_PREVIEW' + , token: '' } ); }); @@ -3222,6 +3223,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_DOWNLOAD' + , token: '' } ); }); From 3d9cdbf13693e683bc847d9aec7666e00dec41d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 16:24:11 +0100 Subject: [PATCH 145/171] FIX Debug v15 --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 4 ++-- htdocs/public/payment/paymentok.php | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d12ad16194..1faa9271623 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1805,6 +1805,7 @@ class Adherent extends CommonObject $paiement = new Paiement($this->db); $paiement->datepaye = $paymentdate; $paiement->amounts = $amounts; + $paiement->paiementcode = $operation; $paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1); $paiement->num_payment = $num_chq; $paiement->note_public = $label; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 2a8522ab05b..ab68ac7f9b1 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -613,7 +613,7 @@ class Paiement extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datepaye, - $this->paiementid, // Payment mode id or code ("CHQ or VIR for example") + $this->paiementcode ? $this->paiementcode : $this->paiementid, // Payment mode code ('CB', 'CHQ' or 'VIR' for example). Use payment id if not defined for backward compatibility. $label, $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) $this->num_payment, diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7be3f5e3351..7668489c8ea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10373,6 +10373,7 @@ function newToken() /** * Return the value of token currently saved into session with name 'token'. + * For ajax call, you must use this token as a parameter of the call into the js calling script (the called ajax php page must also set constant NOTOKENRENEWAL). * * @return string */ diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0760b85c65c..63a68f7b802 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1181,9 +1181,9 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 910790db51f..7f3b543ebba 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1259,9 +1259,9 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ea86f28a894..499ff2c4e31 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -412,7 +412,7 @@ if ($ispaymentok) { $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); + dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { From 1107a60b58eb690902ebd14b4f52597ae051c077 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 18 Feb 2022 16:53:55 +0100 Subject: [PATCH 146/171] FIX compute rule in FEC import --- .../class/accountancyimport.class.php | 6 ++--- .../modules/import/import_csv.modules.php | 23 +++++++++++++++++++ .../modules/import/import_xlsx.modules.php | 23 +++++++++++++++++++ htdocs/imports/import.php | 7 +++--- 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index ece843515e2..ea88534b6ed 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -55,8 +55,8 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); - $credit = trim($arrayrecord[12]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); + $credit = floatval(trim($arrayrecord[12]['val'])); if (!empty($debit)) { $amount = $debit; } else { @@ -86,7 +86,7 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); if (!empty($debit)) { $sens = 'D'; } else { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 35f0e4bc2f9..78c8f5e104f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = "'".$tmp[1]."'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index ed14ae31ebb..38c9cd8c56a 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -777,6 +777,29 @@ class ImportXlsx extends ModeleImports $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key); $listvalues[] = "'" . $tmp[1] . "'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ff9b839d1d5..c477df5eb77 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); $updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array()); $separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ',')); $enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); +$separator_used = str_replace('\t', "\t", $separator); $objimport = new Import($db); $objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport)); @@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } if ($model == 'xlsx') { @@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } @@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } From 0517e2e2d33699d3fd2088dd0d51429f8f75108f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 18:35:21 +0100 Subject: [PATCH 147/171] Fix error --- htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index a59998f0165..84d1b007e09 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1151,7 +1151,7 @@ class Paiement extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0, $morecss = '') { - global $conf, $langs; + global $conf, $langs, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 448538c39a8..724c14b93c0 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -853,7 +853,7 @@ class Skill extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action, $hookmanager; - $hookmanager->initHooks(array('jobdao')); + $hookmanager->initHooks(array('skilldao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 5eb4d3408c3c4fd3303002efe6a71e8032ddbc94 Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 18 Feb 2022 19:31:42 +0100 Subject: [PATCH 148/171] Update param_ihm.php --- htdocs/user/param_ihm.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 72f9b075be9..0d2729d904f 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) { if (!empty($conf->agenda->enabled)) { $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda'; } +if (!empty($conf->ticket->enabled)) { + $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; +} $head = user_prepare_head($object); From 05f0f1733d275a393d5aa5192eb8ec53f7485d09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 21:52:33 +0100 Subject: [PATCH 149/171] Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 --- htdocs/hrm/class/position.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index d9df0624b0b..ada58998238 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -853,6 +853,7 @@ class Position extends CommonObject * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @param int $nonewbutton Do not show new button * @return string */ public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) From 9e6f782907fe8e6cc7d79429a1cb994fc7ed82f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 11:26:03 +0100 Subject: [PATCH 150/171] Clean code --- htdocs/core/class/events.class.php | 2 +- htdocs/core/lib/security2.lib.php | 3 ++- htdocs/main.inc.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 104f1567d44..63b5e5e494b 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -167,7 +167,7 @@ class Events // extends CommonObject $sql .= " '".$this->db->escape(getUserRemoteIP())."',"; $sql .= " ".($this->user_agent ? "'".$this->db->escape(dol_trunc($this->user_agent, 250))."'" : 'NULL').","; $sql .= " '".$this->db->idate($this->dateevent)."',"; - $sql .= " ".($user->id ? "'".$this->db->escape($user->id)."'" : 'NULL').","; + $sql .= " ".($user->id > 0 ? ((int) $user->id) : 'NULL').","; $sql .= " '".$this->db->escape(dol_trunc($this->description, 250))."',"; $sql .= " '".$this->db->escape(dol_getprefix())."'"; $sql .= ")"; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index a37a77712c3..e156c83b147 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -187,7 +187,8 @@ if (!function_exists('dol_loginfunction')) { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } - // Set cookie for timeout management + // Set cookie for timeout management. We set it as a cookie so we will be able to use it to set timeout on next page before the session start + // and the conf file is loaded. $prefix = dol_getprefix(''); $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8ddcce45285..88ed3a12f3a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -282,7 +282,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') { // Init session. Name of session is specific to Dolibarr instance. // Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https). -// Note: the function dol_getprefix is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. +// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. $prefix = dol_getprefix(''); $sessionname = 'DOLSESSID_'.$prefix; $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; From e8c48a06c0822b1b477e212cb77bc73cc6ccf0f7 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Jan 2022 11:26:16 +0100 Subject: [PATCH 151/171] Correct typos in ticket.lib --- htdocs/core/lib/ticket.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 3599c17887f..2e70bfba3b9 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -476,7 +476,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too $sql .= $db->order($sortfield_new, $sortorder); - dol_syslog("company.lib::show_actions_done", LOG_DEBUG); + dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; @@ -491,7 +491,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $result = $contactaction->fetchResources(); if ($result < 0) { dol_print_error($db); - setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors'); + setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors'); } //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; From bf9ca1caaa370504448c966cad9c73539adccc86 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 7 Feb 2022 12:30:47 +0100 Subject: [PATCH 152/171] new : allow to display a warning on untreated tickets. Introduces options TICKET_DELAY_BEFORE_FIRST_RESPONSE and TICKET_DELAY_SINCE_LAST_RESPONSE --- htdocs/ticket/list.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b2548807be4..bfb0c8dcbea 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -329,8 +329,6 @@ if (empty($reshook)) { $form = new Form($db); $formTicket = new FormTicket($db); -$now = dol_now(); - $user_temp = new User($db); $socstatic = new Societe($db); @@ -942,6 +940,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; +$now = dol_now(); $cacheofoutputfield = array(); while ($i < ($limit ? min($num, $limit) : $num)) { @@ -956,6 +955,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print ''; foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -1033,6 +1033,26 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + } elseif ($key == 'ref') { + print $object->showOutputField($val, $key, $obj->$key, ''); + + // display a warning on untreated tickets + $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); + $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + if ($is_open && $should_show_warning) { + $date_last_msg_sent = (int) $object->date_last_msg_sent; + $hour_diff = ($now - $date_last_msg_sent) / 3600 ; + + if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + $creation_date = $object->datec; + $hour_diff_creation = ($now - $creation_date) / 3600 ; + if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + } + } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } + } } else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... $tmp = explode(':', $val['type']); if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { From ffbe0946354a8681801ee4b73b8195d40ff6dafa Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Jan 2022 17:02:09 +0100 Subject: [PATCH 153/171] Add strings for ticket warnings --- htdocs/langs/en_US/ticket.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 38b199f7260..710ae491973 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -244,6 +244,8 @@ TicketNotNotifyTiersAtCreate=Not notify company at create Unread=Unread TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface. ErrorTicketRefRequired=Ticket reference name is required +TicketsDelayForFirstResponseTooLong=Too much time elapsed since ticket opening without any answer. +TicketsDelayFromLastResponseTooLong=Too much time elapsed since last answer on this ticket. # # Logs From ad3f7b531e13f1a43a2bb2c7fe0d395f5a01bb18 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 28 Jan 2022 14:31:11 +0100 Subject: [PATCH 154/171] add constants declarations in the module class --- htdocs/core/modules/modTicket.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 68cb3f45551..0ae6b00b1c3 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -107,7 +107,9 @@ class modTicket extends DolibarrModules 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), - 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0) + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0), + 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), + 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0) ); From 5d10d6cb781993d879691cabb80b01d922335cc9 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 28 Jan 2022 16:38:31 +0100 Subject: [PATCH 155/171] allow delays configuration from ticket module params --- htdocs/admin/ticket.php | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index fc8a5e8e0b9..c36f6ae1d1b 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -191,6 +191,18 @@ if ($action == 'setvarother') { if (!($res > 0)) { $error++; } + + $param_delay_first_response = GETPOST('delay_first_response', 'int'); + $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_delay_between_responses = GETPOST('delay_between_responses', 'int'); + $res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } } @@ -503,7 +515,8 @@ print ''; print ''; // Auto assign ticket at user who created it -print ''.$langs->trans("TicketsAutoAssignTicket").''; +print ''; +print ''.$langs->trans("TicketsAutoAssignTicket").''; print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); @@ -517,12 +530,41 @@ print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, print ''; print ''; -print '
'; - if (!$conf->use_javascript_ajax) { print ''; } +// Define wanted maximum time elapsed before answers to tickets +print '
'; +print ''; + +print ''; +print ''.$langs->trans("TicketsDelayBeforeFirstAnswer").""; +print ' + + + '; +print ''; +print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help'); +print ''; +print ''; + +print ''; +print ''.$langs->trans("TicketsDelayBetweenAnswers").""; +print ' + + + '; +print ''; +print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help'); +print ''; +print ''; + +print '
'; + +print '
'; + + // Admin var of module print load_fiche_titre($langs->trans("Notification"), '', ''); From cdbf0bdf6faac8d424731d172307884ca6f1e357 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 31 Jan 2022 09:45:20 +0100 Subject: [PATCH 156/171] add translation strings --- htdocs/langs/en_US/ticket.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 710ae491973..9dfc4874cc5 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -138,6 +138,10 @@ TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. TicketsAutoReadTicket=Automatically mark the ticket as read (when created from backoffice) TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. When ticket is create from the public interface, ticket remains with the status "Not Read". +TicketsDelayBeforeFirstAnswer=A new ticket should receive a first answer before (hours): +TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view. +TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours): +TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received an answer has not had further interaction after this time period (in hours), a warning icon will be displayed in the list view. # # Index & list page From d769d856e745b8d5c55251a4689822fb2a2a2684 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 11:15:11 +0100 Subject: [PATCH 157/171] fix $object->status not being set. Avoid using $object->fk_statut. --- htdocs/ticket/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index bfb0c8dcbea..c7f603056b4 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -951,6 +951,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->status = $object->fk_statut; // fk_statut is deprecated // Show here line of result print ''; From 00e6d2786dc7c92abff39e5d909e54532a6acb8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 12:21:43 +0100 Subject: [PATCH 158/171] Do not use dol_hash anymore for the name of cookies. --- htdocs/core/lib/functions.lib.php | 25 ++++++++++--------- htdocs/main.inc.php | 3 +-- .../public/eventorganization/attendee_new.php | 1 - .../eventorganization/subscriptionok.php | 2 +- htdocs/public/payment/newpayment.php | 3 --- htdocs/public/payment/paymentok.php | 2 -- htdocs/public/project/index.php | 3 --- htdocs/public/project/suggestbooth.php | 1 - htdocs/public/project/suggestconference.php | 1 - htdocs/public/project/viewandvote.php | 2 +- 10 files changed, 16 insertions(+), 27 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 236c76e3bf5..86c1cbe0888 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -870,31 +870,32 @@ if (!function_exists('dol_getprefix')) { * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir * or two instances in same virtual servers. + * This function must not use dol_hash (that is used for password hash) and need to have all context $conf loaded. * * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @return string A calculated prefix */ function dol_getprefix($mode = '') { - // If prefix is for email (we need to have $conf alreayd loaded for this case) + // If prefix is for email (we need to have $conf already loaded for this case) if ($mode == 'email') { global $conf; - if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) + if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; - } elseif (isset($_SERVER["SERVER_NAME"])) { + } elseif (isset($_SERVER["SERVER_NAME"])) { // If MAIL_PREFIX_FOR_EMAIL_ID is set to 'SERVER_NAME' return $_SERVER["SERVER_NAME"]; } } - // The recommended value (may be not defined for old versions) + // The recommended value if MAIL_PREFIX_FOR_EMAIL_ID is not defined (may be not defined for old versions) if (!empty($conf->file->instance_unique_id)) { - return $conf->file->instance_unique_id; + return sha1('dolibarr'.$conf->file->instance_unique_id); } - // For backward compatibility - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + // For backward compatibility when instance_unique_id is not set + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } // If prefix is for session (no need to have $conf loaded) @@ -903,15 +904,15 @@ if (!function_exists('dol_getprefix')) { // The recommended value (may be not defined for old versions) if (!empty($tmp_instance_unique_id)) { - return $tmp_instance_unique_id; + return sha1('dolibarr'.$tmp_instance_unique_id); } - // For backward compatibility + // For backward compatibility when instance_unique_id is not set if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + return sha1($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + } else { + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } - - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 88ed3a12f3a..093813f5776 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -290,7 +290,6 @@ if (!empty($_COOKIE[$sessiontimeout])) { ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); } - // This create lock, released by session_write_close() or end of page. // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. if (!defined('NOSESSION')) { @@ -3263,7 +3262,7 @@ if (!function_exists("llxFooter")) { $forceping = GETPOST('forceping', 'alpha'); if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) { //print ''; - $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); + $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); // Do not use dol_hash(), must not change if salt changes. 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')) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 55303bcb00e..a7cdd1ceda8 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 4a81084223d..8acf3daba78 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -57,7 +57,7 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root, $mysoc; +global $dolibarr_main_url_root, $mysoc; $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d25e14288f8..7bb61a708c5 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -70,9 +70,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 499ff2c4e31..9765af89f7e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -61,8 +61,6 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id; - $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal")); // Clean parameters diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 5f450a6c557..0add64bb700 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -54,9 +54,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 39c2a57700e..cb1b1089b0c 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index b97777c3a9a..22589c941d2 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index e680df15a1c..805eb8cfdd1 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -56,7 +56,7 @@ $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); // For encryption -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; +global $dolibarr_main_url_root; // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data From 2e02b3fcae1ccfd42183f83f58bc42058c57140f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 14:58:47 +0100 Subject: [PATCH 159/171] Ajout table "llx_inventory_extrafields" --- .../install/mysql/migration/15.0.0-16.0.0.sql | 9 ++++++- .../tables/llx_inventory_extrafields.key.sql | 21 +++++++++++++++ .../tables/llx_inventory_extrafields.sql | 27 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_inventory_extrafields.sql diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index b78e53bd287..cbf3c8fadc5 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -237,4 +237,11 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); - +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql new file mode 100644 index 00000000000..ecfd1de723e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql @@ -0,0 +1,21 @@ +-- =================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql new file mode 100644 index 00000000000..f6a6a59e0a1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql @@ -0,0 +1,27 @@ +-- ======================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting + +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + From 8bbbc843eb66afaa40e0ae9772a554f7d5b8c88d Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 15:20:22 +0100 Subject: [PATCH 160/171] =?UTF-8?q?Ajout=20onglet=20param=C3=A8tres=20"Inv?= =?UTF-8?q?entaire=20extrafields"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/lib/stock.lib.php | 5 + .../product/admin/inventory_extrafields.php | 123 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 htdocs/product/admin/inventory_extrafields.php diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 066bf2165be..c6b1bdefe6c 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -114,6 +114,11 @@ function stock_admin_prepare_head() $head[$h][2] = 'stockMouvementAttributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php'; + $head[$h][1] = $langs->trans("InventoryExtraFields"); + $head[$h][2] = 'inventoryAttributes'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove'); return $head; diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php new file mode 100644 index 00000000000..c4566c60741 --- /dev/null +++ b/htdocs/product/admin/inventory_extrafields.php @@ -0,0 +1,123 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * + * 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/product/admin/inventory_extrafields.php + * \ingroup stock + * \brief Page to setup extra fields of inventory + */ + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('stock@stock', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader('', $langs->trans("InventorySetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); + + +$head = stock_admin_prepare_head(); + +print dol_get_fiche_head($head, 'inventoryAttributes', $langs->trans("InventoryExtraFields"), -1, 'account'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') { + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); From dd6d0a118a74915c33d93768e3d2619697f65857 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 15:28:38 +0100 Subject: [PATCH 161/171] Translation --- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/products.lang | 1 + htdocs/product/admin/inventory_extrafields.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1e94ecbfdf0..426e1186868 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2222,4 +2222,5 @@ EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first PreviousHash=Previous hash LateWarningAfter="Late" warning after -TemplateforBusinessCards=Template for a business card in different size \ No newline at end of file +TemplateforBusinessCards=Template for a business card in different size +InventorySetup= Inventory Setup diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 14715670882..960bf02eb46 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -411,3 +411,4 @@ Rank=Rank SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) +InventoryExtraFields= Extra Fields (inventory) diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php index c4566c60741..d21328da336 100644 --- a/htdocs/product/admin/inventory_extrafields.php +++ b/htdocs/product/admin/inventory_extrafields.php @@ -78,7 +78,7 @@ llxHeader('', $langs->trans("InventorySetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans("InventorySetup"), $linkback, 'title_setup'); $head = stock_admin_prepare_head(); From 5647a0436991bdae03f37bcd3c20da6512c1e3e1 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 21 Feb 2022 16:50:12 +0100 Subject: [PATCH 162/171] fix : bad redirection after create we have __ID__ on url redirect, so repplace it with the $id value --- htdocs/product/stock/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 8389d63e843..c784ff3317e 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -159,6 +159,8 @@ if (empty($reshook)) { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); if (!empty($backtopage)) { + + $backtopage = str_replace("__ID__", $id, $backtopage); header("Location: ".$backtopage); exit; } else { From 97ed94fbda6d76b68c2db0c3399731a18754f981 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 16:54:07 +0100 Subject: [PATCH 163/171] NEW Support html content for multiselect component. --- htdocs/categories/edit.php | 2 ++ htdocs/core/class/html.form.class.php | 10 ++++------ htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 2b3ffc95c41..518889b85b3 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -178,7 +178,9 @@ print ''; // Parent category print ''.$langs->trans("In").''; +print img_picto('', 'category', 'class="pictofixedwidth"'); print $form->select_all_categories($type, $object->fk_parent, 'parent', 64, $object->id); +print ajax_combobox('parent'); print ''; $parameters = array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f112b9aa98..fa7fb264995 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8123,12 +8123,9 @@ class Form $out .= "\n".'