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 (13)
Showing
with 490 additions and 432 deletions
......@@ -98,7 +98,7 @@
- correctif #181912 : Module Activités - Les effectifs maximum définis globalement sont pris en compte même quand des effectifs maximums sont définis pour les adultes et/ou enfants.
- correctif #196501 : Mails suggestions d'achat bloqués.
- correctif #196501 : ajout de la variable NOREPLY_EMAIL qui permet de spécifier l'adresse From: à utiliser pour les emails dont on ne veut pas de réponse (suggestions d'achat, réservations, etc...)
- correctif #185072 : RGAA : Correction de la construction du HTML de la description des boîtes avec l'option "Authorisé les balises HTML" activée, l'élément <p> est remplacé par l'élément <div>.
......@@ -120,7 +120,7 @@
- correctif #183266 : Server : Fatal errors in logs files.
- correctif #182795 : Espace disque sur bokeh-mutu.
- correctif #182795 : Dilicom : supprime automatiquement les fichiers de commandes datant de plus de 120 jours
18/01/2024 - v8.0.192
......@@ -10020,4 +10020,4 @@ ex: http://web.afi-sa.net/pergame-enligne.net/recherche/viewnotice/clef/TINTINET
- on peut définir des filtres multiples sur les sections et annexes au niveau profil.
- le rendu des kiosques flash est maintenant mis en cache, ce qui améliore la rapidité d'affichage. Pour rappel, ce cache est présent pour toutes les boîtes et mis à jour toutes les 15mn. Il est automatiquement désactivé lorsqu'on est connecté en tant que modérateur ou administrateur pour que les modifications des boîtes soient automatiquement visibles sur son poste.
- la mise à jour se base maintenant sur la version communautaire et libre de l'OPAC, sous license AGPL. Les sources sont disponibles ici: http://afi-forge.afi-sa.fr/projects/opacce .
\ No newline at end of file
- la mise à jour se base maintenant sur la version communautaire et libre de l'OPAC, sous license AGPL. Les sources sont disponibles ici: http://afi-forge.afi-sa.fr/projects/opacce .
- correctif #190858 : Admin : Newsletter, rendre l'affichage des compteurs du nombre d'inscrits plus cohérents.
\ No newline at end of file
- correctif #199363 : Nanook : Changement de mot de passe, afficher un message d'erreur si la modification a échouée.
\ No newline at end of file
- correctif #201164 : Koha : quand le webservice Koha échoue, la liste des sites de retrait possible est maintenant vide.
\ No newline at end of file
- correctif : Développement : Correction des builds d'intégration continue.
\ No newline at end of file
- fonctionnalité #200425 : Boite d'accessibilité : ajout de la police Luciole pour les malvoyants.
\ No newline at end of file
......@@ -451,7 +451,10 @@ class AuthController extends ZendAfi_Controller_Action {
return $this->_redirect('/auth/login');
}
$this->_helper->notify($this->_('Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'));
($patron->hasErrors())
? $this->_helper->notify($this->_('La modification du mot de passe a échoué : %s', implode(BR,$patron->getErrors()) ), ['status' => 'error'])
: $this->_helper->notify($this->_('Votre mot de passe a été réinitialisé, vous pouvez vous connecter.'));
$this->_redirect('/auth/login');
}
......
......@@ -815,10 +815,12 @@ class RechercheController extends ZendAfi_Controller_Action {
$first = '';
$locations = $comm->pickupLocationsFor($user, $item);
foreach($locations as $k => $v) {
$first = $first ? $first : $k;
if (isset($locations['statut']) && !$locations['statut'])
return [];
foreach($locations as $k => $v)
$element->addMultiOption($k, $v);
}
return $locations;
}
......
......@@ -196,18 +196,21 @@ class Class_Newsletter extends Storm_Model_Abstract {
}
public function getNumberOfUsers() {
public function getNumberOfUsers(): string
{
return sprintf('%05d', count($this->getRecipientsUsersIds()));
}
public function getRecipientsUsersIds() {
public function getRecipientsUsersIds(): array
{
$ids = [];
foreach($this->getRecipientsGroups() as $group)
foreach($group->getUsersIdsOptimized() as $id)
$ids[] = $id;
return array_unique($ids);
foreach ($this->getRecipientsGroups() as $group)
foreach ($group->getUsersIdsOptimized() as $id)
$ids [] = $id;
return array_unique(array_filter($ids));
}
......
......@@ -23,7 +23,7 @@ class UserGroupLoader extends Storm_Model_Loader {
use Trait_MemoryCleaner;
protected $_dynamics_of_user_cache = [];
protected array $_user_ids_optimized = [];
public function getOrCreate(Class_UserGroupCategorie $category,
string $label,
......@@ -64,17 +64,25 @@ class UserGroupLoader extends Storm_Model_Loader {
}
public function getUsersIdsOptimizedOf(Class_UserGroup $group) : array {
return $group->isManual()
? $this->_getManualUserIdsOf($group)
: $this->_getDynamicUserIdsOf($group);
public function getUsersIdsOptimizedOf(Class_UserGroup $group): array
{
if ($ids = ($this->_user_ids_optimized[$group->getId()] ?? []))
return $ids;
return $this->_user_ids_optimized[$group->getId()] =
($group->isManual()
? $this->_getManualUserIdsOf($group)
: $this->_getDynamicUserIdsOf($group));
}
protected function _getManualUserIdsOf(Class_UserGroup $group) : array {
return array_map(fn($row) => $row->getId(),
Class_UserGroupMembership::query()
->select(['id' => 'user_id'])
protected function _getManualUserIdsOf(Class_UserGroup $group): array
{
return array_map(fn($row) => $row->getUserId(),
Class_UserGroupMembership::join('group')
->select('user_id')
->inner(Class_Users::inner('user')
->on_eq('user_id', 'id_user'))
->eq('user_group_id', $group->getId())
->fetchAll());
}
......@@ -351,9 +359,10 @@ class Class_UserGroup extends Storm_Model_Abstract {
}
public function numberOfUsers() : int{
public function numberOfUsers(): int
{
return $this->isManual()
? parent::_numberOf('users')
? count($this->getUsersIdsOptimized())
: $this->numberOfDynamicUsers();
}
......@@ -551,7 +560,9 @@ class Class_UserGroup extends Storm_Model_Abstract {
return $this->getLibelle();
}
public function formatedCount() {
public function formatedCount(): string
{
return sprintf('%05d', $this->numberOfUsers());
}
......@@ -578,22 +589,30 @@ class Class_UserGroup extends Storm_Model_Abstract {
}
public function getUsersIdsOptimized() {
public function getUsersIdsOptimized(): array
{
return $this->getLoader()->getUsersIdsOptimizedOf($this);
}
public function getUsersPage(int $page, int $items_by_page) : ?array{
public function getUsersPage(int $page, int $items_by_page): array
{
if ($this->isDynamic())
return $this->getDynamicUsersPage($page, $items_by_page);
$users=[];
$members = Class_UserGroupMembership::findAllBy(['user_group_id' => $this->getId(),
'limitPage' => [$page, $items_by_page]]);
foreach ($members as $member) {
$users[]=$member->getUser();
}
return array_filter($users);
$id_users = Class_Users::join('user')
->select('id_user')
->inner(Class_UserGroupMembership::inner('group')
->on_eq('id_user', 'user_id')
->eq('user_group_id', $this->getId()))
->limit_page($page, $items_by_page)
->fetchAll();
return $id_users
? (Class_Users::query()
->in('id_user', array_map(fn($id) => $id->getIdUser(), $id_users))
->fetchAll())
: [];
}
......
......@@ -1783,6 +1783,9 @@ class Class_Users extends Storm_Model_Abstract {
? $sigb_com->suggestionsOf($this)
: parent::_get('suggestion_achat');
if ( $error = ($suggestions['erreur'] ?? ''))
$this->addError($error);
return ($suggestions['erreur'] ?? '') ? [] : $suggestions;
}
......
......@@ -19,40 +19,39 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_Fnac extends Class_WebService_Abstract {
private $url = 'http://www3.fnac.com/advanced/book.do?isbn=';
class Class_WebService_Fnac extends Class_WebService_Abstract
{
protected $_search_url = 'http://recherche.fnac.com/r/';
protected string $_search_url = 'https://recherche.fnac.com/r/';
protected string $_record_url = 'https://www.fnac.com/';
public function getResumes($notice) {
if (!$service = $notice->getIsbnOrEan())
public function getResumes(Class_Notice $notice): array
{
if (! $isbn_or_ean = $notice->getIsbnOrEan())
return [];
if ($resume = $this->getResume($service))
return [ ['source' => 'Editeur',
'texte' => $resume]];
return [];
return ($resume = $this->getResume($isbn_or_ean))
? [['source' => 'Editeur',
'texte' => $resume]]
: [];
}
public function getResume($isbn) {
if(!$isbn)
return false;
public function getResume(string $isbn_or_ean): string
{
$isbn_or_ean = trim(str_replace("-", "", $isbn_or_ean));
$fnac_record_search_html = $this->httpGet($this->_search_url . $isbn_or_ean);
$isbn = trim(str_replace("-","",$isbn));
$url = $this->_search_url . $isbn;
$data = $this->httpGet($url);
if(!$url_lire_la_suite = $this->getUrlLireLaSuite($data))
if( ! $url_to_resume = $this->getUrlToResume($fnac_record_search_html))
return '';
if (!($url_lire_la_suite && (new ZendAfi_Validate_Url())->isValid($url_lire_la_suite)))
if (! (new ZendAfi_Validate_Url())->isValid($url_to_resume))
return '';
$suite = $this->httpGet($url_lire_la_suite);
return trim(strip_tags($this->extractResumeFromHTML($suite)));
$full_page = $this->httpGet($url_to_resume);
return trim(strip_tags($this->extractResumeFromHTML($full_page)));
}
......@@ -67,15 +66,23 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
}
public function getUrlLireLaSuite($data) {
$pos = ($pos = striPos($data,"summary")) ? $pos : striPos($data, 'resume');
public function getUrlToResume(string $html): string
{
$doc = new DOMDocument();
$doc->recover = true;
$doc->preserveWhiteSpace = false;
if( ! $doc->loadHTML($html, LIBXML_NOERROR))
return '';
$xpath = new DOMXPath($doc);
if(!$pos)
if ( ! $anchor = $xpath->query('//p[@class="Article-desc"]/a[contains(@class, "Article-title")]'))
return '';
$pos = strPos($data,"a href=\"",$pos)+8;
$posfin = strPos($data,"\"",$pos);
return substr($data,$pos,($posfin-$pos));
return ($url = $anchor->item(0))
? $url->getAttribute('href')
: '';
}
......@@ -157,4 +164,4 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
return trim($resume);
}
}
\ No newline at end of file
}
......@@ -20,44 +20,46 @@
*/
class Class_WebService_Premiere {
function __construct() {
$url_base="http://www.premiere.fr";
$this->url_base["root"]=$url_base;
$this->url_base["resume"]=$url_base."/film/@TITRE@/";
$this->url_base["image"]=$url_base."/film/@TITRE@/";
class Class_WebService_Premiere extends Class_WebService_Abstract
{
public function __construct()
{
$url_base = "https://www.premiere.fr";
$this->url_base["root"] = $url_base;
$this->url_base["resume"] = $url_base."/film/@TITRE@/";
$this->url_base["image"] = $url_base."/film/@TITRE@/";
}
public function getResumes($notice) {
if (!$notice->isDVD())
return array();
public function getResumes(Class_Notice $notice): array
{
if (! $notice->isDVD())
return [];
if ($resume = $this->get_resume($notice->getTitrePrincipal()))
return array(array('source' => 'Premiere.fr',
'texte' => $resume));
return array();
return [['source' => 'Premiere.fr',
'texte' => $resume]];
return [];
}
function get_resume($titre) {
public function get_resume(string $titre):string
{
$titre=$this->encoder_titre($titre);
$url=str_replace("@TITRE@",$titre,$this->url_base["resume"]);
$url = str_replace("@TITRE@",
$titre,
$this->url_base["resume"]);
try{
$httpClient = Class_HttpClientFactory::getInstance()->newHttpClient();
$httpClient->setUri($url);
$response = $httpClient->request();
$data = $response->getBody();
if(!$data) return false;
}catch (Exception $e){
return false;
}
if ( ! $data = $this->httpGet($url))
return '';
// Recherche du bon bloc
$start = 'Synopsis : ';
if (!$pos = strPos($data, $start))
return '';
$pos = $pos + strlen($start);
$posfin=strPos($data,'/>',$pos);
......
......@@ -48,6 +48,6 @@ class Class_WebService_SIGB_Decalog_ResponseReader {
public function getMessage() : string {
return $this->_message;
return (string) $this->_message;
}
}
......@@ -49,7 +49,8 @@ class Class_WebService_SIGB_Decalog_Service extends Class_WebService_SIGB_Abstra
'path' => '/user/lostpassword']];
public static function getService($server_root, $key = null,
public static function getService($server_root,
$key = null,
$institution_code = null,
$record_id_prefix = null) {
return self::newInstance()
......
......@@ -441,6 +441,20 @@ class Class_WebService_SIGB_Emprunteur
}
public function resetLatesLoansCounter(): self
{
unset($this->_nb_retards);
return $this;
}
public function resetLoansCounter(): self
{
unset($this->_nb_emprunts);
return $this;
}
protected function _sortByDateRetour(array $items): array
{
$keys = array_map(fn($item) => $item->getDateRetourTimestamp(), $items);
......
......@@ -104,16 +104,13 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader
public function endLabel(string $data): self {
if ($this->_xml_parser->inParents('debt')
&& $this->_current_debt){
&& $this->_current_debt)
$this->_current_debt->setLabel(trim($data));
if ($this->_xml_parser->inParents('sendingChannel')
&& $this->_current_sending_channel)
$this->_current_sending_channel->setLabel($data);
return $this;
}
if ($this->_xml_parser->inParents('paymentReceiver')
&& $this->_payment_receiver)
$this->_payment_receiver->label = trim($data);
......
......@@ -1153,8 +1153,8 @@ class EmprAuthentifierResponse {
*/
public function createEmprunteur(){
$emprunteur = new Class_WebService_SIGB_Emprunteur(
$this->EmprAuthentifierResult->IDEmprunteur,
$this->EmprAuthentifierResult->IdentiteEmpr);
(string) $this->EmprAuthentifierResult->IDEmprunteur,
(string) $this->EmprAuthentifierResult->IdentiteEmpr);
$emprunteur
->setEmail($this->EmprAuthentifierResult->EmailEmpr ?? '')
->setNbReservations($this->EmprAuthentifierResult->NombreReservations ?? 0)
......
......@@ -36,8 +36,8 @@ class ZendAfi_View_Helper_ListeSuggestionAchat extends ZendAfi_View_Helper_BaseH
public function getListeSuggestion() {
$suggestions = $this->_user->getSuggestionAchat();
if ($this->isWebserviceError($suggestions))
return $this->renderWebserviceError($suggestions);
if ($this->_user->hasErrors())
return implode(' ', $this->_user->getErrors());
$nb_suggestions = count($suggestions);
$html = $this->_tag('span',
......@@ -49,18 +49,4 @@ class ZendAfi_View_Helper_ListeSuggestionAchat extends ZendAfi_View_Helper_BaseH
return $html . $this->view->suggestionAchat_Table($suggestions);
}
protected function isWebserviceError($response) {
return is_array($response)
&& array_key_exists('statut', $response)
&& false === $response['statut'];
}
protected function renderWebserviceError($response) {
return $this->_tag('div', $response['erreur']);
}
}
?>
\ No newline at end of file