diff --git a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php index 08b03a7a44b02e8d45ee3550335d8b39f8640fa1..ef29d8959cd51f0c5785a0a94f8668c94dea8832 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php +++ b/module/VuFind/src/VuFind/ILS/Driver/KohaILSDI.php @@ -905,7 +905,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements $status = 'Lost/Missing'; } - $duedate_formatted = date_format(new \DateTime($duedate), "m/d/Y"); + $duedate_formatted = $this->displayDate($duedate); //Retrieving the full branch name if ($rowItem['HLDBRNCH'] == null) { @@ -1085,9 +1085,11 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements $sql = "SELECT al.amount*100 as amount, " . "al.amountoutstanding*100 as balance, al.accounttype as fine, " . "al.date as createdat, items.biblionumber as id, " . - "al.description as title " . + "al.description as title, issues.date_due as duedate, " . + "issues.issuedate as issuedate " . "FROM `accountlines` al " . "LEFT JOIN items USING (itemnumber) " . + "LEFT JOIN issues USING (issue_id) " . "WHERE al.borrowernumber = :id "; if (!$this->db) { $this->initDB(); @@ -1159,17 +1161,14 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements } $transactionLst[] = [ - 'amount' => $row['amount'], - 'checkout' => "N/A", - 'title' => $row['title'], - 'fine' => $fineValue, - 'balance' => $row['balance'], - 'createdate' => $row['createdat'], - 'duedate' => date_format( - new \DateTime($row['duedate']), "m/d/Y" - ), - 'duedate' => "N/A", - 'id' => isset($row['id']) ? $row['id'] : -1, + 'amount' => $row['amount'], + 'checkout' => $this->displayDateTime($row['issuedate']), + 'title' => $row['title'], + 'fine' => $fineValue, + 'balance' => $row['balance'], + 'createdate' => $this->displayDate($row['createdat']), + 'duedate' => $this->displayDate($row['duedate']), + 'id' => isset($row['id']) ? $row['id'] : -1, ]; } return $transactionLst; @@ -1208,7 +1207,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements 'checkout' => "N/A", 'fine' => $this->getField($fine->{'description'}), 'balance' => 100 * $this->getField($fine->{'amountoutstanding'}), - 'createdate' => $this->getField($fine->{'date'}), + 'createdate' => $this->displayDate($this->getField($fine->{'date'})), // FIXME: require accountlines.itemnumber -> issues.date_due data. 'duedate' => "N/A", // FIXME: require accountlines.itemnumber -> items.biblionumber data @@ -1244,10 +1243,13 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements $holdLst[] = [ 'id' => $this->getField($hold->{'biblionumber'}), 'location' => $this->getField($hold->{'branchname'}), - // FIXME: require exposure of reserves.expirationdate - 'expire' => "N/A", - 'create' => date_format( - new \DateTime($this->getField($hold->{'reservedate'})), "m/d/Y" + 'expire' => isset($hold->{'expirationdate'}) + ? $this->displayDate( + $this->getField($hold->{'expirationdate'}) + ) + : "N/A", + 'create' => $this->displayDate( + $this->getField($hold->{'reservedate'}) ), 'position' => $this->getField($hold->{'priority'}), 'title' => $this->getField($hold->{'title'}), @@ -1522,11 +1524,8 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements } $transactionLst[] = [ - 'duedate' => date_format( - new \DateTime( - $this->getField($loan->{'date_due'}) - ), - "m/d/Y" + 'duedate' => $this->displayDate( + $this->getField($loan->{'date_due'}) ), 'id' => $this->getField($loan->{'biblionumber'}), 'item_id' => $this->getField($loan->{'itemnumber'}), @@ -1585,7 +1584,7 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements = explode(" ", $this->getField($rsp->{'date_due'})); $retVal['details'][$renewItem] = [ "success" => true, - "new_date" => $date, + "new_date" => $this->displayDate($date), "new_time" => $time, "item_id" => $renewItem, ]; @@ -1936,6 +1935,9 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$/", $date) === 1) { // YYYY-MM-DD HH:MM:SS return $this->dateConverter->convertToDisplayDate('Y-m-d H:i:s', $date); + } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d$/", $date) === 1) { + // YYYY-MM-DD HH:MM + return $this->dateConverter->convertToDisplayDate('Y-m-d H:i', $date); } elseif (preg_match("/^\d{4}-\d{2}-\d{2}$/", $date) === 1) { // YYYY-MM-DD return $this->dateConverter->convertToDisplayDate('Y-m-d', $date); } else { @@ -1961,6 +1963,12 @@ class KohaILSDI extends \VuFind\ILS\Driver\AbstractBase implements $this->dateConverter->convertToDisplayDateAndTime( 'Y-m-d H:i:s', $date ); + } elseif (preg_match("/^\d{4}-\d\d-\d\d \d\d:\d\d$/", $date) === 1) { + // YYYY-MM-DD HH:MM + return + $this->dateConverter->convertToDisplayDateAndTime( + 'Y-m-d H:i', $date + ); } else { error_log("Unexpected date format: $date"); return $date;