Automated merge from 22.0 to 23.0 by tool pullmerge.sh

This commit is contained in:
Laurent Destailleur 2026-08-13 17:38:17 +02:00
commit 48958ae565
17 changed files with 154 additions and 111 deletions

View file

@ -6,6 +6,7 @@
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Nicolas Barrouillet <nicolas@pragma-tech.fr>
* Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
*
* 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
@ -1514,7 +1515,7 @@ while ($i < min($num, $limit)) {
} elseif ($line->doc_type == 'bank') {
print $objectstatic->getNomUrl(1);
$bank_ref = strstr($line->doc_ref, '-');
print " " . $bank_ref;
print ' <span class="classfortooltip" title="'.dol_escape_htmltag($line->doc_ref).'">'.dol_escape_htmltag($bank_ref).'</span>';
} else {
print $line->doc_ref;
}

View file

@ -1215,6 +1215,7 @@ class Documents extends DolibarrApi
if (is_object($object) && $generateThumbs) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; // image_format_supported() is defined here
if (image_format_supported($dest_file)) {
$object->addThumbs($dest_file);
}

View file

@ -134,7 +134,7 @@ if (empty($reshook)) {
// Action dispose object
if ($action == 'confirm_disposal' && $confirm == 'yes' && $permissiontoadd) {
$object->disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt
$object->disposal_amount_ht = GETPOSTINT('disposal_amount');
$object->disposal_amount_ht = GETPOSTFLOAT('disposal_amount');
$object->fk_disposal_type = GETPOSTINT('fk_disposal_type');
$disposal_invoice_id = GETPOSTINT('disposal_invoice_id');
$object->disposal_depreciated = ((GETPOST('disposal_depreciated') == '1' || GETPOST('disposal_depreciated') == 'on') ? 1 : 0);
@ -301,7 +301,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$langs->load('bills');
$disposal_date = dol_mktime(0, 0, 0, GETPOSTINT('disposal_datemonth'), GETPOSTINT('disposal_dateday'), GETPOSTINT('disposal_dateyear'), 'gmt'); // for date without hour, we use gmt
$disposal_amount = GETPOSTINT('disposal_amount');
$disposal_amount = GETPOSTFLOAT('disposal_amount');
$fk_disposal_type = GETPOSTINT('fk_disposal_type');
$disposal_invoice_id = GETPOSTINT('disposal_invoice_id');
$disposal_depreciated = GETPOSTISSET('disposal_depreciated') ? GETPOST('disposal_depreciated') : 1;

View file

@ -418,7 +418,6 @@ class ChargeSociales extends CommonObject
if ($this->type > 0) {
$sql .= ", fk_type = ".((int) $this->type);
}
$sql .= ", fk_user_modif=".((int) $user->id);
$sql .= " WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);

View file

@ -1306,7 +1306,7 @@ class Contrat extends CommonObject
if (!$error) {
// We remove directory
$ref = dol_sanitizeFileName($this->ref);
if ($conf->contrat->dir_output) {
if ($conf->contrat->dir_output && !empty($ref)) {
$dir = $conf->contrat->multidir_output[$this->entity]."/".$ref;
if (file_exists($dir)) {
$res = @dol_delete_dir_recursive($dir);

View file

@ -114,9 +114,9 @@ class Comment extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->description)."'";
$sql .= ", ".($this->datec != '' ? "'".$this->db->idate($this->datec)."'" : 'null');
$sql .= ", '".(isset($this->fk_element) ? $this->fk_element : "null")."'";
$sql .= ", ".(isset($this->fk_element) ? ((int) $this->fk_element) : "null");
$sql .= ", '".$this->db->escape($this->element_type)."'";
$sql .= ", '".(isset($this->fk_user_author) ? $this->fk_user_author : "null")."'";
$sql .= ", ".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null");
$sql .= ", ".((int) $user->id);
$sql .= ", ".(!empty($this->entity) ? $this->entity : '1');
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");

View file

@ -2077,62 +2077,24 @@ function dol_string_unaccent($str)
// See http://www.utf8-chartable.de/
$string = rawurlencode($str);
$replacements = array(
'%C3%80' => 'A',
'%C3%81' => 'A',
'%C3%82' => 'A',
'%C3%83' => 'A',
'%C3%84' => 'A',
'%C3%85' => 'A',
'%C3%80' => 'A', '%C3%81' => 'A', '%C3%82' => 'A', '%C3%83' => 'A', '%C3%84' => 'A', '%C3%85' => 'A',
'%C3%87' => 'C',
'%C3%88' => 'E',
'%C3%89' => 'E',
'%C3%8A' => 'E',
'%C3%8B' => 'E',
'%C3%8C' => 'I',
'%C3%8D' => 'I',
'%C3%8E' => 'I',
'%C3%8F' => 'I',
'%C3%88' => 'E', '%C3%89' => 'E', '%C3%8A' => 'E', '%C3%8B' => 'E',
'%C3%8C' => 'I', '%C3%8D' => 'I', '%C3%8E' => 'I', '%C3%8F' => 'I',
'%C3%91' => 'N',
'%C3%92' => 'O',
'%C3%93' => 'O',
'%C3%94' => 'O',
'%C3%95' => 'O',
'%C3%96' => 'O',
'%C3%92' => 'O', '%C3%93' => 'O', '%C3%94' => 'O', '%C3%95' => 'O', '%C3%96' => 'O', '%C5%90' => 'O',
'%C5%A0' => 'S',
'%C3%99' => 'U',
'%C3%9A' => 'U',
'%C3%9B' => 'U',
'%C3%9C' => 'U',
'%C3%9D' => 'Y',
'%C5%B8' => 'y',
'%C3%A0' => 'a',
'%C3%A1' => 'a',
'%C3%A2' => 'a',
'%C3%A3' => 'a',
'%C3%A4' => 'a',
'%C3%A5' => 'a',
'%C3%99' => 'U', '%C3%9A' => 'U', '%C3%9B' => 'U', '%C3%9C' => 'U', '%C5%B0' => 'U',
'%C3%9D' => 'Y', '%C5%B8' => 'y',
'%C3%A0' => 'a', '%C3%A1' => 'a', '%C3%A2' => 'a', '%C3%A3' => 'a', '%C3%A4' => 'a', '%C3%A5' => 'a',
'%C3%A7' => 'c',
'%C3%A8' => 'e',
'%C3%A9' => 'e',
'%C3%AA' => 'e',
'%C3%AB' => 'e',
'%C3%AC' => 'i',
'%C3%AD' => 'i',
'%C3%AE' => 'i',
'%C3%AF' => 'i',
'%C3%A8' => 'e', '%C3%A9' => 'e', '%C3%AA' => 'e', '%C3%AB' => 'e',
'%C3%AC' => 'i', '%C3%AD' => 'i', '%C3%AE' => 'i', '%C3%AF' => 'i',
'%C3%B1' => 'n',
'%C3%B2' => 'o',
'%C3%B3' => 'o',
'%C3%B4' => 'o',
'%C3%B5' => 'o',
'%C3%B6' => 'o',
'%C3%B2' => 'o', '%C3%B3' => 'o', '%C3%B4' => 'o', '%C3%B5' => 'o', '%C3%B6' => 'o', '%C5%91' => 'o',
'%C5%A1' => 's',
'%C3%B9' => 'u',
'%C3%BA' => 'u',
'%C3%BB' => 'u',
'%C3%BC' => 'u',
'%C3%BD' => 'y',
'%C3%BF' => 'y',
'%C3%B9' => 'u', '%C3%BA' => 'u', '%C3%BB' => 'u', '%C3%BC' => 'u', '%C5%B1' => 'u',
'%C3%BD' => 'y', '%C3%BF' => 'y',
'%CC%80' => '',
'%CC%81' => '',
'%CC%82' => '',
@ -2151,7 +2113,7 @@ function dol_string_unaccent($str)
'%CC%8F' => '',
'%CC%90' => '',
'%CC%91' => '',
'%CC%A7' => '',
'%CC%A7' => ''
);
$string = strtr($string, $replacements);
return rawurldecode($string);
@ -4849,7 +4811,7 @@ function dol_print_phone($phone, $countrycode = '', $contactid = 0, $socid = 0,
}
} elseif (strtoupper($countrycode) == "JO") { //Jordanie
if (dol_strlen($phone) == 12) { //ex: +962_A_BCD_EF_GH
$newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 1) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2);
$newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 1) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2);
}
} elseif (strtoupper($countrycode) == "JM") { //Jamaïque
if (dol_strlen($newphone) == 12) { //ex: +1867_ABC_DEFG
@ -4914,12 +4876,12 @@ function dol_print_phone($phone, $countrycode = '', $contactid = 0, $socid = 0,
$newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4);
} elseif (dol_strlen($phone) == 9) { // mobile add code and fix 9 chiffres +51_AAA_BBB_CCC
$newphonewa = '+51' . $newphone;
$newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 10, 3);
$newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3);
} elseif (dol_strlen($phone) == 11) { // fix 11 chiffres +511_AAA_BBBB
$newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 8, 4);
$newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 4);
} elseif (dol_strlen($phone) == 12) { // mobile +51_AAA_BBB_CCC
$newphonewa = $newphone;
$newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 10, 3) . $separ . substr($newphone, 14, 3);
$newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3);
}
} elseif (strtoupper($countrycode) == "IN") { //India
if (dol_strlen($phone) == 13) {
@ -12961,7 +12923,7 @@ function printCommonFooter($zone = 'private')
if (tmptypefield == 'textarea') {
// We must instead check the content of ckeditor
var tmpeditor = CKEDITOR.instances['" . dol_escape_js($paramkey) . "'];
var tmpeditor = (typeof CKEDITOR !== 'undefined') ? CKEDITOR.instances['".dol_escape_js($paramkey)."'] : null;
if (tmpeditor) {
tmpvalue = tmpeditor.getData();
console.log('For textarea tmpvalue is '+tmpvalue);
@ -12969,7 +12931,7 @@ function printCommonFooter($zone = 'private')
}
let tmpvalueisempty = false;
if (tmpvalue === null || tmpvalue === undefined || tmpvalue === '' || tmpvalue === -1) {
if (tmpvalue === null || tmpvalue === undefined || tmpvalue === '' || tmpvalue === -1 || tmpvalue === '-1') {
tmpvalueisempty = true;
}
if (tmpvalue === '0' && (tmptypefield == 'select' || tmptypefield == 'input')) {

View file

@ -2648,8 +2648,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (empty($project_year_filter) || !is_numeric($project_year_filter)) {
$project_year_filter = date("Y");
}
$sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day((int) $project_year_filter, 12, false)).")";
$sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day((int) $project_year_filter, 1, false)).")";
$sql .= " AND (p.dateo IS NULL OR p.dateo <= '".$db->idate(dol_get_last_day((int) $project_year_filter, 12, false))."')";
$sql .= " AND (p.datee IS NULL OR p.datee >= '".$db->idate(dol_get_first_day((int) $project_year_filter, 1, false))."')";
}
}

View file

@ -29,6 +29,7 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -123,12 +124,16 @@ class html_cerfafr extends ModeleDon
// This is not the proper way to do it but $formclass->form_modes_reglement
// prints the translation instead of returning it
$formclass->load_cache_types_paiements();
if ($don->modepaymentid) {
$paymentmode = $formclass->cache_types_paiements[$don->modepaymentid]['label'];
// Don::fetch() stores the payment mode into mode_reglement_id. The modepaymentid property is only
// set by the create/update forms, so it is always empty when the document is built from a fetched
// donation and no payment mode checkbox was ever ticked on the receipt.
$modepaymentid = !empty($don->mode_reglement_id) ? $don->mode_reglement_id : $don->modepaymentid;
if ($modepaymentid) {
$paymentmode = !empty($formclass->cache_types_paiements[$modepaymentid]['label']) ? $formclass->cache_types_paiements[$modepaymentid]['label'] : '';
} else {
$paymentmode = '';
}
$modepaymentcode = !empty($formclass->cache_types_paiements[$don->modepaymentid]['code']) ? $formclass->cache_types_paiements[$don->modepaymentid]['code'] : "";
$modepaymentcode = !empty($formclass->cache_types_paiements[$modepaymentid]['code']) ? $formclass->cache_types_paiements[$modepaymentid]['code'] : "";
if ($modepaymentcode == 'CHQ') {
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
} elseif ($modepaymentcode == 'LIQ') {
@ -149,6 +154,43 @@ class html_cerfafr extends ModeleDon
$CodeDon = '<td width="33%"><input type="checkbox" disabled="true" > 200 du CGI</td><td width="33%"><input type="checkbox" disabled="true" checked="checked" > 238 bis du CGI</td><td width="33%"><input type="checkbox" disabled="true" > 978 du CGI</td>';
}
*/
// Donator identity.
// When option DONATION_USE_THIRDPARTIES is on, the donation form does not show the name/address
// inputs at all, so llx_don only holds fk_soc and every donator field stays empty. The receipt
// would then be issued without the mandatory identity of the donator, so fall back on the linked
// third party for each field left empty.
$donatorsociete = (string) $don->societe;
$donatorlastname = (string) $don->lastname;
$donatorfirstname = (string) $don->firstname;
$donatoraddress = (string) $don->address;
$donatorzip = (string) $don->zip;
$donatortown = (string) $don->town;
if (!empty($don->socid) && $don->socid > 0) {
$donatorthirdparty = new Societe($this->db);
if ($donatorthirdparty->fetch($don->socid) > 0) {
if (dol_strlen(trim($donatorsociete.$donatorlastname.$donatorfirstname)) == 0) {
// A third party holds a single name field, even for a private individual, so it goes
// to the "Nom" cell of the form and the "Prénoms" cell is left empty.
$donatorsociete = (string) $donatorthirdparty->name;
}
if (dol_strlen(trim($donatoraddress)) == 0) {
$donatoraddress = (string) $donatorthirdparty->address;
}
if (dol_strlen(trim($donatorzip)) == 0) {
$donatorzip = (string) $donatorthirdparty->zip;
}
if (dol_strlen(trim($donatortown)) == 0) {
$donatortown = (string) $donatorthirdparty->town;
}
} else {
dol_syslog("html_cerfafr::write_file Failed to load thirdparty ".$don->socid." linked to donation ".$don->id.", donator block will remain empty - ".$donatorthirdparty->error, LOG_ERR);
}
}
if (dol_strlen(trim($donatorsociete.$donatorlastname.$donatorfirstname)) == 0) {
dol_syslog("html_cerfafr::write_file No name found for the donator of donation ".$don->id.", the receipt will not be compliant", LOG_WARNING);
}
// Define contents
$donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html";
@ -167,13 +209,18 @@ class html_cerfafr extends ModeleDon
$form = str_replace('__MAIN_INFO_SOCIETE_ZIP__', (string) $mysoc->zip, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_TOWN__', (string) $mysoc->town, $form);
$form = str_replace('__MAIN_INFO_SOCIETE_OBJECT__', $mysoc->socialobject, $form);
$form = str_replace('__DONATOR_FIRSTNAME__', (string) $don->firstname, $form);
$form = str_replace('__DONATOR_LASTNAME__', (string) $don->lastname, $form);
$form = str_replace('__DONATOR_SOCIETE__', (string) $don->societe, $form);
$form = str_replace('__DONATOR_FIRSTNAME__', dol_escape_htmltag($donatorfirstname), $form);
// The template concatenates __DONATOR_SOCIETE__ and __DONATOR_LASTNAME__ with no separator,
// so add a line break when both are filled in.
$donatorlastnameprefix = (dol_strlen(trim($donatorsociete)) > 0 && dol_strlen(trim($donatorlastname)) > 0) ? '<br>' : '';
$form = str_replace('__DONATOR_LASTNAME__', $donatorlastnameprefix.dol_escape_htmltag($donatorlastname), $form);
$form = str_replace('__DONATOR_SOCIETE__', dol_escape_htmltag($donatorsociete), $form);
$form = str_replace('__DONATOR_STATUT__', (string) $don->statut, $form);
$form = str_replace('__DONATOR_ADDRESS__', (string) $don->address, $form);
$form = str_replace('__DONATOR_ZIP__', (string) $don->zip, $form);
$form = str_replace('__DONATOR_TOWN__', (string) $don->town, $form);
$form = str_replace('__DONATOR_ADDRESS__', dol_nl2br(dol_escape_htmltag($donatoraddress, 0, 1)), $form);
$form = str_replace('__DONATOR_ZIP__', dol_escape_htmltag($donatorzip), $form);
$form = str_replace('__DONATOR_TOWN__', dol_escape_htmltag($donatortown), $form);
$form = str_replace('__PAYMENTMODE_LIB__ ', (string) $paymentmode, $form);
$form = str_replace('__NOW__', dol_print_date($now, 'day', false, $outputlangs), $form);
$form = str_replace('__DONATION_PAYMENT_MODE__', $ModePaiement, $form);

View file

@ -1199,7 +1199,7 @@ class Fichinter extends CommonObject
// Remove directory with files
$fichinterref = dol_sanitizeFileName($this->ref);
if ($conf->ficheinter->dir_output) {
if ($conf->ficheinter->dir_output && !empty($fichinterref)) {
$dir = $conf->ficheinter->dir_output."/".$fichinterref;
$file = $conf->ficheinter->dir_output."/".$fichinterref."/".$fichinterref.".pdf";
if (file_exists($file)) {

View file

@ -2595,7 +2595,7 @@ class CommandeFournisseur extends CommonOrder
// We remove directory
$ref = dol_sanitizeFileName($this->ref);
if ($conf->fournisseur->commande->dir_output) {
if ($conf->fournisseur->commande->dir_output && !empty($ref)) {
$dir = $conf->fournisseur->commande->dir_output."/".$ref;
$file = $dir."/".$ref.".pdf";
if (file_exists($file)) {

View file

@ -1555,10 +1555,10 @@ class FactureFournisseur extends CommonInvoice
$this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
// We remove directory
if ($conf->fournisseur->facture->dir_output) {
$ref = dol_sanitizeFileName($this->ref);
if ($conf->fournisseur->facture->dir_output && !empty($ref)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ref = dol_sanitizeFileName($this->ref);
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$ref;
$file = $dir."/".$ref.".pdf";
if (file_exists($file)) {

View file

@ -174,7 +174,8 @@ if (empty($reshook)) {
// The lookup must be scoped to the parent MO and use an exact match on origin_id/origin_type,
// otherwise the default 'origin_id LIKE %..%' filter can return an unrelated line (or none),
// which would let the child MO be created from the leftover parent POST data (duplicate MO).
$TMoLines = $moline->fetchAll('DESC', 'rowid', 1, 0, array('fk_mo' => $mo_parent->id, 'origin_id' => (int) $id_bom_line, 'origin_type' => 'bomline'));
$filter = '(fk_mo:=:'.((int) $mo_parent->id).') AND (origin_id:=:'.((int) $id_bom_line).") AND (origin_type:=:'bomline')";
$TMoLines = $moline->fetchAll('DESC', 'rowid', '1', '', $filter);
if (empty($TMoLines)) {
continue;

View file

@ -76,8 +76,8 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$stocklimit = GETPOSTFLOAT('seuil_stock_alerte');
$desiredstock = GETPOSTFLOAT('desiredstock');
$stocklimit = (GETPOST('seuil_stock_alerte') !== '') ? GETPOSTFLOAT('seuil_stock_alerte') : null;
$desiredstock = (GETPOST('desiredstock') !== '') ? GETPOSTFLOAT('desiredstock') : null;
$cancel = GETPOST('cancel', 'alpha');
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
$d_eatby = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear'));

View file

@ -1098,7 +1098,7 @@ class Project extends CommonObject
if (empty($error)) {
// We remove directory
$projectref = dol_sanitizeFileName($this->ref);
if ($conf->project->dir_output) {
if ($conf->project->dir_output && !empty($projectref)) {
$dir = $conf->project->dir_output."/".$projectref;
if (file_exists($dir)) {
$res = @dol_delete_dir_recursive($dir);

View file

@ -139,6 +139,8 @@ $projectstatic = new Project($db);
$extrafields->fetch_name_optionals_label($projectstatic->table_element);
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Load task
if ($id > 0 || $ref) {
$object->fetch($id, $ref);
@ -1415,10 +1417,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($search_timespent_endmin) {
$param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin));
}
/*
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
*/
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
if ($id) {
$param .= '&id=' . urlencode((string) ($id));
}
if ($projectid) {
$param .= '&projectid=' . urlencode((string) ($projectid));
}
@ -1622,13 +1625,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
}
$sql = "SELECT t.rowid, t.fk_element, t.element_date, t.element_datehour, t.element_date_withhour, t.element_duration, t.fk_user, t.note, t.thm,";
$sql .= " t.fk_product,";
$sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet,";
$sql .= " t.fk_product, t.invoice_line_id,";
$sql .= " pt.rowid as taskid, pt.ref, pt.label, pt.fk_projet, pt.billable";
$sql .= " u.lastname, u.firstname, u.login, u.photo, u.gender, u.statut as user_status,";
$sql .= " il.fk_facture as invoice_id, inv.fk_statut,";
$sql .= " p.fk_soc,s.name_alias,";
$sql .= " t.invoice_line_id,";
$sql .= " pt.billable";
if (!empty($extrafields->attributes['projet_task']['label'])) {
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) {
$sql .= ($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key." as options_".$key : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -1642,6 +1648,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as prod ON prod.rowid = t.fk_product";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as pt ON pt.rowid = t.fk_element";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON pt.rowid = efpt.fk_object";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = pt.fk_projet";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON t.fk_user = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
@ -1736,6 +1743,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$sql .= dolSqlDateFilter('t.element_datehour', $search_day, $search_month, $search_year);
// Add where from extra fields
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -2056,10 +2068,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<td class="liste_titre center">' . $form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1) . '</td>';
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
*/
// Extra fields
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'ef.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields' => $arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -2142,10 +2154,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center ', $langs->trans("SelectLinesOfTimeSpentToInvoice"));
$totalarray['nbfield']++;
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
*/
// Extra fields
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'ef.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -2556,10 +2568,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
}
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
*/
// Extra fields
$obj = $task_time;
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'ef.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields' => $arrayfields, 'obj' => $task_time, 'i' => $i, 'totalarray' => &$totalarray);
@ -2767,10 +2780,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '</td>';
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
*/
// Extra fields
$obj = $task_time;
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'ef.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields' => $arrayfields, 'obj' => $task_time, 'mode' => 'split1');
@ -2935,10 +2949,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '</td>';
}
/*
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
*/
// Extra fields
$obj = $task_time;
$extrafieldsobjectkey = 'projet_task';
$extrafieldsobjectprefix = 'ef.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields' => $arrayfields, 'obj' => $task_time, 'mode' => 'split2');

View file

@ -1254,6 +1254,23 @@ class FunctionsLibTest extends CommonClassTest
$object->country_code = 'CA';
$phone = dol_print_phone('1234567890', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span class="paddingright">(123) 456-7890</span>', $phone, 'Phone for CA 1');
// Every digit must appear exactly once, in order, whatever the country format
$object->country_code = 'JO';
$phone = dol_print_phone('+96212345678', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span class="paddingright">+962 1 234 56 78</span>', $phone, 'Phone for JO 1');
$object->country_code = 'PE';
$phone = dol_print_phone('987654321', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span class="paddingright">987 654 321</span>', $phone, 'Phone for PE 1');
$object->country_code = 'PE';
$phone = dol_print_phone('+5111234567', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span class="paddingright">+511 123 4567</span>', $phone, 'Phone for PE 2');
$object->country_code = 'PE';
$phone = dol_print_phone('+51987654321', $object->country_code, 0, 0, 0, ' ');
$this->assertEquals('<span class="paddingright">+51 987 654 321</span>', $phone, 'Phone for PE 3');
}