From dc72cd390b70901d06f1143b992ae52b64e50f53 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 5 Mar 2024 16:31:45 +0100 Subject: [PATCH 1/6] Qual: Clean up caches when PR is closed (#28648) # Qual: Clean up caches when PR is closed This will clean up caches when a PR is closed. This requires that `actions:write` is enabled. Co-authored-by: Laurent Destailleur --- .github/workflows/cache-clean-pr.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/cache-clean-pr.yml diff --git a/.github/workflows/cache-clean-pr.yml b/.github/workflows/cache-clean-pr.yml new file mode 100644 index 00000000000..51a4282a0e9 --- /dev/null +++ b/.github/workflows/cache-clean-pr.yml @@ -0,0 +1,36 @@ +--- +name: Cleanup caches of a closed branch +# See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy +on: + pull_request: + types: [closed] + workflow_dispatch: +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + # `actions:write` permission is required to delete caches + # See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id + actions: write + contents: read + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + REPO=${{ github.repository }} + BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2664661afc46259d0d050e6b0a705e48b190f240 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Tue, 5 Mar 2024 16:32:40 +0100 Subject: [PATCH 2/6] qual: phan for htdocs/core/lib/functions.lib.php (#28640) 68 entries for "Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299" Examples (first 10): htdocs/accountancy/admin/categories.php 155 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/accountancy/admin/categories.php 189 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/accountancy/bookkeeping/card.php 778 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/eventorganization.php 341 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/hrm.php 596 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/hrm.php 603 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/hrm.php 627 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/knowledgemanagement.php 293 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/knowledgemanagement.php 300 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) htdocs/admin/multicurrency.php 115 TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($mesg) is null of type null but \setEventMessages() takes string (no real type) defined at htdocs/core/lib/functions.lib.php:9299 (the inferred real argument type has nothing in common with the parameter's phpdoc type) --- 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 311351618c8..162d25420c1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9288,7 +9288,7 @@ function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) * Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events. * Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function. * - * @param string $mesg Message string + * @param string|null $mesg Message string * @param array|null $mesgs Message array * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') * @param string $messagekey A key to be used to allow the feature "Never show this message again" From bc2f527e411c60b325e8833f62459d2ef060c6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2024 17:11:46 +0100 Subject: [PATCH 3/6] add phpdoc (#28639) * add phpdoc * add phpdoc * add phpdoc * add phpdoc * add phpdoc * add phpdoc --- htdocs/adherents/class/adherent.class.php | 36 ++++++++- htdocs/comm/action/class/ical.class.php | 40 ++++++++-- .../fourn/class/fournisseur.product.class.php | 13 +++- htdocs/imports/class/import.class.php | 75 ++++++++++++++++++- .../class/intracommreport.class.php | 15 +++- .../mailmanspip/class/mailmanspip.class.php | 17 ++++- .../core/modules/modMyModule.class.php | 13 ++-- 7 files changed, 186 insertions(+), 23 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7a88f72e0d0..85087330092 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015 Marcos García - * Copyright (C) 2015-2024 Frédéric France + * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART @@ -74,7 +74,9 @@ class Adherent extends CommonObject */ public $picto = 'member'; - + /** + * @var string[] array of messages + */ public $mesgs; /** @@ -217,6 +219,9 @@ class Adherent extends CommonObject */ public $gender; + /** + * @var int|string date of birth + */ public $birth; /** @@ -249,22 +254,49 @@ class Adherent extends CommonObject // Fields loaded by fetch_subscriptions() from member table + /** + * @var int|string date + */ public $first_subscription_date; + /** + * @var int|string date + */ public $first_subscription_date_start; + /** + * @var int|string date + */ public $first_subscription_date_end; + /** + * @var int|string date + */ public $first_subscription_amount; + /** + * @var int|string date + */ public $last_subscription_date; + /** + * @var int|string date + */ public $last_subscription_date_start; + /** + * @var int|string date + */ public $last_subscription_date_end; + /** + * @var int|string date + */ public $last_subscription_amount; + /** + * @var array + */ public $subscriptions = array(); /** diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index a6dce13a694..20b34678a5d 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013-2014 Laurent Destailleur * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,13 +38,39 @@ class ICal */ public $file; - // Text in file + /** + * @var string Text in file + */ public $file_text; - public $cal; // Array to save iCalendar parse data - public $event_count; // Number of Events - public $todo_count; // Number of Todos - public $freebusy_count; // Number of Freebusy - public $last_key; //Help variable save last key (multiline string) + + /** + * @var array Array to save iCalendar parse data + */ + public $cal; + + /** + * @var int Number of Events + */ + public $event_count; + + /** + * @var int Number of Todos + */ + public $todo_count; + + /** + * @var int Number of Freebusy + */ + public $freebusy_count; + + /** + * @var string Help variable save last key (multiline string) + */ + public $last_key; + + /** + * @var string error message + */ public $error; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 035c088db87..f2397aa763c 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2015 Marcos García * Copyright (C) 2016-2023 Charlene Benke - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2020 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify @@ -165,8 +165,15 @@ class ProductFournisseur extends Product */ public $fk_supplier_price_expression; - public $supplier_reputation; // reputation of supplier - public $reputations = array(); // list of available supplier reputations + /** + * @var string reputation of supplier + */ + public $supplier_reputation; + + /** + * @var string[] list of available supplier reputations + */ + public $reputations = array(); // Multicurreny public $fourn_multicurrency_id; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 05d8b4bb54b..eac1d838cf8 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2011 Laurent Destailleur * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2020 Ahmad Jamaly Rabib - * Copyright (C) 2021 Frédéric France + * Copyright (C) 2021-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,28 +49,99 @@ class Import */ public $errno; + /** + * @var array + */ public $array_import_module; + + /** + * @var array + */ public $array_import_perms; + + /** + * @var array + */ public $array_import_icon; + + /** + * @var array + */ public $array_import_code; + + /** + * @var array + */ public $array_import_label; + + /** + * @var array + */ public $array_import_tables; + + /** + * @var array + */ public $array_import_tables_creator; + + /** + * @var array + */ public $array_import_fields; + + /** + * @var array + */ public $array_import_fieldshidden; + + /** + * @var array + */ public $array_import_entities; + + /** + * @var array + */ public $array_import_regex; + + /** + * @var array + */ public $array_import_updatekeys; + + /** + * @var array + */ public $array_import_preselected_updatekeys; + + /** + * @var array + */ public $array_import_examplevalues; + + /** + * @var array + */ public $array_import_convertvalue; + + /** + * @var array + */ public $array_import_run_sql_after; // To store import templates public $id; public $hexa; // List of fields in the export profile public $datatoimport; - public $model_name; // Name of export profile + + /** + * @var string Name of export profile + */ + public $model_name; + + /** + * @var int ID + */ public $fk_user; diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 9f689743e2a..aa6007eb227 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2019-2020 Open-DSI - * Copyright (C) 2020-2024 Frédéric France + * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,8 +55,10 @@ class IntracommReport extends CommonObject public $picto = 'intracommreport'; - - public $label; // ref ??? + /** + * @var string ref ??? + */ + public $label; public $period; @@ -67,7 +69,14 @@ class IntracommReport extends CommonObject */ public $declaration_number; + /** + * @var string + */ public $exporttype; // deb or des + + /** + * @var string + */ public $type_declaration; // 'introduction' or 'expedition' public $numero_declaration; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index 9d9d065ed19..ba70a2dc710 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,9 +54,24 @@ class MailmanSpip */ public $errors = array(); + /** + * @var array + */ public $mladded_ok; + + /** + * @var array + */ public $mladded_ko; + + /** + * @var array + */ public $mlremoved_ok; + + /** + * @var array + */ public $mlremoved_ko; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 11025ce3fff..0b166dd54b1 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI - * Copyright (C) 2019-2020 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -148,7 +148,7 @@ class modMyModule extends DolibarrModules $this->langfiles = array("mymodule@mymodule"); // Prerequisites - $this->phpmin = array(7, 0); // Minimum version of PHP required by module + $this->phpmin = array(7, 1); // Minimum version of PHP required by module $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module $this->need_javascript_ajax = 0; @@ -179,9 +179,12 @@ class modMyModule extends DolibarrModules // Array to add new pages in new tabs $this->tabs = array(); // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->hasRight('mymodule', 'read'):/mymodule/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->hasRight('othermodule', 'read'):/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. - // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->hasRight('mymodule', 'read'):/mymodule/mynewtab1.php?id=__ID__'); + // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->hasRight('othermodule', 'read'):/mymodule/mynewtab2.php?id=__ID__', + // To remove an existing tab identified by code tabname + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // // Where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) From a2c92f183cc54c35013469638780c28e65df0b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2024 17:12:36 +0100 Subject: [PATCH 4/6] Phpstan fix (#28637) * fix phpstan * fix phpstan * fix phpstan * fix phpstan --- htdocs/core/class/html.formadmin.class.php | 3 ++- htdocs/core/modules/DolibarrModules.class.php | 5 +++-- htdocs/reception/class/reception.class.php | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 125bb04a30e..7b1eb01c1a2 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -184,7 +185,7 @@ class FormAdmin * @param string $htmlname Name of html select * @param array $dirmenuarray Array of directories to scan * @param string $moreattrib More attributes on html select tag - * @return integer|null + * @return integer|void */ public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '') { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 520a7ecc1f1..d98127a6e59 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Josep Lluís Amador - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -335,7 +335,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it /** - * @var string[] List of module class names that must be enabled if this module is enabled. e.g.: array('modAnotherModule', 'FR'=>'modYetAnotherModule') + * @var array List of module class names that must be enabled if this module is enabled. e.g.: array('modAnotherModule', 'FR'=>'modYetAnotherModule') + * Another example : array('always'=>array("modBanque", "modFacture", "modProduct", "modCategorie"), 'FR'=>array('modBlockedLog')); * @see $requiredby */ public $depends; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0aeb300a666..5d7b262f22e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -922,7 +922,7 @@ class Reception extends CommonObject $this->ref = trim($this->ref); } if (isset($this->entity)) { - $this->entity = trim($this->entity); + $this->entity = (int) $this->entity; } if (isset($this->ref_supplier)) { $this->ref_supplier = trim($this->ref_supplier); @@ -931,10 +931,10 @@ class Reception extends CommonObject $this->socid = trim($this->socid); } if (isset($this->fk_user_author)) { - $this->fk_user_author = trim($this->fk_user_author); + $this->fk_user_author = (int) $this->fk_user_author; } if (isset($this->fk_user_valid)) { - $this->fk_user_valid = trim($this->fk_user_valid); + $this->fk_user_valid = (int) $this->fk_user_valid; } if (isset($this->shipping_method_id)) { $this->shipping_method_id = (int) $this->shipping_method_id; From 0ba3567ad6b203207224506a604f57e8c37b9457 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Tue, 5 Mar 2024 17:13:41 +0100 Subject: [PATCH 5/6] qual: phan for htdocs/accountancy/admin/card.php (#28638) * qual: phan for htdocs/accountancy/admin/card.php htdocs/accountancy/admin/card.php 89 Plugin PhanPluginDuplicateExpressionAssignment Both sides of the assignment = are the same: $account_number htdocs/accountancy/admin/card.php 152 Plugin PhanPluginDuplicateExpressionAssignment Both sides of the assignment = are the same: $account_number * typo --- htdocs/accountancy/admin/card.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index e4fde3aec38..8dcbff61b8d 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -85,17 +85,11 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { - $account_number = $account_number; - } else { + if (!getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { $account_number = clean_account($account_number); } - if (GETPOSTINT('account_parent') <= 0) { - $account_parent = 0; - } else { - $account_parent = GETPOSTINT('account_parent'); - } + $account_parent = (GETPOSTINT('account_parent') > 0) ? GETPOSTINT('account_parent') : 0; $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type', 'alpha'); @@ -148,17 +142,11 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { // Clean code // To manage zero or not at the end of the accounting account - if (getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { - $account_number = $account_number; - } else { + if (!getDolGlobalString('ACCOUNTING_MANAGE_ZERO')) { $account_number = clean_account($account_number); } - if (GETPOSTINT('account_parent') <= 0) { - $account_parent = 0; - } else { - $account_parent = GETPOSTINT('account_parent'); - } + $account_parent = (GETPOSTINT('account_parent') > 0) ? GETPOSTINT('account_parent') : 0; $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type', 'alpha'); From 8d9e9f13cfead5ff6ddb8acf72d4bbbc6a3398ef Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Tue, 5 Mar 2024 17:18:36 +0100 Subject: [PATCH 6/6] fix #28374 : tosell is not used anymore on products, use status (#28647) --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9c30198f3e7..7a3b3c13cba 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -233,7 +233,7 @@ if (empty($reshook)) { $line->fetch_product(); } if (is_object($line->product) && $line->product->id > 0) { - if (empty($line->product->tosell)) { + if (empty($line->product->status)) { $warningMsgLineList[$line->id] = $langs->trans('WarningLineProductNotToSell', $line->product->ref); } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3b40b864f5a..92621cdfcac 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -203,7 +203,7 @@ if (empty($reshook)) { $line->fetch_product(); } if (is_object($line->product) && $line->product->id > 0) { - if (empty($line->product->tosell)) { + if (empty($line->product->status)) { $warningMsgLineList[$line->id] = $langs->trans('WarningLineProductNotToSell', $line->product->ref); } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dd784b53419..ca53310fb71 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -234,7 +234,7 @@ if (empty($reshook)) { $line->fetch_product(); } if (is_object($line->product) && $line->product->id > 0) { - if (empty($line->product->tosell)) { + if (empty($line->product->status)) { $warningMsgLineList[$line->id] = $langs->trans('WarningLineProductNotToSell', $line->product->ref); } }