diff --git a/app/controllers/admin/LicensesController.php b/app/controllers/admin/LicensesController.php index 9e29594ab4..9871052e46 100755 --- a/app/controllers/admin/LicensesController.php +++ b/app/controllers/admin/LicensesController.php @@ -369,8 +369,8 @@ class LicensesController extends AdminController // Delete the license and the associated license seats DB::table('license_seats') - ->where('id', $asset->id) - ->update(array('assigned_to' => NULL)); + ->where('id', $license->id) + ->update(array('assigned_to' => NULL,'asset_id' => NULL)); $licenseseats = $license->licenseseats(); $licenseseats->delete(); @@ -578,7 +578,7 @@ class LicensesController extends AdminController $logaction->checkedout_to = $licenseseat->assigned_to; // Update the asset data - $licenseseat->assigned_to = '0'; + $licenseseat->assigned_to = NULL; $licenseseat->asset_id = NULL; // Was the asset updated? diff --git a/app/models/Asset.php b/app/models/Asset.php index 5f74c71c6b..f2f11565a7 100755 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -201,6 +201,12 @@ class Asset extends Elegant public static function autoincrement_asset() { $settings = Setting::getSettings(); + + if (isset($asset_tag->id)) { + $asset_id = $asset_tag->id; + } else { + $asset_id = 1; + } if ($settings->auto_increment_assets == '1') { $asset_tag = DB::table('assets') ->where('physical', '=', '1') diff --git a/composer.json b/composer.json index 139d9cb72f..e6b395f00e 100755 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "intervention/image": "dev-master" }, "require-dev": { - "phpunit/phpunit": "*" + "phpunit/phpunit": "*", + "mockery/mockery": "0.9.*" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index bfd0117992..74a3207ba3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b2d1b48bc514e40f1a4ef04cd86aa86f", + "hash": "4242b20dc02d70aa7d97a211ea1e58b8", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1194,12 +1194,12 @@ "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "7583a2b96b9fda7ece90e34a23cd46e4858b3352" + "reference": "f05ed3a44a8e40533d4cf60a0669db6b1887b499" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/7583a2b96b9fda7ece90e34a23cd46e4858b3352", - "reference": "7583a2b96b9fda7ece90e34a23cd46e4858b3352", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f05ed3a44a8e40533d4cf60a0669db6b1887b499", + "reference": "f05ed3a44a8e40533d4cf60a0669db6b1887b499", "shasum": "" }, "require": { @@ -1258,7 +1258,7 @@ "logging", "psr-3" ], - "time": "2015-01-29 16:05:08" + "time": "2015-02-11 14:20:33" }, { "name": "nesbot/carbon", @@ -1756,12 +1756,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "1624dd47e1f4dc89ae4e7ca4a0476325042f8e82" + "reference": "a634f4e901f5d20696020980cae70d8d94c6193d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/1624dd47e1f4dc89ae4e7ca4a0476325042f8e82", - "reference": "1624dd47e1f4dc89ae4e7ca4a0476325042f8e82", + "url": "https://api.github.com/repos/symfony/Config/zipball/a634f4e901f5d20696020980cae70d8d94c6193d", + "reference": "a634f4e901f5d20696020980cae70d8d94c6193d", "shasum": "" }, "require": { @@ -1795,7 +1795,7 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:35" + "time": "2015-02-11 07:17:51" }, { "name": "symfony/console", @@ -1804,12 +1804,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "767a4be52d062d49bb0ef5f593f5f5d06b2f5ff3" + "reference": "a43e750b4c74f3bdfca77c79c343033d35a6cd6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/767a4be52d062d49bb0ef5f593f5f5d06b2f5ff3", - "reference": "767a4be52d062d49bb0ef5f593f5f5d06b2f5ff3", + "url": "https://api.github.com/repos/symfony/Console/zipball/a43e750b4c74f3bdfca77c79c343033d35a6cd6e", + "reference": "a43e750b4c74f3bdfca77c79c343033d35a6cd6e", "shasum": "" }, "require": { @@ -1850,7 +1850,7 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2015-02-05 06:31:40" + "time": "2015-02-08 07:07:45" }, { "name": "symfony/css-selector", @@ -2022,12 +2022,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "e9298668dce8dd219d1ee2290c7f313954f1f984" + "reference": "2dc33aff298b20ad099ac456034aebc5055f02fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e9298668dce8dd219d1ee2290c7f313954f1f984", - "reference": "e9298668dce8dd219d1ee2290c7f313954f1f984", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/2dc33aff298b20ad099ac456034aebc5055f02fb", + "reference": "2dc33aff298b20ad099ac456034aebc5055f02fb", "shasum": "" }, "require": { @@ -2071,7 +2071,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2015-02-05 06:58:17" + "time": "2015-02-11 07:17:51" }, { "name": "symfony/filesystem", @@ -2080,12 +2080,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "e681ca515e1e668a551b089177867e62e03d7d2d" + "reference": "177e0a8e29fab3f0556f7a973b5a42935e42a4d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/e681ca515e1e668a551b089177867e62e03d7d2d", - "reference": "e681ca515e1e668a551b089177867e62e03d7d2d", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/177e0a8e29fab3f0556f7a973b5a42935e42a4d7", + "reference": "177e0a8e29fab3f0556f7a973b5a42935e42a4d7", "shasum": "" }, "require": { @@ -2118,7 +2118,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2015-01-09 06:51:41" + "time": "2015-02-11 07:17:51" }, { "name": "symfony/finder", @@ -2174,12 +2174,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "749f478499b89aaf53bdd6c80743fc0c3a72cce4" + "reference": "79b2385ee420944ab89c6972acae9c7c8cb9a412" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/749f478499b89aaf53bdd6c80743fc0c3a72cce4", - "reference": "749f478499b89aaf53bdd6c80743fc0c3a72cce4", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/79b2385ee420944ab89c6972acae9c7c8cb9a412", + "reference": "79b2385ee420944ab89c6972acae9c7c8cb9a412", "shasum": "" }, "require": { @@ -2218,7 +2218,7 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2015-02-05 06:31:40" + "time": "2015-02-08 07:07:45" }, { "name": "symfony/http-kernel", @@ -2227,12 +2227,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "122057675f27f41b25b5811523516cc018eb28ed" + "reference": "b481edb3c476dcd2040443f38292c1fadd2fac88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/122057675f27f41b25b5811523516cc018eb28ed", - "reference": "122057675f27f41b25b5811523516cc018eb28ed", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/b481edb3c476dcd2040443f38292c1fadd2fac88", + "reference": "b481edb3c476dcd2040443f38292c1fadd2fac88", "shasum": "" }, "require": { @@ -2292,7 +2292,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2015-02-02 14:03:24" + "time": "2015-02-08 07:08:16" }, { "name": "symfony/process", @@ -2301,12 +2301,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "daaa39a0d7462c225f711b20dc8f5896bdab92ff" + "reference": "00a1308e8b5aec5eba7c8f1708426a78f929be8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/daaa39a0d7462c225f711b20dc8f5896bdab92ff", - "reference": "daaa39a0d7462c225f711b20dc8f5896bdab92ff", + "url": "https://api.github.com/repos/symfony/Process/zipball/00a1308e8b5aec5eba7c8f1708426a78f929be8c", + "reference": "00a1308e8b5aec5eba7c8f1708426a78f929be8c", "shasum": "" }, "require": { @@ -2339,7 +2339,7 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2015-02-05 08:31:48" + "time": "2015-02-08 07:07:45" }, { "name": "symfony/routing", @@ -2348,12 +2348,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "8743280059d6d74db4a7fb58bbe049bd795195a9" + "reference": "46142c34ea830f47429df6e15faec3a33292d618" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/8743280059d6d74db4a7fb58bbe049bd795195a9", - "reference": "8743280059d6d74db4a7fb58bbe049bd795195a9", + "url": "https://api.github.com/repos/symfony/Routing/zipball/46142c34ea830f47429df6e15faec3a33292d618", + "reference": "46142c34ea830f47429df6e15faec3a33292d618", "shasum": "" }, "require": { @@ -2407,7 +2407,7 @@ "uri", "url" ], - "time": "2015-02-05 06:31:40" + "time": "2015-02-08 07:07:45" }, { "name": "symfony/security-core", @@ -2479,12 +2479,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "f6ce5e09596ec0493ef42acf5eb0b38218733e48" + "reference": "2883cdac7f23a0355760e485d6906528ad1e9504" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/f6ce5e09596ec0493ef42acf5eb0b38218733e48", - "reference": "f6ce5e09596ec0493ef42acf5eb0b38218733e48", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/2883cdac7f23a0355760e485d6906528ad1e9504", + "reference": "2883cdac7f23a0355760e485d6906528ad1e9504", "shasum": "" }, "require": { @@ -2517,7 +2517,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2015-01-09 06:51:41" + "time": "2015-02-11 07:17:51" }, { "name": "symfony/translation", @@ -2639,12 +2639,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "02ba3dc638c5d3f0ab3b47ddb74f98c11dcc0c60" + "reference": "43aac3461a5679f486f7c96e4d7e780a59fec997" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/02ba3dc638c5d3f0ab3b47ddb74f98c11dcc0c60", - "reference": "02ba3dc638c5d3f0ab3b47ddb74f98c11dcc0c60", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/43aac3461a5679f486f7c96e4d7e780a59fec997", + "reference": "43aac3461a5679f486f7c96e4d7e780a59fec997", "shasum": "" }, "require": { @@ -2677,7 +2677,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2015-01-25 04:39:35" + "time": "2015-02-11 07:17:51" } ], "packages-dev": [ @@ -2735,6 +2735,72 @@ ], "time": "2015-01-16 19:29:51" }, + { + "name": "mockery/mockery", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/padraic/mockery.git", + "reference": "f770ab0cf167cccf1a701f28411fbfc9971ff90e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/padraic/mockery/zipball/f770ab0cf167cccf1a701f28411fbfc9971ff90e", + "reference": "f770ab0cf167cccf1a701f28411fbfc9971ff90e", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.0", + "php": ">=5.3.2" + }, + "require-dev": { + "hamcrest/hamcrest-php": "~1.1", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "~0.7@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "homepage": "http://github.com/padraic/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2015-02-11 12:43:02" + }, { "name": "phpdocumentor/reflection-docblock", "version": "dev-master", @@ -2790,12 +2856,12 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d647e27524f9f7edc37baf63a114b52f5975808f" + "reference": "3a9204c44667c302049ab4eadb02daab789e19ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d647e27524f9f7edc37baf63a114b52f5975808f", - "reference": "d647e27524f9f7edc37baf63a114b52f5975808f", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3a9204c44667c302049ab4eadb02daab789e19ed", + "reference": "3a9204c44667c302049ab4eadb02daab789e19ed", "shasum": "" }, "require": { @@ -2842,7 +2908,7 @@ "spy", "stub" ], - "time": "2015-01-26 10:50:16" + "time": "2015-02-09 17:43:38" }, { "name": "phpunit/php-code-coverage", @@ -3094,12 +3160,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2b1e1e267d0286538b1762aa2c79a96ae1e583c8" + "reference": "7c1de6a854a36ba330b352a005a4f5f928619f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2b1e1e267d0286538b1762aa2c79a96ae1e583c8", - "reference": "2b1e1e267d0286538b1762aa2c79a96ae1e583c8", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c1de6a854a36ba330b352a005a4f5f928619f53", + "reference": "7c1de6a854a36ba330b352a005a4f5f928619f53", "shasum": "" }, "require": { @@ -3158,7 +3224,7 @@ "testing", "xunit" ], - "time": "2015-02-06 05:41:08" + "time": "2015-02-09 06:38:12" }, { "name": "phpunit/phpunit-mock-objects",