From 5e9158697412a1b4368bd932ca6b83dd24329c30 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:12:20 +0100 Subject: [PATCH 1/5] Add column in c_ticket_category to have a link with c_ticket_type (#37548) Co-authored-by: Lucas Marcouiller --- htdocs/install/mysql/migration/23.0.0-24.0.0.sql | 3 ++- htdocs/install/mysql/tables/llx_c_ticket_category-ticket.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index e7e1252c21b..05cfa10d287 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -189,6 +189,7 @@ ALTER TABLE llx_societe_remise_except ADD COLUMN localtax1_type varchar(10) NUL ALTER TABLE llx_societe_remise_except ADD COLUMN localtax2_tx double(7,4) DEFAULT 0 NOT NULL AFTER localtax1_type; ALTER TABLE llx_societe_remise_except ADD COLUMN localtax2_type varchar(10) NULL AFTER localtax2_tx; -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'holiday', 'holiday', '', 0, null, null, '(HolidayHrInformationsPreviousMonth)', 100,'isModEnabled("holiday")', 1, '__(HolidayHrInformationsPreviousMonthTopic)__', '__(HolidayHrInformationsPreviousMonthContent)__:
__ARRAY_EMPLOYEE_STARTDAY_ENDDAY_DAYS__', null, 0) +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'holiday', 'holiday', '', 0, null, null, '(HolidayHrInformationsPreviousMonth)', 100,'isModEnabled("holiday")', 1, '__(HolidayHrInformationsPreviousMonthTopic)__', '__(HolidayHrInformationsPreviousMonthContent)__:
__ARRAY_EMPLOYEE_STARTDAY_ENDDAY_DAYS__', null, 0); +ALTER TABLE llx_c_ticket_category ADD COLUMN fk_ticket_type integer NULL; -- end of migration diff --git a/htdocs/install/mysql/tables/llx_c_ticket_category-ticket.sql b/htdocs/install/mysql/tables/llx_c_ticket_category-ticket.sql index 971fb844ce3..d4d3021d256 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_category-ticket.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_category-ticket.sql @@ -31,5 +31,6 @@ create table llx_c_ticket_category force_severity varchar(32) NULL, -- To force the severity if we choosed this category description varchar(255), -- A long description of ticket pos integer DEFAULT 0 NOT NULL, - active integer DEFAULT 1 + active integer DEFAULT 1, + fk_ticket_type integer NULL )ENGINE=innodb; From 4cef8b50513716640c3bfa9bf9843bd9acb5e9d7 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+BB2A-Anthony@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:19:41 +0100 Subject: [PATCH 2/5] NEW - Add substitution for deposit (#37546) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP LNE * Default value * Fix trans and warning * Doc * Debug v23 * Debug v23 * Debug v23 * Doc * New import Leave Balance (Datastructure) (#37001) * New import Leave Balance (Datastructure) * fix --------- Co-authored-by: Lucas Marcouiller * Qual: Update Phan baseline.txt with reduced issue counts (#36996) This commit updates the Phan baseline.txt file. * Better log * Log * Better error management * Doc * Fix error message * CI * Try to fix CI * fix phan (#37007) * CI * fix phan (#37008) PhanTypeMismatchArgumentNullable Argument 3 ($txt) is $productlot->batch of type ?string but \TCPDF::MultiCell() takes string defined at htdocs/includes/tecnickcom/tcpdf/tcpdf.php:5871 (expected type to be non-nullable) * CI * NEW Add new EUID number (#36997) * Doc * ci * Fix CI * Improve OAuth HTTP error details (#36951) Keep throwing TokenResponseException on HTTP 4xx/5xx while also capturing the response body (ignore_errors) to include a short snippet for admins. Co-authored-by: caminotravelcenter Co-authored-by: Laurent Destailleur * NEW add import of leave balance (Implementation) (#37011) * New add import Leave Balance * add eof * Update modHoliday.class.php --------- Co-authored-by: Lucas Marcouiller Co-authored-by: Laurent Destailleur * NEW add image format avif (#37014) * add format avif * Update functions.lib.php * Exclude non interesting warning * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * CI * CI * CI * Trans * CI * CI * CI * Fix typo in phpstan.neon.dist for isset() rule (#37018) See https://github.com/Dolibarr/dolibarr/actions/runs/21444577128/job/61756970301?pr=37017 * Remove jstz.min.js from JavaScript array (#37017) jstz.min.js was deleted in https://github.com/Dolibarr/dolibarr/commit/5599ac733b07d990d64e3ff18b30b3dca16d5b86 * Remove jstz.min.js from JavaScript array (#37017) jstz.min.js was deleted in https://github.com/Dolibarr/dolibarr/commit/5599ac733b07d990d64e3ff18b30b3dca16d5b86 * prevent ST_AsWKT() (#37013) * prevent ST_AsWKT() * Update commonobject.class.php --------- Co-authored-by: Laurent Destailleur * prevent ST_AsWKT() (#37013) * prevent ST_AsWKT() * Update commonobject.class.php --------- Co-authored-by: Laurent Destailleur * Try to fix phan * CI * CI * ci * ci * css * qual: Update french texts (comments) to english (#37009) * qual: Update french texts (comments) to english * Qual: Update comment to english in card-rec.php and card.php Translation of comments in the files card-rec.php and card.php. * Qual: Translate comments to English * Qual: Translate comments to English * Fix space into tab * Fix spelling * Qual: Translate comments to English * Update website.php --------- Co-authored-by: Laurent Destailleur * ci * Clean code * Fix test * Debug v23 * Merge manually changes from #37012 that seems good. * Log * More robust phpunit * Populate openid data from wellknow url (#37023) * Delete inexistant file File jstz.min.js was deleted in https://github.com/Dolibarr/dolibarr/commit/5599ac733b07d990d64e3ff18b30b3dca16d5b86 * Populate openid parameters from wellknow url * CI * Debug v23 - fix code for rounding * MCP server sql part (#37025) * Create llx_ai_request_log.sql * Create llx_ai_request_log.key.sql * Update 23.0.0-24.0.0.sql * Update llx_ai_request_log.sql * Update 23.0.0-24.0.0.sql * Remove foreign key constraint from llx_ai_request_log Removed foreign key constraint for fk_user in llx_ai_request_log. --------- Co-authored-by: Laurent Destailleur * Debug v24 * Fix syntax error * NEW allow to disable freezone product on takepos (#37004) * allow to disable freezone product on takepos * Conditionally add FreeZone product to menus * Add NoFreeZoneProduct language entry --------- Co-authored-by: Laurent Destailleur * Fix label of dispute * [database] Minimum amount and subscription's amount formula description (#37021) * Remove jstz.min.js from JavaScript array (#37017) jstz.min.js was deleted in https://github.com/Dolibarr/dolibarr/commit/5599ac733b07d990d64e3ff18b30b3dca16d5b86 * prevent ST_AsWKT() (#37013) * prevent ST_AsWKT() * Update commonobject.class.php --------- Co-authored-by: Laurent Destailleur * css * Update llx_adherent_type.sql add minimumamount and amountformuladescription rows * Update 22.0.0-23.0.0.sql add minimumamount and amountformuladescription column --------- Co-authored-by: hansemschnokeloch Co-authored-by: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Co-authored-by: Laurent Destailleur * NEW: Display thirdparty name with ref in supplier orders linked objects (#36952) Co-authored-by: Zakaria Boushaba * css * Debug v23 * Fix type * CI * CI * Test without file list * CI * Add api document management for holiday (#36915) Co-authored-by: Laurent Destailleur * NEW Invoice - List - use select2 multiselect for status (#36834) * NEW Invoice - List - use select2 multiselect for status * Optimize * CI * CI * Review * Duplicate line and last problem * CI --------- Co-authored-by: Laurent Destailleur * FIX Pb in total price of line when adding the discount of a down payment when unit price was using a high accuracy. * Clean code * try to fix phan * Fix phan * Clean code * Clean code * Debug v23 * Fix LDAP * fix facture.class.php (#37031) * Debug v23 * Qual: Update french comments with 'nombre' (#37032) Update french comments with 'nombre' in their phrasing Co-authored-by: Laurent Destailleur * fix phan (#37029) Co-authored-by: Laurent Destailleur * fix phan (#37030) Co-authored-by: Laurent Destailleur * Doc * Doc comment * FIX When bank direct debit SEPA ref is > 99 * Fix when there is more than 99 direct debit in same month * Debug v24 * Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into 23.0 * CSS * Fix when there is more than 99 direct debit in same month * Debug v24 * FIX Division by zero * FIX Division by zero * More log * More log * More log * More Log * Fix IPN payment * Fix IPN * Log * Clean code * Debug v23 - Fix ipn for dispute and withdraw funds. * fix CI (#37033) * fix CI (#37033) * CI * fix french doc (#36897) * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix * fix * fix * fix * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * fix french doc * Update html.form.class.php * Update html.form.class.php * Update index.php * fix * fix * fix * fix * fix * fix * fix * fix * Update modules_facture.php * Update phpstan.neon.dist --------- Co-authored-by: Laurent Destailleur * Qual: Translate French comments to English (#37044) * Qual: Translate French comments to English * Qual: Translate French comments to English * Qual: Translate French comments to English ("niveau") (#37041) Translate French comments to English (comments with "niveau") * fix french doc (#37040) * warning error if no societe->id defined (#37039) * fix french doc (#37037) * fix french doc * Update dispatch.php * Update dispatch.php * Update graph.php * fix french doc (#37047) * fix french doc * Update index.php * Update index.php * Fix CI * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * CI * Fix CI * Minimum amount and subscription's amount formula description (#37006) Co-authored-by: Laurent Destailleur * Warning on export/import - Add isset() protection in Export::load_arrays() & Import::load_arrays() (#37043) * Warning on export - Add isset() protection in Export::load_arrays() * Warning on import - Add isset() protection in Import::load_arrays() --------- Co-authored-by: Laurent Destailleur * Clean comment * Warning on account model (#37042) * Error on account model * Simplify rowid assignment in accountmodel.php --------- Co-authored-by: Laurent Destailleur * Fix #35394 Display public note on first page (#36993) * Display public note (an incoterms and sales rep signat) only on real first page * Display public note (an incoterms and sales rep signat) only on real first page --------- Co-authored-by: vmaury Co-authored-by: Laurent Destailleur * FIX: Add htmlname and selectedrate to parameters array for hook (#36998) Co-authored-by: Laurent Destailleur * FIX: Add htmlname and selectedrate to parameters array for hook (#36998) Co-authored-by: Laurent Destailleur * Fix CI * Fix CI * Fix CI * Fix ci * Qual: Translate French comments to English (#37052) * Qual: Translate French 'valeur' in comments to English (#37051) * NEW Accountancy - Select between accrual accounting and cash accounting (#37050) * Qual: Translate french 'avec' comments to English (#37049) # Qual: Translate french 'avec' comments to English * FIX divisa rate indirect to direct because Dolibarr use indirect for default (#37046) * FIX rate_indirect to rate_direct Direct : 1 Divisa Currency = X Currency Main. Indirect : 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * FIX divisa rate indirect to direct Direct : 1 Divisa Currency = X Currency Main. Indirect: 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * FIX divisa rate indirect to direct Direct : 1 Divisa Currency = X Currency Main. Indirect: 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * FIX divisa rate indirect to direct Direct : 1 Divisa Currency = X Currency Main. Indirect: 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * FIX divisa rate indirect to direct Direct : 1 Divisa Currency = X Currency Main. Indirect: 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * Divisa rate direct Direct : 1 Divisa Currency = X Currency Main. Indirect: 1 Currency Main = X Divisa Currency. Then for Dolibarr use is Indirect for default * Add col rate_direct because Dolibarr use for.default rate indirect --------- Co-authored-by: Laurent Destailleur * CI * Add thumbnails for avif (#37045) * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * vignette for avif * fix * fix * fix * fix * fix * fix * fix * fix * fix --------- Co-authored-by: Laurent Destailleur * FIX #36892 * NEW : Manage discount for all lines for supplier elements. (#36954) * NEW : Manage remise for all lines for supplier elements. * Cast remise_percent to float in updateline call --------- Co-authored-by: Laurent Destailleur * Fix Signature position (#37048) Move up the position of the signature to fix its explosion on 3 pages * remove french doc and fix travis migration missing (#37053) * fix french doc * fix french doc * fix french doc * fix french doc * Clean up comments in card.php Removed unnecessary comments from card.php --------- Co-authored-by: Laurent Destailleur * Debug v23 * Fix CSS * Fix CSS * Fix sql syntax error * Fix sql syntax error * Add optionnal img to openid login (#37060) * fix french doc (#37056) * fix french doc * fix french doc * fix french doc * doc translation * doc translation * doc translation * doc translation * doc translation * load tables in init for create categorie table associated (#37059) * Fix situation invoice * Fix situation invoice * Debug v23 * Link and filter on ountry for holiday types * Link and filter on ountry for holiday types * Trans * Debug v23 * css * CSS on current day * Debug v23 * css * More complete message * Make array of dispute status a shared constant * Debug v23 * Debug v23 * bad link on sql in fichinter list (#37081) * bad link on sql in fichinter list (#37081) * FIX: TakePOS, webapp-hardware-bridge and TakePOS-Connector for modern weighing scales (#37078) * feat: CustomerDisplay through Webapp-Hardware-Bridge * feat: WeighingScale through Webapp-Hardware-Bridge * feat: WeighingScale through Webapp-Hardware-Bridge * fix: looks like a typo * feat: for small screens * fix: attribut contenant le prix du produit ajouté * feat: ajout d'un callback de gestion d'erreur * Clean code for Takepos * Debug v23 * Fix new path of dolreceiptprinter.class.php * Adjust signature appearance position in PDF generation (#37076) * EmailCollector: exclude sender emails/domains (#37075) # Conflicts: # htdocs/langs/en_US/admin.lang Co-authored-by: braito4 * fix: dev/examples/zapier/package.json to reduce vulnerabilities (#37071) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-LODASH-15053838 Co-authored-by: snyk-bot * translate french doc to english (#37064) * fix french doc * fix french doc * fix french doc * fix french doc * fix * fix * fix * fix * Trans * Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop * Change translation function to transnoentities (#37065) Co-authored-by: Laurent Destailleur * Change translation function to transnoentities (#37065) Co-authored-by: Laurent Destailleur * NEW Show total multicurrency on payment (#37070) * Total multicurrency * Total multicurrency paiment * total result multicurrency * show total multicurrency * Fix CI * CLOSE #37085 - Popup notif is just under the menu bar * fix: add missing geturl lib (#37088) * Fix CI * Restrict to modiied files * #36843 Update card-rec.php (#37062) The item desc is already added into the line when selecting the Item. No Need to concat it again when clicking the "add" button. * Clean code * Fix CI * Doc * Fix CI * family assignment logic on user perms of external modules (#36456) * family assignment logic on user perms of external modules Updated family assignment logic to default to 'other' if family does not exist in $familyinfo. * Update copyright year for Charlene Benke * family assignment logic on user perms of external modules (#36456) * family assignment logic on user perms of external modules Updated family assignment logic to default to 'other' if family does not exist in $familyinfo. * Update copyright year for Charlene Benke * Fix comment and keep external modules out of core modules * Close #36975 * Close #36975 * css * NEW : hide remise_except unit price on invoice lines (#37066) Co-authored-by: Laurent Destailleur * NEW(API): create fixed amount discount (#37091) * NEW(API): create fixed amount discount * FIX CI * FIX CI --------- Co-authored-by: Benjamin Falière * Fix phan * CI * FIX * FIX * NEW - Add substitution for deposit --------- Co-authored-by: Laurent Destailleur Co-authored-by: Laurent Destailleur Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Co-authored-by: Lucas Marcouiller Co-authored-by: MDW Co-authored-by: Frédéric FRANCE Co-authored-by: Alexandre SPANGARO Co-authored-by: Braito Co-authored-by: caminotravelcenter Co-authored-by: hansemschnokeloch Co-authored-by: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com> Co-authored-by: Charlène Benke <1179011+defrance@users.noreply.github.com> Co-authored-by: Thatoo Co-authored-by: Zakaria Boushaba <48571684+Boushabazakaria@users.noreply.github.com> Co-authored-by: Zakaria Boushaba Co-authored-by: Vincent Maury Co-authored-by: vmaury Co-authored-by: Jyhere Co-authored-by: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Co-authored-by: ThomasNgr-OpenDSI Co-authored-by: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Co-authored-by: LePat Co-authored-by: braito4 Co-authored-by: snyk-bot Co-authored-by: Vanyo Co-authored-by: AWeerWolf <74211972+AWeerWolf@users.noreply.github.com> Co-authored-by: Benjamin Falière <121813548+BenjaminFlr@users.noreply.github.com> Co-authored-by: Benjamin Falière Co-authored-by: Anthony Berton --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9d567ade0f6..0e63c42d4a2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10835,6 +10835,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__AMOUNT_TEXT__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, '', true) : ''; $substitutionarray['__AMOUNT_TEXTCURRENCY__'] = is_object($object) ? dol_convertToWord($object->total_ttc, $outputlangs, $conf->currency, true) : ''; + $substitutionarray['__DEPOSIT_PERCENT__'] = is_object($object) ? $object->deposit_percent : ''; + $substitutionarray['__DEPOSIT_AMOUNT__'] = is_object($object) ? price2num($object->total_ttc * ($object->deposit_percent / 100), 'MT') : ''; + $substitutionarray['__AMOUNT_REMAIN__'] = is_object($object) ? price2num($object->total_ttc - $already_payed_all, 'MT') : ''; $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? (isset($object->total_vat) ? $object->total_vat : $object->total_tva) : ''; From 4bd118ee1b4e186bfad23dc8586ad31274842b38 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:21:08 +0100 Subject: [PATCH 3/5] NEW Add Batch and function to send HR information (#37542) * Add Batch and fucntion toi send HR information * fix CI * fix CI --------- Co-authored-by: Lucas Marcouiller --- htdocs/core/modules/modHoliday.class.php | 15 ++ htdocs/holiday/class/holiday.class.php | 191 +++++++++++++++++++++++ 2 files changed, 206 insertions(+) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index aa805118980..c401510320f 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -150,6 +150,21 @@ class modHoliday extends DolibarrModules 'status' => 1, 'test' => '$conf->holiday->enabled', 'datestart' => $datestart + ), + 1 => array( + 'label' => 'SendPreviousMonthHRInformations:holiday', + 'jobtype' => 'method', + 'class' => 'holiday/class/holiday.class.php', + 'objectname' => 'Holiday', + 'method' => 'sendPreviousMonthHRInformations', + 'parameters' => 'emailaddress, EmailTemplateCode', + 'comment' => 'Send HR information to the defined email address. EmailTemplateCode can be id or label of emailtemplate to send', + 'frequency' => 1, + 'unitfrequency' => 3600 * 24 * 31, + 'priority' => 50, + 'status' => 0, + 'test' => '$conf->holiday->enabled', + 'datestart' => $datestart ) ); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 19c1e119251..90cb5b5c1d3 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2624,4 +2624,195 @@ class Holiday extends CommonObject $return .= ''; return $return; } + + /** + * Send a mail with previous month Hr information + * CAN BE A CRON TASK + * + * @param string $mailto Email address to send to + * @param string $template Id or Label of mail template to use + * @param string $newlang Force a lang or empty for auto + * + * @return int 0 if OK, <> 0 if KO (this function is used also by cron so only 0 is OK) + */ + public function sendPreviousMonthHRInformations($mailto = "", $template = "", $newlang = "") + { + global $conf, $langs, $user; + + $db = $this->db; + $outputlangs = $langs; + + $error = 0; + $this->output=''; + $this->error=''; + $arrayfields = array( + 'user' => 'Employee', + 'type' => 'Type', + 'date_start' => 'DateDebCP', + 'date_end' => 'DateFinCP', + 'used_days' => 'NbUseDaysCPShort', + ); + + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $outputlangs->loadLangs(array('main', 'holiday', 'hrm')); + + if (empty($mailto) || !isValidEmail($mailto)) { + $this->errors[] = 'Bad value for parameter mailto. Must be a valid email address.'; + return 1; + } + + $typeleaves = $this->getTypes(1, -1); + $arraytypeleaves = array(); + foreach ($typeleaves as $key => $val) { + $labeltoshow = ($outputlangs->trans($val['code']) != $val['code'] ? $outputlangs->trans($val['code']) : $val['label']); + $arraytypeleaves[$val['rowid']] = $labeltoshow; + } + $listhalfday = array('morning' => $outputlangs->trans("Morning"), "afternoon" => $outputlangs->trans("Afternoon")); + + $datenow = dol_getdate(dol_now()); + $prev_month = dol_get_prev_month($datenow["mon"], $datenow["year"]); + $year_month = sprintf("%04d", $prev_month["year"]).'-'.sprintf("%02d", $prev_month["month"]); + $arrayleaves = array(); + + $sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday, cp.statut as status"; + $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; + $sql .= " WHERE cp.entity IN (".getEntity('holiday').") AND cp.rowid > 0"; + $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; + $sql .= " AND ("; + $sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$this->db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$this->db->escape($year_month)."')"; + $sql .= " OR"; // For leave over several months + $sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$this->db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$this->db->escape($year_month)."') "; + $sql .= " )"; + $sql .= $this->db->order("cp.fk_user, cp.date_debut", "ASC"); + $resql = $this->db->query($sql); + if (empty($resql)) { + $this->errors[] = $this->db->lasterror(); + return 1; + } + $num = $this->db->num_rows($resql); + if ($num > 0) { + $tmpuser = new User($this->db); + while ($obj = $this->db->fetch_object($resql)) { + $tmpuser->fetch($obj->fk_user); + + $date_start = $this->db->jdate($obj->date_debut, true); + $date_end = $this->db->jdate($obj->date_fin, true); + + $tmpstart = dol_getdate($date_start); + $tmpend = dol_getdate($date_end); + + $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; + $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + + $halfdayinmonth = $obj->halfday; + $starthalfdayinmonth = $starthalfday; + $endhalfdayinmonth = $endhalfday; + + //0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning + + // Set date_start_gmt and date_end_gmt that are date to show for the selected month + $date_start_inmonth = $this->db->jdate($obj->date_debut, true); + $date_end_inmonth = $this->db->jdate($obj->date_fin, true); + if ($tmpstart['year'] < $prev_month["year"] || $tmpstart['mon'] < $prev_month["month"]) { + $date_start_inmonth = dol_get_first_day($prev_month["year"], $prev_month["month"], true); + $starthalfdayinmonth = 'morning'; + if ($halfdayinmonth == 2) { + $halfdayinmonth = 1; + } + if ($halfdayinmonth == -1) { + $halfdayinmonth = 0; + } + } + if ($tmpend['year'] > $prev_month["year"] || $tmpend['mon'] > $prev_month["month"]) { + $date_end_inmonth = dol_get_last_day($prev_month["year"], $prev_month["month"], true) - ((24 * 3600) - 1); + $endhalfdayinmonth = 'afternoon'; + if ($halfdayinmonth == 2) { + $halfdayinmonth = -1; + } + if ($halfdayinmonth == 1) { + $halfdayinmonth = 0; + } + } + $arrayleaves[] = array( + "user" => $tmpuser->getNomUrl(0, 'nolink', 0, 0, 24, 1), + "type" => $arraytypeleaves[$obj->fk_type], + "date_start" => dol_print_date($date_start_inmonth, 'day') . '('.$outputlangs->trans($listhalfday[$starthalfdayinmonth]).')', + "date_end" => dol_print_date($date_end_inmonth, 'day') . '('.$outputlangs->trans($listhalfday[$endhalfdayinmonth]).')', + "used_days" => num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth, $tmpuser->country_id) + ); + } + } + + $outputarrayleaves = '
'; + $outputarrayleaves .= ''; + foreach ($arrayfields as $key => $label) { + $outputarrayleaves .= ''; + } + $outputarrayleaves .= ''; + + if (!empty($arrayleaves)) { + foreach ($arrayleaves as $key => $fields) { + $outputarrayleaves .= ''; + foreach ($fields as $field => $value) { + $outputarrayleaves .= ''; + } + $outputarrayleaves .= ''; + } + } else { + $outputarrayleaves .= ''; + $outputarrayleaves .= ''; + $outputarrayleaves .= ''; + } + $outputarrayleaves .= '
'; + $outputarrayleaves .= $outputlangs->trans($label); + $outputarrayleaves .= '
'; + $outputarrayleaves .= $value; + $outputarrayleaves .= '
'; + $outputarrayleaves .= $outputlangs->trans("None"); + $outputarrayleaves .= '
'; + + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + + $formmail = new FormMail($this->db); + $templateId = 0; + $templateLabel = ''; + if (empty($template) || $template == 'EmailTemplateCode') { + $templateLabel = '(HolidayHrInformationsPreviousMonth)'; + } else { + if (is_numeric($template)) { + $templateId = $template; + } else { + $templateLabel = $template; + } + } + $mailtemplate = $formmail->getEMailTemplate($this->db, "holiday", $user, $outputlangs, $templateId, 1, $templateLabel); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $this); + complete_substitutions_array($substitutionarray, $outputlangs, $this); + + $subject = make_substitutions($mailtemplate->topic, $substitutionarray, $outputlangs); + $msg = make_substitutions($mailtemplate->content, $substitutionarray, $outputlangs); + $from = dol_string_nospecial(getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; + + $msg = preg_replace('/__ARRAY_EMPLOYEE_STARTDAY_ENDDAY_DAYS__/', $outputarrayleaves, $msg); + $cmail = new CMailFile($subject, $mailto, $from, $msg, array(), array(), array(), '', '', 0, 1); + $result = $cmail->sendfile(); + if (!$result || !empty($cmail->error) || !empty($cmail->errors)) { + $this->errors[] = $cmail->error; + if (is_array($cmail->errors) && count($cmail->errors) > 0) { + $this->errors = array_merge($this->errors, $cmail->errors); + $error++; + } + } + + if (!empty($this->errors)) { + $this->output .= "\n"; + // The $this->errors will be concatenated to the output by the function that call this method. + } + return ($error ? 1 : 0); + } } From 32309dbad7b71a0e2e44bc9675adc531ea1fd9b0 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 20 Mar 2026 16:24:47 +0100 Subject: [PATCH 4/5] Qual third parties API clean index method (#37536) * Removed stcomm join * Cleaned PHPDoc * Cleaned PHPDoc --- .../societe/class/api_thirdparties.class.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c1e62959e8a..e9aaef56d25 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -132,21 +132,25 @@ class Thirdparties extends DolibarrApi * Get a list of third parties * * @since 3.8.0 Initial implementation + * @since 21.0.0 Data pagination * - * @param string $sortfield S ort field + * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit List limit * @param int $page Page number - * @param int $mode Set to 0 to show all third parties, Set to 1 to show only customers, 2 for prospects, 3 for neither customer or prospect, 4 for suppliers + * @param int $mode Set to 0 to show all third parties, Set to 1 to show only customers, 2 for prospects, 3 for neither customer nor prospect, 4 for suppliers * @param int $category Use this param to filter the list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "((t.nom:like:'TheCompany%') or (t.name_alias:like:'TheCompany%')) and (t.datec:<:'20160101')" * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names - * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0* - * @return array Array of thirdparty objects + * @param bool $pagination_data If this parameter is set to true, the response will include pagination data. The default value is false. Page starts from 0* + * @return array Array of third party objects * @phan-return Societe[]|array{data:Societe[],pagination:array{total:int,page:int,page_count:int,limit:int}} * @phpstan-return Societe[]|array{data:Societe[],pagination:array{total:int,page:int,page_count:int,limit:int}} * - * @throws RestException + * @throws RestException 400 + * @throws RestException 403 + * @throws RestException 404 + * @throws RestException 503 */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $properties = '', $pagination_data = false) { @@ -176,9 +180,7 @@ class Thirdparties extends DolibarrApi $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; } } - $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql .= " WHERE t.entity IN (".getEntity('societe').")"; - $sql .= " AND t.fk_stcomm = st.id"; if ($mode == 1) { $sql .= " AND t.client IN (1, 3)"; } elseif ($mode == 2) { @@ -188,7 +190,7 @@ class Thirdparties extends DolibarrApi } elseif ($mode == 4) { $sql .= " AND t.fournisseur IN (1)"; } - // Select thirdparties of given category + // Select third parties of a given category if ($category > 0) { if (!empty($mode) && $mode != 4) { $sql .= " AND c.fk_categorie = ".((int) $category)." AND c.fk_soc = t.rowid"; @@ -248,7 +250,7 @@ class Thirdparties extends DolibarrApi $i++; } } else { - throw new RestException(503, 'Error when retrieve thirdparties : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieve third parties : '.$this->db->lasterror()); } if (!count($obj_ret)) { $message = ''; @@ -271,7 +273,7 @@ class Thirdparties extends DolibarrApi throw new RestException(404, $message); } - //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit) + //if $pagination_data is true, the response will contain element data with all values and element pagination with pagination data(total,page,limit) if ($pagination_data) { $totalsResult = $this->db->query($sqlTotals); $total = $this->db->fetch_object($totalsResult)->total; From 0e1741a0987bc729dee65833f4576d40254f2023 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Fri, 20 Mar 2026 16:30:51 +0100 Subject: [PATCH 5/5] Fix syslog configuration (#37531) * Fix syslog configuration * Fix retrieval of SYSLOG_FACILITY constant --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/syslog/mod_syslog_syslog.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 80706c439c7..1481577cf86 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -86,7 +86,7 @@ class mod_syslog_syslog extends LogHandler { global $langs; - $facility = constant(getDolGlobalString('SYSLOG_FACILITY')); + $facility = defined(getDolGlobalString('SYSLOG_FACILITY')) ? constant(getDolGlobalString('SYSLOG_FACILITY')) : null; if ($facility) { // Only LOG_USER supported on Windows @@ -117,8 +117,8 @@ class mod_syslog_syslog extends LogHandler return; // Global option to disable output of this handler } - if (getDolGlobalString('SYSLOG_FACILITY')) { // Example LOG_USER - $facility = constant($conf->global->SYSLOG_FACILITY); + if (getDolGlobalString('SYSLOG_FACILITY') && defined(getDolGlobalString('SYSLOG_FACILITY'))) { // Example LOG_USER + $facility = constant(getDolGlobalString('SYSLOG_FACILITY')); } else { $facility = constant('LOG_USER'); }