Skip to content
Snippets Groups Projects
Commit c887a1c1 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

dev #12691 - Authors terms are based on 'codif_auteur' instead of biblio records.

parent 04db3e66
Branches
Tags
5 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!215Dev#12992 Custom Fields,!209Hotline#13914 Album Link Config Menu,!190Dev#12691 Autocomplete,!165Dev#12691 Autocomplete
......@@ -24,6 +24,7 @@ class Class_Autocomplete_Index {
use Trait_StaticFileSystem;
protected $file_name;
protected $model_name;
public function getBasePath() {
......@@ -96,16 +97,16 @@ class Class_Autocomplete_Index {
$page_size = 1000;
$page = ($done/$page_size) + 1;
$response->total = Class_Notice::countBy([]);
$response->total = call_user_func_array([$this->model_name, 'countBy'], [[]]);
$notices = Class_Notice::findAllBy(['limitPage' => [$page, $page_size]]);
foreach($notices as $notice)
$file_system->fwrite($file, $this->getRecordData($notice)."\n");
$models = call_user_func_array([$this->model_name, 'findAllBy'], [['limitPage' => [$page, $page_size]]]);
foreach($models as $model)
$file_system->fwrite($file, $this->getRecordData($model)."\n");
$file_system->fclose($file);
$response->done = ($response->total > $done + $page_size) ?
$done + $page_size :
$done + count($notices);
$done + count($models);
return $response;
}
......
......@@ -22,9 +22,10 @@
class Class_Autocomplete_IndexAuthor extends Class_Autocomplete_Index {
protected $file_name = 'authors';
protected $model_name = 'Class_CodifAuteur';
protected function getRecordData($record) {
return $record->getAuteurPrincipal();
return $record->getLibelle();
}
}
......
......@@ -22,6 +22,7 @@
class Class_Autocomplete_IndexTitle extends Class_Autocomplete_Index {
protected $file_name = 'titles';
protected $model_name='Class_Notice';
protected function getRecordData($record) {
return $record->getTitrePrincipal();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment