Skip to content

Commit

Permalink
rent system fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sveneld committed May 25, 2024
1 parent ae5f9c4 commit 529726f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-data/php/override.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Date]
date.timezone = UTC
date.timezone = "UTC"
4 changes: 3 additions & 1 deletion receive.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use BikeShare\Authentication\Auth;
use BikeShare\Db\DbInterface;
use BikeShare\Rent\RentSystemFactory;
use BikeShare\Rent\RentSystemInterface;
use BikeShare\Rent\RentSystemSms;
use BikeShare\SmsConnector\SmsConnectorInterface;
use Psr\Log\LoggerInterface;

Expand All @@ -15,7 +15,9 @@
* @var SmsConnectorInterface $sms
* @var LoggerInterface $logger
* @var DbInterface $db
* @var Auth $auth
*/
$auth = new Auth($db);
log_sms($sms->getUUID(),$sms->getNumber(),$sms->getTime(),$sms->getMessage(),$sms->getIPAddress());

/**
Expand Down
4 changes: 2 additions & 2 deletions scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
checkbikeno($bikeno);
if (!empty($_POST['rent']) && $_POST['rent'] == "yes") {
$result = $rentSystem->rentBike($userid, $bikeno);
response($result['message'], $result['error'], 0);
response($result['content'], $result['error'], 0);
} else {
showrentform($userid, $bikeno);
}
Expand All @@ -59,7 +59,7 @@
$stand = $parameter;
checkstandname($stand);
$result = $rentSystem->returnBike($userid, 0, $stand);
response($result['message'], $result['error'], 0);
response($result['content'], $result['error'], 0);
break;
default:
unrecognizedqrcode();
Expand Down
2 changes: 2 additions & 0 deletions src/Rent/RentSystemSms.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function returnBike($number, $bikeId, $standName, $note = '', $force = fa

if (preg_match("/return[\s,\.]+[0-9]+[\s,\.]+[a-zA-Z0-9]+[\s,\.]+(.*)/i", $note, $matches)) {
$note = $this->db->escape(trim($matches[1]));
} else {
$note = '';
}

return parent::returnBike($userId, $bikeId, $standName, $note, $force);
Expand Down

0 comments on commit 529726f

Please sign in to comment.