Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (22)
Showing
with 271 additions and 101 deletions
- correctif #181513 : Langues : Ajout des langues manquantes en se basant sur https://www.loc.gov/standards/iso639-2/php/code_list.php.
\ No newline at end of file
- correctif #182545 : MATOMO : rendre les portails Bokeh opérationnels même si le serveur Matomo est indisponible
\ No newline at end of file
- correctif #182795 : [Dilicom] Espace disque sur bokeh-mutu
\ No newline at end of file
- correctif #193340 : PNB : les liens télécharger ou consulter ne fonctionnent plus si on n'est pas connecté
\ No newline at end of file
- correctif #193724, #194491 : Fiche Abonné : L'ordre de tri doit se faire par date de retour de la plus ancienne à la plus récenete.
\ No newline at end of file
- correctif #193922 : SIGB Koha : Lors de la récupération de la liste des bibliothèques auprès de Koha, les annexes avec le paramètre "Exclue du PEB" ne s'affichent pas dans la liste des sites de retrait des réservations. De la même façon, les bibliothèques dont le paramètre "public" est désactivté dans Koha n'apparaissent plus dans la liste des choix pour la pré-inscription des lecteurs.
\ No newline at end of file
- correctif #194147 : Admin : Correctif le changement du mot de passe ne fonctionnait pas pour des ADMIN BIB.
\ No newline at end of file
- correctif #194248 : SIGB Koha : Meilleur affichage de l'historique de prêts, tri par ordre de date d'emprunt décroissant, les prêts les plus récents sont affichés en premier. L'affichage est limité à 4 mois ou 50 prêts pour des questions de performances.
- correctif #194562 : Recherche : Catalogue avec formulaire personnalisé et panier associé, le critère sur les paniers doit se positionner en OU sans affecter ceux du formulaire.
\ No newline at end of file
- hotline #193173 : Affichage de notices de périodiques paginée : page blanche
\ No newline at end of file
......@@ -655,8 +655,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$patron->setPreviousPassword($previous_password);
try {
$patron->ensureService($this->_user)->save();
if (!$patron->hasErrors() && $this->_user->isValid()) {
if ($patron->ensureAndSave($this->_user) && $this->_user->isValid()) {
$this->_user->save();
$this->_helper->notify($this->_('Vos modifications ont bien été enregistrées'));
return $this->_redirect('/abonne/fiche');
......
......@@ -131,7 +131,7 @@ class AuthController extends ZendAfi_Controller_Action {
if ($user->save()) {
$patron = $user->getEmprunteur();
$patron->setPassword($this->_request->getPost('secure_password'));
$patron->ensureService($user)->save();
$patron->ensureAndSave($user);
$this->getHelper('notify')->bePopup();
$this->_helper->notify($this->_('Votre compte est sécurisé. Vous pouvez maintenant vous connecter avec votre courriel et votre nouveau mot de passe.'));
......@@ -422,15 +422,13 @@ class AuthController extends ZendAfi_Controller_Action {
$patron->updateFromUser($user);
try {
$patron->ensureService($user);
if ($patron->isNullInstance() || $patron->save())
if ($patron->ensureAndSave($user))
$user->save();
} catch(Exception $e) {
$this->_helper->notify($e->getMessage());
return $this->_redirect('/auth/login');
}
$this->_helper->notify($this->_('Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'));
$this->_redirect('/auth/login');
}
......
......@@ -255,7 +255,6 @@ class BibNumeriqueController extends ZendAfi_Controller_Action {
protected function _userShouldBeRedirect() {
if (!$this->_user){
$this->getResponse()->setHeader('Location', $this->view->url());
$this->_forwardToLogin('', $this->view->url());
return true;
}
......
<?php
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("aar", "afar", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("abk", "abkhaze", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ady", "adyghé", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ain", "aïnou", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("alt", "altai du Sud", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("anp", "angika", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ast", "asturien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("bas", "basa", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("bis", "bichlamar", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("bos", "bosniaque", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("bua", "bouriate", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("byn", "blin", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ceb", "cebuano", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("chk", "chuuk", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("chm", "mari", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("chp", "chipewyan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("cnr", "monténégrin", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("cos", "corse", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("crh", "tatar de Crimé", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("csb", "kachoube", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("dar", "dargwa", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("dgr", "dogrib", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("div", "maldivien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("dsb", "bas-sorabe", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("dzo", "dzongkha", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("epo", "espéranto", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("fao", "féroïen", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("fat", "fanti", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("fil", "filipino", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("frr", "frison septentrional", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("frs", "frison oriental", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("fry", "frison occidental", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("fur", "frioulan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gba", "gbaya", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gez", "guèze", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gla", "gaélique", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gle", "irlandais", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("glg", "galicien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("glv", "manx", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gor", "gorontalo", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("grn", "guarani", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gsw", "suisse alémanique", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("gwi", "gwich\'in", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("hat", "haïtien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("hit", "hittite", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("hmn", "hmong", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("hrv", "croate", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("hsb", "haut-sorabe", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("iba", "iban", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ido", "ido", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("iii", "yi de Sichuan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("iku", "inuktitut", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ile", "interlingue", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ilo", "ilocano", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ina", "interlingua", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("inh", "ingouche", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ipk", "inupiaq", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("jbo", "lojban", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kal", "groenlandais", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kbd", "kabardien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("khm", "khmer central", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kmb", "kimbundu", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kom", "kom", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kos", "kosrae", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("krc", "karatchai balkar", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("krl", "carélien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("kum", "koumyk", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("lez", "lezghien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("lim", "limbourgeois", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ltz", "luxembourgeois", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("lua", "luba-lulua", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("lus", "lushai", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("mdf", "moksa", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("mdr", "mandar", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("mlg", "malgache", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("mnc", "mandchou", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("mwl", "mirandais", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("myv", "erza", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nap", "napolitain", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nau", "nauruan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nbl", "ndébélé du Sud", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nia", "nias", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nno", "norvégien nynorsk", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nob", "norvégien bokmål", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nog", "nogaï", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("non", "norrois, vieux", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nqo", "n\'ko", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("nwc", "newari classique", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("oci", "occitan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("orm", "galla", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("phn", "phénicien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("rap", "rapanui", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("rup", "aroumain", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sah", "iakoute", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sas", "sasak", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sat", "santal", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("scn", "sicilien", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sco", "écossais", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sin", "singhalais", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sma", "sami du Sud", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sme", "sami du Nord", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("smj", "sami de Lule", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("smn", "sami d\'Inari", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("smo", "samoan", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sms", "sami skolt", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sna", "shona", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("snk", "soninké", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("sot", "sotho du Sud", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("srd", "sarde", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("srn", "sranan tongo", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("srp", "serbe", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("ssw", "swati", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("syc", "syriaque classique", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tat", "tatar", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tet", "tetum", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tgk", "tadjik", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tgl", "tagalog", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tkl", "tokelau", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tlh", "klingon", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tmh", "tamacheq", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tpi", "tok pisin", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tsn", "tswana", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tvl", "tuvalu", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("tyv", "touva", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("udm", "oudmourte", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("vol", "volapük", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("wln", "wallon", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("xal", "kalmouk", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("zbl", "symboles Bliss", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("zgh", "amazighe standard marocain", 0);');
$adapter->query('INSERT INTO `codif_langue` (`id_langue`, `libelle`, `nb_notices`) VALUES ("zha", "zhuang", 0);');
} catch (Exception $e) {}
......@@ -21,14 +21,15 @@
class Class_Batch_DilicomJobOnix extends Class_Batch_Job {
use Trait_StaticFileSystem;
use Trait_StormFileSystem, Trait_TimeSource;
protected $_client;
protected $_ftp_path = 'HUB/O/';
protected $_local_path;
protected $_full_prefix = 'full_pnb_';
protected $_inc_prefix = 'diffusion_pnb_';
const DELETE_FILES_DELAY = 120;
protected $_client;
protected string $_ftp_path = 'HUB/O/';
protected string $_local_path;
protected string $_full_prefix = 'full_pnb_';
protected string $_inc_prefix = 'diffusion_pnb_';
public function __construct($parent) {
parent::__construct($parent);
......@@ -37,74 +38,108 @@ class Class_Batch_DilicomJobOnix extends Class_Batch_Job {
/** @category testing */
public function setFtpClient($client) {
public function setFtpClient($client) : self {
$this->_client = $client;
return $this;
}
protected function getFtpClient() {
return $this->_client
? $this->_client
: $this->_client = new Class_FTPClient();
return $this->_client ??= new Class_FTPClient;
}
protected function _log($message) {
protected function _log(string $message) : self {
$this->getLogger()->log($message . "\n");
return $this;
}
public function run() {
$this->_cleanRepository();
$client = static::getFtpClient();
if (!$client->connect(Class_AdminVar::get('DILICOM_PNB_FTP_SERVER'),
Class_AdminVar::get('DILICOM_PNB_FTP_USER'),
Class_AdminVar::get('DILICOM_PNB_FTP_PASS'))) {
if ( ! $client->connect(Class_AdminVar::get('DILICOM_PNB_FTP_SERVER'),
Class_AdminVar::get('DILICOM_PNB_FTP_USER'),
Class_AdminVar::get('DILICOM_PNB_FTP_PASS'))) {
$this->_log($this->_('Impossible de se connecter au serveur %s',
Class_AdminVar::get('DILICOM_PNB_FTP_SERVER')));
return false;
}
if (false === $list = $client->ls($this->_ftp_path)) {
$this->_log($this->_('Impossible de lister le contenu de %s',
$this->_ftp_path));
return false;
}
if (!$list) {
if ( ! $list) {
$this->_log($this->_('Aucun fichier présent dans %s',
$this->_ftp_path));
return false;
}
$list = $this->_detectFiles($list);
if (!$this->downloadAll($list))
if ( ! $this->_downloadAll($list))
return false;
$this->processAll($list);
$this->_processAll($list);
}
public function setModelData($data) {
protected function _cleanRepository() : self {
if ( ! $this->getFileSystem()->fileExists($this->_local_path))
return $this;
foreach ($this->getFileSystem()->fileNamesAt($this->_local_path) as $file_name)
$this->_deleteFileIfNEcessary($file_name);
return $this;
}
protected function _deleteFileIfNEcessary(string $file_name) : self {
$file_time = $this->getFileSystem()->fileMTime($this->_local_path . $file_name) ?? 0;
if ($file_time <= 0)
return $this;
$current_time = $this->getCurrentTime();
$current_time -= (static::DELETE_FILES_DELAY * 24 * 60 * 60);
if ($file_time < $current_time)
$this->getFileSystem()->delete($this->_local_path . $file_name);
return $this;
}
protected function _setModelData(string $data) : self {
if ($this->getModel())
$this->getModel()->setData($data);
return $this;
}
public function getModelData() {
protected function _getModelData() : ?string {
return $this->getModel() ? $this->getModel()->getData() : null;
}
protected function ensureLocalPathExists() {
if ($this->getFileSystem()->file_exists($this->_local_path))
protected function _ensureLocalPathExists() : bool {
if ($this->getFileSystem()->fileExists($this->_local_path))
return true;
if (!$this->getFileSystem()->mkdir($this->_local_path)) {
if ( ! $this->getFileSystem()->mkdir($this->_local_path)) {
$this->_log($this->_('Impossible de créer le répertoire local %s', $this->_local_path));
return false;
}
......@@ -112,82 +147,81 @@ class Class_Batch_DilicomJobOnix extends Class_Batch_Job {
}
protected function downloadAll($list) {
if (!$this->ensureLocalPathExists())
protected function _downloadAll(array $list) : bool {
if ( ! $this->_ensureLocalPathExists())
return false;
foreach($list as $file) {
if (!$this->downloadOne($file)) {
foreach ($list as $file)
if ( ! $this->_downloadOne($file)) {
$this->_log($this->_('Impossible de télécharger le fichier %s',
$this->_ftp_path . $file));
return false;
}
}
return true;
}
protected function downloadOne($remote_file) {
protected function _downloadOne($remote_file) {
return static::getFtpClient()->get($this->_ftp_path . $remote_file,
$this->_local_path . $remote_file);
}
protected function processAll($list) {
protected function _processAll(array $list) : self {
foreach ($list as $file)
$this->processOne($file);
return $this;
}
public function processOne($local_file, $update_constraints=false) {
public function processOne(string $local_file, ?bool $update_constraints = false) : self {
$this->_log($this->_('Fichier %s', $local_file));
$path = $update_constraints ? '' : $this->_local_path ;
$xml = $this->getFileSystem()->file_get_contents($path . $local_file);
$xml = $this->getFileSystem()->fileGetContents($path . $local_file);
$report = function($import_count, $errors) {
$this->_log($this->_('%d livre(s) importé(s)', $import_count));
if ($errors) {
if ($errors)
$this->_log($this->_('Erreur(s) : %s',
implode("\n ", $errors)));
}
};
(new Class_WebService_BibNumerique_Dilicom($update_constraints))
->importOffersFile($xml, $report);
$this->setModelData($local_file);
return $this->_setModelData($local_file);
}
protected function _detectFiles($list) {
$list = array_map(
function($element) {
return str_replace($this->_ftp_path, '', $element);
},
protected function _detectFiles(array $list) : array {
$list = array_map(fn($element) => str_replace($this->_ftp_path, '', $element),
$list);
if ($data = $this->getModelData())
$list = $this->filesAfter($data, $list);
if ($data = $this->_getModelData())
$list = $this->_filesAfter($data, $list);
if (!$list) {
if ( ! $list) {
$this->_log($this->_('Aucun fichier plus récent que le dernier fichier déjà traité (%s)',
$data));
return [];
}
$fulls = $this->filterFiles($list, function($name) { return $this->isFull($name); });
$incs = $this->filterFiles($list, function($name) { return $this->isIncremental($name); });
$fulls = $this->_filterFiles($list, fn($name) => $this->_isFull($name));
$incs = $this->_filterFiles($list, fn($name) => $this->_isIncremental($name));
$this->_log($this->_('%s fichier(s) à traiter dans %s',
count($fulls) + count($incs),
$this->_ftp_path));
if ($last_full = $this->lastFileIn($fulls))
if ($last_full = $this->_lastFileIn($fulls))
$this->_log($this->_('Fichier total à traiter : %s', $last_full));
if ($last_incs = ($last_full ? $this->filesAfter($last_full, $incs): $incs))
if ($last_incs = ($last_full ? $this->_filesAfter($last_full, $incs): $incs))
$this->_log($this->_('Fichiers incrémentaux à traiter : %s',
implode(' ', $last_incs)));
......@@ -195,24 +229,22 @@ class Class_Batch_DilicomJobOnix extends Class_Batch_Job {
}
private function filesAfter($previous, $list) {
return array_filter(
$list,
function($name) use ($previous) {
return $this->fileDate($name) > $this->fileDate($previous);
});
protected function _filesAfter(string $previous, array $list) : array {
return array_filter($list,
fn($name) => $this->_fileDate($name) > $this->_fileDate($previous));
}
private function lastFileIn($list) {
protected function _lastFileIn(array $list) : ?string {
$last = null;
foreach($list as $name) {
foreach ($list as $name) {
if (null == $last) {
$last = $name;
continue;
}
if ($this->fileDate($name) > $this->fileDate($last))
if ($this->_fileDate($name) > $this->_fileDate($last))
$last = $name;
}
......@@ -220,28 +252,29 @@ class Class_Batch_DilicomJobOnix extends Class_Batch_Job {
}
private function fileDate($name) {
protected function _fileDate(string $name) : string {
$parts = explode('_', $name);
return substr(end($parts), 0, 8);
}
private function filterFiles($list, $closure) {
protected function _filterFiles(array $list, Closure $closure) : array {
return array_filter($list, $closure);
}
private function isFull($name) {
protected function _isFull(string $name) : bool {
return $this->_startsWith($this->_full_prefix, $name);
}
private function isIncremental($name) {
protected function _isIncremental(string $name) : bool {
return $this->_startsWith($this->_inc_prefix, $name);
}
private function _startsWith($prefix, $value) {
protected function _startsWith(string $prefix, string $value) : bool {
return substr($value, 0, strlen($prefix)) === $prefix;
}
}
\ No newline at end of file
}
......@@ -65,16 +65,16 @@ class Class_MoteurRecherche_Clauses {
if ($this->_match_axes && ! $this->_match_in_file)
$this->_criteria->match($this->_match_axes);
if ($this->_or_multifacets)
$this->_criteria->wrapWithOr((new Storm_Query_Criteria)
->match($this->_or_multifacets));
if ($this->_advanced_blocks)
$this->_advanced_blocks->consumeAll();
foreach ($this->_axes_criteria as $criteria)
$this->_criteria->append($criteria);
if ($this->_or_multifacets)
$this->_criteria->wrapWithOr((new Storm_Query_Criteria)
->match($this->_or_multifacets));
return $this;
}
......
......@@ -591,17 +591,12 @@ class Class_Notice extends Storm_Model_Abstract {
}
/* deprecated */
public function getArticlesPeriodique() {
// lire dans la base
$datas = Class_Notice_SerialArticles::findAllBy(['clef_chapeau' => $this->getClefChapeau(),
'clef_numero' => $this->getTomeAlpha(),
'order' => 'id_article asc']);
$datas = $this->getSerialsArticles();
$articles = [];
foreach ($datas as $enreg) {
if (!$enreg->getUnimarc()) continue;
$serial_article = $enreg->getMarcRecord();
$article = ["titre" => $serial_article->getTitrePrincipal()];
if ($complement = $serial_article->getComplementTitre())
......@@ -621,6 +616,17 @@ class Class_Notice extends Storm_Model_Abstract {
}
public function getSerialsArticles(): array
{
return Class_Notice_SerialArticles::query()
->eq('clef_chapeau', $this->getClefChapeau())
->eq('clef_numero', $this->getTomeAlpha())
->gt('unimarc', '')
->order('id_article')
->fetchAll();
}
public function getCodeFacette($champ) {
foreach ($this->getFacetCodes() as $item) {
if ($item[0] == $champ)
......
......@@ -219,24 +219,17 @@ class Class_User_Cards extends Storm_Model_Collection {
public function getLoansHistory() :Storm_Collection {
/* see forge #137459 and koha library/Class/WebService/SIGB/Koha/RestfulService loanHistory($borrower) */
try {
return
$this->_decorateOperationFrom(function($card)
{
return $card->getLoansHistory();
});
$loans = $this->_decorateOperationFrom(fn($card) => $card->getLoansHistory());
$loans->uasort(fn($a, $b) => strcmp(Class_Date::frToIso($b->getIssueDate()),
Class_Date::frToIso($a->getIssueDate())));
return $loans;
} catch (Exception $exception) {
return new Storm_Collection;
}
}
public function getHistoryLoansCount() :int {
return $this->getLoansHistory()->count();
}
protected function _decorateOperationFrom(Closure $closure) :Storm_Collection {
$operations = new Storm_Collection();
......
......@@ -185,12 +185,8 @@ class Class_User_EditFormHelper {
$patron->setPreviousPassword($this->_old_password);
try {
$service = $patron
->ensureService($this->_user);
$service->save();
if ($service->hasErrors()) {
$this->_form->addErrors($service->getErrors());
if ( ! $patron->ensureAndSave($this->_user)) {
$this->_form->addErrors($patron->getErrors());
$this->_form->addDecorator('Errors');
return false;
}
......
......@@ -56,10 +56,10 @@ class Class_User_Loans extends Storm_Model_Collection_Abstract {
}
public function sortByIssueDate() : Storm_Collection {
$loans = $this->getArrayCopy();
usort($loans, fn($a, $b) => strcmp($b->getDateRetourISO8601(),
$a->getDateRetourISO8601()));
return (new Storm_Collection($loans));
public function sortByIssueDate() : self {
$this->uasort(fn($a, $b) => strcmp($a->getDateRetourISO8601(),
$b->getDateRetourISO8601()));
return $this;
}
}