Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ShiftNotesDateRange | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getShiftNotesByDateRange | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Core\ShiftNotes; |
| 4 | |
| 5 | use BuyerKiosk\Core\Store; |
| 6 | |
| 7 | class ShiftNotesDateRange extends Store { |
| 8 | private $db; |
| 9 | private $log; |
| 10 | |
| 11 | public function __construct($typeNum) |
| 12 | { |
| 13 | parent::createStore($typeNum); |
| 14 | $this->db = dbConnectByName($this->getDbName()); |
| 15 | $this->log = new \KLogger($_ENV['LOG_DIR']."debug.log", \KLogger::DEBUG); |
| 16 | |
| 17 | } |
| 18 | |
| 19 | public function getShiftNotesByDateRange($start, $end) { |
| 20 | $notesArray = []; |
| 21 | $this->log->LogDebug("Start: ".$start); |
| 22 | $this->log->LogDebug("End: ".$end); |
| 23 | $stmt = $this->db->prepare("SELECT * FROM (SELECT * FROM shiftNotes WHERE itemType = 0 AND (((:start <= DATE(timeStamp)) AND (DATE(`timeStamp`) <= :end)) OR ((:start <= DATE(timeClosed)) AND (DATE(timeClosed) <= :end)))) as A UNION (SELECT * FROM shiftNotes WHERE itemType = 1 AND (((:start <= DATE(timeStamp)) AND (DATE(`timeStamp`) <= :end)) OR ((:start <= DATE(timeClosed)) AND (DATE(timeClosed) <= :end)) OR itemStatus < 2)) ORDER BY timeStamp DESC"); |
| 24 | $stmt->bindValue(":start", $start); |
| 25 | $stmt->bindValue(":end", $end); |
| 26 | if($stmt->execute()) { |
| 27 | while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 28 | $shiftNote = new ShiftNotes(); |
| 29 | $shiftNote->readFromRow($row); |
| 30 | $notesArray[] = $shiftNote; |
| 31 | } |
| 32 | } |
| 33 | return $notesArray; |
| 34 | } |
| 35 | } |