@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | protected $primaryKey = 'OrderID'; |
| 74 | 74 | |
| 75 | - protected $saleOrderLines = [ ]; |
|
| 75 | + protected $saleOrderLines = []; |
|
| 76 | 76 | |
| 77 | 77 | protected $fillable = [ |
| 78 | 78 | 'OrderID', |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function addItem(array $array) |
| 142 | 142 | { |
| 143 | - if (!isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) { |
|
| 143 | + if ( ! isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) { |
|
| 144 | 144 | $this->attributes['SalesOrderLines'] = []; |
| 145 | 145 | } |
| 146 | - if (!isset($array['LineNumber'])) { |
|
| 146 | + if ( ! isset($array['LineNumber'])) { |
|
| 147 | 147 | $array['LineNumber'] = count($this->attributes['SalesOrderLines']) + 1; |
| 148 | 148 | } |
| 149 | 149 | $this->attributes['SalesOrderLines'][] = $array; |
@@ -15,7 +15,6 @@ |
||
| 15 | 15 | * @property Byte $Main Indicates the main unit per division. Will be used when creating new item |
| 16 | 16 | * @property String $TimeUnit If Type = 'T' (time) then this fields indicates the type of time frame. yy = Year, mm = Month, wk = Week, dd = Day, hh = Hour, mi = Minute, ss = Second |
| 17 | 17 | * @property String $Type Type 'Time' is especially important for contracts. |
| 18 | - |
|
| 19 | 18 | */ |
| 20 | 19 | class Units extends Model |
| 21 | 20 | {
|
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | use Persistance\Storable; |
| 100 | 100 | |
| 101 | 101 | protected $fillable = [ |
| 102 | - 'Barcode', |
|
| 102 | + 'Barcode', |
|
| 103 | 103 | 'ID', |
| 104 | 104 | 'Class_01', |
| 105 | 105 | 'Class_02', |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | public function find($id) |
| 7 | 7 | { |
| 8 | - $filter = $this->primaryKey . " eq guid'$id'"; |
|
| 8 | + $filter = $this->primaryKey . " eq guid'$id'"; |
|
| 9 | 9 | |
| 10 | 10 | if ($this->primaryKey === 'Code') { |
| 11 | 11 | $filter = $this->primaryKey . " eq $id"; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return string (guid) |
| 43 | 43 | */ |
| 44 | - public function findId($code, $key='Code'){ |
|
| 45 | - if ( $this->isFillable($key) ) { |
|
| 44 | + public function findId($code, $key = 'Code') { |
|
| 45 | + if ($this->isFillable($key)) { |
|
| 46 | 46 | $format = ($this->url == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s'; |
| 47 | 47 | if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) { |
| 48 | 48 | $format = "guid'$format'"; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | '$select' => $this->primaryKey, |
| 59 | 59 | '$orderby' => $this->primaryKey, |
| 60 | 60 | ]; |
| 61 | - if( $records = $this->connection()->get($this->url, $request) ){ |
|
| 61 | + if ($records = $this->connection()->get($this->url, $request)) { |
|
| 62 | 62 | return $records[0][$this->primaryKey]; |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $result = $this->connection()->get($this->url, $request, $headers); |
| 92 | 92 | |
| 93 | - if (!empty($divisionId)) { |
|
| 93 | + if ( ! empty($divisionId)) { |
|
| 94 | 94 | $this->connection()->setDivision($originalDivision); // Restore division |
| 95 | 95 | } |
| 96 | 96 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | // If we have one result which is not an assoc array, make it the first element of an array for the |
| 126 | 126 | // collectionFromResult function so we always return a collection from filter |
| 127 | 127 | if ((bool) count(array_filter(array_keys($result), 'is_string'))) { |
| 128 | - $result = [ $result ]; |
|
| 128 | + $result = [$result]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | while ($this->connection()->nextUrl !== null) |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $nextResult = $this->connection()->get($this->connection()->nextUrl); |
| 134 | 134 | $result = array_merge($result, $nextResult); |
| 135 | 135 | } |
| 136 | - $collection = [ ]; |
|
| 136 | + $collection = []; |
|
| 137 | 137 | foreach ($result as $r) { |
| 138 | 138 | $collection[] = new self($this->connection(), $r); |
| 139 | 139 | } |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | $format = ($this->url == 'crm/Accounts' && $key === 'Code') ? '%18s' : '%s'; |
| 47 | 47 | if (preg_match('/^[\w]{8}-([\w]{4}-){3}[\w]{12}$/', $code)) { |
| 48 | 48 | $format = "guid'$format'"; |
| 49 | - } |
|
| 50 | - elseif (is_string($code)) { |
|
| 49 | + } elseif (is_string($code)) { |
|
| 51 | 50 | $format = "'$format'"; |
| 52 | 51 | } |
| 53 | 52 | |
@@ -31,22 +31,22 @@ |
||
| 31 | 31 | protected $primaryKey = 'HID'; |
| 32 | 32 | |
| 33 | 33 | protected $fillable = [ |
| 34 | - 'AccountCode', |
|
| 35 | - 'AccountId', |
|
| 36 | - 'AccountName', |
|
| 37 | - 'Amount', |
|
| 38 | - 'AmountInTransit', |
|
| 39 | - 'CurrencyCode', |
|
| 40 | - 'Description', |
|
| 41 | - 'DueDate', |
|
| 42 | - 'EntryNumber', |
|
| 43 | - 'HID', |
|
| 44 | - 'Id', |
|
| 45 | - 'InvoiceDate', |
|
| 46 | - 'InvoiceNumber', |
|
| 47 | - 'JournalCode', |
|
| 48 | - 'JournalDescription', |
|
| 49 | - 'YourRef' |
|
| 34 | + 'AccountCode', |
|
| 35 | + 'AccountId', |
|
| 36 | + 'AccountName', |
|
| 37 | + 'Amount', |
|
| 38 | + 'AmountInTransit', |
|
| 39 | + 'CurrencyCode', |
|
| 40 | + 'Description', |
|
| 41 | + 'DueDate', |
|
| 42 | + 'EntryNumber', |
|
| 43 | + 'HID', |
|
| 44 | + 'Id', |
|
| 45 | + 'InvoiceDate', |
|
| 46 | + 'InvoiceNumber', |
|
| 47 | + 'JournalCode', |
|
| 48 | + 'JournalDescription', |
|
| 49 | + 'YourRef' |
|
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | 52 | protected $url = 'read/financial/ReceivablesList'; |
@@ -29,8 +29,6 @@ |
||
| 29 | 29 | * @property DateTime $StartDate Together with EndDate this determines whether the price is active |
| 30 | 30 | * @property String $Unit The unit code of the price |
| 31 | 31 | * @property String $UnitDescription Description of the price unit |
| 32 | - |
|
| 33 | - |
|
| 34 | 32 | */ |
| 35 | 33 | class SalesItemPrice extends Model |
| 36 | 34 | { |
@@ -33,23 +33,23 @@ |
||
| 33 | 33 | protected $primaryKey = 'CurrentYear'; |
| 34 | 34 | |
| 35 | 35 | protected $fillable = [ |
| 36 | - 'CostsCurrentPeriod', |
|
| 37 | - 'CostsCurrentYear', |
|
| 38 | - 'CostsPreviousYear', |
|
| 39 | - 'CostsPreviousYearPeriod', |
|
| 40 | - 'CurrencyCode', |
|
| 41 | - 'CurrentYear', |
|
| 42 | - 'CurrentPeriod', |
|
| 43 | - 'PreviousYear', |
|
| 44 | - 'PreviousYearPeriod', |
|
| 45 | - 'ResultCurrentPeriod', |
|
| 46 | - 'ResultCurrentYear', |
|
| 47 | - 'ResultPreviousYear', |
|
| 48 | - 'ResultPreviousYearPeriod', |
|
| 49 | - 'RevenueCurrentPeriod', |
|
| 50 | - 'RevenueCurrentYear', |
|
| 51 | - 'RevenuePreviousYear', |
|
| 52 | - 'RevenuePreviousPeriod' |
|
| 36 | + 'CostsCurrentPeriod', |
|
| 37 | + 'CostsCurrentYear', |
|
| 38 | + 'CostsPreviousYear', |
|
| 39 | + 'CostsPreviousYearPeriod', |
|
| 40 | + 'CurrencyCode', |
|
| 41 | + 'CurrentYear', |
|
| 42 | + 'CurrentPeriod', |
|
| 43 | + 'PreviousYear', |
|
| 44 | + 'PreviousYearPeriod', |
|
| 45 | + 'ResultCurrentPeriod', |
|
| 46 | + 'ResultCurrentYear', |
|
| 47 | + 'ResultPreviousYear', |
|
| 48 | + 'ResultPreviousYearPeriod', |
|
| 49 | + 'RevenueCurrentPeriod', |
|
| 50 | + 'RevenueCurrentYear', |
|
| 51 | + 'RevenuePreviousYear', |
|
| 52 | + 'RevenuePreviousPeriod' |
|
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | protected $url = 'read/financial/ProfitLossOverview'; |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | * @return mixed |
| 132 | 132 | */ |
| 133 | 133 | public function getSalesInvoiceLines() { |
| 134 | - if(array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) { |
|
| 134 | + if (array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) { |
|
| 135 | 135 | $this->attributes['SalesInvoiceLines'] = (new SalesInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->InvoiceID}'"); |
| 136 | 136 | } |
| 137 | 137 | return $this->attributes['SalesInvoiceLines']; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | protected $primaryKey = 'EntryID'; |
| 61 | 61 | |
| 62 | - protected $saleEntryLines = [ ]; |
|
| 62 | + protected $saleEntryLines = []; |
|
| 63 | 63 | |
| 64 | 64 | protected $fillable = [ |
| 65 | 65 | 'EntryID', |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | public function addItem(array $array) |
| 113 | 113 | { |
| 114 | - if ( ! isset( $this->attributes['SalesEntryLines'] ) || $this->attributes['SalesEntryLines'] == null) { |
|
| 115 | - $this->attributes['SalesEntryLines'] = [ ]; |
|
| 114 | + if ( ! isset($this->attributes['SalesEntryLines']) || $this->attributes['SalesEntryLines'] == null) { |
|
| 115 | + $this->attributes['SalesEntryLines'] = []; |
|
| 116 | 116 | } |
| 117 | - if ( ! isset( $array['LineNumber'] )) { |
|
| 117 | + if ( ! isset($array['LineNumber'])) { |
|
| 118 | 118 | $array['LineNumber'] = count($this->attributes['SalesEntryLines']) + 1; |
| 119 | 119 | } |
| 120 | 120 | $this->attributes['SalesEntryLines'][] = $array; |