From a27ff9158856c84aae96fe0580a1fde0d470da7d Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 17 Jan 2024 20:31:06 +0100 Subject: [PATCH] Internal: Database: Fix internal methods calls with name vs title (8) - plugins - refs #3581 #4706 --- .../src/AdvancedSubscriptionPlugin.php | 6 +-- .../src/HookAdvancedSubscription.php | 2 +- .../src/open_session.php | 2 +- .../src/buy_course_plugin.class.php | 8 ++-- .../plugin/buycourses/src/buycourses.ajax.php | 8 ++-- .../src/service_process_confirm.php | 4 +- .../plugin/buycourses/src/service_success.php | 4 +- .../plugin/buycourses/src/services_edit.php | 2 +- .../plugin/courselegal/CourseLegalPlugin.php | 2 +- .../block_session/block_session.class.php | 2 +- public/plugin/justification/Justification.php | 4 +- public/plugin/justification/README.md | 10 ++++- .../LearningCalendarPlugin.php | 6 +-- public/plugin/learning_calendar/README.md | 8 ++++ .../learning_calendar/calendar_users.php | 2 +- public/plugin/studentfollowup/my_students.php | 2 +- public/plugin/vchamilo/README.md | 42 +++++++++++-------- public/plugin/vchamilo/install.php | 6 +-- public/plugin/vchamilo/lib/Virtual.php | 2 +- 19 files changed, 72 insertions(+), 50 deletions(-) diff --git a/public/plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php b/public/plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php index 99d3d3dbec..a4c7ebd4a2 100644 --- a/public/plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php +++ b/public/plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php @@ -1260,7 +1260,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface } /** - * List all session (id, name) for select input. + * List all session (id, title) for select input. * * @param int $limit * @@ -1270,11 +1270,11 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface { $limit = (int) $limit; $sessionTable = Database::get_main_table(TABLE_MAIN_SESSION); - $columns = 'id, name'; + $columns = 'id, title'; $conditions = []; if ($limit > 0) { $conditions = [ - 'order' => 'name', + 'order' => 'title', 'limit' => $limit, ]; } diff --git a/public/plugin/advanced_subscription/src/HookAdvancedSubscription.php b/public/plugin/advanced_subscription/src/HookAdvancedSubscription.php index 48e5c29e50..83f6288e48 100644 --- a/public/plugin/advanced_subscription/src/HookAdvancedSubscription.php +++ b/public/plugin/advanced_subscription/src/HookAdvancedSubscription.php @@ -263,7 +263,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs 'name' => 'coach_id', 'type' => 'xsd:int', ], - // session.name + // session.title 'name' => [ 'name' => 'name', 'type' => 'xsd:string', diff --git a/public/plugin/advanced_subscription/src/open_session.php b/public/plugin/advanced_subscription/src/open_session.php index 1703b61f8b..990a9099d7 100644 --- a/public/plugin/advanced_subscription/src/open_session.php +++ b/public/plugin/advanced_subscription/src/open_session.php @@ -35,7 +35,7 @@ if (SessionManager::isUserSubscribedAsStudent( 'errorMessages', [sprintf( $plugin->get_lang('YouAreAlreadySubscribedToSessionX'), - $sessionInfo['name'] + $sessionInfo['title'] )] ); } else { diff --git a/public/plugin/buycourses/src/buy_course_plugin.class.php b/public/plugin/buycourses/src/buy_course_plugin.class.php index f790b986a5..914241f448 100644 --- a/public/plugin/buycourses/src/buy_course_plugin.class.php +++ b/public/plugin/buycourses/src/buy_course_plugin.class.php @@ -2096,7 +2096,7 @@ class BuyCoursesPlugin extends Plugin $return = Database::insert( $servicesTable, [ - 'name' => Security::remove_XSS($service['name']), + 'title' => Security::remove_XSS($service['name']), 'description' => Security::remove_XSS($service['description']), 'price' => $service['price'], 'tax_perc' => '' != $service['tax_perc'] ? (int) $service['tax_perc'] : null, @@ -2151,7 +2151,7 @@ class BuyCoursesPlugin extends Plugin return Database::update( $servicesTable, [ - 'name' => Security::remove_XSS($service['name']), + 'title' => Security::remove_XSS($service['name']), 'description' => Security::remove_XSS($service['description']), 'price' => $service['price'], 'tax_perc' => '' != $service['tax_perc'] ? (int) $service['tax_perc'] : null, @@ -2419,7 +2419,7 @@ class BuyCoursesPlugin extends Plugin $isoCode = $currency['iso_code']; $servicesSale = Database::select( - 'ss.*, s.name, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image', + 'ss.*, s.title, s.description, s.price as service_price, s.duration_days, s.applies_to, s.owner_id, s.visibility, s.image', "$servicesSaleTable ss $innerJoins", $conditions, 'first' @@ -2428,7 +2428,7 @@ class BuyCoursesPlugin extends Plugin $buyer = api_get_user_info($servicesSale['buyer_id']); $servicesSale['service']['id'] = $servicesSale['service_id']; - $servicesSale['service']['name'] = $servicesSale['name']; + $servicesSale['service']['title'] = $servicesSale['title']; $servicesSale['service']['description'] = $servicesSale['description']; $servicesSale['service']['price'] = $servicesSale['service_price']; $servicesSale['service']['currency'] = $isoCode; diff --git a/public/plugin/buycourses/src/buycourses.ajax.php b/public/plugin/buycourses/src/buycourses.ajax.php index d40630e438..ad63365217 100644 --- a/public/plugin/buycourses/src/buycourses.ajax.php +++ b/public/plugin/buycourses/src/buycourses.ajax.php @@ -386,7 +386,7 @@ switch ($action) { "moneda" => $serviceSale['currency'], "monto" => intval(floatval($serviceSale['price']) * 100), "usuario" => $user['username'], - "descripcion" => $serviceSale['service']['name'], + "descripcion" => $serviceSale['service']['title'], "pedido" => $serviceSale['reference'], "codigo_pais" => "PE", "direccion" => get_lang('None'), @@ -405,7 +405,7 @@ switch ($action) { Display::return_message( sprintf( $plugin->get_lang('SubscriptionToCourseXSuccessful'), - $serviceSale['service']['name'] + $serviceSale['service']['title'] ), 'success' ) @@ -453,7 +453,7 @@ switch ($action) { $html .= "
"; $html .= "{$plugin->get_lang('ServiceInformation')}"; $html .= "