From 9ad5553c47b064fa4e3b30fe6824d101a52f38c7 Mon Sep 17 00:00:00 2001 From: melina Date: Wed, 8 Jun 2022 17:56:11 +0200 Subject: [PATCH 01/42] Add setup parameters --- htdocs/langs/en_US/cashdesk.lang | 8 +++++- htdocs/langs/fr_FR/cashdesk.lang | 6 ++++ htdocs/takepos/admin/appearance.php | 43 +++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index b53eb235c29..07b91316771 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -136,4 +136,10 @@ PrintWithoutDetails=Print without details YearNotDefined=Year is not defined TakeposBarcodeRuleToInsertProduct=Barcode rule to insert product TakeposBarcodeRuleToInsertProductDesc=Rule to extract the product reference + a quantity from a scanned barcode.
If empty (default value), application will use the full barcode scanned to find the product.

If defined, syntax must be:
ref:NB+qu:NB+qd:NB+other:NB
where NB is the number of characters to use to extract data from the scanned barcode with: -AlreadyPrinted=Already printed \ No newline at end of file +AlreadyPrinted=Already printed +HideCategories=Hide categories +HideStockOnLine=Hide stock on line +ShowOnlyProductInStock=Show the products in stock +ShowCategoryDescription=Show category description +ShowProductReference=Show reference of products +UsePriceHT=Use price excl. taxes and not price incl. taxes \ No newline at end of file diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 24d35d56a06..5ce6fb98a5d 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -136,3 +136,9 @@ PrintWithoutDetails=Générer sans les détails YearNotDefined=L'année n'est pas définie TakeposBarcodeRuleToInsertProduct=Règle de lecture du code barre des produits TakeposBarcodeRuleToInsertProductDesc=Règle pour extraire la référence produit + une quantité d'un code barre scanné.
Si vide (valeur par défaut), l'application utilisera le code-barres complet scanné pour trouver le produit.

Si elle est définie, la syntaxe doit être:
ref: NB + Qu: NB + QD: NB + autres: NB
où NB est le nombre de caractères à utiliser pour extraire les données du code à barres scannés avec: +HideCategories=Masquer les catégories +HideStockOnLine=Masquer le stock en ligne +ShowOnlyProductInStock=Affficher les produits en stock +ShowCategoryDescription=Afficher la description des catégories +ShowProductReference=Afficher la référence des produits +UsePriceHT= Utiliser le prix HT et non en TTC \ No newline at end of file diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 135a3b2a9e7..060c955728d 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -117,6 +117,49 @@ $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6"); print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0); print "\n"; +// D'ont display category +print ''; +print $langs->trans('HideCategories'); +print ''; +print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + +// Hide stock on line +print ''; +print $langs->trans('HideStockOnLine'); +print ''; +print ajax_constantonoff("TAKEPOS_HIDE_STOCK_ON_LINE", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + +// Only the products in stock +print ''; +print $langs->trans('ShowOnlyProductInStock'); +print ''; +print ajax_constantonoff("TAKEPOS_PRODUCT_IN_STOCK", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + +// View description of the categories +print ''; +print $langs->trans('ShowCategoryDescription'); +print ''; +print ajax_constantonoff("TAKEPOS_SHOW_CATEGORY_DESCRIPTION", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + +// View reference of products +print ''; +print $langs->trans('ShowProductReference'); +print ''; +print ajax_constantonoff("TAKEPOS_SHOW_PRODUCT_REFERENCE", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + +// Use price excl. taxes (HT) and not price incl. taxes (TTC) +print ''; +print $langs->trans('UsePriceHT'); +print ''; +print ajax_constantonoff("TAKEPOS_CHANGE_PRICE_HT", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + + print ''; print $form->buttonsSaveCancel("Save", ''); From fb3f2698ae6c58b4340b4061626f55176f60aaec Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Jun 2022 08:46:46 +0000 Subject: [PATCH 02/42] Fixing style errors. --- htdocs/takepos/admin/appearance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 060c955728d..9198b03bb63 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -124,7 +124,7 @@ print ''; print ajax_constantonoff("TAKEPOS_HIDE_CATEGORIES", array(), $conf->entity, 0, 0, 1, 0); print "\n"; -// Hide stock on line +// Hide stock on line print ''; print $langs->trans('HideStockOnLine'); print ''; From 50ae1b1f7693f53cc687c681a4cd716bb8822db0 Mon Sep 17 00:00:00 2001 From: kamel Date: Fri, 10 Jun 2022 10:19:56 +0200 Subject: [PATCH 03/42] NEW: Add new hook for show virtual stock details on product stock card --- htdocs/product/stock/product.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b9fc1a201e5..e8622781a3f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -734,6 +734,15 @@ if ($id > 0 || $ref) { $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); + $parameters = array(); + $reshook = $hookmanager->executeHooks('physicalStockTextStockOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + $text_stock_options = $hookmanager->resPrint; + } elseif ($reshook == 0) { + $text_stock_options .= $hookmanager->resPrint; + } else { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } print ''; print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); @@ -820,6 +829,15 @@ if ($id > 0 || $ref) { $helpondiff .= $langs->trans("ProductQtyToConsumeByMO").': '.$object->stats_mrptoconsume['qty'].'
'; $helpondiff .= $langs->trans("ProductQtyToProduceByMO").': '.$object->stats_mrptoproduce['qty']; } + $parameters = array('found' => &$found, 'id' => $object->id, 'includedraftpoforvirtual' => null); + $reshook = $hookmanager->executeHooks('virtualStockHelpOnDiff', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + $helpondiff = $hookmanager->resPrint; + } elseif ($reshook == 0) { + $helpondiff .= $hookmanager->resPrint; + } else { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } // Calculating a theorical value From 348fb8e9f23e1001cfa7afda0543b144827f9128 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 12 Jun 2022 21:34:35 +0200 Subject: [PATCH 04/42] Stripe Terminal --- htdocs/stripe/admin/stripe.php | 54 +++++++ htdocs/stripe/ajax/ajax.php | 124 +++++++++++++++ htdocs/stripe/class/stripe.class.php | 41 ++++- htdocs/takepos/admin/terminal.php | 43 +++++ htdocs/takepos/pay.php | 229 ++++++++++++++++++++++++++- 5 files changed, 486 insertions(+), 5 deletions(-) create mode 100644 htdocs/stripe/ajax/ajax.php diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 77c8d9a03b2..8240b21ff75 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -104,6 +104,10 @@ if ($action == 'setvalue' && $user->admin) { if (!$result > 0) { $error++; } + $result = dolibarr_set_const($db, "STRIPE_LOCATION", GETPOST('STRIPE_LOCATION', 'alpha'), 'chaine', 0, '', $conf->entity); + if (!$result > 0) { + $error++; + } $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) { $error++; @@ -364,6 +368,56 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ? print ''; } +// Card Present for Stripe Terminal +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code + print ''; + print $langs->trans("STRIPE_CARD_PRESENT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_CARD_PRESENT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_CARD_PRESENT", $arrval, $conf->global->STRIPE_CARD_PRESENT); + } + print ''; +} + +// Locations for Stripe Terminal +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code + print ''; + print $langs->trans("STRIPE_LOCATION").''; + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + global $stripearrayofkeysbyenv; + $site_account = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + \Stripe\Stripe::setApiKey($site_account); + if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { + $service = 'StripeTest'; + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + } else { + $service = 'StripeLive'; + $servicestatus = '1'; + } + $stripe = new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); + if ($stripeacc) { + $locations = \Stripe\Terminal\Location::all('', array("stripe_account" => $stripeacc)); + } else { + $locations = \Stripe\Terminal\Location::all(); + } + $location = array(); + $location[""] = $langs->trans("EmptyLocation"); + foreach ($locations as $locations) { + $location[$locations->id] = $locations->display_name; + } + print $form->selectarray("STRIPE_LOCATION", $location, $conf->global->STRIPE_LOCATION); + print ''; +} + // Activate Payment Request API if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // TODO Not used by current code print ''; diff --git a/htdocs/stripe/ajax/ajax.php b/htdocs/stripe/ajax/ajax.php new file mode 100644 index 00000000000..e50b426ee87 --- /dev/null +++ b/htdocs/stripe/ajax/ajax.php @@ -0,0 +1,124 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/stripe/ajax/ajax.php + * \brief Ajax action for Stipe ie: Terminal + */ + +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php'; +require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + +$action = GETPOST('action', 'aZ09'); +$location = GETPOST('location', 'alphanohtml'); +$stripeacc = GETPOST('stripeacc', 'alphanohtml'); +$servicestatus = GETPOST('servicestatus', 'int'); +$amount = GETPOST('amount', 'int'); + +if (empty($user->rights->takepos->run)) { + accessforbidden(); +} + + +/* + * View + */ + +if ($action == 'getConnexionToken') { + try { + // Be sure to authenticate the endpoint for creating connection tokens. + // Force to use the correct API key + global $stripearrayofkeysbyenv; + \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']); + // The ConnectionToken's secret lets you connect to any Stripe Terminal reader + // and take payments with your Stripe account. + $array = array(); + if (isset($location) && !empty($location)) $array['location'] = $location; + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $connectionToken = \Stripe\Terminal\ConnectionToken::create($array); + } else { + $connectionToken = \Stripe\Terminal\ConnectionToken::create($array, array("stripe_account" => $stripeacc)); + } + echo json_encode(array('secret' => $connectionToken->secret)); + } catch (Error $e) { + http_response_code(500); + echo json_encode(['error' => $e->getMessage()]); + } +} elseif ($action == 'createPaymentIntent') { + try { + $json_str = file_get_contents('php://input'); + $json_obj = json_decode($json_str); + + // For Terminal payments, the 'payment_method_types' parameter must include + // 'card_present' and the 'capture_method' must be set to 'manual' + $object = new Facture($db); + $object->fetch($json_obj->invoiceid); + $object->fetch_thirdparty(); + + $fulltag='INV='.$object->id.'.CUS='.$object->thirdparty->id; + $tag=null; + $fulltag=dol_string_unaccent($fulltag); + + $stripe = new Stripe($db); + $customer = $stripe->customerStripe($object->thirdparty, $stripeacc, $servicestatus, 1); + + $intent = $stripe->getPaymentIntent($json_obj->amount, $object->multicurrency_code, null, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $customer, $stripeacc, $servicestatus, 1, 'terminal', false, null, 0, 1); + + echo json_encode(array('client_secret' => $intent->client_secret)); + } catch (Error $e) { + http_response_code(500); + echo json_encode(['error' => $e->getMessage()]); + } +} elseif ($action == 'capturePaymentIntent') { + try { + // retrieve JSON from POST body + $json_str = file_get_contents('php://input'); + $json_obj = json_decode($json_str); + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $intent = \Stripe\PaymentIntent::retrieve($json_obj->id); + } else { + $intent = \Stripe\PaymentIntent::retrieve($json_obj->id, array("stripe_account" => $stripeacc)); + } + $intent = $intent->capture(); + + echo json_encode($intent); + } catch (Error $e) { + http_response_code(500); + echo json_encode(['error' => $e->getMessage()]); + } +} diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 36e67d2827c..b14ed0e8ca6 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -290,6 +290,34 @@ class Stripe extends CommonObject return $stripepaymentmethod; } + /** + * Get the Stripe reader Object from its ID + * + * @param string $reader Reader ID + * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @return \Stripe\Terminal\Reader|null Stripe Reader or null if not found + */ + public function getSelectedReader($reader, $key = '', $status = 0) + { + $selectedreader = null; + + try { + // Force to use the correct API key + global $stripearrayofkeysbyenv; + \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); + if (empty($key)) { // If the Stripe connect account not set, we use common API usage + $selectedreader = \Stripe\Terminal\Reader::retrieve(''.$reader.''); + } else { + $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve(''.$reader.'', array("stripe_account" => $key)); + } + } catch (Exception $e) { + $this->error = $e->getMessage(); + } + + return $selectedreader; + } + /** * Get the Stripe payment intent. Create it with confirmnow=false * Warning. If a payment was tried and failed, a payment intent was created. @@ -350,7 +378,7 @@ class Stripe extends CommonObject $paymentintent = null; - if (is_object($object) && !empty($conf->global->STRIPE_REUSE_EXISTING_INTENT_IF_FOUND)) { + if (is_object($object) && !empty($conf->global->STRIPE_REUSE_EXISTING_INTENT_IF_FOUND) && empty($conf->global->STRIPE_CARD_PRESENT)) { // Warning. If a payment was tried and failed, a payment intent was created. // But if we change something on object to pay (amount or other that does not change the idempotency key), reusing same payment intent is not allowed by Stripe. // Recommended solution is to recreate a new payment intent each time we need one (old one will be automatically closed by Stripe after a delay), Stripe will @@ -424,6 +452,9 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_SOFORT)) { $paymentmethodtypes[] = "sofort"; } + if (!empty($conf->global->STRIPE_CARD_PRESENT) && $mode == 'terminal') { + $paymentmethodtypes = array("card_present"); + } $dataforintent = array( "confirm" => $confirmnow, // Do not confirm immediatly during creation of intent @@ -456,6 +487,11 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_KLARNA)) { unset($dataforintent['setup_future_usage']); } + if (!empty($conf->global->STRIPE_CARD_PRESENT) && $mode == 'terminal') { + unset($dataforintent['setup_future_usage']); + $dataforintent["capture_method"] = "manual"; + $dataforintent["confirmation_method"] = "manual"; + } if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; $description .= ' - '.$payment_method; @@ -607,6 +643,9 @@ class Stripe extends CommonObject if (!empty($conf->global->STRIPE_BANCONTACT)) { $paymentmethodtypes[] = "bancontact"; } + if (!empty($conf->global->STRIPE_KLARNA)) { + $paymentmethodtypes[] = "klarna"; + } if (!empty($conf->global->STRIPE_IDEAL)) { $paymentmethodtypes[] = "ideal"; } diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index f6562d81693..64ce74b6022 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -1,6 +1,7 @@ * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2021 Thibault FOUCART * * 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 @@ -28,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $terminal = GETPOST('terminal', 'int'); // If socid provided by ajax company selector @@ -73,6 +75,9 @@ if (GETPOST('action', 'alpha') == 'set') { $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); + if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$terminaltouse, GETPOST('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); + } if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); } @@ -174,6 +179,44 @@ if (!empty($conf->banque->enabled)) { $atleastonefound++; } print ''; + + if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { + print ''.$langs->trans("CashDeskBankAccountForStripeTerminal").''; // Force Stripe Terminal + print ''; + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + global $stripearrayofkeysbyenv; + $site_account = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + \Stripe\Stripe::setApiKey($site_account); + if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { + $service = 'StripeTest'; + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); + } else { + $service = 'StripeLive'; + $servicestatus = '1'; + } + $stripe = new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); + if ($stripeacc) { + $readers = \Stripe\Terminal\Reader::all('', array("location" => $conf->global->STRIPE_LOCATION, "stripe_account" => $stripeacc)); + } else { + $readers = \Stripe\Terminal\Reader::all('', array("location" => $conf->global->STRIPE_LOCATION)); + } + + $reader = array(); + $reader[""] = $langs->trans("NoReader"); + foreach ($readers as $readers) { + $reader[$reader->id] = $readers->label.' ('.$readers->status.')'; + } + print $form->selectarray('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, $reader, $conf->global->{'CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse}); + print ''; + } + if ($conf->global->TAKEPOS_ENABLE_SUMUP) { print ''.$langs->trans("CashDeskBankAccountForSumup").''; print ''; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 40d873654c6..cc1d335272d 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -1,5 +1,6 @@ + * Copyright (C) 2021 Thibault FOUCART * * 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 @@ -40,6 +41,7 @@ if (!defined('NOREQUIREHTML')) { require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $langs->loadLangs(array("main", "bills", "cashdesk", "banks")); @@ -51,11 +53,60 @@ if (empty($user->rights->takepos->run)) { accessforbidden(); } +if (!empty($conf->stripe->enabled)) { + $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; + $site_account = $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; + + $stripe = new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account (no remote access to Stripe here) + $stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus, $site_account); // Get remote Stripe customer 'cus_...' (no remote access to Stripe here) + $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"]; + ?> + + +stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning', 1); +} + $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); @@ -73,6 +124,57 @@ if ($invoiceid > 0) { } } +?> + +global->TAKEPOS_NUMPAD == 0) { }); } + function fetchPaymentIntentClientSecret(amount, invoiceid) { + const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid }); + + return fetch('', { + method: "POST", + headers: { + 'Content-Type': 'application/json' + }, + body: bodyContent + }) + .then(function(response) { + return response.json(); + }) + .then(function(data) { + return data.client_secret; + }); + } + + + function capturePaymentIntent(paymentIntentId) { + const bodyContent = JSON.stringify({"id": paymentIntentId}) + + return fetch('', { + method: "POST", + headers: { + 'Content-Type': 'application/json' + }, + body: bodyContent + }) + .then(function(response) { + return response.json(); + }) + .then(function(data) { + return data.client_secret; + }); + } + + + function ValidateStripeTerminal() { + console.log("Launch ValidateStripeTerminal"); + var invoiceid = 0 ? $invoiceid : 0); ?>; + var accountid = $("#selectaccountid").val(); + var amountpayed = $("#change1").val(); + var excess = $("#change2").val(); + if (amountpayed > getRemainToPay(); ?>) { + amountpayed = getRemainToPay(); ?>; + } + if (amountpayed == 0) { + amountpayed = getRemainToPay(); ?>; + } + + console.log("Pay with terminal ", amountpayed); + + fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(function(client_secret) { + global->STRIPE_TERMINAL_SIMULATED)) { ?> + terminal.setSimulatorConfiguration({testCardNumber: 'global->STRIPE_TERMINAL_SIMULATED; ?>'}); + + document.getElementById("card-present-alert").innerHTML = '
trans('PaymentSendToStripeTerminal'); ?>
'; + terminal.collectPaymentMethod(client_secret).then(function(result) { + if (result.error) { + // Placeholder for handling result.error + document.getElementById("card-present-alert").innerHTML = '
'+result.error.message+'
'; + } else { + document.getElementById("card-present-alert").innerHTML = '
trans('PaymentBeingProcessed'); ?>
'; + console.log('terminal.collectPaymentMethod', result.paymentIntent); + terminal.processPayment(result.paymentIntent).then(function(result) { + if (result.error) { + document.getElementById("card-present-alert").innerHTML = '
'+result.error.message+'
'; + console.log(result.error) + } else if (result.paymentIntent) { + paymentIntentId = result.paymentIntent.id; + console.log('terminal.processPayment', result.paymentIntent); + capturePaymentIntent(paymentIntentId).then(function(client_secret) { + if (result.error) { + // Placeholder for handling result.error + document.getElementById("card-present-alert").innerHTML = '
'+result.error.message+'
'; + console.log("error when capturing paymentIntent", result.error); + } else { + document.getElementById("card-present-alert").innerHTML = '
trans('PaymentValidated'); ?>
'; + console.log("Capture paymentIntent successfull "+paymentIntentId); + parent.$("#poslines").load("invoice.php?place=&action=valid&pay=CB&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { + if (amountpayed > || amountpayed == || amountpayed==0 ) { + console.log("Close popup"); + parent.$.colorbox.close(); + } + else { + console.log("Amount is not comple, so we do NOT close popup and reload it."); + location.reload(); + } + }); + + } + }); + } + }); + } + }); + }); + } + function ValidateSumup() { console.log("Launch ValidateSumup"); @@ -271,7 +479,7 @@ if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) { ?> -
+
trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?>
@@ -299,7 +507,6 @@ if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) { } ?>
-
global->TAKEPOS_NUMPAD; - +if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { + print ''; + dol_htmloutput_mesg($langs->trans('ConnectingToStripeTerminal', 'Stripe'), '', 'warning', 1); + print ''; +} print ''; print ''; print ''; @@ -424,8 +635,18 @@ while ($i < count($arrayOfValidPaymentModes)) { $i = $i + 1; } -$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]; +if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { + $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"]; + print ''; + if (!empty($conf->global->$keyforstripeterminalbank)) { + } else { + $langs->loadLangs(array("errors", "admin")); + //print ''; + } +} + if ($conf->global->TAKEPOS_ENABLE_SUMUP) { + $keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]; if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { From 627f3469336d636ea1f1a9d52c2a3231117c8463 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 12 Jun 2022 21:40:21 +0200 Subject: [PATCH 05/42] Update pay.php --- htdocs/takepos/pay.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index cc1d335272d..f4c1a0416b1 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -103,7 +103,7 @@ function fetchConnectionToken() { * View */ -if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { +if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning', 1); } @@ -524,7 +524,7 @@ $action_buttons = array( ), ); $numpad = $conf->global->TAKEPOS_NUMPAD; -if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { +if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) { print ''; dol_htmloutput_mesg($langs->trans('ConnectingToStripeTerminal', 'Stripe'), '', 'warning', 1); print ''; From 87f98b5bcbeea3778a45450dfe62293bef93f042 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 12 Jun 2022 21:44:17 +0200 Subject: [PATCH 06/42] Update pay.php --- htdocs/takepos/pay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index f4c1a0416b1..f487862e895 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -635,7 +635,7 @@ while ($i < count($arrayOfValidPaymentModes)) { $i = $i + 1; } -if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { +if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && !empty($conf->global->STRIPE_CARD_PRESENT)) { $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$_SESSION["takeposterminal"]; print ''; if (!empty($conf->global->$keyforstripeterminalbank)) { From 616e6f5a8f833a27c46f5667c85f2c989fa2ed60 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 12 Jun 2022 19:46:22 +0000 Subject: [PATCH 07/42] Fixing style errors. --- htdocs/stripe/ajax/ajax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/ajax/ajax.php b/htdocs/stripe/ajax/ajax.php index e50b426ee87..cf6ec53d580 100644 --- a/htdocs/stripe/ajax/ajax.php +++ b/htdocs/stripe/ajax/ajax.php @@ -92,13 +92,13 @@ if ($action == 'getConnexionToken') { $fulltag='INV='.$object->id.'.CUS='.$object->thirdparty->id; $tag=null; - $fulltag=dol_string_unaccent($fulltag); + $fulltag=dol_string_unaccent($fulltag); $stripe = new Stripe($db); $customer = $stripe->customerStripe($object->thirdparty, $stripeacc, $servicestatus, 1); $intent = $stripe->getPaymentIntent($json_obj->amount, $object->multicurrency_code, null, 'Stripe payment: '.$fulltag.(is_object($object)?' ref='.$object->ref:''), $object, $customer, $stripeacc, $servicestatus, 1, 'terminal', false, null, 0, 1); - + echo json_encode(array('client_secret' => $intent->client_secret)); } catch (Error $e) { http_response_code(500); From 950c0c2183963a32eba08f0ecd3094648fbbd57a Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 20 Jun 2022 09:15:19 +0200 Subject: [PATCH 08/42] Create llx_element_categorie.sql The goal of table llx_element_categorie is to replace all tables llx_categories_xxx (with one table). the llx_element_tag table initially intended for this does not have the correct nomenclature to express its real use (and was used for other things before) more informations here : https://github.com/Dolibarr/dolibarr/pull/21192 --- .../mysql/tables/llx_element_categorie.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_element_categorie.sql diff --git a/htdocs/install/mysql/tables/llx_element_categorie.sql b/htdocs/install/mysql/tables/llx_element_categorie.sql new file mode 100644 index 00000000000..a1c7fddb0eb --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_categorie.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2022 charlene Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +create table llx_element_categorie +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_categorie integer NOT NULL, + fk_element integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; From 8c0b1efce4e32715fa4b415acef39fa056644eab Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 21 Jun 2022 15:21:45 +0200 Subject: [PATCH 09/42] NEW add objectLink expedition --- htdocs/core/class/html.form.class.php | 3 ++- htdocs/expedition/card.php | 4 ++-- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f112b9aa98..072383f7ae9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8414,7 +8414,7 @@ class Form if (empty($conf->supplier_proposal->enabled)) { continue; // Do not show if module disabled } - } elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { + } elseif ($objecttype == 'shipping' || $objecttype == 'shipment' || $objecttype == 'expedition') { $tplpath = 'expedition'; if (empty($conf->expedition->enabled)) { continue; // Do not show if module disabled @@ -8533,6 +8533,7 @@ class Form $possiblelinks = array( 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), + 'shipping'=>array('enabled'=>$conf->expedition->enabled, 'perms'=>1, 'label'=>'LinkToExpedition', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f835e293f5f..09f28d456e6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2551,8 +2551,8 @@ if ($action == 'create') { // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); - $somethingshown = $form->showLinkedObjectBlock($object, ''); + $linktoelem = $form->showLinkToObjectBlock($object, null, array('shipping')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); print '
'; diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 26e4ebbb47d..e26f60486e5 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -60,8 +60,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'commande') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> - id.'&token='.newToken().'&action=dellink&dellinkid='.$key; ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2867c7b853b..503587aa8f0 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -799,6 +799,7 @@ URLPhoto=URL of photo/logo SetLinkToAnotherThirdParty=Link to another third party LinkTo=Link to LinkToProposal=Link to proposal +LinkToExpedition= Link to expedition LinkToOrder=Link to order LinkToInvoice=Link to invoice LinkToTemplateInvoice=Link to template invoice diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 12778f337dd..2c0a6cee908 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -799,6 +799,7 @@ URLPhoto=URL de la photo/logo SetLinkToAnotherThirdParty=Lier vers un autre tiers LinkTo=Lier à LinkToProposal=Lier à une proposition commerciale +LinkToExpedition=Lier à une expédition LinkToOrder=Lier à une commande LinkToInvoice=Lier à une facture LinkToTemplateInvoice=Lien vers le modèle de facture From 3eff91a6dc7cb259906cfd18d6dc59d6e5b1431f Mon Sep 17 00:00:00 2001 From: atm-steve Date: Wed, 22 Jun 2022 10:50:54 +0200 Subject: [PATCH 10/42] wip: popin with new fileds --- htdocs/contrat/card.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 87d6b98475b..df74c8dbf25 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1261,7 +1261,24 @@ if ($action == 'create') { // Confirmation de la fermeture $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1); } elseif ($action == 'activate') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", '', 0, 1); + //$sql = "SELECT date_ouverture, date_cloture, commentaire FROM " . MAIN_DB_PREFIX ."contratdet WHERE fk_contrat = " . $object->id; + ////$sql.= ""; +// + //$result = $db->query($sql); + //if ($result) { + // $objp = $db->fetch_object($result); + //} +// + //// Definie date debut et fin par defaut + //$dateactstart = $objp->date_ouverture; + //$dateactend = $objp->date_cloture; + //$comment = $objp->commentaire; + $formquestion = array( + array('type' => 'other', 'name' => 'active', 'label' => $langs->trans("DateServiceActivate"), 'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'), + array('type' => 'other', 'name' => 'active', 'label' => $langs->trans("DateEndPlanned"), 'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0), '', ''), + array('type' => 'text', 'comment' => 'active', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300') + ); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280); } elseif ($action == 'clone') { // Clone confirmation $formquestion = array(array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); From 3d7904c404f970a5523ee96d53d25d923ae18e62 Mon Sep 17 00:00:00 2001 From: atm-steve Date: Wed, 22 Jun 2022 12:05:39 +0200 Subject: [PATCH 11/42] feat: activate all services on contrat --- htdocs/contrat/card.php | 24 +++++++----------------- htdocs/contrat/class/contrat.class.php | 4 ++-- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index df74c8dbf25..0254efdbe95 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -785,8 +785,10 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) { - // Close all lines - $result = $object->activateAll($user); + $date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear')); + $date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear')); + $comment = GETPOST('comment', 'alpha'); + $result = $object->activateAll($user, $date_start, 0, $comment, $date_end); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -1261,22 +1263,10 @@ if ($action == 'create') { // Confirmation de la fermeture $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1); } elseif ($action == 'activate') { - //$sql = "SELECT date_ouverture, date_cloture, commentaire FROM " . MAIN_DB_PREFIX ."contratdet WHERE fk_contrat = " . $object->id; - ////$sql.= ""; -// - //$result = $db->query($sql); - //if ($result) { - // $objp = $db->fetch_object($result); - //} -// - //// Definie date debut et fin par defaut - //$dateactstart = $objp->date_ouverture; - //$dateactend = $objp->date_cloture; - //$comment = $objp->commentaire; $formquestion = array( - array('type' => 'other', 'name' => 'active', 'label' => $langs->trans("DateServiceActivate"), 'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'), - array('type' => 'other', 'name' => 'active', 'label' => $langs->trans("DateEndPlanned"), 'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0), '', ''), - array('type' => 'text', 'comment' => 'active', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300') + array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), /*'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0),*/ /*'socid', '(s.client=1 OR s.client=2 OR s.client=3)'*/), + array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''), + array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300') ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280); } elseif ($action == 'clone') { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4e4437c1b2c..87f728b18a4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -369,7 +369,7 @@ class Contrat extends CommonObject * @return int <0 if KO, >0 if OK * @see () */ - public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') + public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '', $date_end = '') { if (empty($date_start)) { $date_start = dol_now(); @@ -387,7 +387,7 @@ class Contrat extends CommonObject if ($contratline->statut != ContratLigne::STATUS_OPEN) { $contratline->context = $this->context; - $result = $contratline->active_line($user, $date_start, -1, $comment); // This call trigger LINECONTRACT_ACTIVATE + $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE if ($result < 0) { $error++; $this->error = $contratline->error; From a14b7009002dd65071adebd5c386838e17101eba Mon Sep 17 00:00:00 2001 From: bagtaib Date: Wed, 22 Jun 2022 15:09:23 +0200 Subject: [PATCH 12/42] New #19511 --- htdocs/core/lib/functions.lib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 13d44e1ec8a..c86cd4bd77b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3310,6 +3310,17 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli //ex: +61_A_BCDE_FGHI $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4); } + } elseif (strtoupper($countrycode) == "LU") { + // Luxembourg + if (dol_strlen($phone) == 10) {// fixe 6 chiffres +352_AA_BB_CC + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2); + } elseif (dol_strlen($phone) == 11) {// fixe 7 chiffres +352_AA_BB_CC_D + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 1); + } elseif (dol_strlen($phone) == 12) {// fixe 8 chiffres +352_AA_BB_CC_DD + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); + } elseif (dol_strlen($phone) == 13) {// mobile +352_AAA_BB_CC_DD + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); + } } if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone From e7858a97bf7c71cb3102b22c74de40a0535f4fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:46:32 +0200 Subject: [PATCH 13/42] Delete llx_element_tag.sql --- .../install/mysql/tables/llx_element_tag.sql | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 htdocs/install/mysql/tables/llx_element_tag.sql diff --git a/htdocs/install/mysql/tables/llx_element_tag.sql b/htdocs/install/mysql/tables/llx_element_tag.sql deleted file mode 100644 index d43ced98130..00000000000 --- a/htdocs/install/mysql/tables/llx_element_tag.sql +++ /dev/null @@ -1,25 +0,0 @@ --- ============================================================================ --- Copyright (C) 2021 Maxime Kohlhaas --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ============================================================================ - -create table llx_element_tag -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_categorie integer NOT NULL, - fk_element integer NOT NULL, - import_key varchar(14) -)ENGINE=innodb; From 7594c142360b82a4b483fe381653001bc54a3c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:46:57 +0200 Subject: [PATCH 14/42] Delete llx_element_tag.key.sql --- .../mysql/tables/llx_element_tag.key.sql | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 htdocs/install/mysql/tables/llx_element_tag.key.sql diff --git a/htdocs/install/mysql/tables/llx_element_tag.key.sql b/htdocs/install/mysql/tables/llx_element_tag.key.sql deleted file mode 100644 index d3a0b38afa9..00000000000 --- a/htdocs/install/mysql/tables/llx_element_tag.key.sql +++ /dev/null @@ -1,21 +0,0 @@ --- ============================================================================ --- Copyright (C) 2021 Maxime Kohlhaas --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ============================================================================ - -ALTER TABLE llx_element_tag ADD UNIQUE INDEX idx_element_tag_uk (fk_categorie, fk_element); - -ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); From 77552fa32ae0fa5e3882980f5712318a0c6835e3 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Jul 2022 10:17:56 +0200 Subject: [PATCH 15/42] FIX : We must remove empty values of $features array in fetchByProductCombination2ValuePairs() because some products can use only several attributes in their variations and not necessarily all. In this case, fetch doesn't work without my correction --- htdocs/variants/class/ProductCombination.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index ac9d5403671..c4c660e61d8 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,6 +602,8 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); + $features = array_filter($features); + foreach ($features as $attr => $attr_val) { $actual_comp[$attr] = $attr_val; } From f10788e4c6c50ee60f8722b4cb8d88720d34c121 Mon Sep 17 00:00:00 2001 From: jpb Date: Thu, 7 Jul 2022 10:24:39 +0200 Subject: [PATCH 16/42] fix export resource type filter --- htdocs/core/modules/modResource.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 0478cdff2a7..82ee03a4df7 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -238,20 +238,22 @@ class modResource extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("resource", "read")); - $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); - $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); - $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); + $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.rowid'=>'ResourceType', 'c.label'=>'ResourceTypeLabel', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); + $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text','r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.rowid'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); + $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.rowid'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); + $keyforselect = 'resource'; $keyforelement = 'resource'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.code = r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; $this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')'; + // Imports //-------- $r = 0; From 986c241ee11c942dbc252dedbd988c20e281e611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Fri, 8 Jul 2022 08:09:40 +0200 Subject: [PATCH 17/42] create llx_element_categorie.key.sql --- .../tables/llx_element_categorie.key.sql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_element_categorie.key.sql diff --git a/htdocs/install/mysql/tables/llx_element_categorie.key.sql b/htdocs/install/mysql/tables/llx_element_categorie.key.sql new file mode 100644 index 00000000000..0367eddc0a1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_element_categorie.key.sql @@ -0,0 +1,22 @@ +-- ============================================================================ +-- Copyright (C) 2022 Charlene Benke +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_element_categorie ADD UNIQUE INDEX idx_element_categorie_idx1 (fk_element, fk_categorie); + +ALTER TABLE llx_element_contact ADD CONSTRAINT fk_element_categorie_fk_categorie FOREIGN KEY (fk_categorie) REFERENCES llx_fk_categorie(rowid); From 787f52fd7f463cdcc7622ae7e8423974071f19e6 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 8 Jul 2022 09:32:20 +0200 Subject: [PATCH 18/42] FIX : with callback function --- htdocs/variants/class/ProductCombination.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index c4c660e61d8..7d90c1b247d 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,7 +602,9 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); - $features = array_filter($features); + $features = array_filter($features, function($v) { + return !empty($v); + }); foreach ($features as $attr => $attr_val) { $actual_comp[$attr] = $attr_val; From 04fd17347e78e480fc99cb1e2d8cc2d1fa326568 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 8 Jul 2022 07:36:09 +0000 Subject: [PATCH 19/42] Fixing style errors. --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 7d90c1b247d..472c474c81c 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -602,7 +602,7 @@ class ProductCombination $prodcomb2val = new ProductCombination2ValuePair($this->db); $prodcomb = new ProductCombination($this->db); - $features = array_filter($features, function($v) { + $features = array_filter($features, function ($v) { return !empty($v); }); From d375c9fbbe7fc44c07c5c6d31aa0ef57ddf91c3d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 8 Jul 2022 10:35:43 +0200 Subject: [PATCH 20/42] FIX : backport commit 5b3fcc5e43979b1b0789bf81fb8f1b2b59c93056, chkbxlst cannot be emptied --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6e4f6892e05..3d10525c568 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2072,7 +2072,7 @@ class ExtraFields if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) { continue; } - if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') { + if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) { //when unticking boolean field, it's not set in POST continue; } From 9db3c1bbd682670ea3e2543d5e78680f291e2e48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jul 2022 10:56:36 +0200 Subject: [PATCH 21/42] Fix currency missing --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6b11d31c2ff..d1ca876b7cc 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -960,7 +960,7 @@ class ProductFournisseur extends Product public function display_price_product_fournisseur($showunitprice = 1, $showsuptitle = 1, $maxlen = 0, $notooltip = 0, $productFournList = array()) { // phpcs:enable - global $langs; + global $conf, $langs; $out = ''; $langs->load("suppliers"); @@ -978,7 +978,7 @@ class ProductFournisseur extends Product } $out .= ''; } else { - $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").'   (' : ''); + $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").'   (' : ''); $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; $out .= ($showunitprice ? ')' : ''); } From 61f1595f8c8404634add718b000ae7576657e3cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Jul 2022 11:21:54 +0200 Subject: [PATCH 22/42] Fix look and feel v15 --- htdocs/core/lib/functions.lib.php | 5 ++++- htdocs/product/price.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ffc88c157ff..8bc9a453ab2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5187,9 +5187,10 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be * @param boolean $addpercent Add a percent % sign in output * @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat) * @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates + * @param int $html Used for html output * @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)') */ -function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0) +function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, $html = 0) { $morelabel = ''; @@ -5197,9 +5198,11 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0) $rate = str_replace('%', '', $rate); $addpercent = true; } + $reg = array(); if (preg_match('/\((.*)\)/', $rate, $reg)) { $morelabel = ' ('.$reg[1].')'; $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate); + $morelabel = ' '.($html ? '' : '').'('.$reg[1].')'.($html ? '' : ''); } if (preg_match('/\*/', $rate)) { $rate = str_replace('*', '', $rate); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index ab3086bfd0b..e83816b84ce 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1177,7 +1177,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ if (empty($positiverates)) { $positiverates = '0'; } - echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr); + echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr, 0, 1); /* if ($object->default_vat_code) { From 226488b7edeb0f89f1740537b1b9dd1dd0837951 Mon Sep 17 00:00:00 2001 From: jpb Date: Fri, 8 Jul 2022 12:32:17 +0200 Subject: [PATCH 23/42] rank change. if we only have one order we leave the origin rank otherwhise we pass -1 --- htdocs/core/actions_massactions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 70b79ffbefc..56492276c73 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - + $nbOrders = is_array($orders) ? count($orders) : 1; foreach ($orders as $id_order) { $cmd = new Commande($db); @@ -726,7 +726,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } - + $rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang; $result = $objecttmp->addline( $desc, $lines[$i]->subprice, @@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders 'HT', 0, $product_type, - $lines[$i]->rang, + $rankedLine, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, From 56ea6989cf8a67557d4abaa551f66fcb5b65eaf3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:30:31 +0200 Subject: [PATCH 24/42] check batch on receptions->addline when module is enabled --- htdocs/reception/class/reception.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0be0ea7ba37..9f8fb616582 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -752,6 +752,23 @@ class Reception extends CommonObject } } + // Check batch is set + $product = new Product($this->db); + $product->fetch($fk_product); + if (!empty($conf->productbatch->enabled)) { + $langs->load("errors"); + if (!empty($product->status_batch) && empty($batch)) { + $this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref); + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } elseif (empty($product->status_batch) && !empty($batch)) { + $this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref); + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } + } + unset ($product); + // extrafields $line->array_options = $supplierorderline->array_options; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { From f042a62a1c8e3604f87ce82c72d668d00dbf135c Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:47:13 +0200 Subject: [PATCH 25/42] remove overkill setEventMessage() --- htdocs/reception/class/reception.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 9f8fb616582..3cf5220edbb 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -759,11 +759,9 @@ class Reception extends CommonObject $langs->load("errors"); if (!empty($product->status_batch) && empty($batch)) { $this->error = $langs->trans('ErrorProductNeedBatchNumber', $product->ref); - setEventMessages($this->error, $this->errors, 'errors'); return -1; } elseif (empty($product->status_batch) && !empty($batch)) { $this->error = $langs->trans('ErrorProductDoesNotNeedBatchNumber', $product->ref); - setEventMessages($this->error, $this->errors, 'errors'); return -1; } } From c0d3aaf445763473bbc002143f177fc16127f506 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 8 Jul 2022 15:53:41 +0200 Subject: [PATCH 26/42] stickler fix --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 3cf5220edbb..53acd077d2b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -765,7 +765,7 @@ class Reception extends CommonObject return -1; } } - unset ($product); + unset($product); // extrafields $line->array_options = $supplierorderline->array_options; From 56c4817d6decea4c69c16adfa438cf72e51adb16 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 8 Jul 2022 17:30:15 +0200 Subject: [PATCH 27/42] fix: Bad amount calc on Invoice index --- htdocs/core/lib/invoice.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index c64c63fc0dd..552658f091d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -1165,6 +1165,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $i++; $total += $obj->total_ht; $total_ttc += $obj->total_ttc; + $totalam += $obj->am; continue; } From 1c61dda0ddd000d34fdc363a1a54f0c87120d228 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 10 Jul 2022 10:11:23 +0200 Subject: [PATCH 28/42] Update stripe.php --- htdocs/stripe/admin/stripe.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 8240b21ff75..bd86b31e0f2 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018-2021 Thibault FOUCART + * Copyright (C) 2018-2022 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -104,10 +104,12 @@ if ($action == 'setvalue' && $user->admin) { if (!$result > 0) { $error++; } + if (GETPOSTISSET('STRIPE_LOCATION')) { $result = dolibarr_set_const($db, "STRIPE_LOCATION", GETPOST('STRIPE_LOCATION', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) { $error++; } + } $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) { $error++; From 445add32e30a296ecb3e2e1917a7e2fd38c3c8e9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 10 Jul 2022 08:16:04 +0000 Subject: [PATCH 29/42] Fixing style errors. --- htdocs/stripe/admin/stripe.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index bd86b31e0f2..0206de8cb43 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -105,10 +105,10 @@ if ($action == 'setvalue' && $user->admin) { $error++; } if (GETPOSTISSET('STRIPE_LOCATION')) { - $result = dolibarr_set_const($db, "STRIPE_LOCATION", GETPOST('STRIPE_LOCATION', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!$result > 0) { - $error++; - } + $result = dolibarr_set_const($db, "STRIPE_LOCATION", GETPOST('STRIPE_LOCATION', 'alpha'), 'chaine', 0, '', $conf->entity); + if (!$result > 0) { + $error++; + } } $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) { From 6362cdfe2efd64660ebad1fb513ce678632d8d31 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 10 Jul 2022 13:00:34 +0200 Subject: [PATCH 30/42] FIX regression by php8 fix on setVarsFromFetchObj --- 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 9cfe5b47de5..c432fbd8b60 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8891,7 +8891,7 @@ abstract class CommonObject } } } else { - $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null; + $this->{$field} = isset($obj->{$field}) ? $obj->{$field} : null; } } From 384652086281bff0512e200bdf3cc334d6561d41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 14:55:36 +0200 Subject: [PATCH 31/42] Trans --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 6de4824ecea..9350efef602 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -40,6 +40,7 @@ Language_es_AR=Spanish (Argentina) Language_es_BO=Spanish (Bolivia) Language_es_CL=Spanish (Chile) Language_es_CO=Spanish (Colombia) +Language_es_CR=Spanish (Costa Rica) Language_es_DO=Spanish (Dominican Republic) Language_es_EC=Spanish (Ecuador) Language_es_GT=Spanish (Guatemala) From 09932000dd06c5b6b4aae370c4a2ed02f2aa72f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:06:41 +0200 Subject: [PATCH 32/42] FIX online signature works partially on ODT templates. --- htdocs/core/ajax/onlineSign.php | 48 ++++++++++++------- htdocs/core/class/commonobject.class.php | 7 ++- .../doc/doc_generic_proposal_odt.modules.php | 1 + .../core/modules/propale/modules_propale.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 2 +- 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 994ba5c42f3..5f3cc281f90 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -69,10 +69,10 @@ $type = $mode; // Check securitykey $securekeyseed = ''; if ($type == 'proposal') { - $securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN; + $securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : ''; } -if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { http_response_code(403); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); exit(-1); @@ -122,28 +122,40 @@ if ($action == "importSignature") { } if (!$error) { - $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + // Defined modele of doc + $directdownloadlink = $object->getLastMainDocLink('proposal'); - $pdf = pdf_getInstance(); - $pdf->Open(); - $pdf->AddPage(); - $pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF + if (preg_match('/\.pdf/i', $directdownloadlink)) { + $newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf"; + $sourcefile = $upload_dir.$ref.".pdf"; - for ($i=1;$i<($pagecount+1);$i++) { - if ($i>1) $pdf->AddPage(); - $tppl=$pdf->importPage($i); - $pdf->useTemplate($tppl); + if (dol_is_file($sourcefile)) { + $pdf = pdf_getInstance(); + $pdf->Open(); + $pdf->AddPage(); + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF + + for ($i=1; $i<($pagecount+1); $i++) { + if ($i>1) $pdf->AddPage(); + $tppl=$pdf->importPage($i); + $pdf->useTemplate($tppl); + } + + $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. + $pdf->Close(); + $pdf->Output($newpdffilename, "F"); + + // Index the new file and update the last_main_doc property of object. + $object->indexFile($newpdffilename, 1); + } + } else { + // Adding signature on doc not yet supported } + } - $pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset. - $pdf->Close(); - $pdf->Output($newpdffilename, "F"); - + if (!$error) { $db->begin(); - // Index the new file and update the last_main_doc property of object. - $object->indexFile($newpdffilename, 1); - $online_sign_ip = getUserRemoteIP(); $online_sign_name = ''; // TODO Ask name on form to sign diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9cfe5b47de5..62782d28a96 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -602,6 +602,8 @@ abstract class CommonObject // No constructor as it is an abstract class + + /** * Check an object id/ref exists * If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch @@ -648,6 +650,7 @@ abstract class CommonObject return -1; } + /** * Method to output saved errors * @@ -5530,7 +5533,9 @@ abstract class CommonObject * Index a file into the ECM database * * @param string $destfull Full path of file to index - * @param int $update_main_doc_field Update field main_doc file into table of object + * @param int $update_main_doc_field Update field main_doc fied into the table of object. + * This param is set when called for a document generation if document generator hase + * ->update_main_doc_field set and returns ->result['fullpath']. * @return int <0 if KO, >0 if OK */ public function indexFile($destfull, $update_main_doc_field) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 6f91d676949..7f2e0733e9d 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -71,6 +71,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $this->db = $db; $this->name = "ODT templates"; $this->description = $langs->trans("DocumentModelOdt"); + $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template $this->scandir = 'PROPALE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan // Page size for A4 format diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index ee7df804c59..dcb386947a3 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -67,7 +67,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator /** - * Classe mere des modeles de numerotation des references de propales + * Parent class for numbering rules of proposals */ abstract class ModeleNumRefPropales { diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index d1020dc2c1d..5e920444c35 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -328,7 +328,7 @@ if ($source == 'proposal') { // Object $text = ''.$langs->trans("SignatureProposalRef", $proposal->ref).''; - print ''.$langs->trans("Designation"); + print ''.$langs->trans("Designation"); print ''.$text; if ($proposal->status == $proposal::STATUS_VALIDATED) { $directdownloadlink = $proposal->getLastMainDocLink('proposal'); From cccb453a053ca763ce73affa6977cdbcb057696a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:35:23 +0200 Subject: [PATCH 33/42] Fix doc --- htdocs/expedition/class/expedition.class.php | 1 + htdocs/fourn/class/fournisseur.commande.dispatch.class.php | 3 +++ htdocs/reception/class/reception.class.php | 1 + 3 files changed, 5 insertions(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2de87f93666..22d1d0c7b19 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -898,6 +898,7 @@ class Expedition extends CommonObject * Add an expedition line. * If STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS is set, you can add a shipment line, with no stock source defined * If STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT is not set, you can add a shipment line, even if not enough into stock + * Note: For product that need a batch number, you must use addline_batch() * * @param int $entrepot_id Id of warehouse * @param int $id Id of source line (order line) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 27c991e5896..dfb1e371636 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -79,6 +79,9 @@ class CommandeFournisseurDispatch extends CommonObjectLine */ public $fk_commandefourndet; + public $fk_reception; + + public $qty; public $qty_asked; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 1a7a079cd31..7244fdcb60b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -879,6 +879,7 @@ class Reception extends CommonObject $line->status = 1; $line->cost_price = $cost_price; $line->fk_reception = $this->id; + $this->lines[$num] = $line; return $num; From c16cd502d00b561950525206c255af6a2afe19c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 18:43:25 +0200 Subject: [PATCH 34/42] Update actions_massactions.inc.php --- htdocs/core/actions_massactions.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 56492276c73..811e9b80d44 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -604,7 +604,9 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $nb_bills_created = 0; $db->begin(); - $nbOrders = is_array($orders) ? count($orders) : 1; + + $nbOrders = is_array($orders) ? count($orders) : 1; + foreach ($orders as $id_order) { $cmd = new Commande($db); From c71616f45dec608fb7cd73bc9917f498bd7a41e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 19:13:09 +0200 Subject: [PATCH 35/42] css --- htdocs/admin/tools/dolibarr_export.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 7d02aea0e73..56b975f0202 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -172,7 +172,7 @@ print ''; print ''; -print ''; +print ''; print '
'; print '
'.$langs->trans("ExportMethod").''; @@ -195,7 +195,7 @@ print '
'; print '
'; print ''; -print ''; +print ''; print '
'; From 5de434eb3721e833065001306fbf76ec3a15d65a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 19:14:33 +0200 Subject: [PATCH 36/42] css --- htdocs/admin/system/perf.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 0bdb442863d..f43bc3bf49a 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -51,6 +51,9 @@ print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup'); print ''.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
'; +print '
'; +print '
'; + // Recupere la version de PHP $phpversion = version_php(); print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n"; From e9b3d436ca6635c13bdad0a6b3e3c4f3b6220d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 19:47:36 +0200 Subject: [PATCH 37/42] css --- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 20 ++++++++++---------- htdocs/stripe/admin/stripe.php | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 001ada1de0f..e355f9654a3 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -43,10 +43,10 @@ if (!empty($conf->commande->enabled)) { print ''; print ''; if (GETPOST('generate_order_ref', 'alpha')) { - print '
-> '; $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); + print ''."\n"; } print ''; } @@ -65,10 +65,10 @@ if (isModEnabled('facture')) { print ''; print ''; if (GETPOST('generate_invoice_ref', 'alpha')) { - print '
-> '; $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); + print ''."\n"; } print ''; } @@ -87,10 +87,10 @@ if (!empty($conf->contrat->enabled)) { print ''; print ''; if (GETPOST('generate_contract_ref')) { - print '
-> '; $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); + print ''."\n"; } print ''; } @@ -109,10 +109,10 @@ if (!empty($conf->adherent->enabled)) { print ''; print ''; if (GETPOST('generate_member_ref')) { - print '
-> '; $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); + print ''."\n"; } print ''; } @@ -131,10 +131,10 @@ if (!empty($conf->don->enabled)) { print ''; print ''; if (GETPOST('generate_donation_ref')) { - print '
-> '; + print ''."\n"; } print ''; } diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 0206de8cb43..d61d03b2be6 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -293,7 +293,7 @@ if (empty($conf->stripeconnect->enabled)) { print '
'; } print ''; - $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; + $out = img_picto('', 'globe', 'class="pictofixedwidth"').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php', 3); $out .= ''; $out .= ajax_autoselect("onlinelivewebhookurl", 0); @@ -353,19 +353,19 @@ print ''; print ''; print $langs->trans("StripeUserAccountForActions").''; -print img_picto('', 'user').$form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); +print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); print ''; print ''; print $langs->trans("BankAccount").''; -print img_picto('', 'bank_account').' '; +print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); print ''; if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // What is this for ? print ''; print $langs->trans("BankAccountForBankTransfer").''; - print img_picto('', 'bank_account').' '; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1); print ''; } From 6b07daf40fb60549e94d56b754e3e39adca29def Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 10 Jul 2022 20:12:35 +0200 Subject: [PATCH 38/42] Fix missing migration --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 2 ++ .../mysql/tables/llx_commande_fournisseur_dispatch.sql | 4 ++++ 2 files changed, 6 insertions(+) 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 451184f4d08..9c32e191198 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 @@ -43,6 +43,8 @@ ALTER TABLE llx_c_email_templates ADD COLUMN email_to varchar(255); ALTER TABLE llx_c_email_templates ADD COLUMN email_tocc varchar(255); ALTER TABLE llx_c_email_templates ADD COLUMN email_tobcc varchar(255); +ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; + -- v17 diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 974e10c09ff..058a74eea19 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -17,6 +17,10 @@ -- This table is just an history table to track all receiving done for a -- particular supplier order. A movement with same information is also done -- into stock_movement so this table may be useless. +-- +-- Detail of each lines of a reception (qty, batch and into wich warehouse is +-- received a purchase order line). +-- This table should be also name llx_receptiondet. -- =================================================================== create table llx_commande_fournisseur_dispatch From 638643226324ba63fe0d6a4960e99703a60dd3ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jul 2022 00:01:33 +0200 Subject: [PATCH 39/42] Fix missing migration --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index c090c55dee7..8e2b004efda 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -662,3 +662,4 @@ DELETE FROM llx_cronjob WHERE label = 'PurgeDeleteTemporaryFilesShort' AND param ALTER TABLE llx_cronjob DROP INDEX uk_cronjob; ALTER TABLE llx_cronjob ADD UNIQUE INDEX uk_cronjob (label, entity); +ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; From e0b664066be76dc5bd8f236faf083bec276fd8b1 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 7 Jul 2022 16:24:59 +0200 Subject: [PATCH 40/42] default to create on card.php if $action is empty --- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/fiscalyear_card.php | 2 +- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/adherents/card.php | 2 +- htdocs/admin/emailcollector_card.php | 2 +- htdocs/asset/card.php | 2 +- htdocs/asset/model/card.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/bookmarks/card.php | 2 +- htdocs/comm/action/card.php | 2 +- htdocs/comm/mailing/card.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/compta/bank/card.php | 2 +- htdocs/compta/bank/various_payment/card.php | 2 +- htdocs/compta/deplacement/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/compta/localtax/card.php | 2 +- htdocs/compta/sociales/card.php | 2 +- htdocs/compta/tva/card.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/cron/card.php | 2 +- htdocs/delivery/card.php | 2 +- htdocs/don/card.php | 2 +- htdocs/ecm/dir_add_card.php | 2 +- htdocs/eventorganization/conferenceorbooth_card.php | 4 ++-- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/expensereport/card.php | 2 +- htdocs/fichinter/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/hrm/establishment/card.php | 2 +- htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/job_card.php | 2 +- htdocs/hrm/skill_card.php | 2 +- htdocs/intracommreport/card.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +- htdocs/loan/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/partnership/partnership_card.php | 2 +- htdocs/product/inventory/card.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/product/stock/productlot_card.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_card.php | 2 +- htdocs/reception/card.php | 2 +- htdocs/recruitment/recruitmentcandidature_card.php | 2 +- htdocs/recruitment/recruitmentjobposition_card.php | 2 +- htdocs/resource/card.php | 2 +- htdocs/salaries/card.php | 2 +- htdocs/societe/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/notify/card.php | 2 +- htdocs/variants/card.php | 2 +- htdocs/webhook/target_card.php | 2 +- htdocs/website/websiteaccount_card.php | 2 +- htdocs/workstation/workstation_card.php | 2 +- 59 files changed, 60 insertions(+), 60 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..15428e356c8 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -220,7 +220,7 @@ llxheader('', $title, $help_url); // Create mode -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans('NewAccountingAccount')); print '
'."\n"; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 2aa33f21645..96f9d988ebb 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -154,7 +154,7 @@ $help_url = "EN:Module_Double_Entry_Accounting"; llxHeader('', $title, $help_url); -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewFiscalYear")); print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7c8c0dca547..5f4ebcc22fc 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -340,7 +340,7 @@ if ($action == 'delete') { print $formconfirm; } -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("CreateMvts")); $object = new BookKeeping($db); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0096ba9a285..4731414f285 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -920,7 +920,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // Create mode - if ($action == 'create') { + if ($action == 'create' || (empty($action) && empty($id))) { $object->canvas = $canvas; $object->state_id = GETPOST('state_id', 'int'); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index ab4f0c7def0..9f0986ad8f2 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -253,7 +253,7 @@ $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électro llxHeader('', 'EmailCollector', $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector"))); print ''; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index d94ba613d91..be635bb17f6 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -166,7 +166,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Asset")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php index 3d3ec2f67d2..c1b5187cd3c 100644 --- a/htdocs/asset/model/card.php +++ b/htdocs/asset/model/card.php @@ -138,7 +138,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ee619a589e3..bc1bb0c5b11 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -268,7 +268,7 @@ $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); print ''; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index bbc92a83ef1..5f2e9ab5b81 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -144,7 +144,7 @@ $h++; $hselected = 'card'; -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { /* * Fact bookmark creation mode */ diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 351ab9212bc..5cc9d1b2217 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -923,7 +923,7 @@ $arrayrecurrulefreq = array( $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('', $langs->trans("Agenda"), $help_url); -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $contact = new Contact($db); $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d46a02132a1..5e495d4c530 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -704,7 +704,7 @@ llxHeader( array() ); -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { // EMailing in creation mode print ''."\n"; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b8b46a0c8d9..defe7fc88fd 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1533,7 +1533,7 @@ llxHeader('', $title, $help_url); $now = dol_now(); // Add new proposal -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $currency_code = $conf->currency; print load_fiche_titre($langs->trans("NewProp"), '', 'propal'); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 29341b0fb99..1f01336be06 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -341,7 +341,7 @@ llxHeader("", $title, $help_url); // Creation -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $object = new Account($db); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account'); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 95d5ffa0e9e..e4e47253efe 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -335,7 +335,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { } // Create mode -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { // Update fields properties in realtime if (!empty($conf->use_javascript_ajax)) { print "\n".''; // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewEval"), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index a9ec4f77121..c90ff0ce9dd 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -180,7 +180,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentities('Job')), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 3a27d5898c0..795d7fab65f 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -187,7 +187,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewSkill"), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 681320e0d75..938b99adf4c 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -156,7 +156,7 @@ if ($action == 'add' && $permissiontoadd) { */ // Creation mode -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $title = $langs->trans("IntracommReportTitle"); llxHeader("", $title); print load_fiche_titre($langs->trans("IntracommReportTitle")); diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index baddd9e29a5..74bd23608d0 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -169,7 +169,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewKnowledgeRecord"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 3ad898cda98..047a64780b2 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -254,7 +254,7 @@ llxHeader("", $title, $help_url); // Create mode -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index b7a051c1bd9..0d398fdcf53 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -242,7 +242,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { if (empty($permissiontoadd)) { accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); exit; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 2c333ff616e..178b51ec2bd 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -241,7 +241,7 @@ llxHeader('', $title, ''); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { if (GETPOST('fk_bom', 'int') > 0) { $titlelist = $langs->trans("ToConsume"); if ($objectbom->bomtype == 1) { diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 08164421f60..82d9aa4d56e 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -259,7 +259,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 0a21f9939ee..daf9d386db7 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -181,7 +181,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewInventory"), '', 'product'); print ''; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 3ef85adeb84..c5910b5e563 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -285,7 +285,7 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("WarehouseCard"), $help_url); -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewWarehouse"), '', 'stock'); dol_set_focus('input[name="libelle"]'); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 6e6f8991e83..8b2c0720c47 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -378,7 +378,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("Batch"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index b009ace7275..cf8f9fdf572 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -413,7 +413,7 @@ print '}); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("StockTransfer")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index ed4586a7376..c8feafb146d 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -728,7 +728,7 @@ if ($action == 'create2') { } // Mode creation. -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $recept = new Reception($db); print load_fiche_titre($langs->trans("CreateReception")); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 0da5badd7bc..076778fd56f 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -283,7 +283,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index b2172aca80d..f1567ae0ae4 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -202,7 +202,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewPositionToBeFilled"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 4ffbe1eb0a7..40ba3e8b4dc 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -197,7 +197,7 @@ $form = new Form($db); $formresource = new FormResource($db); if ($action == 'create' || $object->fetch($id, $ref) > 0) { - if ($action == 'create') { + if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($title, '', 'object_resource'); print dol_get_fiche_head(''); } else { diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 7d57575dacd..86711022c1e 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -457,7 +457,7 @@ if ($id > 0) { } // Create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $year_current = strftime("%Y", dol_now()); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8e347a6d487..42b6e514e63 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -979,7 +979,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used in standard mode // ----------------------------------------- - if ($action == 'create') { + if ($action == 'create' || (empty($action) && empty($id))) { /* * Creation */ diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 9e92a5fb4b6..b1e4c2e8c5d 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1138,7 +1138,7 @@ if (!empty($conf->project->enabled)) { $now = dol_now(); // Add new askprice -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { $currency_code = $conf->currency; print load_fiche_titre($langs->trans("NewAskPrice"), '', 'supplier_proposal'); diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1acfa858663..1e6776f7118 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -254,7 +254,7 @@ $fuserstatic = new User($db); $form = new Form($db); $formfile = new FormFile($db); -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group'); dol_set_focus('#nom'); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 3337d846f0b..56c6d2d01f7 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -272,7 +272,7 @@ if ($result > 0) { print ''; - if ($action == 'create') { + if ($action == 'create' || (empty($action) && empty($id))) { // $listofemails=$object->thirdparty_and_contact_email_array(); if ($object->email) { $actions = array(); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 68bb8d60998..470e3fd96f8 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -158,7 +158,7 @@ $help_url = 'EN:Module_Products#Variants'; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ProductAttribute")), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index dd0d5e171e8..3ffd381f3aa 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -240,7 +240,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { if (empty($permissiontoadd)) { accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); exit; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 249398c322e..7a075eb8734 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -118,7 +118,7 @@ $formfile = new FormFile($db); llxHeader('', 'WebsiteAccount', ''); // Part to create -if ($action == 'create') { +if ($action == 'create' || (empty($action) && empty($id))) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("WebsiteAccount"))); print ''; diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 9e859dcc2d0..a2409802024 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -186,7 +186,7 @@ llxHeader('', $title, $help_url); trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto); print ''; From 24dc93600088faf89709dde56ca5a8a1e82f7c90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jul 2022 00:05:50 +0200 Subject: [PATCH 41/42] Revert "default to create on card.php if $action is empty" This reverts commit e0b664066be76dc5bd8f236faf083bec276fd8b1. --- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/fiscalyear_card.php | 2 +- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/adherents/card.php | 2 +- htdocs/admin/emailcollector_card.php | 2 +- htdocs/asset/card.php | 2 +- htdocs/asset/model/card.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/bookmarks/card.php | 2 +- htdocs/comm/action/card.php | 2 +- htdocs/comm/mailing/card.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/compta/bank/card.php | 2 +- htdocs/compta/bank/various_payment/card.php | 2 +- htdocs/compta/deplacement/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/compta/localtax/card.php | 2 +- htdocs/compta/sociales/card.php | 2 +- htdocs/compta/tva/card.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/cron/card.php | 2 +- htdocs/delivery/card.php | 2 +- htdocs/don/card.php | 2 +- htdocs/ecm/dir_add_card.php | 2 +- htdocs/eventorganization/conferenceorbooth_card.php | 4 ++-- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/expensereport/card.php | 2 +- htdocs/fichinter/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/hrm/establishment/card.php | 2 +- htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/job_card.php | 2 +- htdocs/hrm/skill_card.php | 2 +- htdocs/intracommreport/card.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +- htdocs/loan/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/partnership/partnership_card.php | 2 +- htdocs/product/inventory/card.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/product/stock/productlot_card.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_card.php | 2 +- htdocs/reception/card.php | 2 +- htdocs/recruitment/recruitmentcandidature_card.php | 2 +- htdocs/recruitment/recruitmentjobposition_card.php | 2 +- htdocs/resource/card.php | 2 +- htdocs/salaries/card.php | 2 +- htdocs/societe/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- htdocs/user/group/card.php | 2 +- htdocs/user/notify/card.php | 2 +- htdocs/variants/card.php | 2 +- htdocs/webhook/target_card.php | 2 +- htdocs/website/websiteaccount_card.php | 2 +- htdocs/workstation/workstation_card.php | 2 +- 59 files changed, 60 insertions(+), 60 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 15428e356c8..02b95cfd043 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -220,7 +220,7 @@ llxheader('', $title, $help_url); // Create mode -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans('NewAccountingAccount')); print ''."\n"; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 96f9d988ebb..2aa33f21645 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -154,7 +154,7 @@ $help_url = "EN:Module_Double_Entry_Accounting"; llxHeader('', $title, $help_url); -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewFiscalYear")); print ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5f4ebcc22fc..7c8c0dca547 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -340,7 +340,7 @@ if ($action == 'delete') { print $formconfirm; } -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); $object = new BookKeeping($db); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4731414f285..0096ba9a285 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -920,7 +920,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // Create mode - if ($action == 'create' || (empty($action) && empty($id))) { + if ($action == 'create') { $object->canvas = $canvas; $object->state_id = GETPOST('state_id', 'int'); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 9f0986ad8f2..ab4f0c7def0 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -253,7 +253,7 @@ $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électro llxHeader('', 'EmailCollector', $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector"))); print ''; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index be635bb17f6..d94ba613d91 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -166,7 +166,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Asset")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php index c1b5187cd3c..3d3ec2f67d2 100644 --- a/htdocs/asset/model/card.php +++ b/htdocs/asset/model/card.php @@ -138,7 +138,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index bc1bb0c5b11..ee619a589e3 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -268,7 +268,7 @@ $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); print ''; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 5f2e9ab5b81..bbc92a83ef1 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -144,7 +144,7 @@ $h++; $hselected = 'card'; -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { /* * Fact bookmark creation mode */ diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5cc9d1b2217..351ab9212bc 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -923,7 +923,7 @@ $arrayrecurrulefreq = array( $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('', $langs->trans("Agenda"), $help_url); -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $contact = new Contact($db); $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 5e495d4c530..d46a02132a1 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -704,7 +704,7 @@ llxHeader( array() ); -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { // EMailing in creation mode print ''."\n"; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index defe7fc88fd..b8b46a0c8d9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1533,7 +1533,7 @@ llxHeader('', $title, $help_url); $now = dol_now(); // Add new proposal -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $currency_code = $conf->currency; print load_fiche_titre($langs->trans("NewProp"), '', 'propal'); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 1f01336be06..29341b0fb99 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -341,7 +341,7 @@ llxHeader("", $title, $help_url); // Creation -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $object = new Account($db); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account'); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index e4e47253efe..95d5ffa0e9e 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -335,7 +335,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { } // Create mode -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { // Update fields properties in realtime if (!empty($conf->use_javascript_ajax)) { print "\n".''; // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewEval"), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php index c90ff0ce9dd..a9ec4f77121 100644 --- a/htdocs/hrm/job_card.php +++ b/htdocs/hrm/job_card.php @@ -180,7 +180,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentities('Job')), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 795d7fab65f..3a27d5898c0 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -187,7 +187,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewSkill"), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 938b99adf4c..681320e0d75 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -156,7 +156,7 @@ if ($action == 'add' && $permissiontoadd) { */ // Creation mode -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $title = $langs->trans("IntracommReportTitle"); llxHeader("", $title); print load_fiche_titre($langs->trans("IntracommReportTitle")); diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 74bd23608d0..baddd9e29a5 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -169,7 +169,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewKnowledgeRecord"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 047a64780b2..3ad898cda98 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -254,7 +254,7 @@ llxHeader("", $title, $help_url); // Create mode -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 0d398fdcf53..b7a051c1bd9 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -242,7 +242,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { if (empty($permissiontoadd)) { accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); exit; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 178b51ec2bd..2c333ff616e 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -241,7 +241,7 @@ llxHeader('', $title, ''); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { if (GETPOST('fk_bom', 'int') > 0) { $titlelist = $langs->trans("ToConsume"); if ($objectbom->bomtype == 1) { diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 82d9aa4d56e..08164421f60 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -259,7 +259,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index daf9d386db7..0a21f9939ee 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -181,7 +181,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewInventory"), '', 'product'); print ''; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index c5910b5e563..3ef85adeb84 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -285,7 +285,7 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("WarehouseCard"), $help_url); -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewWarehouse"), '', 'stock'); dol_set_focus('input[name="libelle"]'); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 8b2c0720c47..6e6f8991e83 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -378,7 +378,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("Batch"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index cf8f9fdf572..b009ace7275 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -413,7 +413,7 @@ print '}); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("StockTransfer")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index c8feafb146d..ed4586a7376 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -728,7 +728,7 @@ if ($action == 'create2') { } // Mode creation. -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $recept = new Reception($db); print load_fiche_titre($langs->trans("CreateReception")); diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 076778fd56f..0da5badd7bc 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -283,7 +283,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index f1567ae0ae4..b2172aca80d 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -202,7 +202,7 @@ $help_url = ''; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewPositionToBeFilled"), '', 'object_'.$object->picto); print ''; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 40ba3e8b4dc..4ffbe1eb0a7 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -197,7 +197,7 @@ $form = new Form($db); $formresource = new FormResource($db); if ($action == 'create' || $object->fetch($id, $ref) > 0) { - if ($action == 'create' || (empty($action) && empty($id))) { + if ($action == 'create') { print load_fiche_titre($title, '', 'object_resource'); print dol_get_fiche_head(''); } else { diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 86711022c1e..7d57575dacd 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -457,7 +457,7 @@ if ($id > 0) { } // Create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $year_current = strftime("%Y", dol_now()); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 42b6e514e63..8e347a6d487 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -979,7 +979,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used in standard mode // ----------------------------------------- - if ($action == 'create' || (empty($action) && empty($id))) { + if ($action == 'create') { /* * Creation */ diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b1e4c2e8c5d..9e92a5fb4b6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1138,7 +1138,7 @@ if (!empty($conf->project->enabled)) { $now = dol_now(); // Add new askprice -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { $currency_code = $conf->currency; print load_fiche_titre($langs->trans("NewAskPrice"), '', 'supplier_proposal'); diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1e6776f7118..1acfa858663 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -254,7 +254,7 @@ $fuserstatic = new User($db); $form = new Form($db); $formfile = new FormFile($db); -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group'); dol_set_focus('#nom'); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 56c6d2d01f7..3337d846f0b 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -272,7 +272,7 @@ if ($result > 0) { print ''; - if ($action == 'create' || (empty($action) && empty($id))) { + if ($action == 'create') { // $listofemails=$object->thirdparty_and_contact_email_array(); if ($object->email) { $actions = array(); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 470e3fd96f8..68bb8d60998 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -158,7 +158,7 @@ $help_url = 'EN:Module_Products#Variants'; llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ProductAttribute")), '', 'object_' . $object->picto); print ''; diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 3ffd381f3aa..dd0d5e171e8 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -240,7 +240,7 @@ llxHeader('', $title, $help_url); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { if (empty($permissiontoadd)) { accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); exit; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 7a075eb8734..249398c322e 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -118,7 +118,7 @@ $formfile = new FormFile($db); llxHeader('', 'WebsiteAccount', ''); // Part to create -if ($action == 'create' || (empty($action) && empty($id))) { +if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("WebsiteAccount"))); print ''; diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index a2409802024..9e859dcc2d0 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -186,7 +186,7 @@ llxHeader('', $title, $help_url); trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto); print ''; From 30dff96ef4a2bdd1513f6c9c762a57c305bc173e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Jul 2022 01:27:19 +0200 Subject: [PATCH 42/42] Fix var_dump --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f4b0f88b3ef..381280289ee 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7846,7 +7846,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con } else { if (! $msgishtml) { $valueishtml = dol_textishtml($value, 1); - var_dump("valueishtml=".$valueishtml); + //var_dump("valueishtml=".$valueishtml); if ($valueishtml) { $text = dol_htmlentitiesbr($text);