diff --git a/html/admin/setup.php b/html/admin/setup.php
index 6d47756a0..e33f4fcde 100644
--- a/html/admin/setup.php
+++ b/html/admin/setup.php
@@ -467,6 +467,9 @@ if ( DEBUG=='false' ) ob_start();
ExecuteScript($db,'sql/patch/upgrade15.sql');
} // version
+ if ( GetVersion($db) == 16 ) {
+ ExecuteScript($db,'sql/patch/upgrade16.sql');
+ } // version
if ( DEBUG == 'false') ob_end_clean();
}//for
@@ -547,6 +550,9 @@ if (DEBUG == 'false' ) ob_start();
if ( GetVersion($db) == 15 ) {
ExecuteScript($db,'sql/patch/upgrade15.sql');
} // version
+ if ( GetVersion($db) == 16 ) {
+ ExecuteScript($db,'sql/patch/upgrade16.sql');
+ } // version
if ( DEBUG == 'false') ob_end_clean();
}
diff --git a/html/admin/sql/patch/upgrade16.sql b/html/admin/sql/patch/upgrade16.sql
new file mode 100644
index 000000000..b860869ff
--- /dev/null
+++ b/html/admin/sql/patch/upgrade16.sql
@@ -0,0 +1,25 @@
+begin;
+
+create or replace function card_class_base(p_f_id fiche.f_id%type)
+returns fiche_def.fd_class_base%type
+as
+$$
+declare
+ n_poste fiche_def.fd_class_base%type;
+begin
+-- card_class_base (integer)
+-- param: $1 fiche.f_id
+-- purpose : retrieve the class of a card
+--
+
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
+ where f_id=p_f_id;
+ if not FOUND then
+ raise exception 'Invalid fiche card_class_base(%)',p_f_id;
+ end if;
+return n_poste;
+end;
+$$ language plpgsql;
+update version set val=17;
+commit;