Commit 1375d13b authored by Laurent's avatar Laurent

hotline #114506 a loan in history should not be late

parent 1246e123
Pipeline #10847 passed with stage
in 46 minutes and 24 seconds
- ticket #114506 : historique des prêts : n'affiche plus la mention "en retard"
\ No newline at end of file
......@@ -64,6 +64,7 @@ class Class_WebService_SIGB_Carthame_AccountResponseReader {
public function endF490() {
$this->_current_emprunt->beReturned()->beNotRenewable();
$this->_emprunteur->addLoansHistory($this->_current_emprunt);
}
......
......@@ -21,6 +21,7 @@
class Class_WebService_SIGB_Emprunt extends Class_WebService_SIGB_ExemplaireOperation {
protected $enRetard;
protected $_returned = false;
protected $renewable = true;
protected $type = '';
......@@ -47,6 +48,12 @@ class Class_WebService_SIGB_Emprunt extends Class_WebService_SIGB_ExemplaireOper
}
public function beReturned() {
$this->_returned = true;
return $this;
}
/**
* @return int
*/
......@@ -94,12 +101,15 @@ class Class_WebService_SIGB_Emprunt extends Class_WebService_SIGB_ExemplaireOper
*/
public function enRetard() {
if (!isset($this->enRetard)) {
$this->enRetard = ($this->getDateRetourTimestamp() <= strtotime('Yesterday'));
$this->enRetard = (!$this->_returned)
&&
($this->getDateRetourTimestamp() <= strtotime('Yesterday'));
}
return $this->enRetard;
}
public function isLate() {
return $this->enRetard();
}
......
......@@ -45,7 +45,8 @@ class Class_WebService_SIGB_Koha_LoansReader {
->setCodeBarre($data->barcode)
->setIssueDate($this->formatDate($data->issuedate))
->setDateRetour($data->returndate ? $this->formatDate($data->returndate) : '')
->beNotRenewable();
->beNotRenewable()
->beReturned();
return $loan;
}
......
......@@ -44,6 +44,7 @@ class Class_WebService_SIGB_Nanook_GetLoanHistoryReader {
public function startLoan() {
$this->_current_loan = Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire();
$this->_current_loan->beReturned();
$this->_loans_history->addLoan($this->_current_loan);
}
......
......@@ -858,6 +858,18 @@ class CarthameEmprunteurPatrickBTest extends CarthameOperationTestCase {
public function noticeIdForFirstHistoryShouldBeI210064() {
$this->assertEquals('I210064', $this->emprunteur->getLoansHistory()->getLoans()->first()->getNoNotice());
}
/** @test */
public function firstHistoryLoanShouldNotBeLate() {
$this->assertFalse($this->emprunteur->getLoansHistory()->getLoans()->first()->isLate());
}
/** @test */
public function firstHistoryLoanShouldNotBeRenewable() {
$this->assertFalse($this->emprunteur->getLoansHistory()->getLoans()->first()->isRenewable());
}
}
......
......@@ -525,6 +525,11 @@ class KohaRestGetUserHistoryTest extends KohaRestfulTestCase {
$this->assertEquals('22/07/2015', $this->loans_history->getLoans()[1]->getDateRetour());
}
/** @test */
public function firstLoanShouldNotBeLate() {
$this->assertFalse($this->loans_history->getLoans()[0]->isLate());
}
}
......
......@@ -1493,6 +1493,13 @@ class NanookLoanHistoryTest extends NanookTestCase {
$this->assertEquals(231645, $this->loans_history->getLoans()[0]->getId());
}
/** @test */
public function firstLoanIdShouldNotBeLate() {
$this->assertFalse($this->loans_history->getLoans()[0]->isLate());
}
/** @test */
public function noticeNumberShouldBe464732() {
$this->assertEquals(464732, $this->loans_history->getLoans()[0]->getNoNotice());
......
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