From d99a3d9f354f18e6d75c2bb729eb5bc16ac2d95e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 3 Feb 2024 14:37:00 +0100 Subject: [PATCH 1/8] Update ChangeLog (#27980) add => added moved "SEC:" into "For developers or integrators" section --- ChangeLog | 125 +++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc13087832a..0cfaa1ca3ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,9 +29,10 @@ For users: ---------- NEW: Compatibility with PHP 8.2 NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable +NEW: Add a CLI tool to regenerate all documents NEW: Add a confirmation popup when deleting extrafields NEW: Add type 'icon' type for extrafields -NEW: Close #20930 Use ajax for state loading after country change +NEW: #20930 Use ajax for state loading after country change NEW: #23331 Add support for parent projects (#24856) NEW: #22531 Expense report - Add two fields into export : Qty & Unit price (excl.) (#26309) NEW: #22626 date filter thirdparties contracts projects (#22707) @@ -42,54 +43,51 @@ NEW: Accountancy: Add quick navigation with keyboard shortcut on ledger (#26221) NEW: Accountancy: FEC/FEC2 format export with attachments (#26192) NEW: Accountancy: Option to choose length of lettering code NEW: Accountancy: Chart of accounts ES PCG08-PYME-CAT in catalan language -NEW: Add a button to create a product or a service from an order or an invoice (#26173) -NEW: Add a button to re-encrypt data of a dolcrypt extrafield password -NEW: Add a CLI tool to regenerate all documents -NEW: Add a goto url from smartphone search page -NEW: Add all id prof checker on thirdparty for code compta customer and supplier -NEW: Add a protection on purgeFiles -NEW: Add chart of accounts PCG08-PYME-CAT for ES in catalan language -NEW: add constant to check if qty shipped not greater than qty ordered -NEW: Add context for the movement stock (role toconsume/toproduce) on mrp -NEW: Add contract link on ticket -NEW: Add culum Technical ID in list of details lines of an order (#26164) -NEW: Add custom compute for exports -NEW: Add custom Text on footer total (#26334) -NEW: Add different picto for each type of extrafields (date, string, ...) -NEW: Added of a popup on validation instead of a database fielld to know if the user wants to include subwarehouse -NEW: Added of the field "include_sub_warehouse" in the table "llx_inventory" -NEW: Added VAT free & VAT amounts on payment input -NEW: Add ext payment system ID in the payment page with link to Stripe -NEW: Add field TechnicalID in list of users -NEW: Add filter on status of line of a dictionary -NEW: Add get_substitutionarray_other() on shipping odt (#25080) -NEW: add IdProfCheck on thirdparty for BE (xxxx.xxx.xxx) -NEW: Add index on prelevement_demande -NEW: Add invoice subtype in customer invoice (#26543) and template invoice (SQL part) (#26535) -NEW: Add label to price level when changing price (#26240) -NEW: Add modifications of template invoices into agenda -NEW: Add more company information (ProfId7 to 10) (#25266) -NEW: Add more information to holiday mailings (#25461) -NEW: Add more param on fetch() to prepare perf optimization -NEW: Add more tables activated by module activation only -NEW: Add new field into $fields array + Creation of the function getChildWarehouse() -NEW: Add option for cancel consumed and produced lines (delete lines and rollback stocks) when delete or cancel an manufacturing order (#26254) -NEW: Add option in PDF for purchase order and quotation to hide prices -NEW: Add option TAKEPOS_HIDE_PRODUCT_PRICES to hide prices in TakePOS -NEW: add order supplier submit notif -NEW: add parent product column on list -NEW: Add picto in product/service list in object lines (#25511) -NEW: Add possibility to choose separator #21426 -NEW: Add preselected update keys attribute to import class and select it by default if filled -NEW: Add recurring behaviour -NEW: add recursive deletion option for child m os (#26102) -NEW: Add refactoring user permission (#26162) -NEW: add sorting of product price list by customer (#26483) -NEW: Add tab Events/Agenda on recurring invoices -NEW: Add the formEditObjectLine hook on commande card and invoice card -NEW: Add the picto phone of thirdparty on the kanban view of projects -NEW: Add the status of partnership to select partnership for emailing -NEW: add Ticket tab on contract +NEW: added a button to create a product or a service from an order or an invoice (#26173) +NEW: added a button to re-encrypt data of a dolcrypt extrafield password +NEW: added a goto url from smartphone search page +NEW: added all id prof checker on thirdparty for code compta customer and supplier +NEW: added protection on purgeFiles +NEW: added a constant to check if qty shipped not greater than qty ordered +NEW: added context for the movement stock (role toconsume/toproduce) on mrp +NEW: added contract link on ticket +NEW: added column 'Technical ID' in list of details lines of an order (#26164) +NEW: added custom compute for exports +NEW: added custom text on footer total (#26334) +NEW: added different picto for each type of extrafields (date, string, ...) +NEW: added a popup on validation instead of a database field to know if the user wants to include subwarehouse +NEW: added the field "include_sub_warehouse" in the table "llx_inventory" +NEW: added VAT free & VAT amounts on payment input +NEW: added ext payment system ID in the payment page with link to Stripe +NEW: added field Technical ID in list of users +NEW: added filter on status of line of a dictionary +NEW: added get_substitutionarray_other() on shipping odt (#25080) +NEW: added IdProfCheck on thirdparty for BE (xxxx.xxx.xxx) +NEW: added index on prelevement_demande +NEW: added invoice subtype in customer invoice (#26543) and template invoice (SQL part) (#26535) +NEW: added a label to price level when changing price (#26240) +NEW: added modifications of template invoices into agenda +NEW: added more company information (ProfId7 to 10) (#25266) +NEW: added more information to holiday mailings (#25461) +NEW: added more param on fetch() to prepare perf optimization +NEW: added more tables activated by module activation only +NEW: added new field into $fields array + Creation of the function getChildWarehouse() +NEW: added option for cancel consumed and produced lines (delete lines and rollback stocks) when delete or cancel an manufacturing order (#26254) +NEW: added option in PDF for purchase order and quotation to hide prices +NEW: added order supplier submit notif +NEW: added parent product column on list +NEW: added picto in product/service list in object lines (#25511) +NEW: added possibility to choose separator #21426 +NEW: added preselected update keys attribute to import class and select it by default if filled +NEW: added recurring behaviour +NEW: added recursive deletion option for child MOs (#26102) +NEW: added refactoring user permission (#26162) +NEW: added sorting of product price list by customer (#26483) +NEW: added tab Events/Agenda on recurring invoices +NEW: added the formEditObjectLine hook on commande card and invoice card +NEW: added the picto phone of thirdparty on the kanban view of projects +NEW: added the status of partnership to select partnership for emailing +NEW: added Ticket tab on contract NEW: Agenda: agenda per user use quarter hour split instead of half hour split NEW: Allow generation of delivery note through REST-API (#26226) NEW: Allow sync of currency rates with currency layer by default. @@ -108,6 +106,7 @@ NEW: clone skill object (#26526) NEW: column in table prelevement_lignes for fk_user (#26196) NEW: CONF allow modify ticket classification even if closed NEW: conf to display date entry stock exped and sort in date order (#22625) +NEW: Contract: Merge the "Create ..." buttons on contract into one. NEW: create a product from a free line in a document (#22324) NEW: customize position in complete_head_from_modules (#26406) NEW: Date d'entree en stock sur les exped au moment de la création -> Stock date on exped at time of creation @@ -118,19 +117,20 @@ NEW: Donations: Generic doc template for donations (#26338) NEW: drop down for action button show a simple button if only 1 action NEW: Enhance github_commits_perversion to get more stats on git commits NEW: Enhance IPN to support payment_intent.succeeded for both card/ban -NEW: Exports: add product barcode on stock exports +NEW: Exports: added product barcode on stock exports NEW: extrafields password accepts 'dolcrypt' algorithm (reversible algo) NEW: Factorize a lot of code for numbering modules NEW: filter on from/to period rather than month/year (#26378) -NEW: FontAwesome - Add possibility to select another version -NEW: Can generate SEPA files for salaries (#26541) +NEW: FontAwesome - added possibility to select another version NEW: Get list evaluation with skills details in user fiche (#26510) NEW: hidden conf to disable use of dns_get_record (which can become unresponsive) (#26339) +NEW: HR: PDF Generation for each Human Resource Evaluations NEW: improved resource data structure -NEW: Intervention: close notification for interventions +NEW: Interventions: close notification for interventions NEW: Inventory: include sub warehouse in inventory NEW: Inventory: inventory without virtual products (kits) NEW: Invoices: subtypes for customers and vendors (#26233) +NEW: Invoices: start and end date for due date filter on invoice list NEW: Invoice time from task, make task note better display in invoice line NEW: lazy load to substitute project variables (#26451) NEW: LDAP: Active Directory UserAccountControl (#25507) @@ -140,7 +140,6 @@ NEW: Manage rate indirect. (#26449) NEW: Manufacturing Order: add edit line on MO (#26122) NEW: memorize model name for PDF hooks NEW: Menu editor is responsive -NEW: Merge the "Create ..." buttons on contract into one. NEW: ModuleBuilder: Can modify the picto into ModuleBuilder NEW: ModuleBuilder: Form for add object's property on ModuleBuilder NEW: More accurate tooltip on what admin permissions are @@ -151,7 +150,7 @@ NEW: no need to create invoice supplier object on supplier card for standalone c NEW: Open-Surveys: Add a public page to list all open surveys NEW: Option to show label, ref+label or only ref of product in TakePOS NEW: payment full amount detail tooltip -NEW: Payment: Can edit both the Test and Live stripe customer account on payment +NEW: Payments: Can edit both the Test and Live stripe customer account on payment NEW: possibility to deselect line when create a recurring invoice + missing to use fk_parent_line NEW: Projects: List - use select2 multiselect for status NEW: Projects: massactions to delete projects @@ -162,11 +161,11 @@ NEW: Retrieve VAT details from the Greek Ministry of Finance GSIS SOAP web servi NEW: Right for stats orders (#24607) NEW: rights and check access to create portal accounts NEW: Row in list higher height (#26177) +NEW: Salaries: Can generate SEPA files for salaries (#26541) NEW: Save date of RUM creation when creating a Stripe SEPA mandate -NEW: Shipment: can include service (for information and invoicing) (#26407) +NEW: Shipments: can include service (for information and invoicing) (#26407) NEW: Show id of module on the tooltip module help page NEW: show VAT free amount on payment input close #26208 (#26209) -NEW: start and end date for due date filter on invoice list NEW: Sub total in list (#26165) NEW: Support html content for combo list of email recipient NEW: TakePOS: add constant to check qty asked is available (#24820) @@ -174,6 +173,7 @@ NEW: TakePOS: add constant to choose contact instead of customer (#24807) NEW: TakePOS: amount label with or without tax in free product (#24829) NEW: TakePOS: compatibility with lots and serials (#26426) NEW: TakePOS: use default customer, category and product when enable TakePOS (#25031) +NEW: TakePOS: added option TAKEPOS_HIDE_PRODUCT_PRICES to hide prices in TakePOS NEW: Tickets: add and list external contributors on ticket public interface NEW: Third-Parties: add total line to third-parties list (#26148) NEW: Tooltips are using ajax by default @@ -187,12 +187,7 @@ NEW: use account address in sepa mandate (#23642) NEW: VAT rate - Add entity NEW: Website: Support of js into the Dolibarr server preview NEW: When an user unset the batch management of products, transformation of each batch stock movement in global stock movement -NEW: PDF Generation for each Human Resource Evaluations. -SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) -SEC: Add action confirm_... as sensitive to need a CSRF token -SEC: Disable not used PHP streams -SEC: Add option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY For developers or integrators: @@ -201,6 +196,12 @@ For developers or integrators: QUAL Reduce very seriously the technical debt (using PHPStan, Psalm and Rector) NEW Tool in dev/tools/rector to autofix code using style coding practice rules +SECURITY +SEC: #25512 applicative anti bruteforce - security on too many login attempts (#25520) +SEC: added action confirm_... as sensitive to need a CSRF token +SEC: Disable not used PHP streams +SEC: added option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY + PERFORMANCE PERF: Removed a useless fetch_thirdparty PERF: Perf avoid 2 useless fetch into the triggers of agenda. From 9aec1a41feec520208c900482eb5496ffbfb9774 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sat, 3 Feb 2024 14:37:17 +0100 Subject: [PATCH 2/8] qual: phpstan for htdocs/compta/paiement/class/cpaiement.class.php (#27981) htdocs/compta/paiement/class/cpaiement.class.php 98 Property Cpaiement::$active (int) does not accept string. htdocs/compta/paiement/class/cpaiement.class.php 253 Property Cpaiement::$active (int) does not accept string. htdocs/compta/paiement/class/cpaiement.class.php 373 Property Cpaiement::$active (int) does not accept string. --- htdocs/compta/paiement/class/cpaiement.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index b8a4bb77c64..7dc738d2a00 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -95,7 +95,7 @@ class Cpaiement extends CommonDict $this->type = trim($this->type); } if (isset($this->active)) { - $this->active = trim($this->active); + $this->active = (int) $this->active; } if (isset($this->accountancy_code)) { $this->accountancy_code = trim($this->accountancy_code); @@ -250,7 +250,7 @@ class Cpaiement extends CommonDict $this->type = trim($this->type); } if (isset($this->active)) { - $this->active = trim($this->active); + $this->active = (int) $this->active; } if (isset($this->accountancy_code)) { $this->accountancy_code = trim($this->accountancy_code); @@ -365,12 +365,11 @@ class Cpaiement extends CommonDict public function initAsSpecimen() { $this->id = 0; - $this->code = ''; $this->libelle = ''; $this->label = ''; $this->type = ''; - $this->active = ''; + $this->active = 0; $this->accountancy_code = ''; $this->module = ''; } From 1804ba1433935faefe14a9cf1db906ae89e63176 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sat, 3 Feb 2024 14:38:36 +0100 Subject: [PATCH 3/8] qual: phpstan for htdocs/core/class/cunits.class.php (#27982) * qual: phpstan for htdocs/core/class/cunits.class.php htdocs/core/class/cunits.class.php 88 Property CommonDict::$active (int) does not accept string. htdocs/core/class/cunits.class.php 415 Method CUnits::getUnitFromCode() should return int but returns string. * qual: phpstan - Update functions.lib.php - dol_getIdFromCode() * Update functions.lib.php --- htdocs/core/class/cunits.class.php | 9 +++------ htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 4a5326d719e..85d0ce1f4a6 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -85,7 +85,7 @@ class CUnits extends CommonDict $this->libelle = trim($this->short_label); } if (isset($this->unit_type)) { - $this->active = trim($this->unit_type); + $this->active = (int) $this->unit_type; } if (isset($this->active)) { $this->active = (int) $this->active; @@ -406,12 +406,9 @@ class CUnits extends CommonDict */ public function getUnitFromCode($code, $mode = 'code', $unit_type = '') { - if ($mode == 'short_label') { - return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid', 0, " AND unit_type = '".$this->db->escape($unit_type)."'"); - } elseif ($mode == 'code') { - return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid', 0, " AND unit_type = '". $this->db->escape($unit_type) ."'"); + if ($mode == 'short_label' || $mode == 'code') { + return dol_getIdFromCode($this->db, $code, 'c_units', $mode, 'rowid', 0, " AND unit_type = '".$this->db->escape($unit_type)."'"); } - return $code; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1418ca9680a..2af8a5cc4e8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9558,7 +9558,7 @@ function dol_osencode($str) * @param string $fieldid Field to get * @param int $entityfilter Filter by entity * @param string $filters Filters to add. WARNING: string must be escaped for SQL and not coming from user input. - * @return int Return integer <0 if KO, Id of code if OK + * @return int<-1,max> ID of code if OK, 0 if key empty, -1 if KO * @see $langs->getLabelFromKey */ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = 'id', $entityfilter = 0, $filters = '') @@ -9567,7 +9567,7 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = // If key empty if ($key == '') { - return ''; + return 0; } // Check in cache From 52182852faed18b641440b5ae43cce99077baeea Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sat, 3 Feb 2024 14:38:56 +0100 Subject: [PATCH 4/8] qual: phpstan for htdocs/comm/action/class/actioncommreminder.class.php (#27958) htdocs/comm/action/class/actioncommreminder.class.php 46 PHPDoc type array of property ActionCommReminder::$ismultientitymanaged is not covariant with PHPDoc type int of overridden property CommonObject::$ismultientitymanaged. htdocs/comm/action/class/actioncommreminder.class.php 46 Property ActionCommReminder::$ismultientitymanaged (array) does not accept default value of type int. --- htdocs/comm/action/class/actioncommreminder.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index fff59f3fd11..81d6249eaad 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -41,7 +41,7 @@ class ActionCommReminder extends CommonObject public $table_element = 'actioncomm_reminder'; /** - * @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + * @var int Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; From f40b891cfed124bcbc9a87166674bf060bfa3c3e Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Sat, 3 Feb 2024 14:39:59 +0100 Subject: [PATCH 5/8] NEW Develop new quick edit opportunity status (#27892) * Add ability to quickly edit project status & percentage * TEMP * PHPstan checks --- htdocs/core/class/html.formprojet.class.php | 49 ++++++++++++++++++ htdocs/projet/card.php | 56 +++++++++++++++++---- 2 files changed, 94 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 6e3f37d824c..bb6584ad4ba 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -921,4 +921,53 @@ class FormProjets extends Form return $out; } + + /** + * Output html select to select opportunity status + * + * @param string $page Page + * @param string $selected Id preselected + * @param int $percent_value percentage of the opportunity + * @param string $htmlname_status name of HTML element for status select + * @param string $htmlname_percent name of HTML element for percent input + * @param string $filter optional filters criteras + * @param int $nooutput No print output. Return it only. + * @return void|string + */ + public function formOpportunityStatus($page, $selected = '', $percent_value = 0, $htmlname_status = 'none', $htmlname_percent = 'none', $filter = '', $nooutput = 0) + { + // phpcs:enable + global $conf, $langs; + + $out = ''; + if ($htmlname_status != "none" && $htmlname_percent != 'none') { + $out .= '
'; + $out .= ''; + $out .= ''; + $out .= $this-> selectOpportunityStatus($htmlname_status, $selected, 1, 0, 0, 0, 'minwidth150 inline-block valignmiddle', 1, 1); + $out .= ' / '; + $out .= ' %'; + $out .= ''; + $out .= ''; + $out .= '
'; + } else { + if ($selected > 0) { + $code = dol_getIdFromCode($this->db, $selected, 'c_lead_status', 'rowid', 'code'); + $out .= $langs->trans("OppStatus".$code); + + // Opportunity percent + $out.= ' / '; + $out.= price($percent_value, 0, $langs, 1, 0).' %'; + $out.= ''; + } else { + $out .= " "; + } + } + + if ($nooutput) { + return $out; + } else { + print $out; + } + } } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 74ab3a085de..fac60bca8f5 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -404,6 +404,42 @@ if (empty($reshook)) { } } + if ($action == 'set_opp_status' && $user->rights->projet->creer) { + $error = 0; + if (GETPOSTISSET('opp_status')) { + $object->opp_status = $opp_status; + } + if (GETPOSTISSET('opp_percent')) { + $object->opp_percent = $opp_percent; + } + + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if ($object->opp_amount && ($object->opp_status <= 0)) { + $error++; + setEventMessages($langs->trans("ErrorOppStatusRequiredIfAmount"), null, 'errors'); + } + } + + if (!$error) { + $result = $object->update($user); + if ($result < 0) { + $error++; + if ($result == -4) { + setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + + if ($error) { + $db->rollback(); + $action = 'edit'; + } else { + $db->commit(); + } + } + // Build doc if ($action == 'builddoc' && $permissiontoadd) { // Save last template used to generate document @@ -1347,18 +1383,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status - print ''.$langs->trans("OpportunityStatus").''; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) { - print $langs->trans("OppStatus".$code); + print ''.$langs->trans("OpportunityStatus"); + if ($action != 'edit_opp_status' && $user->hasRight('projet', 'creer')) { + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; } - - // Opportunity percent - print ' / '; - if (strcmp($object->opp_percent, '')) { - print price($object->opp_percent, 0, $langs, 1, 0).' %'; - } - print ''; + print ''; + $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; + $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; + $percent_value = (GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : '')); + $formproject->formOpportunityStatus($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->opp_status, $percent_value, $html_name_status, $html_name_percent); + print ''; // Opportunity Amount print ''.$langs->trans("OpportunityAmount").''; From c3882eb3a0659fbd1d83e7db5499f14e24ebbc2b Mon Sep 17 00:00:00 2001 From: William Mead Date: Sat, 3 Feb 2024 14:41:49 +0100 Subject: [PATCH 6/8] New intervention signed status data structure (#27856) * Added intervention signed action trigger * Added signed status bool * Added intervention signed migration path * Removed sign action trigger * Changed signed to integer --------- Co-authored-by: Laurent Destailleur --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 3 ++- htdocs/install/mysql/tables/llx_fichinter.sql | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index ff4da61dc87..359d160e17b 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -212,5 +212,6 @@ ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtex -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; -ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; +ALTER TABLE llx_fichinter ADD COLUMN signed integer DEFAULT NULL AFTER duree; +ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index b9f9008f202..9e5d932b21a 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -39,6 +39,7 @@ create table llx_fichinter datee date, -- date de fin d'intervention datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention + signed integer DEFAULT NULL, -- signed status description text, note_private text, note_public text, From bcabb27c92e0b0befdf6c96cb7e2cea2f6a5096b Mon Sep 17 00:00:00 2001 From: William Mead Date: Sat, 3 Feb 2024 14:50:56 +0100 Subject: [PATCH 7/8] NEW supplier order submit method message (#27855) * Added supplier order submit method to message. Added contributor details. * Updated localization with supplier order submit method * Adjusted order method presentation * Update interface_50_modAgenda_ActionsAuto.class.php --------- Co-authored-by: Laurent Destailleur --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 3 ++- htdocs/langs/en_US/orders.lang | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index c129095017f..40c192a92d6 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2023 William Mead * Copyright (C) 2023 Christian Foellmann + * Copyright (C) 2024 William Mead * * 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 @@ -853,7 +854,7 @@ class InterfaceActionsAuto extends DolibarrTriggers if (empty($object->actionmsg2)) { if (empty($object->context['actionmsg2'])) { - $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref)); + $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ?: $object->ref), $object->getInputMethod()); } else { $object->actionmsg2 = $object->context['actionmsg2']; } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 662348b6977..acee379edad 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -130,7 +130,7 @@ DispatchSupplierOrder=Receiving purchase order %s FirstApprovalAlreadyDone=First approval already done SecondApprovalAlreadyDone=Second approval already done SupplierOrderReceivedInDolibarr=Purchase Order %s received %s -SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted +SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted (%s) SupplierOrderClassifiedBilled=Purchase Order %s set billed OtherOrders=Other orders SupplierOrderValidatedAndApproved=Supplier order is validated and approved : %s From 45718a2a4db9d229b74222b099dfccc94d5d5139 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Sat, 3 Feb 2024 14:53:09 +0100 Subject: [PATCH 8/8] Fix some phpstan warnings (#27884) * Fix some phpstan warnongs * fix CI * fix --------- Co-authored-by: Hystepik Co-authored-by: Laurent Destailleur --- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/api/class/api_access.class.php | 2 +- htdocs/bom/class/bom.class.php | 8 ++++---- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- htdocs/bookmarks/class/bookmark.class.php | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 32daa92d626..535bbab326f 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -43,7 +43,7 @@ class Subscription extends CommonObject public $table_element = 'subscription'; /** - * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table + * @var string Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table */ public $ismultientitymanaged = 'fk_adherent@adherent'; diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index e46dfd14d86..82a60bc5116 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -62,7 +62,7 @@ class DolibarrApiAccess implements iAuthenticate /** * @var User $user Loggued user */ - public static $user = ''; + public static $user = null; /** diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 808acba17f6..94e93d1d631 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1475,7 +1475,7 @@ class BOM extends CommonObject $this->error = $tmpproduct->error; return -1; } - $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : (float) $tmpproduct->pmp); + $line->unit_cost = (float) price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : (float) $tmpproduct->pmp); if (empty($line->unit_cost)) { if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) { if ($productFournisseur->fourn_remise_percent != "0") { @@ -1826,17 +1826,17 @@ class BOMLine extends CommonObjectLine // END MODULEBUILDER PROPERTIES /** - * @var int Calculated cost for the BOM line + * @var float Calculated cost for the BOM line */ public $total_cost = 0; /** - * @var int Line unit cost based on product cost price or pmp + * @var float Line unit cost based on product cost price or pmp */ public $unit_cost = 0; /** - * @var Bom array of Bom in line + * @var array array of Bom in line */ public $childBom = array(); diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 1c7b193d2d5..32e976b9848 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -328,7 +328,7 @@ if ($resql) { $workstation = new Workstation($this->db); $res = $workstation->fetch($sub_bom_product->fk_default_workstation); if ($res > 0) { - $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + $sub_bom_line->total_cost = (float) price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); } print ''.price(price2num($sub_bom_line->total_cost, 'MT')).''; diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index c488758008e..1626777c106 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -45,12 +45,12 @@ class Bookmark extends CommonObject public $ismultientitymanaged = 1; /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'bookmark'; /** - * @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... + * @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... */ public $errno; @@ -60,7 +60,7 @@ class Bookmark extends CommonObject public $id; /** - * @var int User ID. If > 0, bookmark of one user. If == 0, bookmark public (for everybody) + * @var int User ID. If > 0, bookmark of one user. If == 0, bookmark public (for everybody) */ public $fk_user;