From 67e523de2094e7ecfda565d955a4e5dfa41c02ce Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 1 Sep 2022 09:51:10 +0200 Subject: [PATCH 01/27] fix index --- htdocs/product/index.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index e976e176224..b76be278a44 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -341,6 +341,11 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod $product_static->status_buy = $objp->tobuy; $product_static->status_batch = $objp->tobatch; + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire'); + if ($product_static->isService()) { + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); + } + // Multilangs if (!empty($conf->global->MAIN_MULTILANGS)) { $sql = "SELECT label"; @@ -378,10 +383,12 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod } } print ''; - if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') { - print price($objp->price_ttc).' '.$langs->trans("TTC"); - } else { - print price($objp->price).' '.$langs->trans("HT"); + if ($usercancreadprice) { + if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') { + print price($objp->price_ttc).' '.$langs->trans("TTC"); + } else { + print price($objp->price).' '.$langs->trans("HT"); + } } print ''; } @@ -410,7 +417,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod // TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter" // Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": // "commitment engagment" method and "cash accounting" method -if (!empty($conf->global->MAIN_SHOW_PRODUCT_ACTIVITY_TRIM)) { +if ( isModEnabled("invoice") && $user->hasRight('facture', 'lire') && getDolGlobalString('MAIN_SHOW_PRODUCT_ACTIVITY_TRIM')) { if (isModEnabled("product")) { activitytrim(0); } From cd46f8b3b9ad3c8d3cba4fcd569dddfb0f5ee589 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 1 Sep 2022 10:00:36 +0200 Subject: [PATCH 02/27] FIX - Box --- htdocs/core/boxes/box_produits.php | 37 ++++++++++++++++++------------ 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 7a9518d345e..505d022dccd 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -150,6 +150,11 @@ class box_produits extends ModeleBoxes $productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export; $productstatic->date_modification = $datem; + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire'); + if ($productstatic->isService()) { + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); + } + $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $productstatic->getNomUrl(1), @@ -162,22 +167,24 @@ class box_produits extends ModeleBoxes ); $price = ''; $price_base_type = ''; - if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) { - $price_base_type = $langs->trans($objp->price_base_type); - $price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc); - } else { - //Parse the dynamic price - $productstatic->fetch($objp->rowid, '', '', 1); - $priceparser = new PriceParser($this->db); - $price_result = $priceparser->parseProduct($productstatic); - if ($price_result >= 0) { - if ($objp->price_base_type == 'HT') { - $price_base_type = $langs->trans("HT"); - } else { - $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); - $price_base_type = $langs->trans("TTC"); + if ($usercancreadprice) { + if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) { + $price_base_type = $langs->trans($objp->price_base_type); + $price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc); + } else { + //Parse the dynamic price + $productstatic->fetch($objp->rowid, '', '', 1); + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProduct($productstatic); + if ($price_result >= 0) { + if ($objp->price_base_type == 'HT') { + $price_base_type = $langs->trans("HT"); + } else { + $price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); + $price_base_type = $langs->trans("TTC"); + } + $price = price($price_result); } - $price = price($price_result); } } $this->info_box_contents[$line][] = array( From 328c55498376e45b780d085b33a5e55937f1fce5 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Thu, 1 Sep 2022 10:05:08 +0200 Subject: [PATCH 03/27] FIX - php V8 warning commonobject class --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5b5de36406a..2983282a9e1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -749,7 +749,7 @@ abstract class CommonObject $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); $this->firstname = dol_ucwords(dol_strtolower($this->firstname)); $this->name = dol_ucwords(dol_strtolower($this->name)); - $this->name_alias = dol_ucwords(dol_strtolower($this->name_alias)); + $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):''; } if (!empty($conf->global->MAIN_ALL_TO_UPPER)) { $this->lastname = dol_strtoupper($this->lastname); From 03a39d33b904dcc64c3ee6d0653983e2f0c1545c Mon Sep 17 00:00:00 2001 From: Radarjr2002 <112626442+Radarjr2002@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:10:25 +0200 Subject: [PATCH 04/27] Warning in php 8 --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 9e17d925dbe..11cbcad7b85 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -123,7 +123,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $i++; $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."',"; $texttoinsert .= " 'label'=>'".$val['label']."',"; - if ($val['picto']) { + if (!empty($val['picto'])) { $texttoinsert .= " 'picto'=>'".$val['picto']."',"; } $texttoinsert .= " 'enabled'=>'".($val['enabled'] !== '' ? $val['enabled'] : 1)."',"; From a83b42ba8e480f93b5d8e276394e166782e5359a Mon Sep 17 00:00:00 2001 From: Radarjr2002 <112626442+Radarjr2002@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:21:15 +0200 Subject: [PATCH 05/27] fix php8 warnings --- htdocs/contact/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index d7eb7f53d82..6ea90797d43 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1316,7 +1316,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $login = dol_buildlogin($object->lastname, $object->firstname); $generated_password = ''; - if (!$ldap_sid) { // TODO ldap_sid ? + if (empty($ldap_sid)) { // TODO ldap_sid ? require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password = getRandomPassword(false); } From 06fafc9d7b7358684d13e0af768d5269220352ef Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 1 Sep 2022 15:04:30 +0200 Subject: [PATCH 06/27] New : Add action to push banque account in Stripe account --- htdocs/societe/paymentmodes.php | 42 ++++++++- htdocs/stripe/class/stripe.class.php | 123 +++++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5b9bd1046ef..7d082440661 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -516,6 +516,40 @@ if (empty($reshook)) { } } } + if ($action == 'syncsepatostripe') { + $companybankaccount->fetch(GETPOST('bankid')); + // print "stripe account = " . json_encode($stripe->getStripeAccount($service)); + // print json_encode($companybankaccount); + // print "fetch id = " . json_encode($socid); + + $companypaymentmode = new CompanyPaymentMode($db); + $companypaymentmode->fetch(null, null, $socid); + // print json_encode($companypaymentmode); + + if ($companypaymentmode->type != 'ban') { + $error++; + setEventMessages('ThisPaymentModeIsNotSepa', null, 'errors'); + } else { + // Get the Stripe customer + $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); + // print json_encode($cu); + if (!$cu) { + $error++; + setEventMessages($stripe->error, $stripe->errors, 'errors'); + } + + if (!$error) { + // Creation of Stripe SEPA + update of societe_account + $card = $stripe->sepaStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1); + if (!$card) { + $error++; + setEventMessages($stripe->error, $stripe->errors, 'errors'); + } else { + setEventMessages("", array("SEPA on Stripe", "SEPA IBAN is now linked to customer account !")); + } + } + } + } if ($action == 'setkey_account') { $error = 0; @@ -632,7 +666,7 @@ if (empty($reshook)) { } elseif ($action == 'setassourcedefault') { // Set as default when payment mode defined remotely only try { $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); - if (preg_match('/pm_/', $source)) { + if (preg_match('/pm_|src_/', $source)) { $cu->invoice_settings->default_payment_method = (string) $source; // New } else { $cu->default_source = (string) $source; // Old @@ -660,6 +694,10 @@ if (empty($reshook)) { // $card->detach(); Does not work with card_, only with src_ if (method_exists($card, 'detach')) { $card->detach(); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib as sr "; + $sql .= " SET stripe_card_ref = null"; + $sql .= " WHERE sr.stripe_card_ref = '".$db->escape($source)."'"; + $resql = $db->query($sql); } else { $card->delete(); } @@ -1465,7 +1503,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Edit/Delete print ''; if ($permissiontoaddupdatepaymentinformation) { - print ''; + print ''; print img_picto($langs->trans("CreateBAN"), 'stripe'); print ''; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 5ec149ba07f..6814dc3757f 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -588,7 +588,130 @@ class Stripe extends CommonObject return null; } } + /** + * Get the Stripe SEPA of a company payment mode + * + * @param \Stripe\StripeCustomer $cu Object stripe customer. + * @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity) + * @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA. + * @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found + */ + public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0) + { + global $conf, $user, $langs; + $sepa = null; + $sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa + $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa"; + $sql .= " WHERE sa.rowid = ".$object->id; // We get record from ID, no need for filter on entity + $sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement) + + $soc = new Societe($this->db); + $soc->fetch($object->fk_soc); + + dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + if ($num) { + $obj = $this->db->fetch_object($resql); + $cardref = $obj->stripe_card_ref; + dol_syslog(get_class($this)."::cardStripe cardref=".$cardref); + if ($cardref) { + try { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { + $sepa = $cu->sources->retrieve($cardref); + } else { + $sepa = \Stripe\PaymentMethod::retrieve($cardref); + } + } else { + if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { + //$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided + $sepa = $cu->sources->retrieve($cardref); + } else { + //$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works + $sepa = \Stripe\PaymentMethod::retrieve($cardref); + } + } + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + } + } elseif ($createifnotlinkedtostripe) { + $iban = $obj->iban_prefix; //prefix ? + $ipaddress = getUserRemoteIP(); + + $dataforcard = array( + 'type'=>'sepa_debit', + "sepa_debit" => array('iban' => $iban), + 'currency' => 'eur', + 'usage' => 'reusable', + 'owner' => array( + 'name' => $soc->name, + ), + "metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress) + ); + + //$a = \Stripe\Stripe::getApiKey(); + //var_dump($a);var_dump($stripeacc);exit; + try { + dol_syslog("Try to create sepa_debit 0"); + + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + // Force to use the correct API key + global $stripearrayofkeysbyenv; + $stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + + dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard)); + $s = new \Stripe\StripeClient($stripeacc); + $sepa = $s->sources->create($dataforcard); + if (!$sepa) { + $this->error = 'Creation of sepa_debit on Stripe has failed'; + } else { + //association du client avec cette source de paimeent + $cs = $cu->createSource( + $cu->id, + [ + 'source' => $sepa->id, + ] + ); + if (!$cs) { + $this->error = 'Link SEPA <-> Customer failed'; + } else { + dol_syslog("Try to create sepa_debit 3"); + // print json_encode($sepa); + + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib"; + $sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',"; + $sql .= " stripe_account= '" . $cu->id . '@' . $stripeacc . "'"; + $sql .= " WHERE rowid = ".$object->id; + $sql .= " AND type = 'ban'"; + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + } + } + } + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + } + } + } + } else { + dol_print_error($this->db); + } + + return $sepa; + } /** * Get the Stripe payment intent. Create it with confirmnow=false From 6ce06658400c421e9d8ffbdc640b32b4204c8fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 1 Sep 2022 15:32:48 +0200 Subject: [PATCH 07/27] fix agenda setup --- htdocs/admin/agenda.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 3221738bcd3..e9708d8c005 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -3,6 +3,7 @@ * Copyright (C) 2011 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 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 @@ -184,7 +185,7 @@ if (!empty($triggers)) { } //print 'module='.$module.' code='.$trigger['code'].'
'; - if (isModEnabled('module')) { + if (isModEnabled($module)) { // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { continue; From c8ddcf86b61d5618d0cfd6d09fdcb3dd0bb23097 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 1 Sep 2022 16:06:03 +0200 Subject: [PATCH 08/27] fix Ci error --- htdocs/stripe/class/stripe.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6814dc3757f..6410050c642 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -588,6 +588,7 @@ class Stripe extends CommonObject return null; } } + /** * Get the Stripe SEPA of a company payment mode * @@ -605,7 +606,7 @@ class Stripe extends CommonObject $sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa"; - $sql .= " WHERE sa.rowid = ".$object->id; // We get record from ID, no need for filter on entity + $sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity $sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement) $soc = new Societe($this->db); @@ -691,8 +692,8 @@ class Stripe extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib"; $sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',"; - $sql .= " stripe_account= '" . $cu->id . '@' . $stripeacc . "'"; - $sql .= " WHERE rowid = ".$object->id; + $sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'"; + $sql .= " WHERE rowid = '".$this->db->escape($object->id)."'"; $sql .= " AND type = 'ban'"; $resql = $this->db->query($sql); if (!$resql) { From ffe0420523a39eea19e9b3ad22823271367025fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 1 Sep 2022 16:15:36 +0200 Subject: [PATCH 09/27] fix delay setup --- htdocs/admin/delais.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index af8fed1c197..ec7874b7db8 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Simon Tosser * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 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 @@ -172,7 +173,7 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if ($action == 'update') { foreach ($modules as $module => $delays) { - if (isModEnabled('module')) { + if (isModEnabled($module)) { foreach ($delays as $delay) { if (GETPOST($delay['code']) != '') { dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); @@ -226,7 +227,7 @@ if ($action == 'edit') { print ''.$langs->trans("LateWarningAfter").''; foreach ($modules as $module => $delays) { - if (isModEnabled('module')) { + if (isModEnabled($module)) { foreach ($delays as $delay) { $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0); print ''; @@ -260,7 +261,7 @@ if ($action == 'edit') { print ''.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").''; foreach ($modules as $module => $delays) { - if (isModEnabled('module')) { + if (isModEnabled($module)) { foreach ($delays as $delay) { $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0); print ''; From 86b02bc17bc31faf4628f1328acca6d5dc0a0e98 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 18:03:34 +0200 Subject: [PATCH 10/27] Update new.php --- htdocs/public/members/new.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index c409703862c..6b8616ab777 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -62,6 +62,8 @@ if (is_numeric($entity)) { define("DOLENTITY", $entity); } + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; @@ -437,10 +439,11 @@ if (empty($reshook) && $action == 'add') { // Action called after a submitted was send and member created successfully // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. + if (empty($reshook) && $action == 'added') { llxHeaderVierge($langs->trans("NewMemberForm")); - // Si on a pas ete redirige + // If we have not been redirected print '

'; print '
'; print $langs->trans("NewMemberbyWeb"); @@ -556,42 +559,51 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print ''; } - // Company + // Company // TODO : optional hide print ''.$langs->trans("Company").''; print img_picto('', 'company', 'class="pictofixedwidth"'); print ''."\n"; + // Title print ''.$langs->trans('UserTitle').''; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').''."\n"; + // Lastname print ''.$langs->trans("Lastname").' *'."\n"; + // Firstname print ''.$langs->trans("Firstname").' *'."\n"; + // EMail print ''.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); print ''."\n"; + // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''.$langs->trans("Login").' *'."\n"; print ''.$langs->trans("Password").' *'."\n"; print ''.$langs->trans("PasswordRetype").' *'."\n"; } - // Gender + + // Gender // TODO: add diverse gender print ''.$langs->trans("Gender").''; print ''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); print ''; + // Address print ''.$langs->trans("Address").''."\n"; print ''."\n"; + // Zip / Town print ''.$langs->trans('Zip').' / '.$langs->trans('Town').''; print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75'); print ' / '; print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); print ''; + // Country print ''.$langs->trans('Country').''; print img_picto('', 'country', 'class="pictofixedwidth"'); @@ -621,17 +633,22 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW } print ''; } + // Birthday print ''.$langs->trans("DateOfBirth").''; print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); print ''."\n"; + // Photo print ''.$langs->trans("URLPhoto").''."\n"; + // Public print ''.$langs->trans("Public").''."\n"; + // Other attributes $tpl_context = 'public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + // Comments print ''; print ''.$langs->trans("Comments").''; @@ -733,7 +750,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print dol_get_fiche_end(); - // Save + // Save / Submit print '
'; print ''; if (!empty($backtopage)) { @@ -746,6 +763,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print "
"; print '
'; } else { // Show the table of membership types + // Get units $measuringUnits = new CUnits($db); $result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1)); From 3dc6283eb7216ade80bc5cdd74278545817db1c9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 1 Sep 2022 16:09:05 +0000 Subject: [PATCH 11/27] Fixing style errors. --- htdocs/public/members/new.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6b8616ab777..ccc229e33bf 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -563,47 +563,47 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print ''.$langs->trans("Company").''; print img_picto('', 'company', 'class="pictofixedwidth"'); print ''."\n"; - + // Title print ''.$langs->trans('UserTitle').''; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').''."\n"; - + // Lastname print ''.$langs->trans("Lastname").' *'."\n"; - + // Firstname print ''.$langs->trans("Firstname").' *'."\n"; - + // EMail print ''.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); print ''."\n"; - + // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''.$langs->trans("Login").' *'."\n"; print ''.$langs->trans("Password").' *'."\n"; print ''.$langs->trans("PasswordRetype").' *'."\n"; } - + // Gender // TODO: add diverse gender print ''.$langs->trans("Gender").''; print ''; $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); print ''; - + // Address print ''.$langs->trans("Address").''."\n"; print ''."\n"; - + // Zip / Town print ''.$langs->trans('Zip').' / '.$langs->trans('Town').''; print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75'); print ' / '; print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); print ''; - + // Country print ''.$langs->trans('Country').''; print img_picto('', 'country', 'class="pictofixedwidth"'); @@ -633,22 +633,22 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW } print ''; } - + // Birthday print ''.$langs->trans("DateOfBirth").''; print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); print ''."\n"; - + // Photo print ''.$langs->trans("URLPhoto").''."\n"; - + // Public print ''.$langs->trans("Public").''."\n"; - + // Other attributes $tpl_context = 'public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - + // Comments print ''; print ''.$langs->trans("Comments").''; @@ -763,7 +763,6 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print "
"; print ''; } else { // Show the table of membership types - // Get units $measuringUnits = new CUnits($db); $result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1)); From fce1c1a36aefd0445b2777ab0aea3ef53fb3c7d4 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:13:25 +0200 Subject: [PATCH 12/27] Update about.php --- htdocs/zapier/admin/about.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/zapier/admin/about.php b/htdocs/zapier/admin/about.php index b7e2936fc41..71120a384a2 100644 --- a/htdocs/zapier/admin/about.php +++ b/htdocs/zapier/admin/about.php @@ -21,9 +21,9 @@ */ /** - * \file zapier/admin/about.php - * \ingroup zapier - * \brief About page of module Zapier. + * \file htdocs/zapier/admin/about.php + * \ingroup zapier + * \brief About page of module Zapier. */ // Load Dolibarr environment @@ -35,19 +35,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once '../lib/zapier.lib.php'; // Translations -$langs->loadLangs(array("errors", "admin", "zapier")); +$langs->loadLangs(array('admin', 'errors', 'zapier')); // Access control if (!$user->admin) { accessforbidden(); } +if (empty($conf->zapier->enabled)) accessforbidden(); +if (empty($user->admin)) accessforbidden(); + + // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); -if (empty($conf->zapier->enabled)) accessforbidden(); -if (empty($user->admin)) accessforbidden(); /* From c53658e24ade0b73f09090da7a64f55cbfe0ed48 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:16:36 +0200 Subject: [PATCH 13/27] Update webhookindex.php --- htdocs/webhook/webhookindex.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/webhook/webhookindex.php b/htdocs/webhook/webhookindex.php index e62c5e3ddae..50a7ec6d9c1 100644 --- a/htdocs/webhook/webhookindex.php +++ b/htdocs/webhook/webhookindex.php @@ -58,15 +58,16 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook")); +$langs->loadLangs(array('webhook')); -$action = GETPOST('action', 'aZ09'); // Security check // if (! $user->rights->webhook->myobject->read) { // accessforbidden(); // } + +$action = GETPOST('action', 'aZ09'); $socid = GETPOST('socid', 'int'); if (isset($user->socid) && $user->socid > 0) { $action = ''; From f4dda6c11c1002fd60a5e27b8f25cf93bd86e1ad Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:22:12 +0200 Subject: [PATCH 14/27] Update target_agenda.php --- htdocs/webhook/target_agenda.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/webhook/target_agenda.php b/htdocs/webhook/target_agenda.php index ccc61d806af..fd3464d3b67 100644 --- a/htdocs/webhook/target_agenda.php +++ b/htdocs/webhook/target_agenda.php @@ -16,11 +16,13 @@ */ /** - * \file target_agenda.php - * \ingroup webhook - * \brief Tab of events on Target + * \file htdocs/webhook/target_agenda.php + * \ingroup webhook + * \brief Tab of events on Target */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -30,7 +32,7 @@ dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook", "other")); +$langs->loadLangs(array('webhook', 'other')); // Get parameters $id = GETPOST('id', 'int'); @@ -47,6 +49,7 @@ if (GETPOST('actioncode', 'array')) { } else { $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } + $search_agenda_label = GETPOST('search_agenda_label'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -71,6 +74,7 @@ $object = new Target($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('targetagenda', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); From 78eab1a8e89778fea8413d6bf3b2e525603ea77f Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:27:27 +0200 Subject: [PATCH 15/27] Update target_card.php --- htdocs/webhook/target_card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 0777b984d9a..7e4ef4bb265 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -16,11 +16,13 @@ */ /** - * \file target_card.php - * \ingroup webhook - * \brief Page to create/edit/view target + * \file target_card.php + * \ingroup webhook + * \brief Page to create/edit/view target */ + +// 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'; @@ -29,7 +31,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook", "other")); +$langs->loadLangs(array('webhook', 'other')); // Get parameters $id = GETPOST('id', 'int'); @@ -69,6 +71,7 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +// Permissions // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; From 1b78423ab3c0ad8feef69ff36cfd191fc98cfcb0 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:30:26 +0200 Subject: [PATCH 16/27] Update target_contact.php --- htdocs/webhook/target_contact.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/webhook/target_contact.php b/htdocs/webhook/target_contact.php index 76b1a92821f..9aa51b2c44e 100644 --- a/htdocs/webhook/target_contact.php +++ b/htdocs/webhook/target_contact.php @@ -16,11 +16,13 @@ */ /** - * \file target_contact.php - * \ingroup webhook - * \brief Tab for contacts linked to Target + * \file htdocs/webhook/target_contact.php + * \ingroup webhook + * \brief Tab for contacts linked to Target */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -28,7 +30,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook", "companies", "other", "mails")); +$langs->loadLangs(array('webhook', 'companies', 'other', 'mails')); $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); @@ -41,12 +43,14 @@ $object = new Target($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('targetcontact', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +// Permissions // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; From d22120e5f4c581cdcf6b3b1e826f90a86e1f5f09 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:35:46 +0200 Subject: [PATCH 17/27] Update target_list.php --- htdocs/webhook/target_list.php | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index e8a736f5e47..d80661906c0 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -17,11 +17,13 @@ */ /** - * \file target_list.php - * \ingroup webhook - * \brief List page for target + * \file htdocs/webhook/target_list.php + * \ingroup webhook + * \brief List page for target */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -34,20 +36,21 @@ require_once __DIR__.'/class/target.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook", "other")); +$langs->loadLangs(array('webhook', 'other')); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... -$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) -$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +// Get Parameters +$id = GETPOST('id', 'int'); +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); -$id = GETPOST('id', 'int'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -119,6 +122,7 @@ foreach ($object->fields as $key => $val) { ); } } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -126,6 +130,7 @@ $object->fields = dol_sort_array($object->fields, 'position'); //$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); $arrayfields = dol_sort_array($arrayfields, 'position'); +// Permissions // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; @@ -207,6 +212,7 @@ $now = dol_now(); //$help_url = "EN:Module_Target|FR:Module_Target_FR|ES:Módulo_Target"; $help_url = ''; $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Targets")); + $morejs = array(); $morecss = array(); From 77f352610a4c382e849b0b489120d076a06fc50e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:38:41 +0200 Subject: [PATCH 18/27] Update target_note.php --- htdocs/webhook/target_note.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/webhook/target_note.php b/htdocs/webhook/target_note.php index 8ba98fd622d..c9fe74c8758 100644 --- a/htdocs/webhook/target_note.php +++ b/htdocs/webhook/target_note.php @@ -17,22 +17,24 @@ */ /** - * \file target_note.php - * \ingroup webhook - * \brief Tab for notes on Target + * \file htdocs/webhook/target_note.php + * \ingroup webhook + * \brief Tab for notes on Target */ + +// Load Dolibarr environment require '../main.inc.php'; dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("webhook@webhook", "companies")); +$langs->loadLangs(array('webhook', 'companies')); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -41,6 +43,7 @@ $object = new Target($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('targetnote', 'globalcard')); // Note that conf->hooks_modules contains array + // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -50,7 +53,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } - +// Permissions // There is several ways to check permission. // Set $enablepermissioncheck to 1 to enable a minimum low level of checks $enablepermissioncheck = 0; @@ -93,7 +96,7 @@ if (empty($reshook)) { $form = new Form($db); -//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +//$help_url='EN:Webhooks|FR:Webhooks_FR|ES:Webhooks_ES'; $help_url = ''; $title = $langs->trans('Target').' - '.$langs->trans("Notes"); llxHeader('', $title, $help_url); From 401493a35931ac421ab5d6a8425322d3c683e1e5 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:41:30 +0200 Subject: [PATCH 19/27] Update blockedlog.php --- htdocs/blockedlog/admin/blockedlog.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 8880e6c1e86..0f9034e374a 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -22,22 +22,25 @@ * \brief Page setup for blockedlog module */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "blockedlog")); +$langs->loadLangs(array('admin', 'blockedlog', 'other')); +// Access Control if (!$user->admin || empty($conf->blockedlog->enabled)) { accessforbidden(); } -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); - -$withtab = GETPOST('withtab', 'int'); +$withtab = GETPOST('withtab', 'int'); /* From ce986e4128859d5923e5de8a51795bfc3801c718 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:46:59 +0200 Subject: [PATCH 20/27] Update blockedlog_list.php --- htdocs/blockedlog/admin/blockedlog_list.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 4490b3897df..934ef9fba7b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -18,11 +18,13 @@ */ /** - * \file htdocs/blockedlog/admin/blockedlog_list.php - * \ingroup blockedlog - * \brief Page setup for blockedlog module + * \file htdocs/blockedlog/admin/blockedlog_list.php + * \ingroup blockedlog + * \brief Page setup for blockedlog module */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; @@ -31,16 +33,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin", "other", "blockedlog", "bills")); +$langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other')); +// Access Control if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) { accessforbidden(); } -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $search_showonlyerrors = GETPOST('search_showonlyerrors', 'int'); if ($search_showonlyerrors < 0) { @@ -95,7 +99,7 @@ $block_static->loadTrackedEvents(); $result = restrictedArea($user, 'blockedlog', 0, ''); - +// Execution Time $max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined $max_time = @ini_get("max_execution_time"); if ($max_time && $max_time < $max_execution_time_for_importexport) { From e3b5b762032acef9a9c391f01d9e472d4059db3b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:54:11 +0200 Subject: [PATCH 21/27] Update blockedlog.class.php --- htdocs/blockedlog/class/blockedlog.class.php | 26 +++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 3ab2b63ad3f..fa428e4f17e 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -140,6 +140,7 @@ class BlockedLog $this->trackedevents = array(); + // Customer Invoice/Facture / Payment if (isModEnabled('facture')) { $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE'; $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE'; @@ -151,18 +152,19 @@ class BlockedLog } /* Supplier + // Supplier Invoice / Payment if (isModEnabled("fournisseur")) { - $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate'; + $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate'; $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete'; $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done - $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done - $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done - - $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate'; - $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate'; + $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done + $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done + $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate'; + $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate'; } */ + // Donation if (!empty($conf->don->enabled)) { $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE'; $this->trackedevents['DON_DELETE'] = 'logDON_DELETE'; @@ -172,23 +174,29 @@ class BlockedLog } /* + // Salary if (!empty($conf->salary->enabled)) { - $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate'; - $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate'; - $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate'; + $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate'; + $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate'; + $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate'; } */ + // Members if (!empty($conf->adherent->enabled)) { $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE'; $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY'; $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE'; } + + // Bank if (isModEnabled("banque")) { $this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE'; $this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY'; $this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE'; } + + // Cashdesk // $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules $moduleposenabled = (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL)); if ($moduleposenabled) { From 111b5633370acb1ec58c56bbc3e7e282e5505cc3 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 20:00:26 +0200 Subject: [PATCH 22/27] Update blockedlog.lib.php --- htdocs/blockedlog/lib/blockedlog.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/blockedlog/lib/blockedlog.lib.php b/htdocs/blockedlog/lib/blockedlog.lib.php index 44f7074d582..23a7ec1f62d 100644 --- a/htdocs/blockedlog/lib/blockedlog.lib.php +++ b/htdocs/blockedlog/lib/blockedlog.lib.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/blockedlog/lib/blockedlog.lib.php - * \ingroup system - * \brief Library for common blockedlog functions + * \file htdocs/blockedlog/lib/blockedlog.lib.php + * \ingroup system + * \brief Library for common blockedlog functions */ /** From 33e112eda7697766f7fecb81509dfa141f7dae92 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:06:30 +0200 Subject: [PATCH 23/27] Update list.php --- htdocs/commande/list.php | 78 ++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 19 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4ba2f410cc9..1363d9bd953 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -33,6 +33,8 @@ * \brief Page to list orders */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -51,6 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array('orders', 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); +// Get Parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -58,6 +61,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +// Search Parameters $search_datecloture_start = GETPOST('search_datecloture_start', 'int'); if (empty($search_datecloture_start)) { $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); @@ -86,7 +90,7 @@ $socid = GETPOST('socid', 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_total_ht = GETPOST('search_total_ht', 'alpha'); +$search_total_ht = GETPOST('search_total_ht', 'alpha'); $search_total_vat = GETPOST('search_total_vat', 'alpha'); $search_total_ttc = GETPOST('search_total_ttc', 'alpha'); $search_warehouse = GETPOST('search_warehouse', 'int'); @@ -209,6 +213,7 @@ $arrayfields = array( 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -724,6 +729,7 @@ if ($action == 'shipped' && $permissiontoadd) { } } } + // Closed records if (!$error && $massaction === 'setbilled' && $permissiontoclose) { $db->begin(); @@ -760,10 +766,12 @@ if (!$error && $massaction === 'setbilled' && $permissiontoclose) { } } + /* * View */ + $now = dol_now(); $form = new Form($db); @@ -799,12 +807,14 @@ $sql .= ' c.fk_input_reason, c.import_key'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; } + // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } + // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -1065,7 +1075,7 @@ if ($resql) { exit; } - llxHeader('', $title, $help_url); + llxHeader('', $title, $help_url); $param = ''; @@ -1327,7 +1337,7 @@ if ($resql) { $moreforfilter = ''; - // If the user can view prospects other than his' + // If the user can view prospects? sales other than his own if ($user->rights->user->user->lire) { $langs->load("commercial"); $moreforfilter .= '
'; @@ -1342,7 +1352,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } - // If the user can view prospects other than his' + // If the user can view other products/services than his own if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -1351,6 +1361,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1); $moreforfilter .= '
'; } + // If Categories are enabled & user has rights to see if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -1358,6 +1369,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, 'maxwidth300 widthcentpercentminusx'); $moreforfilter .= '
'; } + // If Stock is enabled if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -1509,60 +1521,63 @@ if ($resql) { $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1); print ''; } + // Amount HT / net if (!empty($arrayfields['c.total_ht']['checked'])) { - // Amount print ''; print ''; print ''; } + // Amount of VAT if (!empty($arrayfields['c.total_vat']['checked'])) { - // Amount print ''; print ''; print ''; } + // Total Amount (TTC / gross) if (!empty($arrayfields['c.total_ttc']['checked'])) { - // Amount + print ''; print ''; print ''; } + // Currency if (!empty($arrayfields['c.multicurrency_code']['checked'])) { - // Currency print ''; print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1); print ''; } + // Currency rate if (!empty($arrayfields['c.multicurrency_tx']['checked'])) { - // Currency rate print ''; print ''; print ''; } + // Amount HT/net in foreign currency if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { - // Amount + print ''; print ''; print ''; } + // VAT in foreign currency if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { - // Amount VAT print ''; print ''; print ''; } + // Amount/Total (TTC / gross) in foreign currency if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { - // Amount print ''; print ''; print ''; } + // Author if (!empty($arrayfields['u.login']['checked'])) { - // Author print ''; print ''; print ''; } + // Sales Representative if (!empty($arrayfields['sale_representative']['checked'])) { print ''; } @@ -1582,12 +1597,15 @@ if ($resql) { print ''; print ''; } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Date creation if (!empty($arrayfields['c.datec']['checked'])) { print ''; @@ -1775,8 +1793,10 @@ if ($resql) { ), 'pos' => array(), ); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields $parameters = array( 'arrayfields' => $arrayfields, @@ -1976,6 +1996,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Alias name if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; @@ -1985,6 +2006,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Town if (!empty($arrayfields['s.town']['checked'])) { print ''; @@ -1994,6 +2016,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; @@ -2003,6 +2026,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // State if (!empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."\n"; @@ -2010,6 +2034,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; @@ -2020,6 +2045,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Type ent if (!empty($arrayfields['typent.code']['checked'])) { print ''; @@ -2046,6 +2072,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Plannned date of delivery if (!empty($arrayfields['c.date_delivery']['checked'])) { print ''; @@ -2055,6 +2082,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Shipping Method if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { print ''; @@ -2064,6 +2092,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Payment terms if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; @@ -2073,6 +2102,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Payment mode if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { print ''; @@ -2082,6 +2112,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Channel if (!empty($arrayfields['c.fk_input_reason']['checked'])) { print ''; @@ -2091,7 +2122,8 @@ if ($resql) { $totalarray['nbfield']++; } } - // Amount HT + + // Amount HT/net if (!empty($arrayfields['c.total_ht']['checked'])) { print ''.price($obj->total_ht)."\n"; if (!$i) { @@ -2106,6 +2138,7 @@ if ($resql) { $totalarray['val']['c.total_ht'] = $obj->total_ht; } } + // Amount VAT if (!empty($arrayfields['c.total_vat']['checked'])) { print ''.price($obj->total_tva)."\n"; @@ -2117,7 +2150,8 @@ if ($resql) { } $totalarray['val']['c.total_tva'] += $obj->total_tva; } - // Amount TTC + + // Amount TTC / gross if (!empty($arrayfields['c.total_ttc']['checked'])) { print ''.price($obj->total_ttc)."\n"; if (!$i) { @@ -2146,21 +2180,22 @@ if ($resql) { $totalarray['nbfield']++; } } - // Amount HT + + // Amount HT/net in foreign currency if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { print ''.price($obj->multicurrency_total_ht)."\n"; if (!$i) { $totalarray['nbfield']++; } } - // Amount VAT + // Amount VAT in foreign currency if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { print ''.price($obj->multicurrency_total_vat)."\n"; if (!$i) { $totalarray['nbfield']++; } } - // Amount TTC + // Amount TTC / gross in foreign currency if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { print ''.price($obj->multicurrency_total_ttc)."\n"; if (!$i) { @@ -2196,8 +2231,8 @@ if ($resql) { } } + // Sales representatives if (!empty($arrayfields['sale_representative']['checked'])) { - // Sales representatives print ''; if ($obj->socid > 0) { $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); @@ -2250,6 +2285,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Total margin if (!empty($arrayfields['total_margin']['checked'])) { print ''.price($marginInfo['total_margin']).''; @@ -2261,6 +2297,7 @@ if ($resql) { } $totalarray['val']['total_margin'] += $marginInfo['total_margin']; } + // Total margin rate if (!empty($arrayfields['total_margin_rate']['checked'])) { print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; @@ -2268,6 +2305,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Total mark rate if (!empty($arrayfields['total_mark_rate']['checked'])) { print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; @@ -2456,6 +2494,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Import key if (!empty($arrayfields['c.import_key']['checked'])) { print ''.$obj->import_key.''; @@ -2463,6 +2502,7 @@ if ($resql) { $totalarray['nbfield']++; } } + // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; From 9a7ad0a7dca6737606ec2beda0d7f2a613017d4c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 1 Sep 2022 19:17:42 +0000 Subject: [PATCH 24/27] Fixing style errors. --- htdocs/commande/list.php | 58 +++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1363d9bd953..22afe05725f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1075,7 +1075,7 @@ if ($resql) { exit; } - llxHeader('', $title, $help_url); + llxHeader('', $title, $help_url); $param = ''; @@ -1361,7 +1361,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1); $moreforfilter .= ''; } - // If Categories are enabled & user has rights to see + // If Categories are enabled & user has rights to see if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -1533,9 +1533,8 @@ if ($resql) { print ''; print ''; } - // Total Amount (TTC / gross) + // Total Amount (TTC / gross) if (!empty($arrayfields['c.total_ttc']['checked'])) { - print ''; print ''; print ''; @@ -1554,7 +1553,6 @@ if ($resql) { } // Amount HT/net in foreign currency if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { - print ''; print ''; print ''; @@ -1597,15 +1595,15 @@ if ($resql) { print ''; print ''; } - + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - + // Fields from hook $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + // Date creation if (!empty($arrayfields['c.datec']['checked'])) { print ''; @@ -1793,10 +1791,10 @@ if ($resql) { ), 'pos' => array(), ); - + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - + // Hook fields $parameters = array( 'arrayfields' => $arrayfields, @@ -1996,7 +1994,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Alias name if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; @@ -2006,7 +2004,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Town if (!empty($arrayfields['s.town']['checked'])) { print ''; @@ -2016,7 +2014,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; @@ -2026,7 +2024,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // State if (!empty($arrayfields['state.nom']['checked'])) { print "".$obj->state_name."\n"; @@ -2034,7 +2032,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Country if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; @@ -2045,7 +2043,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Type ent if (!empty($arrayfields['typent.code']['checked'])) { print ''; @@ -2072,7 +2070,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Plannned date of delivery if (!empty($arrayfields['c.date_delivery']['checked'])) { print ''; @@ -2082,7 +2080,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Shipping Method if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { print ''; @@ -2092,7 +2090,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Payment terms if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; @@ -2102,7 +2100,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Payment mode if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { print ''; @@ -2112,7 +2110,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Channel if (!empty($arrayfields['c.fk_input_reason']['checked'])) { print ''; @@ -2122,7 +2120,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Amount HT/net if (!empty($arrayfields['c.total_ht']['checked'])) { print ''.price($obj->total_ht)."\n"; @@ -2138,7 +2136,7 @@ if ($resql) { $totalarray['val']['c.total_ht'] = $obj->total_ht; } } - + // Amount VAT if (!empty($arrayfields['c.total_vat']['checked'])) { print ''.price($obj->total_tva)."\n"; @@ -2150,7 +2148,7 @@ if ($resql) { } $totalarray['val']['c.total_tva'] += $obj->total_tva; } - + // Amount TTC / gross if (!empty($arrayfields['c.total_ttc']['checked'])) { print ''.price($obj->total_ttc)."\n"; @@ -2180,7 +2178,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Amount HT/net in foreign currency if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { print ''.price($obj->multicurrency_total_ht)."\n"; @@ -2285,7 +2283,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Total margin if (!empty($arrayfields['total_margin']['checked'])) { print ''.price($marginInfo['total_margin']).''; @@ -2297,7 +2295,7 @@ if ($resql) { } $totalarray['val']['total_margin'] += $marginInfo['total_margin']; } - + // Total margin rate if (!empty($arrayfields['total_margin_rate']['checked'])) { print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').''; @@ -2305,7 +2303,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Total mark rate if (!empty($arrayfields['total_mark_rate']['checked'])) { print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; @@ -2494,7 +2492,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Import key if (!empty($arrayfields['c.import_key']['checked'])) { print ''.$obj->import_key.''; @@ -2502,7 +2500,7 @@ if ($resql) { $totalarray['nbfield']++; } } - + // Status if (!empty($arrayfields['c.fk_statut']['checked'])) { print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; From 3d9b57ac3f59be37ba5f9addb33a3d48fcd170b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 08:53:13 +0200 Subject: [PATCH 25/27] Clean code --- .../categories/class/api_categories.class.php | 3 - .../facture/class/facture-rec.class.php | 10 +- htdocs/core/class/extrafields.class.php | 111 ++++++------------ htdocs/cron/class/cronjob.class.php | 28 +++-- htdocs/fichinter/class/fichinter.class.php | 90 ++++++++------ htdocs/fichinter/class/fichinterrec.class.php | 26 ++-- .../install/mysql/migration/16.0.0-17.0.0.sql | 3 + .../mysql/tables/llx_fichinterdet_rec.sql | 2 - htdocs/website/index.php | 3 +- 9 files changed, 123 insertions(+), 153 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 0a618974024..d5345106093 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -682,9 +682,6 @@ class Categories extends DolibarrApi unset($object->total_ttc); unset($object->total_tva); unset($object->lines); - unset($object->fk_incoterms); - unset($object->label_incoterms); - unset($object->location_incoterms); unset($object->civility_id); unset($object->name); unset($object->lastname); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f15f65954cf..3001baca506 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/compta/facture/class/facture-rec.class.php * \ingroup facture - * \brief Fichier de la classe des factures recurentes + * \brief File of class to manage recurring invoices */ require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; @@ -462,7 +462,7 @@ class FactureRec extends CommonInvoice /** - * Update a line to invoice_rec. + * Update a line invoice_rec. * * @param User $user User * @param int $notrigger No trigger @@ -470,8 +470,6 @@ class FactureRec extends CommonInvoice */ public function update(User $user, $notrigger = 0) { - global $conf; - $error = 0; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; @@ -480,8 +478,8 @@ class FactureRec extends CommonInvoice $sql .= " suspended = ".((int) $this->suspended).","; $sql .= " fk_soc = ".((int) $this->socid).","; $sql .= " total_tva = ".((float) $this->total_tva).","; - $sql .= " localtax1 = ".((float) $this->localtax1).","; - $sql .= " localtax2 = ".((float) $this->localtax2).","; + $sql .= " localtax1 = ".((float) $this->total_localtax1).","; + $sql .= " localtax2 = ".((float) $this->total_localtax2).","; $sql .= " total_ht = ".((float) $this->total_ht).","; $sql .= " total_ttc = ".((float) $this->total_ttc).","; $sql .= " remise_percent = ".((float) $this->remise_percent); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index bbc5e8604ce..5b6e00e91da 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -42,30 +42,6 @@ class ExtraFields */ public $db; - /** - * @var array Array with type of the extra field - * @deprecated - */ - public $attribute_type; - - /** - * @var array Array with label of extra field - * @deprecated - */ - public $attribute_label; - - /** - * @var array Array with list of possible values for some types of extra fields - * @deprecated - */ - public $attribute_choice; - - /** - * @var array array to store extrafields definition - * @deprecated - */ - public $attribute_list; - /** * @var array New array to store extrafields definition */ @@ -128,10 +104,6 @@ class ExtraFields $this->error = ''; $this->errors = array(); $this->attributes = array(); - - // For old usage - $this->attribute_type = array(); - $this->attribute_label = array(); } /** @@ -838,7 +810,7 @@ class ExtraFields // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ... + * Load array this->attributes * * @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. @@ -892,11 +864,6 @@ class ExtraFields $array_name_label[$tab->name] = $tab->label; } - // Old usage - $this->attribute_type[$tab->name] = $tab->type; - $this->attribute_label[$tab->name] = $tab->label; - - // New usage $this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type; $this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label; $this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size; @@ -946,7 +913,7 @@ class ExtraFields * @param string $keyprefix Suffix string to add before name and id of field (can be used to avoid duplicate names) * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) * @param int $objectid Current object id - * @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data + * @param string $extrafieldsobjectkey The key to use to store retreived data (for example $object->table_element) * @param string $mode 1=Used for search filters * @return string */ @@ -965,29 +932,26 @@ class ExtraFields $keyprefix = $keyprefix.'options_'; } - if (!empty($extrafieldsobjectkey)) { - $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; - $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; - $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; - $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; - $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; - $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; - $required = $this->attributes[$extrafieldsobjectkey]['required'][$key]; - $param = $this->attributes[$extrafieldsobjectkey]['param'][$key]; - $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1'); - $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; - $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1'); - $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; - $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } else { - // Old usage - $label = $this->attribute_label[$key]; - $type = $this->attribute_type[$key]; - $list = $this->attribute_list[$key]; - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + if (empty($extrafieldsobjectkey)) { + dol_syslog(get_class($this).'::showInputField extrafieldsobjectkey required', LOG_ERR); + return 'BadValueForParamExtraFieldsObjectKey'; } + $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; + $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; + $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; + $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; + $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; + $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; + $required = $this->attributes[$extrafieldsobjectkey]['required'][$key]; + $param = $this->attributes[$extrafieldsobjectkey]['param'][$key]; + $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1'); + $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; + $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1'); + $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; + $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + if ($computed) { if (!preg_match('/^search_/', $keyprefix)) { return ''.$langs->trans("AutomaticallyCalculated").''; @@ -1591,26 +1555,25 @@ class ExtraFields { global $conf, $langs; - if (!empty($extrafieldsobjectkey)) { - $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; - $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; - $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'... - $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; - $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; - $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; - $required = $this->attributes[$extrafieldsobjectkey]['required'][$key]; - $param = $this->attributes[$extrafieldsobjectkey]['param'][$key]; - $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1'); - $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; - $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1'); - $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; - $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } else { - // Old usage not allowed anymore - dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_WARNING); - return ''; + if (empty($extrafieldsobjectkey)) { + dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_ERR); + return 'BadValueForParamExtraFieldsObjectKey'; } + $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; + $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; + $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'... + $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; + $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; + $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; + $required = $this->attributes[$extrafieldsobjectkey]['required'][$key]; + $param = $this->attributes[$extrafieldsobjectkey]['param'][$key]; + $perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1'); + $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; + $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1'); + $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + if ($hidden) { return ''; // This is a protection. If field is hidden, we should just not call this method. } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 9bc8400188f..033e6512bd8 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -108,62 +108,62 @@ class Cronjob extends CommonObject public $datelastresult = ''; /** - * @var string Last result from end job execution + * @var string Last result from end job execution */ public $lastresult; /** - * @var string Last output from end job execution + * @var string Last output from end job execution */ public $lastoutput; /** - * @var string Unit frequency of job execution + * @var string Unit frequency of job execution */ public $unitfrequency; /** - * @var int Frequency of job execution + * @var int Frequency of job execution */ public $frequency; /** - * @var int Status + * @var int Status */ public $status; /** - * @var int Is job processing + * @var int Is job running ? */ public $processing; /** - * @var int The job current PID + * @var int The job current PID */ public $pid; /** - * @var int ID + * @var int User ID of creation */ public $fk_user_author; /** - * @var int ID + * @var int User ID of last modification */ public $fk_user_mod; /** - * @var int Number of run job execution + * @var int Number of run job execution */ public $nbrun; /** - * @var int Maximum run job execution + * @var int Maximum run job execution */ public $maxrun; /** - * @var string Libname + * @var string Libname */ public $libname; @@ -1513,10 +1513,12 @@ class Cronjobline public $datenextrun = ''; public $dateend = ''; public $datestart = ''; + public $datelastresult = ''; public $lastresult = ''; public $lastoutput; public $unitfrequency; public $frequency; + public $processing; /** * @var int Status @@ -1534,8 +1536,10 @@ class Cronjobline public $fk_user_mod; public $note; + public $note_private; public $nbrun; public $libname; + public $test; /** * Constructor diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 61c127cab9b..dbc14231b41 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -36,36 +36,36 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; */ class Fichinter extends CommonObject { - public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>20), - 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), - 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), - 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), - 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), - 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), - 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), - 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>20), + 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), + 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), + 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70), + 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), + 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), + 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135), ); + /** * @var string ID to identify managed object */ @@ -1267,7 +1267,8 @@ class Fichinter extends CommonObject $line->fk_fichinter = $fichinterid; $line->desc = $desc; - $line->datei = $date_intervention; + $line->date = $date_intervention; + $line->datei = $date_intervention; // For backward compatibility $line->duration = $duration; if (is_array($array_options) && count($array_options) > 0) { @@ -1316,7 +1317,8 @@ class Fichinter extends CommonObject while ($xnbp < $nbp) { $line = new FichinterLigne($this->db); $line->desc = $langs->trans("Description")." ".$xnbp; - $line->datei = ($now - 3600 * (1 + $xnbp)); + $line->date = ($now - 3600 * (1 + $xnbp)); + $line->datei = ($now - 3600 * (1 + $xnbp)); // For backward compatibility $line->duration = 600; $line->fk_fichinter = 0; $this->lines[$xnbp] = $line; @@ -1359,7 +1361,7 @@ class Fichinter extends CommonObject //For invoicing we calculing hours $line->qty = round($objp->duree / 3600, 2); $line->date = $this->db->jdate($objp->date); - $line->datei = $this->db->jdate($objp->date); + $line->datei = $this->db->jdate($objp->date); // For backward compatibility $line->rang = $objp->rang; $line->product_type = 1; $line->fetch_optionals(); @@ -1486,6 +1488,8 @@ class FichinterLigne extends CommonObjectLine public $duration; // Duration of intervention public $rang = 0; + public $tva_tx; + public $subprice; /** * @var string ID to identify managed object @@ -1522,8 +1526,7 @@ class FichinterLigne extends CommonObjectLine */ public function fetch($rowid) { - $sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang,'; - $sql .= ' ft.date as datei'; + $sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang, ft.date'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql .= ' WHERE ft.rowid = '.((int) $rowid); @@ -1534,7 +1537,8 @@ class FichinterLigne extends CommonObjectLine $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_fichinter = $objp->fk_fichinter; - $this->datei = $this->db->jdate($objp->datei); + $this->date = $this->db->jdate($objp->date); + $this->datei = $this->db->jdate($objp->date); // For backward compatibility $this->desc = $objp->description; $this->duration = $objp->duree; $this->rang = $objp->rang; @@ -1562,6 +1566,10 @@ class FichinterLigne extends CommonObjectLine dol_syslog("FichinterLigne::insert rang=".$this->rang); + if (empty($this->date) && !empty($this->datei)) { // For backward compatibility + $this->date = $this->datei; + } + $this->db->begin(); $rangToUse = $this->rang; @@ -1585,7 +1593,7 @@ class FichinterLigne extends CommonObjectLine $sql .= ' (fk_fichinter, description, date, duree, rang)'; $sql .= " VALUES (".((int) $this->fk_fichinter).","; $sql .= " '".$this->db->escape($this->desc)."',"; - $sql .= " '".$this->db->idate($this->datei)."',"; + $sql .= " '".$this->db->idate($this->date)."',"; $sql .= " ".((int) $this->duration).","; $sql .= ' '.((int) $rangToUse); $sql .= ')'; @@ -1647,14 +1655,18 @@ class FichinterLigne extends CommonObjectLine $error = 0; + if (empty($this->date) && !empty($this->datei)) { // For backward compatibility + $this->date = $this->datei; + } + $this->db->begin(); // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; - $sql .= " description='".$this->db->escape($this->desc)."'"; - $sql .= ",date='".$this->db->idate($this->datei)."'"; - $sql .= ",duree=".$this->duration; - $sql .= ",rang='".$this->db->escape($this->rang)."'"; + $sql .= " description = '".$this->db->escape($this->desc)."',"; + $sql .= " date = '".$this->db->idate($this->date)."',"; + $sql .= " duree = ".((int) $this->duration).","; + $sql .= " rang = ".((int) $this->rang); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog("FichinterLigne::update", LOG_DEBUG); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index b128bba60f8..bcf89704e55 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -64,7 +64,6 @@ class FichinterRec extends Fichinter public $number; public $date; public $amount; - public $remise; public $tva; public $total; @@ -222,7 +221,7 @@ class FichinterRec extends Fichinter $result_insert = $this->addline( $fichintsrc->lines[$i]->desc, $fichintsrc->lines[$i]->duration, - $fichintsrc->lines[$i]->datei, + $fichintsrc->lines[$i]->date, $fichintsrc->lines[$i]->rang, $fichintsrc->lines[$i]->subprice, $fichintsrc->lines[$i]->qty, @@ -350,8 +349,8 @@ class FichinterRec extends Fichinter // phpcs:enable $this->lines = array(); - $sql = 'SELECT l.rowid, l.fk_product, l.product_type as product_type, l.label as custom_label, l.description, '; - $sql .= ' l.price, l.qty, l.tva_tx, l.remise_percent, l.subprice, l.duree, '; + $sql = 'SELECT l.rowid, l.fk_product, l.product_type as product_type, l.label as custom_label, l.description,'; + $sql .= ' l.price, l.qty, l.tva_tx, l.remise_percent, l.subprice, l.duree, l.date,'; $sql .= ' l.total_ht, l.total_tva, l.total_ttc,'; $sql .= ' l.rang, l.special_code,'; $sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,'; @@ -381,19 +380,16 @@ class FichinterRec extends Fichinter $line->qty = $objp->qty; $line->duree = $objp->duree; $line->duration = $objp->duree; - $line->datei = $objp->date; + $line->date = $objp->date; $line->subprice = $objp->subprice; $line->tva_tx = $objp->tva_tx; $line->remise_percent = $objp->remise_percent; $line->fk_remise_except = $objp->fk_remise_except; $line->fk_product = $objp->fk_product; - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; $line->info_bits = $objp->info_bits; $line->total_ht = $objp->total_ht; $line->total_tva = $objp->total_tva; $line->total_ttc = $objp->total_ttc; - $line->code_ventilation = $objp->fk_code_ventilation; $line->rang = $objp->rang; $line->special_code = $objp->special_code; $line->fk_unit = $objp->fk_unit; @@ -460,7 +456,7 @@ class FichinterRec extends Fichinter * * @param string $desc Description de la ligne * @param integer $duration Durée - * @param string $datei Date + * @param string $date Date * @param int $rang Position of line * @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $qty Quantity @@ -477,7 +473,7 @@ class FichinterRec extends Fichinter * @param string $fk_unit Unit * @return int <0 if KO, Id of line if OK */ - public function addline($desc, $duration, $datei, $rang = -1, $pu_ht = 0, $qty = 0, $txtva = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $special_code = 0, $label = '', $fk_unit = null) + public function addline($desc, $duration, $date, $rang = -1, $pu_ht = 0, $qty = 0, $txtva = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $special_code = 0, $label = '', $fk_unit = null) { global $mysoc; @@ -520,6 +516,8 @@ class FichinterRec extends Fichinter $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; + $pu_ht = $tabprice[3]; + $product_type = $type; if ($fk_product) { $product = new Product($this->db); @@ -539,8 +537,7 @@ class FichinterRec extends Fichinter $sql .= ", fk_product"; $sql .= ", product_type"; $sql .= ", remise_percent"; - //$sql.= ", subprice"; - $sql .= ", remise"; + $sql .= ", subprice"; $sql .= ", total_ht"; $sql .= ", total_tva"; $sql .= ", total_ttc"; @@ -551,7 +548,7 @@ class FichinterRec extends Fichinter $sql .= (int) $this->id; $sql .= ", ".(!empty($label) ? "'".$this->db->escape($label)."'" : "null"); $sql .= ", ".(!empty($desc) ? "'".$this->db->escape($desc)."'" : "null"); - $sql .= ", ".(!empty($datei) ? "'".$this->db->idate($datei)."'" : "null"); + $sql .= ", ".(!empty($date) ? "'".$this->db->idate($date)."'" : "null"); $sql .= ", ".$duration; //$sql.= ", ".price2num($pu_ht); //$sql.= ", ".(!empty($qty)? $qty :(!empty($duration)? $duration :"null")); @@ -559,8 +556,7 @@ class FichinterRec extends Fichinter $sql .= ", ".(!empty($fk_product) ? $fk_product : "null"); $sql .= ", ".$product_type; $sql .= ", ".(!empty($remise_percent) ? $remise_percent : "null"); - //$sql.= ", '".price2num($pu_ht)."'"; - $sql .= ", null"; + $sql.= ", '".price2num($pu_ht)."'"; $sql .= ", '".price2num($total_ht)."'"; $sql .= ", '".price2num($total_tva)."'"; $sql .= ", '".price2num($total_ttc)."'"; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 5db36ee955b..c84a80aa72f 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -61,6 +61,9 @@ ALTER TABLE llx_user DROP COLUMN idpers3; ALTER TABLE llx_partnership ADD COLUMN ip varchar(250); ALTER TABLE llx_adherent ADD COLUMN ip varchar(250); +ALTER TABLE llx_fichinterdet_rec DROP COLUMN remise; +ALTER TABLE llx_fichinterdet_rec DROP COLUMN fk_export_commpta; + UPDATE llx_const set name = 'ADHERENT_MAILMAN_ADMIN_PASSWORD' WHERE name = 'ADHERENT_MAILMAN_ADMINPW'; ALTER TABLE llx_oauth_token ADD COLUMN state text after tokenstring; diff --git a/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql b/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql index ef799ea379a..bdef744df49 100644 --- a/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql +++ b/htdocs/install/mysql/tables/llx_fichinterdet_rec.sql @@ -41,7 +41,6 @@ create table llx_fichinterdet_rec localtax2_type VARCHAR(1) NULL DEFAULT NULL, qty double NULL DEFAULT NULL, remise_percent double NULL DEFAULT 0, - remise double NULL DEFAULT 0, fk_remise_except integer NULL DEFAULT NULL, price DOUBLE(24, 8) NULL DEFAULT NULL, total_tva DOUBLE(24, 8) NULL DEFAULT NULL, @@ -55,7 +54,6 @@ create table llx_fichinterdet_rec buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0, fk_product_fournisseur_price integer NULL DEFAULT NULL, fk_code_ventilation integer NOT NULL DEFAULT 0, - fk_export_commpta integer NOT NULL DEFAULT 0, special_code integer UNSIGNED NULL DEFAULT 0, fk_unit integer NULL DEFAULT NULL, import_key varchar(14) NULL DEFAULT NULL diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0b599ba640b..f8c6a94c09c 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -751,7 +751,6 @@ if ($action == 'addcontainer' && $usercanedit) { $objectpage->content = preg_replace('/^.*]*)*>/ims', '', $objectpage->content); $objectpage->content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $objectpage->content); - $absoluteurlinaction = $urltograbdirwithoutslash; // TODO Replace 'action="$urltograbdirwithoutslash' into action="/" // TODO Replace 'action="$urltograbdirwithoutslash..."' into action="..." // TODO Replace 'a href="$urltograbdirwithoutslash' into a href="/" @@ -908,7 +907,7 @@ if ($action == 'addcontainer' && $usercanedit) { getAllImages($object, $objectpage, $urltograbbis, $tmpgeturl['content'], $action, 1, $grabimages, $grabimagesinto); - // We try to convert the CSS we got by adding a prefix .bodywebsite with lessc to avoid conflicit with CSS of Dolibarr. + // We try to convert the CSS we got by adding a prefix .bodywebsite with lessc to avoid conflict with CSS of Dolibarr. include_once DOL_DOCUMENT_ROOT.'/core/class/lessc.class.php'; $lesscobj = new Lessc(); try { From 2d794473a5aefac46d8f2fd03344a75b9e7b5a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 09:45:40 +0200 Subject: [PATCH 26/27] Clean code --- htdocs/core/modules/modWebhook.class.php | 2 +- htdocs/webhook/class/target.class.php | 5 +---- htdocs/webhook/lib/webhook.lib.php | 4 +--- htdocs/webhook/lib/webhook_target.lib.php | 4 +--- htdocs/webhook/target_agenda.php | 2 +- htdocs/webhook/target_card.php | 2 +- htdocs/webhook/target_contact.php | 2 +- htdocs/webhook/target_list.php | 2 +- htdocs/webhook/target_note.php | 2 +- htdocs/webhook/webhookindex.php | 4 ---- 10 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index fbcb5f81003..fd7f658bd48 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -141,7 +141,7 @@ class modWebhook extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) // The language file dedicated to your module - $this->langfiles = array("webhook"); + $this->langfiles = array(); // Prerequisites $this->phpmin = array(5, 6); // Minimum version of PHP required by module diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 7eabbe397ab..991201a8d91 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -833,7 +833,7 @@ class Target extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("webhook@webhook"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled'); $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); @@ -928,7 +928,6 @@ class Target extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("webhook@webhook"); if (empty($conf->global->WEBHOOK_TARGET_ADDON)) { $conf->global->WEBHOOK_TARGET_ADDON = 'mod_target_standard'; @@ -993,8 +992,6 @@ class Target extends CommonObject $result = 0; $includedocgeneration = 0; - $langs->load("webhook@webhook"); - if (!dol_strlen($modele)) { $modele = 'standard_target'; diff --git a/htdocs/webhook/lib/webhook.lib.php b/htdocs/webhook/lib/webhook.lib.php index 6c511180b6e..6c48eccfdf8 100644 --- a/htdocs/webhook/lib/webhook.lib.php +++ b/htdocs/webhook/lib/webhook.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Laurent Destailleur * * 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 @@ -30,8 +30,6 @@ function webhookAdminPrepareHead() { global $langs, $conf; - $langs->load("webhook@webhook"); - $h = 0; $head = array(); $head[$h][0] = dol_buildpath("/admin/webhook.php", 1); diff --git a/htdocs/webhook/lib/webhook_target.lib.php b/htdocs/webhook/lib/webhook_target.lib.php index fb01a8f95aa..894e3134c0c 100644 --- a/htdocs/webhook/lib/webhook_target.lib.php +++ b/htdocs/webhook/lib/webhook_target.lib.php @@ -1,5 +1,5 @@ * * 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 @@ -30,8 +30,6 @@ function targetPrepareHead($object) { global $db, $langs, $conf; - $langs->load("webhook@webhook"); - $h = 0; $head = array(); diff --git a/htdocs/webhook/target_agenda.php b/htdocs/webhook/target_agenda.php index fd3464d3b67..bf4e883411b 100644 --- a/htdocs/webhook/target_agenda.php +++ b/htdocs/webhook/target_agenda.php @@ -32,7 +32,7 @@ dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 7e4ef4bb265..0b9ff450d44 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -31,7 +31,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_contact.php b/htdocs/webhook/target_contact.php index 9aa51b2c44e..460cc7d8ea7 100644 --- a/htdocs/webhook/target_contact.php +++ b/htdocs/webhook/target_contact.php @@ -30,7 +30,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'companies', 'other', 'mails')); +$langs->loadLangs(array('companies', 'other', 'mails')); $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index d80661906c0..2a4f2edfcf1 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -36,7 +36,7 @@ require_once __DIR__.'/class/target.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'other')); +$langs->loadLangs(array('other')); // Get Parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/target_note.php b/htdocs/webhook/target_note.php index c9fe74c8758..4b9be8aaea1 100644 --- a/htdocs/webhook/target_note.php +++ b/htdocs/webhook/target_note.php @@ -29,7 +29,7 @@ dol_include_once('/webhook/class/target.class.php'); dol_include_once('/webhook/lib/webhook_target.lib.php'); // Load translation files required by the page -$langs->loadLangs(array('webhook', 'companies')); +$langs->loadLangs(array('companies')); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/webhook/webhookindex.php b/htdocs/webhook/webhookindex.php index 50a7ec6d9c1..77c717b628d 100644 --- a/htdocs/webhook/webhookindex.php +++ b/htdocs/webhook/webhookindex.php @@ -57,10 +57,6 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -// Load translation files required by the page -$langs->loadLangs(array('webhook')); - - // Security check // if (! $user->rights->webhook->myobject->read) { From 89da4e5bc3127151724fc82eac5dd66046cfd58d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:01:16 +0200 Subject: [PATCH 27/27] Update index.php --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index b76be278a44..2deef52946a 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -417,7 +417,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod // TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter" // Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover": // "commitment engagment" method and "cash accounting" method -if ( isModEnabled("invoice") && $user->hasRight('facture', 'lire') && getDolGlobalString('MAIN_SHOW_PRODUCT_ACTIVITY_TRIM')) { +if (isModEnabled("invoice") && $user->hasRight('facture', 'lire') && getDolGlobalString('MAIN_SHOW_PRODUCT_ACTIVITY_TRIM')) { if (isModEnabled("product")) { activitytrim(0); }