diff --git a/modules/notifications/batch/load_basket_event_stack.php b/modules/notifications/batch/load_basket_event_stack.php index f913e15fb76451f23f7dd74c2d15f06c63efadaa..4b89851c4fbce7f0110f6c4dfed432ebbe98bec0 100755 --- a/modules/notifications/batch/load_basket_event_stack.php +++ b/modules/notifications/batch/load_basket_event_stack.php @@ -207,6 +207,8 @@ $mailerParams = $xmlconfig->MAILER; // INCLUDES try { + Bt_myInclude('vendor/autoload.php'); + Bt_myInclude( 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_functions.php' diff --git a/modules/notifications/diffusion_types/dest_user.php b/modules/notifications/diffusion_types/dest_user.php index 16552725b6f141c5c9a08f64cb176d3429c10251..2dbda285f7af6427a880a1409801c9830d716dba 100755 --- a/modules/notifications/diffusion_types/dest_user.php +++ b/modules/notifications/diffusion_types/dest_user.php @@ -22,7 +22,7 @@ switch ($request) { $arrayPDO = array(':recordid' => $event->record_id); switch ($event->table_name) { case 'notes': - $from .= ' JOIN notes ON notes.coll_id = li.coll_id AND notes.identifier = li.res_id'; + $from .= ' JOIN notes ON notes.identifier = li.res_id'; $from .= ' JOIN res_letterbox lb ON lb.res_id = notes.identifier'; $where .= ' AND notes.id = :recordid AND li.item_id != notes.user_id' .' AND (' @@ -86,7 +86,7 @@ switch ($request) { $arrayPDO = array(':recordid' => $event->record_id); switch ($event->table_name) { case 'notes': - $from .= ' JOIN notes ON notes.coll_id = li.coll_id AND notes.identifier = li.res_id'; + $from .= ' JOIN notes ON notes.identifier = li.res_id'; $from .= ' JOIN res_letterbox lb ON lb.res_id = notes.identifier'; $where .= ' AND notes.id = :recordid AND li.item_id != notes.user_id'; if ($notification->diffusion_properties != '') { diff --git a/modules/templates/class/templates_controler_Abstract.php b/modules/templates/class/templates_controler_Abstract.php index bf27752ec6ca2c62b197907381a9d572d7902d5e..d9a31561ac49f03e38b70dbccfb5b4f93a86e488 100755 --- a/modules/templates/class/templates_controler_Abstract.php +++ b/modules/templates/class/templates_controler_Abstract.php @@ -861,7 +861,7 @@ abstract class templates_controler_Abstract extends ObjectControler implements O } // Current basket - if (count($_SESSION['current_basket']) > 0) { + if (!empty($_SESSION['current_basket']) && count($_SESSION['current_basket']) > 0) { foreach ($_SESSION['current_basket'] as $name => $value) { if (!is_array($value)) { $datasources['basket'][0][$name] = $value; @@ -870,13 +870,13 @@ abstract class templates_controler_Abstract extends ObjectControler implements O } // User - if (count($_SESSION['user']) > 0) { + if (!empty($_SESSION['user']) && count($_SESSION['user']) > 0) { foreach ($_SESSION['user'] as $name => $value) { if (!is_array($value)) { $datasources['user'][0][strtolower($name)] = $value; } } - if (count($_SESSION['user']['entities']) > 0) { + if (!empty($_SESSION['user']['entities']) && count($_SESSION['user']['entities']) > 0) { foreach ($_SESSION['user']['entities'] as $entity) { if ($entity['ENTITY_ID'] === $_SESSION['user']['primaryentity']['id']) { $datasources['user'][0]['entity'] = $_SESSION['user']['entities'][0]['ENTITY_LABEL']; diff --git a/modules/templates/datasources/mlb_notes_content.php b/modules/templates/datasources/mlb_notes_content.php index f102a39d7142b16c14f30c2c6bad2b9183e51b8e..afcdaa7163d444f515538054df6c00c2da6bd91e 100755 --- a/modules/templates/datasources/mlb_notes_content.php +++ b/modules/templates/datasources/mlb_notes_content.php @@ -27,9 +27,8 @@ foreach($events as $event) { . "FROM " . $res_view . " mlb " . "JOIN notes on notes.identifier = mlb.res_id " . "JOIN users on users.user_id = notes.user_id " - . "WHERE notes.coll_id = ? " - . "AND notes.id = ? "; - $arrayPDO = array($coll_id, $event->record_id); + . "WHERE notes.id = ? "; + $arrayPDO = array($event->record_id); break; case "res_letterbox" : @@ -38,14 +37,13 @@ foreach($events as $event) { . "notes.*, " . "users.* " . "FROM listinstance li JOIN " . $res_view . " mlb ON mlb.res_id = li.res_id " - . "JOIN notes on li.coll_id=notes.coll_id AND notes.identifier = li.res_id " + . "JOIN notes on notes.identifier = li.res_id " . "JOIN users on users.user_id = notes.user_id " - . "WHERE li.coll_id = ? " - . "AND li.item_id = ? " + . "WHERE li.item_id = ? " . "AND li.item_mode = 'dest' " . "AND li.item_type = 'user_id' " . "AND li.res_id = ? "; - $arrayPDO = array($coll_id, $recipient->user_id, $event->record_id); + $arrayPDO = array($recipient->user_id, $event->record_id); break; } diff --git a/sql/develop.sql b/sql/develop.sql index 56bd3ad594a5df08427b76ab5ddab60cf164e96e..8de0a8a0c351f70bb16db90d8f948f5c81c75955 100755 --- a/sql/develop.sql +++ b/sql/develop.sql @@ -15,7 +15,7 @@ ALTER TABLE res_letterbox DROP COLUMN IF EXISTS external_signatory_book_id; ALTER TABLE res_letterbox ADD COLUMN external_signatory_book_id integer; ALTER TABLE users DROP COLUMN IF EXISTS external_id; -ALTER TABLE users ADD COLUMN external_id json DEFAULT '{}'; +ALTER TABLE users ADD COLUMN external_id jsonb DEFAULT '{}'; /* Redirected Baskets */ DO $$ BEGIN diff --git a/sql/structure.sql b/sql/structure.sql index 44f3a169b696cf86473b21ec08c231c6b4b0e078..3c7fc3e63c270ed62aa50561803813b551fbc8e1 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -226,7 +226,7 @@ CREATE TABLE users cookie_date timestamp without time zone, failed_authentication INTEGER DEFAULT 0, locked_until TIMESTAMP without time zone, - external_id json DEFAULT '{}', + external_id jsonb DEFAULT '{}', CONSTRAINT users_pkey PRIMARY KEY (user_id), CONSTRAINT users_id_key UNIQUE (id) )