Commit 7cf489db authored by Ghislain Loas's avatar Ghislain Loas
Browse files

holtine #50082 revert passing user to helpers

parent 123dcd17
Pipeline #336 failed with stage
in 8 minutes and 29 seconds
......@@ -999,7 +999,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$datas = [];
$emprunts = $this->_user->getLoansWithoutPNB();
foreach($emprunts as $emprunt) {
if (!$exemplaire = Class_Exemplaire::findFirstBySIGBOperation($this->_user, $emprunt))
if (!$exemplaire = $emprunt->getExemplaireOPAC())
continue;
$datas[] = $exemplaire->toUnimarcIso2709();
......
......@@ -6,7 +6,7 @@ if ($this->error)
$this->error,
['class' => 'error']);
echo $this->abonne_Loans($this->user, ($this->loans ? $this->loans : []), false);
echo $this->abonne_Loans(($this->loans ? $this->loans : []), false);
$this->closeBoite();
echo $this->abonne_RetourFiche();
......
......@@ -29,13 +29,13 @@ if ($emprunts = $this->user->getEmprunts()) {
echo $this->abonne_LoanExport();
}
echo $this->abonne_Loans($this->user, $loans);
echo $this->abonne_Loans($loans);
echo $extend_all;
if($this->user->hasPNB()) {
echo $this->tag('h2', $this->_('Prêts numériques en cours'));
echo $this->abonne_LoansPNB($this->user, $this->user->getPNBLoans());
echo $this->abonne_LoansPNB($this->user->getPNBLoans());
}
$this->closeBoite();
......
......@@ -6,7 +6,7 @@ $this->openBoite($this->_('Réservations en cours'));
echo $this->tag('div', $this->user->getNomAff(), ['class' => 'abonneTitre']);
$cards = new Class_User_Cards($this->user);
echo $this->abonne_ReservationsTable($this->user, $cards->getHolds(), $this->fiche);
echo $this->abonne_ReservationsTable($cards->getHolds(), $this->fiche);
$this->closeBoite();
......
......@@ -38,10 +38,10 @@ $nb_resas = $this->user->getNbReservations();
?>
<?php
echo $this->abonne_Loans($this->user, $cards->getLoansWithOutPNB(), $this->_('Mes prêts'));
echo $this->abonne_Loans($cards->getLoansWithOutPNB(), $this->_('Mes prêts'));
if ($this->user->hasPNB())
echo $this->abonne_Loans($this->user, $this->user->getPNBLoans(), $this->_('Mes prêts numériques'));
echo $this->abonne_Loans($this->user->getPNBLoans(), $this->_('Mes prêts numériques'));
echo $this->abonne_Holds($this->user, $cards->getHolds());
echo $this->abonne_Holds($cards->getHolds());
?>
......@@ -101,7 +101,7 @@ class Class_WebService_SIGB_Exemplaire {
if($this->_exemplaire_opac)
return $this->_exemplaire_opac;
$operation = (new Class_Entity())->updateAttributes(['CodeBarres' => $this->code_barre,
$operation = (new Class_Entity())->updateAttributes(['CodeBarre' => $this->code_barre,
'NoNotice' => $this->no_notice]);
return Class_Exemplaire::findFirstBySIGBOperation(Class_Users::getIdentity(), $operation);
}
......
......@@ -25,13 +25,13 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_BaseHelper {
$_line_no,
$_in_progress;
public function abonne_Loans($user, $loans, $in_progress = true) {
public function abonne_Loans($loans, $in_progress = true) {
$this->_in_progress = $in_progress;
Class_ScriptLoader::getInstance()->loadTableSorter();
return
$this->_tag('table',
$this->renderHeader()
. $this->renderLoans($user, $loans),
. $this->renderLoans($loans),
['class' => $this->_in_progress ? 'tablesorter loans' : 'tablesorter loans-history']);
}
......@@ -61,7 +61,7 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_BaseHelper {
}
protected function renderLoans($user, $loans) {
protected function renderLoans($loans) {
$this->_line_no = 1;
$html = '';
......@@ -69,17 +69,17 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_BaseHelper {
$loans = array_reverse($loans->getArrayCopy());
foreach($loans as $loan)
$html .= $this->renderLoan($user, $loan);
$html .= $this->renderLoan($loan);
return $this->_tag('tbody', $html);
}
protected function renderLoan($user, $loan) {
protected function renderLoan($loan) {
$record_title = $loan->getTitre();
$record = new Class_Entity();
if($item = Class_Exemplaire::findFirstBySIGBOperation($user, $loan))
if($item = $loan->getExemplaireOPAC())
$record = $item->getNotice();
if ($record->getId())
......
......@@ -77,7 +77,7 @@ class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_Base
continue;
$record = new Class_Entity();
if($item = Class_Exemplaire::findFirstBySIGBOperation($this->_user, $loan))
if($item = $loan->getExemplaireOPAC())
$record = $item->getNotice();
$title = $record->getId()
......
......@@ -21,8 +21,8 @@
class ZendAfi_View_Helper_Abonne_LoansPNB extends ZendAfi_View_Helper_Abonne_Loans {
public function abonne_LoansPNB($user, $loans, $in_progress = true) {
return parent::abonne_Loans($user, $loans, $in_progress);
public function abonne_LoansPNB($loans, $in_progress = true) {
return parent::abonne_Loans($loans, $in_progress);
}
......@@ -35,7 +35,7 @@ class ZendAfi_View_Helper_Abonne_LoansPNB extends ZendAfi_View_Helper_Abonne_Loa
}
protected function renderLoan($user, $loan) {
protected function renderLoan($loan) {
$record_title = $loan->getTitre();
if ($record_id = $loan->getNoticeOPACId())
......
......@@ -23,11 +23,11 @@
class ZendAfi_View_Helper_Abonne_ReservationsTable extends ZendAfi_View_Helper_BaseHelper {
protected $_line_no;
public function abonne_ReservationsTable($user, $reservations, $fiche) {
public function abonne_ReservationsTable($reservations, $fiche) {
Class_ScriptLoader::getInstance()->loadTableSorter();
return $this->_tag('table',
$this->_renderHeader()
. $this->_renderReservations($user, $reservations, $fiche),
. $this->_renderReservations($reservations, $fiche),
['class' => 'tablesorter reservations']);
}
......@@ -54,21 +54,21 @@ class ZendAfi_View_Helper_Abonne_ReservationsTable extends ZendAfi_View_Helper_B
}
protected function _renderReservations($user, $reservations, $fiche) {
protected function _renderReservations($reservations, $fiche) {
$html = '';
$html .= (isset($fiche['message']) && $fiche['message'] ? $this->_renderError($fiche['message']) : '');
$html .= (isset($fiche['erreur']) && $fiche['erreur'] ? $this->_renderError($fiche['erreur']) : '');
$this->_line_no = 1;
foreach($reservations as $reservation)
$html .= $this->_renderReservation($user, $reservation);
$html .= $this->_renderReservation($reservation);
return $this->_tag('tbody', $html);
}
protected function _renderReservation($user, $reservation) {
protected function _renderReservation($reservation) {
$record = new Class_Entity();
if($item = Class_Exemplaire::findFirstBySIGBOperation($user, $reservation))
if($item = $reservation->getExemplaireOPAC())
$record = $item->getNotice();
return
......@@ -140,13 +140,13 @@ class ZendAfi_View_Helper_Abonne_ReservationsTable extends ZendAfi_View_Helper_B
class ZendAfi_View_Helper_Abonne_OnPlaceConsultationReservationsTable extends ZendAfi_View_Helper_Abonne_ReservationsTable {
public function abonne_OnPlaceConsultationReservationsTable($user, $reservations, $fiche) {
public function abonne_OnPlaceConsultationReservationsTable($reservations, $fiche) {
if (isset($reservations['erreur']))
return '';
Class_ScriptLoader::getInstance()->loadTableSorter();
return $this->_tag('table',
$this->_renderHeader() . $this->_renderReservations($user, $reservations, $fiche),
$this->_renderHeader() . $this->_renderReservations($reservations, $fiche),
['class' => 'tablesorter reservations']);
}
......@@ -171,7 +171,7 @@ class ZendAfi_View_Helper_Abonne_OnPlaceConsultationReservationsTable extends Ze
}
protected function _renderReservation($user, $reservation) {
protected function _renderReservation($reservation) {
$record = $reservation->getRecord();
return
$this->_tag('tr',
......
......@@ -31,10 +31,7 @@ class ZendAfi_View_Helper_Accueil_Reservations extends ZendAfi_View_Helper_Accue
public function renderModelReservations($user, $reservations) {
$html = '';
foreach ($reservations as $reservation) {
$record = null;
if($item = Class_Exemplaire::findFirstBySIGBOperation($user, $reservation))
$record = $item->getNotice();
$record = Class_Notice::find($reservation->getNoticeOPACId());
$html .= $this->renderElement($reservation->getTitre(),
$reservation->getEtat(),
$record);
......
......@@ -23,10 +23,10 @@
class ZendAfi_View_Helper_Telephone_Abonne_Holds extends ZendAfi_View_Helper_Telephone_Abonne_Operations {
public function Abonne_Holds($user, $holds) {
public function Abonne_Holds($holds) {
$this->_title = $this->_('Mes réservations');
$this->_no_operation_text = $this->_('Vous n\'avez aucune reservation en cours');
return $this->abonne_Operations($user, $holds);
return $this->abonne_Operations($holds);
}
......
......@@ -22,10 +22,10 @@
class ZendAfi_View_Helper_Telephone_Abonne_Loans extends ZendAfi_View_Helper_Telephone_Abonne_Operations {
public function abonne_Loans($user, $loans, $title) {
public function abonne_Loans($loans, $title) {
$this->_no_operation_text = $this->_('Vous n\'avez aucun prêt en cours');
$this->_title = $title;
return $this->abonne_Operations($user, $loans);
return $this->abonne_Operations($loans);
}
......
......@@ -24,12 +24,10 @@ class ZendAfi_View_Helper_Telephone_Abonne_Operations extends ZendAfi_View_Helpe
protected
$_operations = [],
$_title = '',
$_no_operation_text = '',
$_user;
$_no_operation_text = '';
public function abonne_Operations($user, $operations) {
public function abonne_Operations($operations) {
$this->_operations = $operations;
$this->_user = $user;
return $this->_tag('ul',
$this->_renderTitle() . $this->_renderOperations(),
['data-role' => 'listview',
......
......@@ -42,8 +42,8 @@ abstract class AbonneControllerLoansHistoryTestCase extends AbstractControllerTe
'login' => 'faustine',
'password' => 'toto',
'int_bib' => $library]);
$this->_emprunteur = new Class_WebService_SIGB_Emprunteur('34', 'faustine');
$this->_emprunteur = new Class_WebService_SIGB_Emprunteur('34', 'faustine');
$faustine->setFicheSigb(['type_comm' => Class_IntBib::COM_KOHA,
'fiche' => $this->_emprunteur]);
......@@ -55,11 +55,11 @@ abstract class AbonneControllerLoansHistoryTestCase extends AbstractControllerTe
$params = ['url_serveur' => static::BASE_URL . 'ilsdi.pl',
'restful' => '1'];
$service = Class_WebService_SIGB_Koha::getService($params);
$service->setWebClient($this->mock_web_client);
$this->_emprunteur->setService($service);
}
}
......
......@@ -130,6 +130,7 @@ abstract class AbonneControllerPretsListThreePretsTestCase extends AbstractAbonn
'notice' => $this->fixture('Class_Notice',
['id' => 889,
'titre_principal' => 'Potter',
'type_doc' => Class_TypeDoc::LIVRE,
'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103  aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm'])]));
$potter->parseExtraAttributes(['Dateretourprevue' => '29/10/2022',
......
......@@ -674,6 +674,12 @@ class CommSigbWithNotAbonneTest extends ModelTestCase {
}
public function tearDown() {
$this->comm_sigb = null;
parent::tearDown();
}
/** @test */
public function prolongerPretShouldReturnError() {
$this->assertEquals(['erreur' => 'Communication SIGB indisponible'],
......
......@@ -20,21 +20,8 @@
*/
include_once('MicrobibFixtures.php');
abstract class MicrobibServiceIntegrationTest extends PHPUnit_Framework_TestCase {
/** @test */
public function infoExemplairesWithRealServer() {
Class_WebService_SIGB_Microbib::reset();
$microbib = Class_WebService_SIGB_Microbib::getService(array('url_serveur' => 'http://80.11.188.93/webservices/ws_maze.wsdl'));
$notice = $microbib->getNotice('5204');
$this->assertEquals(2, count($notice->getExemplaires()));
}
}
abstract class MicrobibServiceTestCase extends PHPUnit_Framework_TestCase {
abstract class MicrobibServiceTestCase extends Storm_Test_ModelTestCase {
protected $_storm_default_to_volatile = true;
protected $_search_client;
protected $_microbib;
......
......@@ -83,7 +83,7 @@ class ReservationsTableTest extends ViewHelperTestCase {
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$cards = new Class_User_Cards($user);
$this->_html = $helper->abonne_ReservationsTable($user, $cards->getHolds(), $user->getFicheSigb());
$this->_html = $helper->abonne_ReservationsTable($cards->getHolds(), $user->getFicheSigb());
}
......
......@@ -35,15 +35,15 @@ class ReservationsTestWithConnectedUser extends ViewHelperTestCase {
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$propaganda = new Class_WebService_SIGB_Reservation('13', new Class_WebService_SIGB_Exemplaire(456));
$propaganda->getExemplaire()
->setTitre('Propaganda')
->setNoticeOPAC(Class_Notice::newInstanceWithId(1234));
->setTitre('Propaganda')
->setNoticeOPAC(Class_Notice::newInstanceWithId(1234)->setTitrePrincipal('Propaganda'));
$propaganda->setEtat('Pas disponible');
$en_suivant_emma = new Class_WebService_SIGB_Reservation('13', new Class_WebService_SIGB_Exemplaire(456));
$en_suivant_emma->getExemplaire()
->setTitre('En suivant Emma')
->setNoticeOPAC(Class_Notice::newInstanceWithId(333));
->setNoticeOPAC(Class_Notice::newInstanceWithId(333)->setTitrePrincipal('En suivant Emma'));
$en_suivant_emma->setEtat('Disponible');
$emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Estelle');
......
Markdown is supported
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