In fact I read again your post and I do not understand...
Translations are take into account and you tjink it is not normal for items which are not translated to use translated sons ?

It is the choice we done : all translated parents are used to create all translated values (sons...)

In your example your are not completly logic because :
Test 3-1 -> "fr: Test 3 > Test 3-1" -> OK
but
Test 3-2 -> "fr: Test 3 > test 3-1 > test 3-2" -> NOK

These 2 cases are the same no ?

Regards



Le 21/01/2015 08:53, Julien Dombre a écrit :
Le 21/01/2015 08:47, Moron, Olivier a écrit :

0.85.1: see my forum post, I explain how to reproduce this bug


I have already tru to reproduce... without succes.
Will try another time...

*Regards,*

*Olivier MORON
*Miscellaneous Program Member

*RAYNET SNC*
Tel : +33 4 76 33 49 52
Fax: +33 4 76 70 56 63

*From:*Glpi-user [mailto:glpi-user-boun...@gna.org] *On Behalf Of *Julien Dombre
*Sent:* Wednesday, January 21, 2015 7:59 AM
*To:* glpi-user@gna.org
*Subject:* Re: [Glpi-user] Fix proposal for: http://www.glpi-project.org/forum/viewtopic.php?id=46119

Hi,

which GLPI version ?
I do not reproduce on 0.85 version.

Regards


Le 20/01/2015 16:00, Moron, Olivier a écrit :

    Dear all,

    I propose the following fix for the bug explained in this post:
    http://www.glpi-project.org/forum/viewtopic.php?id=46119

    /**

    *Generate completename associated with a tree dropdown

    *

    *@paraminput array of user values

    *@paramadd true if translation is added, false if update

    *

    *@returnnothing

    */

    functiongenerateCompletename($input, $add= true) {

    //If there's already a completename for this language, get it's
    ID, otherwise 0

    $completenames_id= self::getTranslationID($input['items_id'],
    $input['itemtype'],

    'completename', $input['language']);

    $item= new$input['itemtype']();

    //Completename is used only for tree dropdowns !

    if($iteminstanceofCommonTreeDropdown && isset($input['language'])) {

    $item->getFromDB($input['items_id']);

    //Regenerate completename : look for item's ancestors

    $completename= "";

    //Get ancestors as an array

    $cache= getAncestorsOf($item->getTable(), $item->getID());

    if(!empty($cache)) {

    foreach($cacheas$ancestor) {

    if($completename!= ''&& $ancestor!= $item->getID()) {

    $completename.= " > ";

    }

    $completename.= self::getTranslatedValue($ancestor,
    $input['itemtype'], 'name',

    $input['language']);

    }

    }

    if($completename!= '') {

    $completename.= " > ";

    }

    $completename.= self::getTranslatedValue($item->getID(),
    $input['itemtype'], 'name',

    $input['language']);

    //Add or update completename for this language

    $translation= newself();

    $tmp['items_id'] = $input['items_id'];

    $tmp['itemtype'] = $input['itemtype'];

    $tmp['field'] = 'completename';

    $tmp['value'] = addslashes($completename);

    $tmp['language'] = $input['language'];

    $tmp['_no_completename'] = true;

    if($completenames_id) {

    $tmp['id'] = $completenames_id;

    $translation->update($tmp);

    } else{

    $translation->add($tmp);

    }

    }

    $completenames= array( ) ;

    $completenames[ $input['items_id'] ] = $completename;

    $foreignKey= $item->getForeignKeyField() ;

    foreach(getSonsOf($item->getTable(), $item->getID()) as$son) {

    //Try to regenerate translated completename only if a
    completename already exists

    //for this son

    $completenames_id= self::getTranslationID($son, $input['itemtype'],

    'completename', $input['language']);

    if($son!= $item->getID()) {

    //get son value

    $son_item= new$input['itemtype']();

    $son_item->getFromDB($son);

    //$completename .= " > ".self::getTranslatedValue($son,
    $input['itemtype'], 'name',

    // $input['language'],

    // $son_item->fields['name']);

    $completenames[ $son] = $completenames[ $son_item->fields[
    $foreignKey] ] ." > ". self::getTranslatedValue($son,
    $input['itemtype'], 'name', $input['language'],
    $son_item->fields['name']);

    unset($tmp['id']);

    $tmp['items_id'] = $son;

    $tmp['itemtype'] = $input['itemtype'];

    $tmp['field'] = 'completename';

    $tmp['value'] = addslashes($completenames[ $son]);

    $tmp['language'] = $input['language'];

    $tmp['_no_completename'] = true;

    if($completenames_id) {

    $tmp['id'] = $completenames_id;

    $translation->update($tmp);

    } else{

    $translation->add($tmp);

    }

    }

    }

    }

    Is there someone who can push this to GLPI repo?

    Thank you,

    Regards,

    Olivier MORON

    Miscellaneous Program Member

    RAYNET SNC

    Tel : +33 4 76 33 49 52

    Fax: +33 4 76 70 56 63




    _______________________________________________

    Glpi-user mailing list

    Glpi-user@gna.org  <mailto:Glpi-user@gna.org>

    https://mail.gna.org/listinfo/glpi-user



_______________________________________________
Glpi-user mailing list
Glpi-user@gna.org
https://mail.gna.org/listinfo/glpi-user



_______________________________________________
Glpi-user mailing list
Glpi-user@gna.org
https://mail.gna.org/listinfo/glpi-user

_______________________________________________
Glpi-user mailing list
Glpi-user@gna.org
https://mail.gna.org/listinfo/glpi-user

Reply via email to