Index: openacs-4/packages/acs-kernel/acs-kernel.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v
diff -u -r1.150.2.52 -r1.150.2.53
--- openacs-4/packages/acs-kernel/acs-kernel.info	7 Feb 2023 17:50:32 -0000	1.150.2.52
+++ openacs-4/packages/acs-kernel/acs-kernel.info	10 Feb 2023 19:07:31 -0000	1.150.2.53
@@ -9,15 +9,15 @@
     <implements-subsite-p>f</implements-subsite-p>
     <inherit-templates-p>t</inherit-templates-p>
 
-    <version name="5.10.1d16" url="http://openacs.org/repository/download/apm/acs-kernel-5.10.1d16.apm">
+    <version name="5.10.1d17" url="http://openacs.org/repository/download/apm/acs-kernel-5.10.1d17.apm">
         <owner url="mailto:oct@openacs.org">OpenACS Core Team</owner>
         <summary>Routines and data models providing the foundation for OpenACS-based Web services.</summary>
         <release-date>2021-09-15</release-date>
         <vendor url="http://openacs.org">OpenACS</vendor>
         <description format="text/html">The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, parties and the supporting PL/SQL and PL/pgSQL procedures.</description>
         <maturity>3</maturity>
 
-        <provides url="acs-kernel" version="5.10.1d16"/>
+        <provides url="acs-kernel" version="5.10.1d17"/>
 
         <callbacks>
         </callbacks>
Index: openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql,v
diff -u -r1.18.2.1 -r1.18.2.2
--- openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql	13 Feb 2022 15:45:06 -0000	1.18.2.1
+++ openacs-4/packages/acs-kernel/sql/oracle/groups-body-create.sql	10 Feb 2023 19:07:31 -0000	1.18.2.2
@@ -596,6 +596,16 @@
     where rel_id = unapprove.rel_id;
   end;
 
+  procedure expire (
+    rel_id      in membership_rels.rel_id%TYPE
+  )
+  is
+  begin
+    update membership_rels
+    set member_state = 'expired'
+    where rel_id = unapprove.rel_id;
+  end;
+
   procedure deleted (
     rel_id      in membership_rels.rel_id%TYPE
   )
Index: openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql,v
diff -u -r1.13.2.3 -r1.13.2.4
--- openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql	22 Jul 2022 17:37:25 -0000	1.13.2.3
+++ openacs-4/packages/acs-kernel/sql/oracle/groups-create.sql	10 Feb 2023 19:07:31 -0000	1.13.2.4
@@ -478,6 +478,10 @@
     rel_id      in membership_rels.rel_id%TYPE
   );
 
+  procedure expire (
+    rel_id      in membership_rels.rel_id%TYPE
+  );
+
   procedure del (
     rel_id      in membership_rels.rel_id%TYPE
   );
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-kernel/sql/oracle/upgrade/upgrade-5.10.1d16-5.10.1d17.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Index: openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql,v
diff -u -r1.36.2.5 -r1.36.2.6
--- openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql	14 Mar 2020 19:06:24 -0000	1.36.2.5
+++ openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql	10 Feb 2023 19:07:31 -0000	1.36.2.6
@@ -834,6 +834,30 @@
 $$ LANGUAGE plpgsql;
 
 
+-- procedure expire
+
+
+-- added
+select define_function_args('membership_rel__expire','rel_id');
+
+--
+-- procedure membership_rel__expire/1
+--
+CREATE OR REPLACE FUNCTION membership_rel__expire(
+   expire__rel_id integer
+) RETURNS integer AS $$
+DECLARE
+BEGIN
+    update membership_rels
+    set member_state = 'expired'
+    where rel_id = expire__rel_id;
+
+    return 0;
+END;
+$$ LANGUAGE plpgsql;
+
+
+
 -- procedure deleted
 
 
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.10.1d16-5.10.1d17.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Index: openacs-4/packages/acs-tcl/acs-tcl.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v
diff -u -r1.95.2.58 -r1.95.2.59
--- openacs-4/packages/acs-tcl/acs-tcl.info	8 Feb 2023 18:35:04 -0000	1.95.2.58
+++ openacs-4/packages/acs-tcl/acs-tcl.info	10 Feb 2023 19:07:31 -0000	1.95.2.59
@@ -9,7 +9,7 @@
     <implements-subsite-p>f</implements-subsite-p>
     <inherit-templates-p>t</inherit-templates-p>
 
-    <version name="5.10.1d28" url="http://openacs.org/repository/download/apm/acs-tcl-5.10.1d28.apm">
+    <version name="5.10.1d29" url="http://openacs.org/repository/download/apm/acs-tcl-5.10.1d29.apm">
         <owner url="http://openacs.org">OpenACS</owner>
         <summary>The Kernel Tcl API library.</summary>
         <release-date>2021-09-15</release-date>
@@ -18,7 +18,7 @@
         <license>GPL version 2</license>
         <maturity>3</maturity>
 
-        <provides url="acs-tcl" version="5.10.1d28"/>
+        <provides url="acs-tcl" version="5.10.1d29"/>
         <requires url="acs-bootstrap-installer" version="5.10.0"/>
         <requires url="acs-kernel" version="5.10.1d16"/>
 
Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/membership-rel-procs-oracle.xql,v
diff -u -r1.5 -r1.5.16.1
--- openacs-4/packages/acs-tcl/tcl/membership-rel-procs-oracle.xql	4 Jun 2006 00:45:47 -0000	1.5
+++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs-oracle.xql	10 Feb 2023 19:07:31 -0000	1.5.16.1
@@ -39,4 +39,9 @@
         </querytext>
     </fullquery>
 
+    <fullquery name="membership_rel::change_state.expire">
+        <querytext>
+            begin membership_rel.expire(rel_id => :rel_id); end;
+        </querytext>
+    </fullquery>
 </queryset>
Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/membership-rel-procs-postgresql.xql,v
diff -u -r1.3 -r1.3.16.1
--- openacs-4/packages/acs-tcl/tcl/membership-rel-procs-postgresql.xql	4 Jun 2006 00:45:47 -0000	1.3
+++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs-postgresql.xql	10 Feb 2023 19:07:31 -0000	1.3.16.1
@@ -39,4 +39,9 @@
         </querytext>
     </fullquery>
 
+    <fullquery name="membership_rel::change_state.expire">
+        <querytext>
+            begin return membership_rel__expire(:rel_id); end;
+        </querytext>
+    </fullquery>
 </queryset>
Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl,v
diff -u -r1.11.2.2 -r1.11.2.3
--- openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl	21 Jul 2020 14:02:08 -0000	1.11.2.2
+++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl	10 Feb 2023 19:07:31 -0000	1.11.2.3
@@ -42,6 +42,7 @@
                 }
                 "needs approval" { db_exec_plsql unapprove {} }
                 "merged" { db_exec_plsql merge {} }
+                "expired" { db_exec_plsql expire {} }
             }
 
             # Record who changed the state
@@ -103,6 +104,14 @@
         change_state -rel_id $rel_id -state "needs approval"
     }
 
+    ad_proc -public expire {
+        {-rel_id:required}
+    } {
+       Expire a membership relation
+    } {
+        change_state -rel_id $rel_id -state "expired"
+    }
+
     ad_proc -public get {
         {-rel_id:required}
     } {
Index: openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl,v
diff -u -r1.7.2.1 -r1.7.2.2
--- openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl	15 Feb 2021 17:53:27 -0000	1.7.2.1
+++ openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl	10 Feb 2023 19:07:31 -0000	1.7.2.2
@@ -16,6 +16,7 @@
         membership_rel::delete
         membership_rel::reject
         membership_rel::unapprove
+        membership_rel::expire
         membership_rel::change_state
         ::acs::test::user::create
     } \
@@ -72,6 +73,15 @@
         aa_equals "Changed State to unapproved"  \
             $user(member_state) "needs approval"
 
+        #Try to change his state to expired
+        aa_log "We change the state to expired"
+        membership_rel::expire -rel_id $rel_id
+        acs_user::get -user_id $user_id -array user
+
+        #Verifying if the state was changed
+        aa_equals "Changed State to expired"  \
+            $user(member_state) "expired"
+
         #Try to change his state to deleted
         aa_log "We change the state to deleted"
         membership_rel::delete -rel_id $rel_id