Bonjour
Je suis en train de mettre au point le reporting et je cherche à comprendre comment se fait le lien entre le libellé « standard » et la surcharge de traduction quand elle existe.
Par exemple, dans la table llx_c_propalst, la ligne id=4, code=PR_FAC, label=Facturée, active=1
doit correspondre quelque part à la surcharge dans la table llx_overwrite_trans à la ligne transkey=PropalStatusBilled, transvalue=Facturé
mais je n’arrive pas à comprendre où se fait le lien…
ksar
Novembre 23, 2021, 8:58
2
Bonjour,
Tout se passe dans la function selectProposalStatus
* Values are id of table c_propalst
*
* @param string $selected Preselected value
* @param int $short Use short labels
* @param int $excludedraft 0=All status, 1=Exclude draft status
* @param int $showempty 1=Add empty line
* @param string $mode 'customer', 'supplier'
* @param string $htmlname Name of select field
* @return void
*/
public function selectProposalStatus($selected = '', $short = 0, $excludedraft = 0, $showempty = 1, $mode = 'customer', $htmlname = 'propal_statut')
{
global $langs;
$prefix = '';
$listofstatus = array();
if ($mode == 'supplier') {
$prefix = 'SupplierProposalStatus';
$langs->load("supplier_proposal");
$listofstatus = array(
PR_FAC est transformé en ‹ Billed › : dolibarr/html.formpropal.class.php at develop · Dolibarr/dolibarr · GitHub
Ensuite la clé de traduction $prefix.$key.$short est appelée : Propal Status Billed
}
$key = $obj['code'];
if ($langs->trans($prefix.$key.($short ? 'Short' : '')) != $prefix.$key.($short ? 'Short' : '')) {
print $langs->trans($prefix.$key.($short ? 'Short' : ''));
} else {
$conv_to_new_code = array('PR_DRAFT'=>'Draft', 'PR_OPEN'=>'Validated', 'PR_CLOSED'=>'Closed', 'PR_SIGNED'=>'Signed', 'PR_NOTSIGNED'=>'NotSigned', 'PR_FAC'=>'Billed');
if (!empty($conv_to_new_code[$obj['code']])) {
$key = $conv_to_new_code[$obj['code']];
}
print ($langs->trans($prefix.$key.($short ? 'Short' : '')) != $prefix.$key.($short ? 'Short' : '')) ? $langs->trans($prefix.$key.($short ? 'Short' : '')) : ($obj['label'] ? $obj['label'] : $obj['code']);
}
print '</option>';
$i++;
}
print '</select>';
print ajax_combobox($htmlname);
}
}
Merci pour ta réponse parfaite.
J’avais commencé à fouiller dans les sources PHP mais n’étais encore pas arrivé à la réponse.