diff --git a/VERSIONS_WIP/111127 b/VERSIONS_WIP/111127 new file mode 100644 index 0000000000000000000000000000000000000000..6c83c2926799964a5e451f3b9b639c8d72f6115b --- /dev/null +++ b/VERSIONS_WIP/111127 @@ -0,0 +1 @@ + - ticket #111127 : Drive : ajout des colonnes Section et Emplacement dans l'export des documents \ No newline at end of file diff --git a/library/Class/DriveCheckout.php b/library/Class/DriveCheckout.php index 0526f2d36d6bbcb8492a682def826156a6faefcb..176dea8046aa649a2bdd108475ac37852377da06 100644 --- a/library/Class/DriveCheckout.php +++ b/library/Class/DriveCheckout.php @@ -167,68 +167,4 @@ class Class_DriveCheckout extends Storm_Model_Abstract { public function notify() { return (new Class_DriveCheckout_Notification($this))->send(); } -} - - - - -class Class_DriveCheckout_Hold { - protected - $_checkout, - $_hold, - $_item; - - public function __construct($checkout, $hold) { - $this->_checkout = $checkout; - $this->_hold = $hold; - $this->_item = $hold->getExemplaireOPAC($checkout->getUser()); - } - - - public function getStartAt() { - return $this->_checkout->getStartAt(); - } - - - public function getIdAbon() { - return $this->_checkout->getIdAbon(); - } - - - public function getNomComplet() { - return $this->_checkout->getNomComplet(); - } - - - public function getCote() { - return $this->_item - ? $this->_item->getCote() - : $this->_hold->getCote(); - } - - - public function getStatus() { - return $this->_hold->getEtat(); - } - - - public function getCodeBarres() { - return $this->_item - ? $this->_item->getCodeBarres() - : $this->_hold->getCodeBarre(); - } - - - public function getTitle() { - return $this->_item - ? $this->_item->getTitrePrincipal() - : $this->_hold->getTitre(); - } - - - public function getRecord() { - return $this->_item - ? $this->_item->getNotice() - : null; - } } \ No newline at end of file diff --git a/library/Class/DriveCheckout/Hold.php b/library/Class/DriveCheckout/Hold.php new file mode 100644 index 0000000000000000000000000000000000000000..b5690377a5d0d416480e8eaea81cd9c5ba809cd5 --- /dev/null +++ b/library/Class/DriveCheckout/Hold.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright (c) 2012-2020, 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 + */ + + +class Class_DriveCheckout_Hold { + protected + $_checkout, + $_hold, + $_item; + + public function __construct($checkout, $hold) { + $this->_checkout = $checkout; + $this->_hold = $hold; + $this->_item = $hold->getExemplaireOPAC($checkout->getUser()); + } + + + public function getStartAt() { + return $this->_checkout->getStartAt(); + } + + + public function getIdAbon() { + return $this->_checkout->getIdAbon(); + } + + + public function getNomComplet() { + return $this->_checkout->getNomComplet(); + } + + + public function getCote() { + return $this->_item + ? $this->_item->getCote() + : $this->_hold->getCote(); + } + + + public function getStatus() { + return $this->_hold->getEtat(); + } + + + public function getCodeBarres() { + return $this->_item + ? $this->_item->getCodeBarres() + : $this->_hold->getCodeBarre(); + } + + + public function getTitle() { + return $this->_item + ? $this->_item->getTitrePrincipal() + : $this->_hold->getTitre(); + } + + + public function getSectionLabel() { + if (!$this->_item || !$section_id = $this->_item->getSection()) + return ''; + + return ($section = Class_CodifSection::find($section_id)) + ? $section->getLibelle() + : ''; + } + + + public function getEmplacementLabel() { + if (!$this->_item || !$emplacement_id = $this->_item->getEmplacement()) + return ''; + + return ($emplacement = Class_CodifEmplacement::find($emplacement_id)) + ? $emplacement->getLibelle() + : ''; + } + + + public function getRecord() { + return $this->_item + ? $this->_item->getNotice() + : null; + } +} \ No newline at end of file diff --git a/library/Class/TableDescription/DriveCheckout/Holds.php b/library/Class/TableDescription/DriveCheckout/Holds.php index 7fcfd881fd621ab9b108aa44f8a3dc3edabaec59..acb1d31f13cc46768347ab4e366b85dec49648ef 100644 --- a/library/Class/TableDescription/DriveCheckout/Holds.php +++ b/library/Class/TableDescription/DriveCheckout/Holds.php @@ -23,6 +23,12 @@ class Class_TableDescription_DriveCheckout_Holds extends Class_TableDescription { public function init() { $this + ->addColumn($this->_('Section'), + function($hold) { return $hold->getSectionLabel(); }) + + ->addColumn($this->_('Emplacement'), + function($hold) { return $hold->getEmplacementLabel(); }) + ->addColumn($this->_('Cote'), function($hold) { return $hold->getCote(); }) diff --git a/library/Class/TableDescription/DriveCheckout/HoldsWithCheckouts.php b/library/Class/TableDescription/DriveCheckout/HoldsWithCheckouts.php index 62257a5fb78f223fb5f558db8552a5362260eb3e..cba0bb694df2a3a1bfa9bed46b732ceb72b611b5 100644 --- a/library/Class/TableDescription/DriveCheckout/HoldsWithCheckouts.php +++ b/library/Class/TableDescription/DriveCheckout/HoldsWithCheckouts.php @@ -31,6 +31,10 @@ class Class_TableDescription_DriveCheckout_HoldsWithCheckouts extends Class_Tabl function($hold) { return $hold->getIdabon(); }) ->addColumn($this->_('Abonné'), function($hold) { return $hold->getNomComplet(); }) + ->addColumn($this->_('Section'), + function($hold) { return $hold->getSectionLabel(); }) + ->addColumn($this->_('Emplacement'), + function($hold) { return $hold->getEmplacementLabel(); }) ->addColumn($this->_('Cote'), function($hold) { return $hold->getCote(); }) diff --git a/tests/scenarios/DriveCheckOut/DriveCheckoutAdminControllerTest.php b/tests/scenarios/DriveCheckOut/DriveCheckoutAdminControllerTest.php index a19005ead070fff82c2afee64f2c795334e21cc1..bdc2fab554ee08d94d2d8dc1346807cdb8f9d9af 100644 --- a/tests/scenarios/DriveCheckOut/DriveCheckoutAdminControllerTest.php +++ b/tests/scenarios/DriveCheckOut/DriveCheckoutAdminControllerTest.php @@ -76,6 +76,16 @@ abstract class DriveCheckOutAdminControllerTestCase extends Admin_AbstractContro 'idabon' => 'A123', 'bib' => $lib_hotel_dieu]); + + $this->fixture('Class_CodifSection', + ['id' => 3, + 'libelle' => 'Jeunesse']); + + $this->fixture('Class_CodifEmplacement', + ['id' => 2, + 'libelle' => 'BD', + 'regles' => '995$e=bd']); + $maurice = $this->fixture('Class_Users', ['id' => 4, 'login' => 'maurice', @@ -93,6 +103,8 @@ abstract class DriveCheckOutAdminControllerTestCase extends Admin_AbstractContro 'notice' => $this->fixture('Class_Notice', ['id' => 123, 'titre_principal' => 'Tintin à Dole']), + 'emplacement' => 2, + 'section' => 3, 'cote' => 'BD2'])) ->setBibliotheque($lib_camus->getLibelle()) ->setCodeBarre('tintin123') @@ -371,6 +383,12 @@ class DriveCheckoutAdminControllerListHoldsForCheckoutThreeTest extends DriveChe } + /** @test */ + public function tableShouldContainsHoldOnTintinWithSectionAndEmplacement() { + $this->assertXPath('//table//td[text()="Jeunesse"]/following-sibling::td[text()="BD"]/following-sibling::td[text()="BD2"]'); + } + + /** @test */ public function tableShouldNotContainsHoldOnTournesol() { $this->assertNotXPath('//table//td[contains(text(),"Tournesol")]'); @@ -432,10 +450,10 @@ class DriveCheckoutAdminControllerExportItemsCSVCamusOnMayFourteenthTest extends /** @test */ public function csvShouldContainsTintinMilouAndDupontItems() { - $this->assertEquals("Jour;Heure;Carte;Abonné;Cote;Code-barres;Titre\n" - . "\"14 mai\";09:00;A124;maurice;BD2;tintin123;\"Tintin à Dole\"\n" - . "\"14 mai\";09:00;A124;maurice;;milou123;\"Milou à Dole\"\n" - . "\"14 mai\";09:00;A124;maurice;;dupont123;\"Dupont à Dole\"\n", + $this->assertEquals("Jour;Heure;Carte;Abonné;Section;Emplacement;Cote;Code-barres;Titre\n" + . "\"14 mai\";09:00;A124;maurice;Jeunesse;BD;BD2;tintin123;\"Tintin à Dole\"\n" + . "\"14 mai\";09:00;A124;maurice;;;;milou123;\"Milou à Dole\"\n" + . "\"14 mai\";09:00;A124;maurice;;;;dupont123;\"Dupont à Dole\"\n", $this->_response->getBody()); } }