Conversie codeigniter 4
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 17:06
|
||||
*/
|
||||
|
||||
class RemoveInvoice {
|
||||
|
||||
private $invoiceID;
|
||||
private $payments;
|
||||
private $removeAllowed;
|
||||
|
||||
public function __construct( $invoiceID )
|
||||
{
|
||||
$this->setInvoiceID( $invoiceID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setInvoiceID( $invoiceID )
|
||||
{
|
||||
$this->invoiceID = $invoiceID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setPayment();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setPayment()
|
||||
{
|
||||
$payments = Payment::whereInvoiceId( $this->invoiceID );
|
||||
|
||||
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if ( $this->payments === FALSE ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user