Added customer_nr to database and invoice templates.
Used standard DATEV format(10000 – 69999) Fixes #31
This commit is contained in:
@@ -20,4 +20,20 @@ public function index()
|
||||
return ApiDataTransformer::snakeToCamel($customerArray);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random available customer number
|
||||
*/
|
||||
public static function generateCustomerNumber()
|
||||
{
|
||||
$newNumber = null;
|
||||
while (!$newNumber) {
|
||||
// DATEV standard
|
||||
$randomNumber = rand(10000, 69999);
|
||||
$customer = Customer::firstWhere('customer_nr', $randomNumber);
|
||||
if ($customer) {
|
||||
return $randomNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user