These are chat archives for collectiveaccess/support

13th
Feb 2017
CollectiveAccess
@collectiveaccess
Feb 13 2017 14:24
@naeemmuhammad You can create an access point in search_indexing.conf with the fields, then create a search element on the access point
@noje Try using the "hookBeforeSaveItem" hook
"hookSaveItem" is triggered right after the save and is intended to be used to do something after a successful save
@kbecker87 Other than rewriting it with a regular expression the answer is no, because those coordinates are part of the Geonames data. We could add an option to allow only the display text to be returned. Please file a JIRA for that and we'll try to get it done.
noje
@noje
Feb 13 2017 15:45
@collectiveaccess I tried this :
public function hookBeforeSaveItem(&$args) {
    $item = $args["instance"];
    $type = $va_type_list[$vn_type_id];
    $OrigSource = $item->get("source_id");
    echo $OrigSource;
    $item ->set("source_id", "31");
}
but still have no luck. It doesn't set the new value (i checked, 31 is one of the id of source element)
I also noticed that the echo command always return the value previously set and not the one that is going to be save (which is the one i want). Is it because of the moment the echo is triggered or do i understand the hookBeforeSaveItem wrong ?
noje
@noje
Feb 13 2017 15:52
I also tried with an other metadata (MTD_NumRapport - which is a text metadata) and it does the same :
public function hookBeforeSaveItem(&$args) {
    $item = $args["instance"];
    $type = $va_type_list[$vn_type_id];
    $OrigSource = $item->get("ca_objects.MTD_NumRapport");
    echo $OrigSource;
    $item ->set("ca_objects.MTD_NumRapport", "31");
}