add translations count (#31398)

This commit is contained in:
Frédéric FRANCE 2024-10-15 15:39:29 +02:00 committed by GitHub
parent 6f6826e387
commit 0b1d243a7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 28 additions and 18 deletions

View File

@ -739,7 +739,7 @@ class BOM extends CommonObject
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new BOMLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();
@ -823,7 +823,7 @@ class BOM extends CommonObject
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new BOMLine($this->db);
$line->fetch($idline);
$line->fetch_optionals();

View File

@ -273,9 +273,9 @@ class Categorie extends CommonObject
public $childs = array();
/**
* @var ?array{string,array{label:string,description:string,note?:string}} multilangs
* @var ?array<string,array{label:string,description:string,note?:string}> Array for multilangs
*/
public $multilangs;
public $multilangs = array();
/**
* @var int imgWidth
@ -1008,7 +1008,7 @@ class Categorie extends CommonObject
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @return int<-1,0>|array<int,array{id:int,fk_parent:int,label:string,description:string,color:string,position:int,socid:int,type:string,entity:int,array_options:array<string,mixed>,visible:int,ref_ext:string,multilangs?:array{string,array{label:string,description:string,note?:string}}}> Array of categories, 0 if no cat, -1 on error
* @return int<-1,0>|array<int,array{id:int,fk_parent:int,label:string,description:string,color:string,position:int,socid:int,type:string,entity:int,array_options:array<string,mixed>,visible:int,ref_ext:string,multilangs?:array<string,array{label:string,description:string,note?:string}>}> Array of categories, 0 if no cat, -1 on error
*/
public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{

View File

@ -954,7 +954,7 @@ class Propal extends CommonObject
$price = (float) $pu - $remise;
}
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);

View File

@ -3230,7 +3230,7 @@ class Commande extends CommonOrder
$price = ((float) $pu - $remise);
}
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();

View File

@ -4248,7 +4248,7 @@ class Facture extends CommonInvoice
}
$price = price2num($price);
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
$line->fetch_optionals();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -53,6 +54,10 @@ function categories_prepare_head(Categorie $object, $type)
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$head[$h][0] = DOL_URL_ROOT.'/categories/traduction.php?id='.$object->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Translation");
$nbTranslations = (!is_null($object->multilangs) && is_countable($object->multilangs)) ? count($object->multilangs) : 0;
if ($nbTranslations > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbTranslations.'</span>';
}
$head[$h][2] = 'translation';
$h++;
}

View File

@ -7,6 +7,7 @@
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 Jean-Rémi TAPONIER <jean-remi@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -94,6 +95,10 @@ function product_prepare_head($object)
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$object->id;
$head[$h][1] = $langs->trans("Translations");
$nbTranslations = !empty($object->multilangs) ? count($object->multilangs) : 0;
if ($nbTranslations > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbTranslations.'</span>';
}
$head[$h][2] = 'translation';
$h++;
}

View File

@ -3021,7 +3021,7 @@ class CommandeFournisseur extends CommonOrder
$localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$this->line = new CommandeFournisseurLigne($this->db);
$this->line->fetch($rowid);

View File

@ -2425,7 +2425,7 @@ class FactureFournisseur extends CommonInvoice
$info_bits = 0;
}
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new SupplierInvoiceLine($this->db);
$line->fetch($id);
$line->fetch_optionals();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
@ -174,7 +174,7 @@ $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
$showweather = (!getDolGlobalString('MAIN_DISABLE_METEO') || getDolGlobalInt('MAIN_DISABLE_METEO') == 2) ? 1 : 0;
//Array that contains all WorkboardResponse classes to process them
// Array that contains all WorkboardResponse classes to process them
$dashboardlines = array();
// Do not include sections without management permission

View File

@ -788,7 +788,7 @@ class SupplierProposal extends CommonObject
$pu = $pu_ttc;
}
//Fetch current line from the database and then clone the object and set it in $oldline property
// Fetch current line from the database and then clone the object and set it in $oldline property
$line = new SupplierProposalLine($this->db);
$line->fetch($rowid);
$line->fetch_optionals();

View File

@ -641,7 +641,7 @@ class ProductAttribute extends CommonObject
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldcopy property
// Fetch current line from the database and then clone the object and set it in $oldcopy property
$this->line = new ProductAttributeValue($this->db);
// Position to use
@ -691,7 +691,7 @@ class ProductAttribute extends CommonObject
$this->db->begin();
//Fetch current line from the database and then clone the object and set it in $oldcopy property
// Fetch current line from the database and then clone the object and set it in $oldcopy property
$this->line = new ProductAttributeValue($this->db);
$result = $this->line->fetch($lineid);
if ($result > 0) {
@ -732,7 +732,7 @@ class ProductAttribute extends CommonObject
$this->db->begin();
//Fetch current line from the database
// Fetch current line from the database
$this->line = new ProductAttributeValue($this->db);
$result = $this->line->fetch($lineid);
if ($result > 0) {