+
+
+
+
+
+
+
+
@course_list.button@
+
+ @course_list.button@
+
+
+
+
+
+
+
+
+
+
+
+
@course_list.button@
+
+
+ @course_list.button@
+
+
+
[_ dotlrn-ecommerce.register]
@@ -379,12 +418,23 @@
}
- html { width 40% nowrap }
+ html { width 40% valign middle nowrap }
}
} -orderby {
course_name {
@@ -408,8 +458,14 @@
set grade_tree_id [parameter::get -package_id [ad_conn package_id] -parameter GradeCategoryTree -default 0]
-db_multirow -extend { fs_chunk section_folder_id section_pages_url category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades section_zones sections_url member_p sessions instructor_names prices shopping_cart_add_url attendees available_slots pending_p waiting_p approved_p instructor_p registration_approved_url button waiting_list_number asm_url } course_list get_courses { } {
+if { $offer_code_p } {
+ set discount_clause [db_map discount]
+} else {
+ set discount_clause ""
+}
+db_multirow -extend { fs_chunk section_folder_id section_pages_url category_name community_url course_edit_url section_add_url section_edit_url course_grades section_grades section_zones sections_url member_p sessions instructor_names prices shopping_cart_add_url attendees available_slots pending_p waiting_p approved_p instructor_p registration_approved_url button waiting_list_number asm_url assessment_id } course_list get_courses { } {
+
# Since dotlrn-ecommerce is based on dotlrn-catalog,
# it's possible to have a dotlrn_catalog object without an
# associated section, eventually change SQL to look at
@@ -442,11 +498,11 @@
set shopping_cart_add_url [export_vars -base register/ { community_id product_id }]
} else {
if { $allow_other_registration_p } {
- set shopping_cart_add_url [export_vars -base ecommerce/participant-change { user_id product_id return_url }]
+ set shopping_cart_add_url [export_vars -base [ad_conn package_url]ecommerce/participant-change { user_id product_id return_url }]
} else {
set return_url [export_vars -base [ad_conn package_url]ecommerce/shopping-cart-add { user_id product_id }]
if { $user_id == 0 } {
- set shopping_cart_add_url [export_vars -base ecommerce/login { return_url }]
+ set shopping_cart_add_url [export_vars -base login { return_url }]
} else {
set shopping_cart_add_url $return_url
}
@@ -531,6 +587,8 @@
if { $available_slots <= 0 } {
set button "[_ dotlrn-ecommerce.join_waiting_list]"
}
+ } else {
+ set available_slots 99999
}
set section_zones [util_memoize [list dotlrn_ecommerce::section::section_zones $community_id]]
Index: openacs-4/packages/dotlrn-ecommerce/sql/oracle/dotlrn-ecommerce-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/sql/oracle/dotlrn-ecommerce-create.sql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/dotlrn-ecommerce/sql/oracle/dotlrn-ecommerce-create.sql 10 Aug 2005 21:18:23 -0000 1.4
+++ openacs-4/packages/dotlrn-ecommerce/sql/oracle/dotlrn-ecommerce-create.sql 20 Aug 2005 18:27:54 -0000 1.5
@@ -70,5 +70,9 @@
alter table ec_custom_product_field_values add maxparticipants integer;
alter table ec_custom_p_field_values_audit add maxparticipants integer;
+insert into ec_custom_product_fields (field_identifier, field_name, default_value, column_type, last_modified,last_modifying_user, modified_ip_address) values ('show_description_p', 'Show Section Description', '', 'char(1)', now(), '0', '0.0.0.0');
+alter table ec_custom_product_field_values add show_description_p char(1) constraint show_description_p_constraint check (show_description_p in ('t', 'f'));
+alter table ec_custom_p_field_values_audit add show_description_p char(1);
+
@@ dotlrn-ecommerce-memberships-create.sql
@@ dotlrn-ecommerce-admin-portlet-create.sql
\ No newline at end of file
Index: openacs-4/packages/dotlrn-ecommerce/sql/postgresql/dotlrn-ecommerce-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/sql/postgresql/dotlrn-ecommerce-create.sql,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/dotlrn-ecommerce/sql/postgresql/dotlrn-ecommerce-create.sql 10 Aug 2005 21:18:23 -0000 1.20
+++ openacs-4/packages/dotlrn-ecommerce/sql/postgresql/dotlrn-ecommerce-create.sql 20 Aug 2005 18:27:54 -0000 1.21
@@ -85,6 +85,10 @@
alter table ec_custom_product_field_values add maxparticipants integer;
alter table ec_custom_p_field_values_audit add maxparticipants integer;
+insert into ec_custom_product_fields (field_identifier, field_name, default_value, column_type, last_modified,last_modifying_user, modified_ip_address) values ('show_description_p', 'Show Section Description', '', 'boolean', now(), '0', '0.0.0.0');
+alter table ec_custom_product_field_values add show_description_p boolean;
+alter table ec_custom_p_field_values_audit add show_description_p boolean;
+
-- Add member states
alter table membership_rels drop constraint membership_rel_mem_ck;
alter table membership_rels add CONSTRAINT membership_rel_mem_ck CHECK ((((((((member_state)::text = 'merged'::text) OR ((member_state)::text = 'approved'::text)) OR ((member_state)::text = 'needs approval'::text)) OR ((member_state)::text = 'banned'::text)) OR ((member_state)::text = 'rejected'::text)) OR ((member_state)::text = 'deleted'::text) OR ((member_state)::text = 'request approval'::text) OR ((member_state)::text = 'request approved'::text) OR ((member_state)::text = 'waitinglist approved'::text) OR ((member_state)::text = 'awaiting payment'::text) OR ((member_state)::text = 'payment received'::text)));
Index: openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 15 Aug 2005 08:47:38 -0000 1.16
+++ openacs-4/packages/dotlrn-ecommerce/tcl/apm-callback-procs.tcl 20 Aug 2005 18:27:54 -0000 1.17
@@ -113,7 +113,7 @@
1 \
number
}
- 0.1d6 0.1d7 {
+ 0.1d6 0.1d7 {
apm_parameter_register \
GradePrerequisitesP \
"Set this to 1 if you want participants to be verified against the Grade requirement for a section." \
@@ -127,7 +127,28 @@
dotlrn-ecommerce \
0 \
number
+ }
+ 0.1d7 0.1d8 {
+ apm_parameter_register \
+ GroupPurchaseP \
+ "Allow purchasing for groups." \
+ dotlrn-ecommerce \
+ 1 \
+ number
+ apm_parameter_register \
+ AllowSettingRelationshipsP \
+ "Support setting of related users." \
+ dotlrn-ecommerce \
+ 1 \
+ number
+
+ apm_parameter_register \
+ OfferCodesP \
+ "Support asking for offer codes for discount prices." \
+ dotlrn-ecommerce \
+ 0 \
+ number
}
}
}
Index: openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl,v
diff -u -r1.22 -r1.23
--- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 18 Aug 2005 14:30:28 -0000 1.22
+++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 20 Aug 2005 18:27:54 -0000 1.23
@@ -151,7 +151,7 @@
@error
} {
db_1row section_info {
- select community_id, course_id as item_id
+ select community_id, course_id as item_id, product_id
from dotlrn_ecommerce_section
where section_id = :section_id
}
@@ -178,7 +178,7 @@
util_memoize_flush [list dotlrn_ecommerce::section::member_price $section_id]
util_memoize_flush [list dotlrn_ecommerce::section::application_assessment $section_id]
util_memoize_flush [list dotlrn_ecommerce::section::section_zones $community_id]
-
+ util_memoize_flush [list dotlrn_ecommerce::section::has_discount_p $product_id]
if { [exists_and_not_null user_id] } {
util_memoize_flush [list dotlrn_ecommerce::section::member_state $user_id $community_id]
util_memoize_flush [list dotlrn_ecommerce::section::waiting_list_number $user_id $community_id]
@@ -670,3 +670,22 @@
ad_schedule_proc -thread t 600 dotlrn_ecommerce::section::check_expired_orders
}
+
+ad_proc -public dotlrn_ecommerce::section::has_discount_p {
+ product_id
+} {
+ Check if there's a current promotion for the product
+
+ @author Roel Canicula (roelmc@pldtdsl.net)
+ @creation-date 2005-08-20
+
+ @return
+
+ @error
+} {
+ return [db_string discount_codes {
+ select count(*)
+ from ec_sale_prices_current
+ where product_id=:product_id
+ } -default 0]
+}
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/offer-code-set.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/offer-code-set.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/offer-code-set.tcl 20 Aug 2005 18:27:54 -0000 1.1
@@ -0,0 +1,59 @@
+# packages/dotlrn-ecommerce/www/ecommerce/offer-code-set.tcl
+
+ad_page_contract {
+
+ Set offer code
+
+ @author Roel Canicula (roelmc@pldtdsl.net)
+ @creation-date 2005-08-20
+ @arch-tag: eaad10fa-7003-47e9-b633-f9d45587751b
+ @cvs-id $Id: offer-code-set.tcl,v 1.1 2005/08/20 18:27:54 roelc Exp $
+} {
+ user_id:integer,notnull,optional
+ product_id:integer,notnull
+ offer_code
+ return_url:notnull
+} -properties {
+} -validate {
+} -errors {
+}
+
+if { ![exists_and_not_null user_id] } {
+ set user_id [ad_verify_and_get_user_id]
+}
+
+set user_session_id [ec_get_user_session_id]
+ec_create_new_session_if_necessary [export_url_vars product_id offer_code return_url]
+
+if { ! [empty_string_p $offer_code] } {
+ if { [db_string get_offer_code_p "
+ select count(*)
+ from ec_user_session_offer_codes
+ where user_session_id=:user_session_id
+ and product_id=:product_id"] == 0 } {
+ db_dml inert_uc_offer_code "
+ insert into ec_user_session_offer_codes
+ (user_session_id, product_id, offer_code)
+ values
+ (:user_session_id, :product_id, :offer_code)"
+ } else {
+ db_dml update_ec_us_offers "
+ update ec_user_session_offer_codes
+ set offer_code = :offer_code
+ where user_session_id = :user_session_id
+ and product_id = :product_id"
+ }
+
+ set original_price [lindex [ec_lowest_price_and_price_name_for_an_item $product_id $user_id] 0]
+ set discounted_price [lindex [ec_lowest_price_and_price_name_for_an_item $product_id $user_id $offer_code] 0]
+ if { ($original_price - $discounted_price) != 0 } {
+ set savings [ec_pretty_price [expr $original_price - $discounted_price]]
+ set message "[_ dotlrn-ecommerce.lt_The_offer_code_was_ac]"
+ } else {
+ set message "[_ dotlrn-ecommerce.lt_Sorry_the_offer_code_]"
+ }
+
+ ad_returnredirect -message $message $return_url
+} else {
+ ad_returnredirect $return_url
+}
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl 18 Aug 2005 18:40:37 -0000 1.15
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-add.tcl 20 Aug 2005 18:27:54 -0000 1.16
@@ -25,19 +25,51 @@
@revision-date April 2002
} {
- product_id:integer
+ product_id:integer,optional
{item_count 1}
{size_choice ""}
{color_choice ""}
{style_choice ""}
usca_p:optional
- user_id:integer,notnull
+ user_id:integer,notnull,optional
{participant_id:integer 0}
{override_p 0}
+
+ offer_code:optional
+ return_url:notnull,optional
}
+set user_session_id [ec_get_user_session_id]
+ec_create_new_session_if_necessary [export_url_vars product_id user_id participant_id item_count offer_code return_url]
+
+if { [info exists offer_code] } {
+ if { ! [exists_and_not_null product_id] && ! [exists_and_not_null user_id] } {
+ ad_returnredirect [export_vars -base $return_url { offer_code }]
+ ad_script_abort
+ }
+
+ if { [db_string get_offer_code_p "
+ select count(*)
+ from ec_user_session_offer_codes
+ where user_session_id=:user_session_id
+ and product_id=:product_id"] == 0 } {
+ db_dml inert_uc_offer_code "
+ insert into ec_user_session_offer_codes
+ (user_session_id, product_id, offer_code)
+ values
+ (:user_session_id, :product_id, :offer_code)"
+ } else {
+ db_dml update_ec_us_offers "
+ update ec_user_session_offer_codes
+ set offer_code = :offer_code
+ where user_session_id = :user_session_id
+ and product_id = :product_id"
+ }
+
+}
+
# avoid anonymous participants
if {$user_id == 0} {
set user_id [auth::require_login]
@@ -115,7 +147,7 @@
set cancel_url [set return_url [export_vars -base [ad_conn package_url]admin/process-purchase-course { user_id }]]
} else {
set return_url [export_vars -base [ad_conn package_url]application-confirm { product_id {member_state "needs approval"} }]
- set cancel_url ..
+ set cancel_url [ad_conn package_url]
}
ad_returnredirect [export_vars -base waiting-list-confirm { product_id user_id participant_id return_url cancel_url }]
ad_script_abort
@@ -189,8 +221,6 @@
# the shopping cart page (shopping-cart.tcl)
# 5. ad_returnredirect them to their shopping cart
-set user_session_id [ec_get_user_session_id]
-ec_create_new_session_if_necessary [export_url_vars product_id user_id participant_id item_count]
set n_confirmed_orders [db_string get_n_confirmed_orders "
select count(*)
from ec_orders
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl 11 Aug 2005 01:03:09 -0000 1.4
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart-delete-from.tcl 20 Aug 2005 18:27:54 -0000 1.5
@@ -81,7 +81,7 @@
# Flush cache
if { [db_0or1row section_from_product {
select section_id
- from dlec_view_sections
+ from dotlrn_ecommerce_section
where product_id = :product_id
}] } {
dotlrn_ecommerce::section::flush_cache $section_id
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 17 Aug 2005 09:31:58 -0000 1.9
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/shopping-cart.adp 20 Aug 2005 18:27:54 -0000 1.10
@@ -20,8 +20,6 @@
-