mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge pull request #833 from nlegoff/fix_1607
[3.8] Fix #1607 Reoder collections is not working
This commit is contained in:
@@ -565,6 +565,12 @@ class collection implements cache_cacheableInterface
|
||||
</sugestedValues>
|
||||
</baseprefs>';
|
||||
|
||||
$sql = "SELECT GREATEST(0, MAX(ord)) + 1 AS ord FROM bas WHERE sbas_id = :sbas_id";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':sbas_id' => $sbas_id));
|
||||
$ord = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$sql = "INSERT INTO coll (coll_id, asciiname, prefs, logo)
|
||||
VALUES (null, :name, :prefs, '')";
|
||||
|
||||
@@ -579,11 +585,15 @@ class collection implements cache_cacheableInterface
|
||||
|
||||
$new_id = (int) $connbas->lastInsertId();
|
||||
|
||||
$sql = "INSERT INTO bas (base_id, active, server_coll_id, sbas_id, aliases)
|
||||
$sql = "INSERT INTO bas (base_id, active, ord, server_coll_id, sbas_id, aliases)
|
||||
VALUES
|
||||
(null, 1, :server_coll_id, :sbas_id, '')";
|
||||
(null, 1, :ord, :server_coll_id, :sbas_id, '')";
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':server_coll_id' => $new_id, ':sbas_id' => $sbas_id));
|
||||
$stmt->execute(array(
|
||||
':server_coll_id' => $new_id,
|
||||
':sbas_id' => $sbas_id,
|
||||
':ord' => $ord['ord'] ?: 1,
|
||||
));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$new_bas = $conn->lastInsertId();
|
||||
@@ -638,7 +648,7 @@ class collection implements cache_cacheableInterface
|
||||
VALUES
|
||||
(null, 1, :server_coll_id, :sbas_id, '')";
|
||||
$stmt = $databox->get_appbox()->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':server_coll_id' => $coll_id, ':sbas_id' => $sbas_id));
|
||||
$stmt->execute(array(':server_coll_id' => $coll_id, ':sbas_id' => $databox->get_sbas_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$new_bas = $databox->get_appbox()->get_connection()->lastInsertId();
|
||||
@@ -646,7 +656,7 @@ class collection implements cache_cacheableInterface
|
||||
|
||||
$databox->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
|
||||
cache_databox::update($app, $sbas_id, 'structure');
|
||||
cache_databox::update($app, $databox->get_sbas_id(), 'structure');
|
||||
|
||||
phrasea::reset_baseDatas($databox->get_appbox());
|
||||
|
||||
|
@@ -11,10 +11,10 @@
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_381alpha1a implements patchInterface
|
||||
class patch_383alpha3a implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '3.8.1-alpha.1';
|
||||
private $release = '3.8.3-alpha.3';
|
||||
|
||||
/** @var array */
|
||||
private $concern = array(base::APPLICATION_BOX);
|
Reference in New Issue
Block a user