Commit 6e55492e authored by Laurent's avatar Laurent

Merge branch 'hotline'

parents e91c4200 438a94ad
Pipeline #5870 passed with stage
in 30 minutes and 59 seconds
......@@ -3,7 +3,7 @@ RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(google[a-z0-9]+\.html|.*/xhprof_html|ckeditor|exploit|\.well-known)
RewriteCond %{REQUEST_FILENAME} !^.*/robots\.txt$ [NC]
RewriteRule !(userfiles|public|tmp|temp|skins|library/templates|library/digital_resources/.*/js)/.*\.(js|ico|txt|gif|jpg|jpeg|png|css|xml|swf|mov|pdf|doc|docx|woff|woff2|eot|svg|ttf|xls|wsdl|mp3|m4v|ogg|ogv|epub|htm|html|xhtml|asmx|zip|sql|bro|flv|mp4|webm|tgz|json|geojson|xsl)$ index.php [NC,NE]
RewriteRule !(userfiles|public|tmp|temp|skins|library/templates|library/digital_resources/.*/js)/.*\.(js|ico|txt|gif|jpg|jpeg|png|css|xml|swf|mov|pdf|doc|docx|woff|woff2|eot|svg|ttf|xls|xlsx|wsdl|mp3|m4v|ogg|ogv|epub|htm|html|xhtml|asmx|zip|sql|bro|flv|mp4|webm|tgz|json|geojson|xsl)$ index.php [NC,NE]
AddType application/x-javascript .js
AddType text/css .css
......
08/01/2019 - v7.12.52
- ticket #81938 : correction de la sauvegarde du paramétrage des boîtes qui pouvait échouer dans certaines conditions
- ticket #82346 : Configuration : autorisation de téléversement des fichiers .xslx dans la liste des fichiers autorisés
- ticket #83536 : Boite Avis : ajout du contexte de retour manquant dans les liens vers les notices
- ticket #83674 : SIGB Opsys : suppression de l'identification par le numéro de carte abonné lorsqu'il était différent de l'identifiant
- ticket #84068 : SIGB Orphee: correction du fonctionnement lorque le webservice n'utilise pas de mots de passe
20/12/2018 - v7.12.51
- ticket #83526 : Cosmogramme : SIGB Nanook : Amélioriation de la mise à jour de l'étalon lors de la modification des libellés de sections, genres et emplacements
......
......@@ -301,6 +301,4 @@ class Admin_WidgetController extends ZendAfi_Controller_Action {
public function formProvider($widget) {
return call_user_func_array([$widget->getForm(), 'newWith'], [$widget->forForm()]);
}
}
\ No newline at end of file
......@@ -102,7 +102,7 @@ class BlogController extends ZendAfi_Controller_Action {
public function viewcritiquesAction() {
$this->view->page = $this->_getParam('page', 1);
$id_module = (int)$this->_getParam('id_module');
$this->view->id_module = $id_module = (int)$this->_getParam('id_module');
$profil = Class_Profil::getCurrentProfil();
$preferences = $profil->getModuleAccueilPreferences($id_module, 'CRITIQUES');
......
<?php
$this->openBoite($this->title);
if(is_array($this->liste_avis))
{
if (is_array($this->liste_avis)) {
$helper = $this->getHelper('Avis');
if ($this->id_module)
$helper->addUrlContext(['retour_avis' => $this->id_module]);
$html_avis = [];
foreach($this->liste_avis as $avis)
$html_avis []= $this->avis($avis);
$html_avis []= $helper->avis($avis);
echo implode('<div class="separator"></div>', $html_avis);
}
echo BR.'<div align="center" style="width:100%">'.$this->pager($this->total,$this->config['nb_display'],$this->page,$this->params_url ).'</div>';
echo BR . $this->tag('div',
$this->pager($this->total,
$this->config['nb_display'],
$this->page,
$this->params_url),
['align' => 'center',
'style' => 'width:100%s']);
$this->closeBoite();
?>
......@@ -42,7 +42,7 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M
public function updateHook($datas) {
foreach(['gauche', 'droite'] as $column) {
$key = 'col_' . $column .'_module_id';
$datas [$key] = $datas['preferences'][$key] = static::createModuleForCol($column, $datas, $datas['id_module'], $datas['profile_id']);
$datas [$key] = $datas['preferences'][$key] = static::createModuleForCol($column, $datas['preferences'], $datas['id_module'], $datas['profile_id']);
}
return $datas;
......
......@@ -145,9 +145,9 @@ class Class_Systeme_ModulesAccueil_Library extends Class_Systeme_ModulesAccueil_
public function updateHook($datas) {
if(array_key_exists('default_filters', $datas)
&& (!is_array($datas['default_filters'])))
$datas['default_filters'] = [];
if (array_key_exists('default_filters', $datas['preferences'])
&& (!is_array($datas['preferences']['default_filters'])))
$datas['preferences']['default_filters'] = [];
return $datas;
}
......
......@@ -61,13 +61,13 @@ class Class_Systeme_ModulesAccueil_MenuVertical extends Class_Systeme_ModulesAcc
public function updateHook($datas) {
if(!isset($datas['menu']))
if(!isset($datas['preferences']['menu']))
return $datas;
if(static::NEW_MENU != $datas['menu'])
if(static::NEW_MENU != $datas['preferences']['menu'])
return $datas;
$datas['menu'] = $this->_prefixMenu($this->addMenu());
$datas['preferences']['menu'] = $this->_prefixMenu($this->addMenu());
return $datas;
}
......
......@@ -52,11 +52,11 @@ class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccue
public function updateHook($datas) {
if(static::DISPLAY_HIERARCHY != $datas['type_aff'])
if(static::DISPLAY_HIERARCHY != $datas['preferences']['type_aff'])
return $datas;
if ($categories = explode('-', $datas['id_categorie']))
$datas['preferences']['id_categorie'] = $datas['id_categorie'] = $categories[0];
if ($categories = explode('-', $datas['preferences']['id_categorie']))
$datas['preferences']['id_categorie'] = $categories[0];
return $datas;
}
......
......@@ -41,4 +41,13 @@ class Class_Systeme_ModulesAccueil_Tags extends Class_Systeme_ModulesAccueil_Nul
'id_panier' => 0,
'id_catalogue' => 0];
}
public function updateHook($datas) {
if (isset($datas['preferences']['type_tags_codes'])) {
$datas['preferences']['type_tags'] = str_replace(';', '', $datas['preferences']['type_tags_codes']);
unset($datas['preferences']['type_tags_codes']);
}
return $datas;
}
}
\ No newline at end of file
......@@ -89,10 +89,10 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity {
protected function _getValues($attributes) {
return $this->_getWidgetResources()
->getValues(array_merge(isset($attributes['preferences'])
->getValues(array_merge($attributes,
isset($attributes['preferences'])
? $attributes['preferences']
: [],
$attributes));
: []));
}
......
......@@ -36,16 +36,34 @@ class Class_Systeme_Widget_Widget extends Class_Systeme_Widget_Abstract {
}
protected function _cleanRootAndPreferences($datas) {
$root_properties = ['type_module' => '',
'division' => '',
'id_module' => '',
'preferences' => '',
'parent_id' => '',
'type_menu' => '',
'libelle' => '',
'picto' => '',
'sous_menus' => []];
$cleaned_datas = array_intersect_key($datas, $root_properties);
$cleaned_datas['preferences'] = array_diff_key($datas,
$root_properties);
return $cleaned_datas;
}
protected function _update() {
$datas = array_merge($this->getLocalSettings(),
$this->getNewDatas());
$cleaned_datas = $this->_cleanRootAndPreferences(
array_merge($this->getLocalSettings(),
$this->getNewDatas()));
if(isset($datas['preferences']))
unset($datas['preferences']);
$cleaned_datas['profile_id'] = $this->getProfileId();
$datas = $this->_getWidgetResources()->updateHook($cleaned_datas);
$datas['preferences'] = $datas;
$datas['profile_id'] = $this->getProfileId();
$datas = $this->_getWidgetResources()->updateHook($datas);
$sub_menus = null;
if(isset($datas['children']))
$sub_menus = $this->_convertChildren($datas['children']);
......
......@@ -188,7 +188,6 @@ abstract class Class_WebService_SIGB_AbstractRESTService extends Class_WebServic
public function ilsdiGetPatronInfo($params, $reader, $error_tag='error') {
$emprunteur = Class_WebService_SIGB_Emprunteur::newInstance()->setService($this);
$params = array_merge(array('service' => 'GetPatronInfo'), $params);
$xml = $this->httpGet($params);
if (0 === strpos($xml, '<html>'))
......
......@@ -231,9 +231,8 @@ class Class_WebService_SIGB_Opsys_Service extends Class_WebService_SIGB_Abstract
* @return Class_WebService_SIGB_Emprunteur
*/
public function authentifierEmprunteur($user) {
$auth = new EmprAuthentifier($this->guid,
$user->hasIdabon() ? $user->getIdabon() : $user->getLogin(),
$user->getPassword());
$auth = new EmprAuthentifier($this->guid, $user->getLogin(), $user->getPassword());
try {
$auth_result = $this->search_client->EmprAuthentifier($auth);
} catch (Exception $e) {
......@@ -254,7 +253,6 @@ class Class_WebService_SIGB_Opsys_Service extends Class_WebService_SIGB_Abstract
$emprunteur->setEndDate($date_fin_abonnement);
}
if ($date_naissance = $entite_result->findAttribute('DateNaissance')) {
$date_naissance = implode('-', array_reverse(explode('/', $date_naissance)));
$emprunteur->setDateNaissance($date_naissance);
......
......@@ -163,7 +163,7 @@ class Class_WebService_SIGB_Orphee_Service extends Class_WebService_SIGB_Abstrac
protected function hasGetAdh() {
return $this->_search_client->hasFunction('GetAdh');
return $this->_search_client && $this->_search_client->hasFunction('GetAdh');
}
......
......@@ -55,14 +55,9 @@ class ZendAfi_Auth extends Zend_Auth {
public function newAuthDb() {
if ($this->_auth_db_adapter)
return $this->_auth_db_adapter;
$authAdapter = new ZendAfi_Auth_Adapter_DbTable(Zend_Db_Table::getDefaultAdapter());
$authAdapter->setTableName('bib_admin_users');
$authAdapter->setIdentityColumn('LOGIN');
$authAdapter->setCredentialColumn('PASSWORD');
return $this->_auth_db_adapter = $authAdapter;
return $this->_auth_db_adapter
? $this->_auth_db_adapter
: $this->_auth_db_adapter = new ZendAfi_Auth_Adapter_DbTable();
}
......
<?php
/**
* Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class ZendAfi_Auth_Adapter_Abstract implements Zend_Auth_Adapter_Interface {
protected
$_identity,
$_credential,
$_authenticated_user;
public function shouldBreakChain() {
return false;
}
/**
* @param string $identity
* @return Zend_Auth_Adapter_Abstract
*/
public function setIdentity($identity) {
$this->_identity = $identity;
return $this;
}
/**
* @param string $credential
* @return Zend_Auth_Adapter_Abstract
*/
public function setCredential($credential) {
$this->_credential = $credential;
return $this;
}
/**
* @return Std_Class
*/
public function getResultObject() {
return $this->_authenticated_user->toStdClass();
}
}
......@@ -19,34 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
class ZendAfi_Auth_Adapter_CommSigb extends ZendAfi_Auth_Adapter_Abstract {
protected
$_identity = null,
$_credential = null,
$_authenticated_user = null,
$_called_services = [];
/**
* @param string $identity
* @return Zend_Auth_Adapter_CommSigb
*/
public function setIdentity($identity) {
$this->_identity = $identity;
return $this;
}
/**
* @param string $credential
* @return Zend_Auth_Adapter_CommSigb
*/
public function setCredential($credential) {
$this->_credential = $credential;
return $this;
}
/**
* @return Zend_Auth_Result
*/
......@@ -145,6 +121,9 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
protected function _getUserFromSigbWithLibrary($user, $library) {
$this->_called_services[] = $service = $library->getSIGBComm();
if (!$service->providesAuthentication())
return;
if (!$loaner = $service->getEmprunteur($user))
return;
......@@ -206,12 +185,4 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
$this->_authenticated_user = $user;
return $result;
}
/**
* @return Std_Class
*/
public function getResultObject() {
return $this->_authenticated_user->toStdClass();
}
}
......@@ -20,43 +20,24 @@
*/
class ZendAfi_Auth_Adapter_DbTable extends Zend_Auth_Adapter_DbTable {
public function shouldBreakChain() {
return false;
}
class ZendAfi_Auth_Adapter_DbTable extends ZendAfi_Auth_Adapter_Abstract {
/**
* _authenticateCreateSelect() - This method creates a Zend_Db_Select object that
* is completely configured to be queried against the database.
*
* @return Zend_Db_Select
*/
protected function _authenticateCreateSelect() {
if (empty($this->_credentialTreatment)
|| (strpos($this->_credentialTreatment, "?") === false))
$this->_credentialTreatment = '?';
/** @return Zend_Auth_Result */
public function authenticate() {
$type = ($this->_authenticated_user = Class_Users::findFirstBy(['login' => $this->_identity,
'password' => $this->_credential,
'password not' => '']))
? Zend_Auth_Result::SUCCESS
: Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
$credentialExpression = new Zend_Db_Expr(
'(CASE WHEN ' .
$this->_zendDb->quoteInto(
$this->_zendDb->quoteIdentifier($this->_credentialColumn, true)
. ' = ' . $this->_credentialTreatment, $this->_credential
)
. ' THEN 1 ELSE 0 END) AS '
. $this->_zendDb->quoteIdentifier('zend_auth_credential_match')
);
return $this->_zendDb
->select()
->from($this->_tableName, array('*', $credentialExpression))
->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity)
->where($this->_zendDb->quoteIdentifier($this->_credentialColumn, true) . ' = ?', $this->_credential)
->where($this->_zendDb->quoteIdentifier($this->_credentialColumn, true) . ' <> ?', '');
return new Zend_Auth_Result($type, $this->_identity);
}
public function getResultObject() {
return $this->getResultRowObject(null,'password');
$object = parent::getResultObject();
unset($object->password);
return $object;
}
}
......@@ -81,7 +81,7 @@ class Bokeh_Engine {
function setupConstants() {
defineConstant('BOKEH_MAJOR_VERSION','7.12');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.51');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.52');
defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/');
......
......@@ -1061,7 +1061,7 @@ class ModoControllerDeleteExpiredRegistrationsTest extends Admin_AbstractControl
['id' => 1,
'login' => 'pwd',
'password' => 'pwd',
'date' => '2018-16-01',
'date' => '2048-12-01',
'mail' => 'pwd@afi-sa.fr']);
$this->fixture('Class_UsersNonValid',
......
......@@ -233,13 +233,13 @@ class WidgetControllerKioquePostTest extends WidgetControllerPostDispatchWidgetC
/** @test */
public function titleShouldBeTitreDuKiosque() {
$this->assertEquals('titre du /kiosque', $this->_saved_settings['titre']);
$this->assertEquals('titre du /kiosque', $this->_saved_settings['preferences']['titre']);
}
/** @test */
public function profilRedirectShouldBeTwelve() {
$this->assertEquals('12', $this->_saved_settings['profil_redirect']);
$this->assertEquals('12', $this->_saved_settings['preferences']['profil_redirect']);
}
}
......@@ -759,21 +759,6 @@ class WidgetControllerVerticalNavDispatchWithMenuFromOtherTest extends WidgetCon
class WidgetControllerTagsDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase {
public function setUp() {
$this->_type_module = 'TAGS';
parent::setUp();
}
/** @test */
public function tagSelectionChampsShouldBePresent() {
$this->assertXPathContentContains('//h2', 'Facettes disponibles');
}
}
class WidgetControllerLoginDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase {
public function setUp() {
......@@ -959,6 +944,85 @@ class WidgetControllerActivitiesPostDispatchTest extends WidgetControllerPostDis
class WidgetControllerTagsDispatchTest extends WidgetControllerDispatchWidgetConfigurationTestCase {
public function _stormHook() {
$tags = ['modules' => ['6' => ['division' => 3,
'id_module' => '6',
'type_module' => 'TAGS',
'type_tags' => 'AMDPZ',
'nombre' => 40,
'preferences' => ['type_tags' => 'AM',
'titre' => 'Des tags',
'nombre' => 10]]]];
$this
->_profil
->setCfgAccueil($tags)
->assertSave();
}
/** @test */
public function tagSelectionChampsShouldBePresent() {
$this->assertXPathContentContains('//h2', 'Facettes disponibles');
}
/** @test */
public function inputTitreShouldContainsDesTags() {
$this->assertXPath('//input[@name="titre"][@value="Des tags"]');
}
/** @test */
public function inputTypeTagsCodesShouldContainsAandM() {
$this->assertXPath('//input[@name="type_tags_codes"][@value="A;M"]');
}
/** @test */
public function inputNombreShouldHaveValueTen() {
$this->assertXPath('//input[@name="nombre"][@value="10"]');
}
}
class WidgetControllerTagsPostDispatchTest extends WidgetControllerPostDispatchWidgetConfigurationTestCase {
public function setUp() {
$this->_type_module = 'TAGS';
$this->_params = ['type_tags_codes' => 'A;M;S'];
parent::setUp();
}
/** @test */
public function typeTagsAMSShouldHaveBeenSaved() {
$this->assertEquals('AMS', $this->_saved_settings['preferences']['type_tags']);
}
/** @test */
public function typeTagsCodesAMSShouldHaveBeenRemovedFromPreferences() {
$this->assertFalse(isset($this->_saved_settings['preferences']['type_tags_codes']));
}
/** @test */
public function typeTagsCodesAMSShouldHaveBeenRemovedFromParams() {
$this->assertFalse(isset($this->_saved_settings['type_tags']));
}
/** @test */
public function preferencesShouldNotContainsDivision() {
$this->assertFalse(isset($this->_saved_settings['preferences']['division']));
}
}
abstract class WidgetControllerTwoWidgetsTestCase extends WidgetControllerWidgetConfigurationTestCase {
public function setUp() {
......@@ -1552,13 +1616,13 @@ class WidgetControllerLoginPostDispatchTest extends WidgetControllerPostDispatch
/** @test */
public function profilRedirectShouldBe678() {
$this->assertEquals(678, $this->_saved_settings['profil_redirect']);
$this->assertEquals(678, $this->_saved_settings['preferences']['profil_redirect']);
}
/** @test */
public function profilLogoutRedirectShouldBe345() {
$this->assertEquals(345, $this->_saved_settings['profil_logout_redirect']);
$this->assertEquals(345, $this->_saved_settings['preferences']['profil_logout_redirect']);
}
......@@ -1881,23 +1945,18 @@ class WidgetControllerDomainBrowserPostDispatchTest extends WidgetControllerPost
/** @test */
public function paramsShouldHaveBeenSaved() {
$this->assertEquals(array_merge($this->_params,
['boite' => '',
'division' => '3',
'id_module' => '6',
'type_module' => 'DOMAIN_BROWSER',
'preferences' => ['titre' => 'Mes Domaines',
'allow_breadcrumb' => '0',
'root_domain_id' => '10',
'display_mode' => '4',
'boite' => '',
'division' => '3',
'id_module' => '6',
'type_module' => 'DOMAIN_BROWSER',
'profile_id' => '5',
'tri' => 'annee desc'],
'profile_id' => '5',
'tri' => 'annee desc']),
$this->assertEquals(['division' => '3',
'id_module' => '6',
'type_module' => 'DOMAIN_BROWSER',
'preferences' => ['titre' => 'Mes Domaines',
'allow_breadcrumb' => '0',
'root_domain_id' => '10',
'display_mode' => '4',
'profile_id' => '5',
'tri' => 'annee desc',
'boite' => '',
],
'profile_id' => '5'],
$this->_saved_settings);
}
}
......@@ -2318,7 +2377,7 @@ class WidgetControllerWidgetAddWidgetFromTemplateTest extends WidgetControllerWi
/** @test */
public function opTimeoutShouldBeSix() {
$this->assertEquals(6,
$this->_module_config['op_timeout']);
$this->_module_config['preferences']['op_timeout']);
}
}
......
......@@ -661,14 +661,12 @@ abstract class ModuleSelectionCritiquesTestCase extends AvisControllersFixturesT
$preferences = ['modules' => [3 => ['division' => 2,
'type_module' => 'CRITIQUES',
'preferences' => ['titre' => 'Coups de coeur'
]
]]];
'preferences' => ['titre' => 'Coups de coeur']]]];
$profil = $this->fixture('Class_Profil',
['id'=>2,
['id' => 2,
'cfg_modules' => ['blog' => ['viewcritiques' => ['nb_display' => 2]]],
'cfg_accueil' => $preferences]);
}
}
......@@ -700,34 +698,49 @@ class AbonneControllerAvisBlogControllerViewCritiquesDefaultTest extends ModuleS
}
class AbonneControllerAvisBlogControllerViewCritiquesTest extends ModuleSelectionCritiquesTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/opac/blog/viewcritiques/id_profil/2/id_module/3');
}
public function testMilleniumIsHere() {
$this->assertQueryContentContains('h2', 'Millenium',$this->_response->getBody());
/** @test */
public function titleShouldBeCoupsDeCoeur() {
$this->assertXPathContentContains('//h1', 'Coups de coeur');
}
public function testPotterIsHere() {
$this->assertQueryContentContains('h2', 'Potter',$this->_response->getBody());
/** @test */
public function milleniumShouldBeDisplayed() {
$this->assertXPathContentContains('//h2', 'Millenium');
}