Skip to content
Snippets Groups Projects
Commit cd7e43f5 authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT Committed by Patrick Barroca
Browse files

hotline#128431 : Notice : Item availability label and holdability could be...

hotline#128431 : Notice : Item availability label and holdability could be broken wehn barcode contains trailing spaces
parent 002914e5
Branches
Tags
1 merge request!3909hotline#128341 : Notice : Item availability label and holdability could be…
Pipeline #12779 passed with stage
in 54 minutes and 18 seconds
- ticket #128431 : Correction d'affichage du statut non disponible et de la réservabilité quand le code barre contient une espace
\ No newline at end of file
......@@ -162,7 +162,7 @@ class Class_WebService_SIGB_Exemplaire {
public function getNoticeOPAC() {
if (!isset($this->_notice_opac) &&
($exemplaire_opac = $this->getExemplaireOPAC()))
$this->_notice_opac = $exemplaire_opac->getNotice();
$this->setNoticeOPAC($exemplaire_opac->getNotice());
return $this->_notice_opac;
}
......@@ -203,15 +203,15 @@ class Class_WebService_SIGB_Exemplaire {
}
public function getBibliotheque(){
if (!$this->bibliotheque and ($exemplaire = $this->getExemplaireOPAC()))
$this->bibliotheque = $exemplaire->getBibLibelle();
public function getBibliotheque() {
if (!$this->bibliotheque && ($exemplaire = $this->getExemplaireOPAC()))
$this->setBibliotheque($exemplaire->getBibLibelle());
return $this->bibliotheque;
}
public function getAuteur(){
public function getAuteur() {
return $this->getNoticeOPAC()
? $this->_notice_opac->getAuteurPrincipal()
: $this->auteur;
......@@ -223,19 +223,19 @@ class Class_WebService_SIGB_Exemplaire {
}
public function setAuteur($auteur){
public function setAuteur($auteur) {
$this->auteur = $auteur;
return $this;
}
public function setSection($section){
public function setSection($section) {
$this->section = $section;
return $this;
}
public function getSection(){
public function getSection() {
return $this->section;
}
......@@ -246,7 +246,7 @@ class Class_WebService_SIGB_Exemplaire {
}
public function getDateRetour(){
public function getDateRetour() {
return $this->date_retour;
}
......@@ -262,16 +262,16 @@ class Class_WebService_SIGB_Exemplaire {
}
public function getCodeBarre(){
public function getCodeBarre() {
if (!$this->code_barre && ($ex_opac = $this->getExemplaireOPAC()))
$this->code_barre = $ex_opac->getCodeBarres();
$this->setCodeBarre($ex_opac->getCodeBarres());
return $this->code_barre;
}
public function setCodeBarre($code_barre){
$this->code_barre = $code_barre;
public function setCodeBarre($code_barre) {
$this->code_barre = trim($code_barre);
return $this;
}
......@@ -284,7 +284,7 @@ class Class_WebService_SIGB_Exemplaire {
public function getCote() {
if (!$this->_cote && ($item = $this->getExemplaireOPAC()))
$this->_cote = $item->getCote();
$this->setCote($item->getCote());
return $this->_cote;
}
......@@ -301,7 +301,7 @@ class Class_WebService_SIGB_Exemplaire {
}
public function getId(){
public function getId() {
return $this->id;
}
......@@ -323,8 +323,10 @@ class Class_WebService_SIGB_Exemplaire {
public function getDisponibilite() {
if ($this->_isEnPret)
return $this->disponibilite;
if (null !== $this->_disponibiliteLabel)
return $this->_disponibiliteLabel;
return $this->disponibilite;
}
......@@ -395,23 +397,28 @@ class Class_WebService_SIGB_Exemplaire {
return $this;
}
public function setDisponibiliteExcluDuPret() {
$this->setDisponibilite($this->message('DISPO_EXCLU_DU_PRET'));
return $this;
}
public function setDisponibilite($disponibilite){
public function setDisponibilite($disponibilite) {
$this->disponibilite = $disponibilite;
if ($this->disponibilite == "") $this->setDisponibiliteLibre();
if ($this->disponibilite == "")
$this->setDisponibiliteLibre();
return $this;
}
public function setNbReservations($nb_resas) {
$this->nb_resas = $nb_resas;
return $this;
}
public function getNbReservations() {
return $this->nb_resas;
}
......@@ -461,13 +468,13 @@ class Class_WebService_SIGB_Exemplaire {
}
public function setReservable($reservable){
public function setReservable($reservable) {
$this->reservable = ($reservable == "true");
return $this;
}
public function beReservable(){
public function beReservable() {
return $this->setReservable(true);
}
......@@ -486,7 +493,7 @@ class Class_WebService_SIGB_Exemplaire {
/**
* @return bool
*/
public function isReservable(){
public function isReservable() {
if (isset($this->reservable))
return $this->reservable;
......@@ -503,14 +510,14 @@ class Class_WebService_SIGB_Exemplaire {
public function setConsultationAvailable($bool = true) {
$this->consultation=$bool;
$this->consultation = $bool;
}
/**
* @return bool
*/
public function isPilonne(){
public function isPilonne() {
return $this->getDisponibilite() == $this->message('DISPO_PILONNE');
}
......@@ -519,22 +526,24 @@ class Class_WebService_SIGB_Exemplaire {
return (null !== $this->getId());
}
public function isDisponible() {
return $this->message('DISPO_LIBRE') == $this->disponibilite;
}
/** @codeCoverageIgnore */
public function __toString(){
public function __toString() {
$str = $this->titre;
if (isset($this->id)) $str.=" #".$this->id.",";
if (isset($this->id))
$str.=" #".$this->id.",";
$str .= ' Reservable: '.($this->isReservable() ? 'true' : 'false').",";
$str .= ' Disponibilite: '.$this->getDisponibilite();
$str .= ' Section:'.$this->getSection();
$str .= ' Bibliothèque:'.$this->getBibliotheque();
$str .= ' Auteur:'.$this->getAuteur();
return $str;
}
}
?>
......@@ -827,7 +827,7 @@ class KohaFixtures {
<ccode>ROMJEUN</ccode>
<itemcallnumber>JR ROW h</itemcallnumber>
<date_due></date_due>
<barcode>2661660439</barcode>
<barcode>2661660439 </barcode>
<itemlost>0</itemlost>
<datelastseen>2011-02-18</datelastseen>
<homebranch>BDM</homebranch>
......
<?php
/**
* Copyright (c) 2012-2021, 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
*/
require_once 'tests/fixtures/KohaFixtures.php';
class WebService_SIGB_NoticeCacheTest extends ModelTestCase {
protected $_exemplaire;
public function setUp() {
parent::setUp();
Class_Profil::setCurrentProfil($this->fixture('Class_Profil',
['id' => 1,
'libelle' => 'Actu']));
$this->mock_web_client = $this->mock();
$this->service = Class_WebService_SIGB_Koha::getService(['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl']);
$this->service->setWebClient($this->mock_web_client);
$this->mock_web_client
->whenCalled('open_url')
->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=33233')
->answers(KohaFixtures::xmlGetRecordHarryPotter());
$notice_cache = new Class_WebService_SIGB_NoticeCache($this->service);
$this->_exemplaire = $notice_cache->getExemplaire('33233', '2661660439');
}
/**
* @see https://forge.afi-sa.net/issues/128431
* @test
*/
public function exemplaireShouldBeValid() {
$this->assertTrue($this->_exemplaire->isValid());
}
}
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