[Koha-cvs] koha updater/updatedatabase C4/ClubsAndServices... [dev_week]
Kyle Hall
kyle.m.hall at gmail.com
Fri Apr 13 20:40:20 CEST 2007
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Kyle Hall <kylemhall> 07/04/13 18:40:20
Modified files:
updater : updatedatabase
Added files:
C4 : ClubsAndServices.pm
clubsAndServices: clubsAndServices.pl editArchetypes.pl
editClubsAndServices.pl
enrollClubsAndServices.pl
koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices:
clubsAndServices.tmpl
editArchetypes.tmpl
editClubsAndServices.tmpl
enrollClubsAndServices.tmpl
Log message:
Adding 'Clubs & Services' Module to Koha, more to come!
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/ClubsAndServices.pm?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/clubsAndServices/clubsAndServices.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/clubsAndServices/editArchetypes.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/clubsAndServices/editClubsAndServices.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/clubsAndServices/enrollClubsAndServices.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/clubsAndServices.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editArchetypes.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editClubsAndServices.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/enrollClubsAndServices.tmpl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=dev_week&r1=1.100.2.43.2.6&r2=1.100.2.43.2.7
Patches:
Index: updater/updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.100.2.43.2.6
retrieving revision 1.100.2.43.2.7
diff -u -b -r1.100.2.43.2.6 -r1.100.2.43.2.7
--- updater/updatedatabase 20 Feb 2007 16:26:51 -0000 1.100.2.43.2.6
+++ updater/updatedatabase 13 Apr 2007 18:40:19 -0000 1.100.2.43.2.7
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# $Id: updatedatabase,v 1.100.2.43.2.6 2007/02/20 16:26:51 rych Exp $
+# $Id: updatedatabase,v 1.100.2.43.2.7 2007/04/13 18:40:19 kylemhall Exp $
# Database Updater
# This script checks for required updates to the database.
@@ -167,6 +167,58 @@
PRIMARY KEY (id)
)",
+ clubsAndServices => "(
+ casId int(11) NOT NULL auto_increment,
+ casaId int(11) NOT NULL COMMENT 'foreign key to clubsAndServicesArchetypes',
+ title text NOT NULL,
+ description text,
+ casData1 text COMMENT 'Data described in casa.casData1Title',
+ casData2 text COMMENT 'Data described in casa.casData2Title',
+ casData3 text COMMENT 'Data described in casa.casData3Title',
+ startDate date NOT NULL,
+ endDate date default NULL,
+ branchcode varchar(4) default NULL COMMENT 'branch where club or service was created.',
+ `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ PRIMARY KEY (casId)
+ )",
+
+ clubsAndServicesArchetypes => "(
+ casaId int(11) NOT NULL auto_increment,
+ type enum('club','service') NOT NULL default 'club',
+ title text NOT NULL COMMENT 'title of this archetype',
+ description text NOT NULL COMMENT 'long description of this archetype',
+ publicEnrollment tinyint(1) NOT NULL default '0' COMMENT 'If 1, patron should be able to enroll in club or service from OPAC, if 0, only a librarian should be able to enroll a patron in the club or service.',
+ casData1Title text COMMENT 'Title of contents in cas.data1',
+ casData2Title text COMMENT 'Title of contents in cas.data2',
+ casData3Title text COMMENT 'Title of contents in cas.data3',
+ caseData1Title text COMMENT 'Title of what is stored in cAsE.data1',
+ caseData2Title text COMMENT 'Title of what is stored in cAsE.data2',
+ caseData3Title text COMMENT 'Title of what is stored in cAsE.data3',
+ casData1Desc text,
+ casData2Desc text,
+ casData3Desc text,
+ caseData1Desc text,
+ caseData2Desc text,
+ caseData3Desc text,
+ branchcode varchar(4) default NULL COMMENT 'branch where archetype was created.',
+ `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ PRIMARY KEY (casaId)
+ )",
+
+ clubsAndServicesEnrollments => "(
+ caseId int(11) NOT NULL auto_increment,
+ casaId int(11) NOT NULL COMMENT 'foreign key to clubsAndServicesArchtypes',
+ casId int(11) NOT NULL COMMENT 'foreign key to clubsAndServices',
+ borrowernumber int(11) NOT NULL COMMENT 'foreign key to borrowers',
+ data1 text COMMENT 'data described in casa.data1description',
+ data2 text,
+ data3 text,
+ dateEnrolled date NOT NULL COMMENT 'date borrowers service begins',
+ dateCanceled date default NULL COMMENT 'date borrower decided to end service',
+ `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ branchcode varchar(4) default NULL COMMENT 'foreign key to branches',
+ PRIMARY KEY (caseId)
+ )",
);
my %requirefields = (
@@ -1645,6 +1697,9 @@
exit;
# $Log: updatedatabase,v $
+# Revision 1.100.2.43.2.7 2007/04/13 18:40:19 kylemhall
+# Adding 'Clubs & Services' Module to Koha, more to come!
+#
# Revision 1.100.2.43.2.6 2007/02/20 16:26:51 rych
# add confirmissuescharge- minimum charge for issuing confirmation dialog to appear
#
Index: C4/ClubsAndServices.pm
===================================================================
RCS file: C4/ClubsAndServices.pm
diff -N C4/ClubsAndServices.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ C4/ClubsAndServices.pm 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,830 @@
+package C4::ClubsAndServices;
+
+# $Id: ClubsAndServices.pm,v 0.1 2007/04/10 kylemhall
+
+# This package is intended for dealing with clubs and services
+# and enrollments in such, such as summer reading clubs, and
+# library newsletters
+
+# Copyright 2007 Kyle Hall
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+
+require Exporter;
+
+use C4::Context;
+
+use DBI;
+
+use Data::Dumper;
+
+use vars qw($VERSION @ISA @EXPORT);
+
+# set the version for version checking
+$VERSION = 0.01;
+
+=head1 NAME
+
+C4::ClubsAndServices - Functions for managing clubs and services
+
+=head1 FUNCTIONS
+
+=over 2
+
+=cut
+
+ at ISA = qw( Exporter );
+ at EXPORT = qw(
+ AddClubOrServiceArchetype
+ UpdateClubOrServiceArchetype
+ DeleteClubOrServiceArchetype
+
+ AddClubOrService
+ UpdateClubOrService
+ DeleteClubOrService
+
+ EnrollInClubOrService
+ GetEnrollments
+ GetClubsAndServices
+ GetClubOrService
+ GetClubsAndServicesArchetypes
+ GetClubOrServiceArchetype
+ CancelClubOrServiceEnrollment
+
+ getTodayMysqlDateFormat
+);
+
+## function AddClubOrServiceArchetype
+## Creates a new archetype for a club or service
+## An archetype is something after which other things a patterned,
+## For example, you could create a 'Summer Reading Club' club archtype
+## which is then used to create an individual 'Summer Reading Club'
+## *for each library* in your system.
+## Input:
+## $type : 'club' or 'service', could be extended to add more types
+## $title: short description of the club or service
+## $description: long description of the club or service
+## $publicEnrollment: If true, any borrower should be able
+## to enroll in club or service from opac. If false,
+## Only a librarian should be able to enroll a borrower
+## in the club or service.
+## $casData1Title: explanation of what is stored in
+## clubsAndServices.casData1Title
+## $casData2Title: same but for casData2Title
+## $casData3Title: same but for casData3Title
+## $caseData1Title: explanation of what is stored in
+## clubsAndServicesEnrollment.data1
+## $caseData2Title: Same but for data2
+## $caseData3Title: Same but for data3
+## $casData1Desc: Long explanation of what is stored in
+## clubsAndServices.casData1Title
+## $casData2Desc: same but for casData2Title
+## $casData3Desc: same but for casData3Title
+## $caseData1Desc: Long explanation of what is stored in
+## clubsAndServicesEnrollment.data1
+## $caseData2Desc: Same but for data2
+## $caseData3Desc: Same but for data3
+## $branchcode: The branchcode for the branch where this Archetype was created
+## Output:
+## $success: 1 if all database operations were successful, 0 otherwise
+## $errorCode: Code for reason of failure, good for translating errors in templates
+## $errorMessage: English description of error
+sub AddClubOrServiceArchetype {
+ my ( $type, $title, $description, $publicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $branchcode ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( ! $type ) {
+ return ( 0, 1, "No Type Given" );
+ }
+ if ( ! $title ) {
+ return ( 0, 2, "No Title Given" );
+ }
+ if ( ! $description ) {
+ return ( 0, 3, "No Description Given" );
+ }
+
+ my $success = 1;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ $sth = $dbh->prepare("INSERT INTO clubsAndServicesArchetypes ( casaId, type, title, description, publicEnrollment, branchcode, timestamp )
+ VALUES ( NULL, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
+ $sth->execute( $type, $title, $description, $publicEnrollment, $branchcode ) or $success = 0;
+ my $casaId = $dbh->{'mysql_insertid'};
+ $sth->finish;
+
+ if ( $casData1Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData1Title = ? WHERE casaId = ?");
+ $sth->execute( $casData1Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $casData2Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData2Title = ? WHERE casaId = ?");
+ $sth->execute( $casData2Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $casData3Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData3Title = ? WHERE casaId = ?");
+ $sth->execute( $casData3Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+
+ if ( $caseData1Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData1Title = ? WHERE casaId = ?");
+ $sth->execute( $caseData1Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $caseData2Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData2Title = ? WHERE casaId = ?");
+ $sth->execute( $caseData2Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $caseData3Title ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData3Title = ? WHERE casaId = ?");
+ $sth->execute( $caseData3Title, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+ if ( $casData1Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData1Desc = ? WHERE casaId = ?");
+ $sth->execute( $casData1Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $casData2Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData2Desc = ? WHERE casaId = ?");
+ $sth->execute( $casData2Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $casData3Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET casData3Desc = ? WHERE casaId = ?");
+ $sth->execute( $casData3Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+ if ( $caseData1Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData1Desc = ? WHERE casaId = ?");
+ $sth->execute( $caseData1Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $caseData2Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData2Desc = ? WHERE casaId = ?");
+ $sth->execute( $caseData2Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+ if ( $caseData3Desc ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes SET caseData3Desc = ? WHERE casaId = ?");
+ $sth->execute( $caseData3Desc, $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+ my ( $errorCode, $errorMessage );
+ if ( ! $success ) {
+ $errorMessage = "Database Failure";
+ $errorCode = 4;
+ }
+
+ return( $success, $errorCode, $errorMessage );
+
+}
+
+## function UpdateClubOrServiceArchetype
+## Updates an archetype for a club or service
+## Input:
+## $casaId: id of the archetype to be updated
+## $type : 'club' or 'service', could be extended to add more types
+## $title: short description of the club or service
+## $description: long description of the club or service
+## $publicEnrollment: If true, any borrower should be able
+## to enroll in club or service from opac. If false,
+## Only a librarian should be able to enroll a borrower
+## in the club or service.
+## $casData1Title: explanation of what is stored in
+## clubsAndServices.casData1Title
+## $casData2Title: same but for casData2Title
+## $casData3Title: same but for casData3Title
+## $caseData1Title: explanation of what is stored in
+## clubsAndServicesEnrollment.data1
+## $caseData2Title: Same but for data2
+## $caseData3Title: Same but for data3
+## $casData1Desc: Long explanation of what is stored in
+## clubsAndServices.casData1Title
+## $casData2Desc: same but for casData2Title
+## $casData3Desc: same but for casData3Title
+## $caseData1Desc: Long explanation of what is stored in
+## clubsAndServicesEnrollment.data1
+## $caseData2Desc: Same but for data2
+## $caseData3Desc: Same but for data3
+## Output:
+## $success: 1 if all database operations were successful, 0 otherwise
+## $errorCode: Code for reason of failure, good for translating errors in templates
+## $errorMessage: English description of error
+sub UpdateClubOrServiceArchetype {
+ my ( $casaId, $type, $title, $description, $publicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc
+ ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( ! $casaId ) {
+ return ( 0, 1, "No Id Given" );
+ }
+ if ( ! $type ) {
+ return ( 0, 2, "No Type Given" );
+ }
+ if ( ! $title ) {
+ return ( 0, 3, "No Title Given" );
+ }
+ if ( ! $description ) {
+ return ( 0, 4, "No Description Given" );
+ }
+
+ my $success = 1;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ $sth = $dbh->prepare("UPDATE clubsAndServicesArchetypes
+ SET
+ type = ?, title = ?, description = ?, publicEnrollment = ?,
+ casData1Title = ?, casData2Title = ?, casData3Title = ?,
+ caseData1Title = ?, caseData2Title = ?, caseData3Title = ?,
+ casData1Desc = ?, casData2Desc = ?, casData3Desc = ?,
+ caseData1Desc = ?, caseData2Desc = ?, caseData3Desc = ?,
+ timestamp = NOW() WHERE casaId = ?");
+# $sth = $dbh->prepare("INSERT INTO clubsAndServicesArchetypes ( casaId, type, title, description, publicEnrollment, timestamp )
+# VALUES ( NULL, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
+ $sth->execute( $type, $title, $description, $publicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $casaId )
+ or return ( $success = 0, my $errorCode = 6, my $errorMessage = $sth->errstr() );
+ $sth->finish;
+
+ return $success;
+
+}
+
+## function DeleteClubOrServiceArchetype
+## Deletes an Archetype of the given id
+## and all Clubs or Services based on it,
+## and all Enrollments based on those clubs
+## or services.
+## Input:
+## $casaId : id of the Archtype to be deleted
+## Output:
+## $success : 1 on successful deletion, 0 otherwise
+sub DeleteClubOrServiceArchetype {
+ my ( $casaId ) = @_;
+
+ ## Paramter check
+ if ( ! $casaId ) {
+ return 0;
+ }
+
+ my $success = 1;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+
+ $sth = $dbh->prepare("DELETE FROM clubsAndServicesEnrollments WHERE casaId = ?");
+ $sth->execute( $casaId ) or $success = 0;
+ $sth->finish;
+
+ if ( $success ) {
+ $sth = $dbh->prepare("DELETE FROM clubsAndServices WHERE casaId = ?");
+ $sth->execute( $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+ if ( $success ) {
+ $sth = $dbh->prepare("DELETE FROM clubsAndServicesArchetypes WHERE casaId = ?");
+ $sth->execute( $casaId ) or $success = 0;
+ $sth->finish;
+ }
+
+ return $success;
+}
+
+## function AddClubOrService
+## Creates a new club or service in the database
+## Input:
+## $type: 'club' or 'service', other types may be added as necessary.
+## $title: Short description of the club or service
+## $description: Long description of the club or service
+## $casData1: The data described in case.casData1Title
+## $casData2: The data described in case.casData2Title
+## $casData3: The data described in case.casData3Title
+## $startDate: The date the club or service begins ( Optional: Defaults to TODAY() )
+## $endDate: The date the club or service ends ( Optional )
+## $branchcode: Branch that created this club or service ( Optional: NULL is system-wide )
+## Output:
+## $success: 1 on successful add, 0 on failure
+## $errorCode: Code for reason of failure, good for translating errors in templates
+## $errorMessage: English description of error
+sub AddClubOrService {
+ my ( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $branchcode ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( ! $casaId ) {
+ return ( 0, 1, "No Archetype Given" );
+ }
+ if ( ! $title ) {
+ return ( 0, 2, "No Title Given" );
+ }
+ if ( ! $description ) {
+ return ( 0, 3, "No Description Given" );
+ }
+
+ my $success = 1;
+
+ if ( ! $startDate ) {
+ $startDate = getTodayMysqlDateFormat();
+ }
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ if ( $endDate ) {
+ $sth = $dbh->prepare("INSERT INTO clubsAndServices ( casId, casaId, title, description, casData1, casData2, casData3, startDate, endDate, branchcode, timestamp )
+ VALUES ( NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
+ $sth->execute( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $branchcode ) or $success = 0;
+ } else {
+ $sth = $dbh->prepare("INSERT INTO clubsAndServices ( casId, casaId, title, description, casData1, casData2, casData3, startDate, branchcode, timestamp )
+ VALUES ( NULL, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)");
+ $sth->execute( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $branchcode ) or $success = 0;
+ }
+ $sth->finish;
+
+ my ( $errorCode, $errorMessage );
+ if ( ! $success ) {
+ $errorMessage = "Database Failure";
+ $errorCode = 5;
+ }
+
+ return( $success, $errorCode, $errorMessage );
+}
+
+## function UpdateClubOrService
+## Updates club or service in the database
+## Input:
+## $casId: id of the club or service to be updated
+## $type: 'club' or 'service', other types may be added as necessary.
+## $title: Short description of the club or service
+## $description: Long description of the club or service
+## $casData1: The data described in case.casData1Title
+## $casData2: The data described in case.casData2Title
+## $casData3: The data described in case.casData3Title
+## $startDate: The date the club or service begins ( Optional: Defaults to TODAY() )
+## $endDate: The date the club or service ends ( Optional )
+## Output:
+## $success: 1 on successful add, 0 on failure
+## $errorCode: Code for reason of failure, good for translating errors in templates
+## $errorMessage: English description of error
+sub UpdateClubOrService {
+ my ( $casId, $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( ! $casId ) {
+ return ( 0, 1, "No casId Given" );
+ }
+ if ( ! $casaId ) {
+ return ( 0, 2, "No Archetype Given" );
+ }
+ if ( ! $title ) {
+ return ( 0, 3, "No Title Given" );
+ }
+ if ( ! $description ) {
+ return ( 0, 4, "No Description Given" );
+ }
+
+ my $success = 1;
+
+ if ( ! $startDate ) {
+ $startDate = getTodayMysqlDateFormat();
+ }
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ if ( $endDate ) {
+ $sth = $dbh->prepare("UPDATE clubsAndServices SET casaId = ?, title = ?, description = ?, casData1 = ?, casData2 = ?, casData3 = ?, startDate = ?, endDate = ?, timestamp = NOW() WHERE casId = ?");
+ $sth->execute( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $casId ) or return( my $success = 0, my $errorCode = 5, my $errorMessage = $sth->errstr() );
+ } else {
+ $sth = $dbh->prepare("UPDATE clubsAndServices SET casaId = ?, title = ?, description = ?, casData1 = ?, casData2 = ?, casData3 = ?, startDate = ?, timestamp = NOW() WHERE casId = ?");
+ $sth->execute( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $casId ) or return( my $success = 0, my $errorCode = 5, my $errorMessage = $sth->errstr() );
+ }
+ $sth->finish;
+
+ my ( $errorCode, $errorMessage );
+ if ( ! $success ) {
+ $errorMessage = "Database Failure";
+ $errorCode = 5;
+ }
+
+ return( $success, $errorCode, $errorMessage );
+}
+
+## function DeleteClubOrService
+## Deletes a club or service of the given id
+## and all enrollments based on it.
+## Input:
+## $casId : id of the club or service to be deleted
+## Output:
+## $success : 1 on successful deletion, 0 otherwise
+sub DeleteClubOrService {
+ my ( $casId ) = @_;
+ my $success = 1;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ $sth = $dbh->prepare("DELETE FROM clubsAndServicesEnrollments WHERE casId = ?");
+ $sth->execute( $casId ) or $success = 0;
+ $sth->finish;
+
+ if ( $success ) {
+ $sth = $dbh->prepare("DELETE FROM clubsAndServices WHERE casId = ?");
+ $sth->execute( $casId ) or $success = 0;
+ $sth->finish;
+ }
+
+ return $success;
+}
+
+## function EnrollInClubOrService
+## Enrolls a borrower in a given club or service
+## Input:
+## $casId: The unique id of the club or service being enrolled in
+## $borrowerCardnumber: The card number of the enrolling borrower
+## $dateEnrolled: Date the enrollment begins ( Optional: Defauls to TODAY() )
+## $data1: The data described in ClubsAndServicesArchetypes.caseData1Title
+## $data2: The data described in ClubsAndServicesArchetypes.caseData2Title
+## $data3: The data described in ClubsAndServicesArchetypes.caseData3Title
+## $branchcode: The branch where this club or service enrollment is,
+## Output:
+## $success: 1 on successful enrollment, 0 on failure
+## $errorCode: Code for reason of failure, good for translating errors in templates
+## $errorMessage: English description of error
+sub EnrollInClubOrService {
+ my ( $casaId, $casId, $borrowerCardnumber, $dateEnrolled, $data1, $data2, $data3, $branchcode ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( ! $casaId ) {
+ return ( 0, 1, "No casaId Given" );
+ }
+ if ( ! $casId ) {
+ return ( 0, 2, "No casId Given" );
+ }
+ if ( ! $borrowerCardnumber ) {
+ return ( 0, 3, "No Borrower Barcode Given" );
+ }
+
+ my $borrowernumber = getBorrowernumberByCardnumber( $borrowerCardnumber );
+
+ if ( isEnrolled( $casId, $borrowernumber ) ) { return ( 0, 5, "Member is already enrolled!" ); }
+
+ if ( ! $dateEnrolled ) {
+ $dateEnrolled = getTodayMysqlDateFormat();
+ }
+
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("INSERT INTO clubsAndServicesEnrollments ( caseId, casaId, casId, borrowernumber, data1, data2, data3, dateEnrolled, dateCanceled, timestamp, branchcode)
+ VALUES ( NULL, ?, ?, ?, ?, ?, ?, ?, NULL, NOW(), ? )");
+ $sth->execute( $casaId, $casId, $borrowernumber, $data1, $data2, $data3, $dateEnrolled, $branchcode ) or return( my $success = 0, my $errorCode = 4, my $errorMessage = $sth->errstr() );
+ $sth->finish;
+
+ return $success = 1;
+}
+
+## function GetEnrollments
+## Returns information about the clubs and services
+## the given borrower is enrolled in.
+## Input:
+## $borrowernumber: The borrowernumber of the borrower
+## Output:
+## $results: Reference to an array of associated arrays
+sub GetEnrollments {
+ my ( $borrowernumber ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare("SELECT * FROM clubsAndServices, clubsAndServicesEnrollments
+ WHERE clubsAndServices.casId = clubsAndServicesEnrollments.casId
+ AND clubsAndServicesEnrollments.borrowernumber = ?");
+ $sth->execute( $borrowernumber ) or return 0;
+
+ my @results;
+ while ( my $row = $sth->fetchrow_hashref ) {
+ push( @results , $row );
+ }
+
+ $sth->finish;
+
+ return \@results;
+}
+
+## function GetClubsAndServices
+## Returns information about clubs and services
+## Input:
+## $type: ( Optional: 'club' or 'service' )
+## $branchcode: ( Optional: Get clubs and services only created by this branch )
+## Output:
+## $results:
+## Reference to an array of associated arrays
+sub GetClubsAndServices {
+ my ( $type, $branchcode ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my ( $sth, @results );
+ if ( $type && $branchcode ) {
+ $sth = $dbh->prepare("SELECT clubsAndServices.casId,
+ clubsAndServices.casaId,
+ clubsAndServices.title,
+ clubsAndServices.description,
+ clubsAndServices.casData1,
+ clubsAndServices.casData2,
+ clubsAndServices.casData3,
+ clubsAndServices.startDate,
+ clubsAndServices.endDate,
+ clubsAndServices.timestamp,
+ clubsAndServices.branchcode
+ FROM clubsAndServices, clubsAndServicesArchetypes
+ WHERE (
+ clubsAndServices.casaId = clubsAndServicesArchetypes.casaId
+ AND clubsAndServices.branchcode = ?
+ AND clubsAndServicesArchetypes.type = ?
+ )");
+ $sth->execute( $branchcode, $type ) or return 0;
+
+ } elsif ( $type ) {
+ $sth = $dbh->prepare("SELECT clubsAndServices.casId,
+ clubsAndServices.casaId,
+ clubsAndServices.title,
+ clubsAndServices.description,
+ clubsAndServices.casData1,
+ clubsAndServices.casData2,
+ clubsAndServices.casData3,
+ clubsAndServices.startDate,
+ clubsAndServices.endDate,
+ clubsAndServices.timestamp,
+ clubsAndServices.branchcode
+ FROM clubsAndServices, clubsAndServicesArchetypes
+ WHERE (
+ clubsAndServices.casaId = clubsAndServicesArchetypes.casaId
+ AND clubsAndServicesArchetypes.type = ?
+ )");
+ $sth->execute( $type ) or return 0;
+
+ } elsif ( $branchcode ) {
+ $sth = $dbh->prepare("SELECT clubsAndServices.casId,
+ clubsAndServices.casaId,
+ clubsAndServices.title,
+ clubsAndServices.description,
+ clubsAndServices.casData1,
+ clubsAndServices.casData2,
+ clubsAndServices.casData3,
+ clubsAndServices.startDate,
+ clubsAndServices.endDate,
+ clubsAndServices.timestamp,
+ clubsAndServices.branchcode
+ FROM clubsAndServices, clubsAndServicesArchetypes
+ WHERE (
+ clubsAndServices.casaId = clubsAndServicesArchetypes.casaId
+ AND clubsAndServices.branchcode = ?
+ )");
+ $sth->execute( $branchcode ) or return 0;
+
+ } else { ## Get all clubs and services
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServices");
+ $sth->execute() or return 0;
+ }
+
+ while ( my $row = $sth->fetchrow_hashref ) {
+ push( @results , $row );
+ }
+
+ $sth->finish;
+
+ return \@results;
+
+}
+
+
+## function GetClubOrService
+## Returns information about a club or service
+## Input:
+## $casId: Id of club or service to get
+## Output:
+## $results:
+## $casId, $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $timestamp, $branchcode
+sub GetClubOrService {
+ my ( $casId ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my ( $sth, @results );
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServices WHERE casId = ?");
+ $sth->execute( $casId ) or return 0;
+
+ my $row = $sth->fetchrow_hashref;
+
+ $sth->finish;
+
+ return (
+ $$row{'casId'},
+ $$row{'casaId'},
+ $$row{'title'},
+ $$row{'description'},
+ $$row{'casData1'},
+ $$row{'casData2'},
+ $$row{'casData3'},
+ $$row{'startDate'},
+ $$row{'endDate'},
+ $$row{'timestamp'},
+ $$row{'branchcode'}
+ );
+
+}
+
+## function GetClubsAndServicesArchetypes
+## Returns information about clubs and services archetypes
+## Input:
+## $type: 'club' or 'service' ( Optional: Defaults to all types )
+## $branchcode: Get clubs or services created by this branch ( Optional )
+## Output:
+## $results:
+## Otherwise: Reference to an array of associated arrays
+## Except: 0 on failure
+sub GetClubsAndServicesArchetypes {
+ my ( $type, $branchcode ) = @_;
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ if ( $type && $branchcode) {
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServicesArchetypes WHERE type = ? AND branchcode = ?");
+ $sth->execute( $type, $branchcode ) or return 0;
+ } elsif ( $type ) {
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServicesArchetypes WHERE type = ?");
+ $sth->execute( $type ) or return 0;
+ } elsif ( $branchcode ) {
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServicesArchetypes WHERE branchcode = ?");
+ $sth->execute( $branchcode ) or return 0;
+ } else {
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServicesArchetypes");
+ $sth->execute() or return 0;
+ }
+
+ my @results;
+ while ( my $row = $sth->fetchrow_hashref ) {
+ push( @results , $row );
+ }
+
+ $sth->finish;
+
+ return \@results;
+}
+
+## function GetClubOrServiceArchetype
+## Returns information about a club or services archetype
+## Input:
+## $casaId: Id of Archetype to get
+## Output:
+## $results:
+## ( $casaId, $type, $title, $description, $publicEnrollment,
+## $casData1Title, $casData2Title, $casData3Title,
+## $caseData1Title, $caseData2Title, $caseData3Title,
+## $casData1Desc, $casData2Desc, $casData3Desc,
+## $caseData1Desc, $caseData2Desc, $caseData3Desc,
+## $timestamp, $branchcode )
+## Except: 0 on failure
+sub GetClubOrServiceArchetype {
+ my ( $casaId ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ $sth = $dbh->prepare("SELECT * FROM clubsAndServicesArchetypes WHERE casaId = ?");
+ $sth->execute( $casaId ) or return 0;
+
+ my $row = $sth->fetchrow_hashref;
+
+ $sth->finish;
+
+ return (
+ $$row{'casaId'},
+ $$row{'type'},
+ $$row{'title'},
+ $$row{'description'},
+ $$row{'publicEnrollment'},
+ $$row{'casData1Title'},
+ $$row{'casData2Title'},
+ $$row{'casData3Title'},
+ $$row{'caseData1Title'},
+ $$row{'caseData2Title'},
+ $$row{'caseData3Title'},
+ $$row{'casData1Desc'},
+ $$row{'casData2Desc'},
+ $$row{'casData3Desc'},
+ $$row{'caseData1Desc'},
+ $$row{'caseData2Desc'},
+ $$row{'caseData3Desc'},
+ $$row{'timestamp'},
+ $$row{'branchcode'}
+ );
+}
+
+## function CancelClubOrServiceEnrollment
+## Cancels the given enrollment in a club or service
+## Input:
+## $caseId: The id of the enrollment to be canceled
+## Output:
+## $success: 1 on successful cancelation, 0 otherwise
+sub CancelClubOrServiceEnrollment {
+ my ( $caseId ) = @_;
+
+ my $success = 1;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare("UPDATE clubsAndServicesEnrollments SET dateCanceled = CURDATE(), timestamp = NOW() WHERE caseId = ?");
+ $sth->execute( $caseId ) or $success = 0;
+ $sth->finish;
+
+ return $success;
+}
+
+sub getBorrowernumberByCardnumber {
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE cardnumber = ?");
+ $sth->execute( @_ ) or return( 0 );
+
+ my $row = $sth->fetchrow_hashref;
+
+ my $borrowernumber = $$row{'borrowernumber'};
+ $sth->finish;
+
+ return( $borrowernumber );
+}
+
+sub isEnrolled {
+ my ( $casId, $borrowernumber ) = @_;
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare("SELECT COUNT(*) as isEnrolled FROM clubsAndServicesEnrollments WHERE casId = ? AND borrowernumber = ?");
+ $sth->execute( $casId, $borrowernumber ) or return( 0 );
+
+ my $row = $sth->fetchrow_hashref;
+
+ my $isEnrolled = $$row{'isEnrolled'};
+ $sth->finish;
+
+ return( $isEnrolled );
+}
+
+sub getTodayMysqlDateFormat {
+ my ($day,$month,$year) = (localtime)[3,4,5];
+ my $today = sprintf("%04d-%02d-%02d", $year + 1900, $month + 1, $day);
+ return $today;
+}
+
+1;
+
+__END__
+
+=back
+
+=head1 AUTHOR
+
+Kyle Hall <kylemhall at gmail.com>
+
+=cut
Index: clubsAndServices/clubsAndServices.pl
===================================================================
RCS file: clubsAndServices/clubsAndServices.pl
diff -N clubsAndServices/clubsAndServices.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clubsAndServices/clubsAndServices.pl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output; # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use C4::ClubsAndServices;
+
+use CGI;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "clubsAndServices/clubsAndServices.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ debug => 1,
+ });
+
+my $branchcode = $query->cookie('branch');
+
+my $clubs = GetClubsAndServices( 'club', $branchcode );
+my $services = GetClubsAndServices( 'service', $branchcode );
+
+$template->param(
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+
+ clubsLoop => $clubs,
+ servicesLoop => $services,
+ );
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: clubsAndServices/editArchetypes.pl
===================================================================
RCS file: clubsAndServices/editArchetypes.pl
diff -N clubsAndServices/editArchetypes.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clubsAndServices/editArchetypes.pl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,207 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output; # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use CGI;
+
+use C4::ClubsAndServices;;
+
+use Data::Dumper;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "clubsAndServices/editArchetypes.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ debug => 1,
+ });
+
+my $branchcode = $query->cookie('branch');
+
+## Create new Archetype
+if ( $query->param('action') eq 'create' ) {
+ my $type = $query->param('type');
+ my $title = $query->param('title');
+ my $description = $query->param('description');
+ my $publicEnrollment = $query->param('publicEnrollment');
+ if ( $publicEnrollment eq 'yes' ) {
+ $publicEnrollment = 1;
+ } else {
+ $publicEnrollment = 0;
+ }
+
+ my $casData1Title = $query->param('casData1Title');
+ my $casData2Title = $query->param('casData2Title');
+ my $casData3Title = $query->param('casData3Title');
+
+ my $caseData1Title = $query->param('caseData1Title');
+ my $caseData2Title = $query->param('caseData2Title');
+ my $caseData3Title = $query->param('caseData3Title');
+
+ my $casData1Desc = $query->param('casData1Desc');
+ my $casData2Desc = $query->param('casData2Desc');
+ my $casData3Desc = $query->param('casData3Desc');
+
+ my $caseData1Desc = $query->param('caseData1Desc');
+ my $caseData2Desc = $query->param('caseData2Desc');
+ my $caseData3Desc = $query->param('caseData3Desc');
+
+
+ my ( $createdSuccessfully, $errorCode, $errorMessage ) = AddClubOrServiceArchetype(
+ $type,
+ $title,
+ $description,
+ $publicEnrollment,
+ $casData1Title,
+ $casData2Title,
+ $casData3Title,
+ $caseData1Title,
+ $caseData2Title,
+ $caseData3Title,
+ $casData1Desc,
+ $casData2Desc,
+ $casData3Desc,
+ $caseData1Desc,
+ $caseData2Desc,
+ $caseData3Desc,
+ $branchcode
+ );
+
+ $template->param(
+ previousActionCreate => 1,
+ createdTitle => $title,
+ );
+
+ if ( $createdSuccessfully ) {
+ $template->param( createSuccess => 1 );
+ } else {
+ $template->param( createFailure => 1);
+ $template->param( failureMessage => $errorMessage );
+ }
+
+}
+
+## Delete an Archtype
+elsif ( $query->param('action') eq 'delete' ) {
+ my $casaId = $query->param('casaId');
+ my $success = DeleteClubOrServiceArchetype( $casaId );
+
+ $template->param( previousActionDelete => 1 );
+ if ( $success ) {
+ $template->param( deleteSuccess => 1 );
+ } else {
+ $template->param( deleteFailure => 1 );
+ }
+}
+
+## Edit a club or service: grab data, put in form.
+elsif ( $query->param('action') eq 'edit' ) {
+ my $casaId = $query->param('casaId');
+ my ( $casaId, $type, $title, $description, $publicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $casaTimestamp, $casaBranchcode ) = GetClubOrServiceArchetype( $casaId );
+
+ $template->param(
+ previousActionEdit => 1,
+ editCasaId => $casaId,
+ editType => $type,
+ editTitle => $title,
+ editDescription => $description,
+ editCasData1Title => $casData1Title,
+ editCasData2Title => $casData2Title,
+ editCasData3Title => $casData3Title,
+ editCaseData1Title => $caseData1Title,
+ editCaseData2Title => $caseData2Title,
+ editCaseData3Title => $caseData3Title,
+ editCasData1Desc => $casData1Desc,
+ editCasData2Desc => $casData2Desc,
+ editCasData3Desc => $casData3Desc,
+ editCaseData1Desc => $caseData1Desc,
+ editCaseData2Desc => $caseData2Desc,
+ editCaseData3Desc => $caseData3Desc,
+ editCasaTimestamp => $casaTimestamp,
+ editCasaBranchcode => $casaBranchcode
+ );
+
+ if ( $publicEnrollment ) {
+ $template->param( editPublicEnrollment => 1 );
+ }
+}
+
+# Update an Archetype
+elsif ( $query->param('action') eq 'update' ) {
+ my $casaId = $query->param('casaId');
+ my $type = $query->param('type');
+ my $title = $query->param('title');
+ my $description = $query->param('description');
+ my $publicEnrollment = $query->param('publicEnrollment');
+ if ( $publicEnrollment eq 'yes' ) {
+ $publicEnrollment = 1;
+ } else {
+ $publicEnrollment = 0;
+ }
+
+ my $casData1Title = $query->param('casData1Title');
+ my $casData2Title = $query->param('casData2Title');
+ my $casData3Title = $query->param('casData3Title');
+
+ my $caseData1Title = $query->param('caseData1Title');
+ my $caseData2Title = $query->param('caseData2Title');
+ my $caseData3Title = $query->param('caseData3Title');
+
+ my $casData1Desc = $query->param('casData1Desc');
+ my $casData2Desc = $query->param('casData2Desc');
+ my $casData3Desc = $query->param('casData3Desc');
+
+ my $caseData1Desc = $query->param('caseData1Desc');
+ my $caseData2Desc = $query->param('caseData2Desc');
+ my $caseData3Desc = $query->param('caseData3Desc');
+
+
+ my ( $createdSuccessfully, $errorCode, $errorMessage ) =
+ UpdateClubOrServiceArchetype(
+ $casaId, $type, $title, $description, $publicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc
+ );
+
+ $template->param(
+ previousActionUpdate => 1,
+ updatedTitle => $title,
+ );
+
+ if ( $createdSuccessfully ) {
+ $template->param( updateSuccess => 1 );
+ } else {
+ $template->param( updateFailure => 1);
+ $template->param( failureMessage => $errorMessage );
+ }
+
+}
+
+
+my $clubArchetypes = GetClubsAndServicesArchetypes( 'club' );
+my $serviceArchetypes = GetClubsAndServicesArchetypes( 'service' );
+
+$template->param(
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+
+ clubArchetypesLoop => $clubArchetypes,
+ serviceArchetypesLoop => $serviceArchetypes,
+ );
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: clubsAndServices/editClubsAndServices.pl
===================================================================
RCS file: clubsAndServices/editClubsAndServices.pl
diff -N clubsAndServices/editClubsAndServices.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clubsAndServices/editClubsAndServices.pl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,184 @@
+#!/usr/bin/perl
+
+use strict;
+require Exporter;
+
+use HTML::Template;
+use CGI;
+use Data::Dumper;
+
+use C4::Database;
+use C4::Output; # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+
+use C4::ClubsAndServices;;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "clubsAndServices/editClubsAndServices.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ debug => 1,
+ });
+
+my $branchcode = $query->cookie('branch');
+
+# Archetype selected for Club or Service creation
+if ( $query->param('action') eq 'selectArchetype' ) {
+ my $casaId = $query->param('casaId');
+
+ my ( $casaId, $casaType, $casaTitle, $casaDescription, $casaPublicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $casaTimestamp ) = GetClubOrServiceArchetype( $casaId );
+
+ $template->param(
+ previousActionSelectArchetype => 1,
+
+ casaId => $casaId,
+ casaType => $casaType,
+ casaTitle => $casaTitle,
+ casaDescription => $casaDescription,
+ casaPublicEnrollment => $casaPublicEnrollment,
+ casData1Title => $casData1Title,
+ casData2Title => $casData2Title,
+ casData3Title => $casData3Title,
+ caseData1Title => $caseData1Title,
+ caseData2Title => $caseData2Title,
+ caseData3Title => $caseData3Title,
+ casData1Desc => $casData1Desc,
+ casData2Desc => $casData2Desc,
+ casData3Desc => $casData3Desc,
+ caseData1Desc => $caseData1Desc,
+ caseData2Desc => $caseData2Desc,
+ caseData3Desc => $caseData3Desc,
+ caseTimestamp => $casaTimestamp
+ );
+}
+
+# Create new Club or Service
+elsif ( $query->param('action') eq 'create' ) {
+ my $casaId = $query->param('casaId');
+ my $title = $query->param('title');
+ my $description = $query->param('description');
+ my $casData1 = $query->param('casData1');
+ my $casData2 = $query->param('casData2');
+ my $casData3 = $query->param('casData3');
+ my $startDate = $query->param('startDate');
+ my $endDate = $query->param('endDate');
+
+ my ( $createdSuccessfully, $errorCode, $errorMessage )
+ = AddClubOrService( $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $branchcode );
+
+ $template->param(
+ previousActionCreate => 1,
+ createdTitle => $title,
+ );
+
+ if ( $createdSuccessfully ) {
+ $template->param( createSuccess => 1 );
+ } else {
+ $template->param( createFailure => 1 );
+ $template->param( failureMessage => $errorMessage );
+ }
+}
+
+## Delete a club or service
+elsif ( $query->param('action') eq 'delete' ) {
+ my $casId = $query->param('casId');
+ my $success = DeleteClubOrService( $casId );
+
+ $template->param( previousActionDelete => 1 );
+ if ( $success ) {
+ $template->param( deleteSuccess => 1 );
+ } else {
+ $template->param( deleteFailure => 1 );
+ }
+}
+
+## Edit a club or service: grab data, put in form.
+elsif ( $query->param('action') eq 'edit' ) {
+ my $casId = $query->param('casId');
+ my ( $casId, $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate, $timestamp ) = GetClubOrService( $casId );
+
+ my ( $casaId, $casaType, $casaTitle, $casaDescription, $casaPublicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $casaTimestamp ) = GetClubOrServiceArchetype( $casaId );
+
+ $template->param(
+ previousActionSelectArchetype => 1,
+ previousActionEdit => 1,
+ editCasId => $casId,
+ editCasaId => $casaId,
+ editTitle => $title,
+ editDescription => $description,
+ editCasData1 => $casData1,
+ editCasData2 => $casData2,
+ editCasData3 => $casData3,
+ editStartDate => $startDate,
+ editEndDate => $endDate,
+ editTimestamp => $timestamp,
+
+ casaId => $casaId,
+ casaTitle => $casaTitle,
+ casData1Title => $casData1Title,
+ casData2Title => $casData2Title,
+ casData3Title => $casData3Title,
+ casData1Desc => $casData1Desc,
+ casData2Desc => $casData2Desc,
+ casData3Desc => $casData3Desc
+ );
+}
+
+# Update a Club or Service
+if ( $query->param('action') eq 'update' ) {
+ my $casId = $query->param('casId');
+ my $casaId = $query->param('casaId');
+ my $title = $query->param('title');
+ my $description = $query->param('description');
+ my $casData1 = $query->param('casData1');
+ my $casData2 = $query->param('casData2');
+ my $casData3 = $query->param('casData3');
+ my $startDate = $query->param('startDate');
+ my $endDate = $query->param('endDate');
+
+ my ( $createdSuccessfully, $errorCode, $errorMessage )
+ = UpdateClubOrService( $casId, $casaId, $title, $description, $casData1, $casData2, $casData3, $startDate, $endDate );
+
+ $template->param(
+ previousActionUpdate => 1,
+ updatedTitle => $title,
+ );
+
+ if ( $createdSuccessfully ) {
+ $template->param( updateSuccess => 1 );
+ } else {
+ $template->param( updateFailure => 1 );
+ $template->param( failureMessage => $errorMessage );
+ }
+}
+
+my $clubs = GetClubsAndServices( 'club' );
+my $services = GetClubsAndServices( 'service' );
+my $archetypes = GetClubsAndServicesArchetypes();
+
+$template->param(
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+
+ clubsLoop => $clubs,
+ servicesLoop => $services,
+ archetypesLoop => $archetypes,
+ );
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: clubsAndServices/enrollClubsAndServices.pl
===================================================================
RCS file: clubsAndServices/enrollClubsAndServices.pl
diff -N clubsAndServices/enrollClubsAndServices.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ clubsAndServices/enrollClubsAndServices.pl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,99 @@
+#!/usr/bin/perl
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Output; # contains gettemplate
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Context;
+use C4::ClubsAndServices;
+
+use CGI;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "clubsAndServices/enrollClubsAndServices.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ debug => 1,
+ });
+
+my $branchcode = $query->cookie('branch');
+
+if ( $query->param('action') eq 'enroll' ) {
+ my $borrowerBarcode = $query->param('borrowerBarcode');
+ my $casId = $query->param('casId');
+ my $casaId = $query->param('casaId');
+ my $data1 = $query->param('data1');
+ my $data2 = $query->param('data2');
+ my $data3 = $query->param('data3');
+
+ my $dateEnrolled; # Will default to Today
+
+ my ( $success, $errorCode, $errorMessage ) = EnrollInClubOrService( $casaId, $casId, $borrowerBarcode, $dateEnrolled, $data1, $data2, $data3, $branchcode );
+
+ $template->param(
+ previousActionEnroll => 1,
+ enrolledBarcode => $borrowerBarcode,
+ );
+
+ if ( $success ) {
+ $template->param( enrollSuccess => 1 );
+ } else {
+ $template->param( enrollFailure => 1 );
+ $template->param( failureMessage => $errorMessage );
+ }
+
+}
+
+my ( $casId, $casaId, $casTitle, $casDescription, $casStartDate, $casEndDate, $casTimestamp ) = GetClubOrService( $query->param('casId') );
+my ( $casaId, $casaType, $casaTitle, $casaDescription, $casaPublicEnrollment,
+ $casData1Title, $casData2Title, $casData3Title,
+ $caseData1Title, $caseData2Title, $caseData3Title,
+ $casData1Desc, $casData2Desc, $casData3Desc,
+ $caseData1Desc, $caseData2Desc, $caseData3Desc,
+ $timestamp )= GetClubOrServiceArchetype( $casaId );
+
+$template->param(
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+
+ casId => $casId,
+ casTitle => $casTitle,
+ casDescription => $casDescription,
+ casStartDate => $casStartDate,
+ casEndDate => $casEndDate,
+ casTimeStamp => $casTimestamp,
+
+ casaId => $casaId,
+ casaType => $casaType,
+ casaTitle => $casaTitle,
+ casaDescription => $casaDescription,
+ casaPublicEnrollment => $casaPublicEnrollment,
+ );
+
+if ( $caseData1Title ) {
+ $template->param( caseData1Title => $caseData1Title );
+}
+if ( $caseData2Title ) {
+ $template->param( caseData2Title => $caseData2Title );
+}
+if ( $caseData3Title ) {
+ $template->param( caseData3Title => $caseData3Title );
+}
+
+if ( $caseData1Desc ) {
+ $template->param( caseData1Desc => $caseData1Desc );
+}
+if ( $caseData2Desc ) {
+ $template->param( caseData2Desc => $caseData2Desc );
+}
+if ( $caseData3Desc ) {
+ $template->param( caseData3Desc => $caseData3Desc );
+}
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/clubsAndServices.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/clubsAndServices.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/clubsAndServices.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/clubsAndServices.tmpl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,69 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+ <dl class="bodyPane">
+ <dt class="bodyPane">Clubs & Services</dt>
+ <dd class="bodyPane">
+ <br />
+ <div>
+ <!-- TMPL_IF NAME="clubsLoop" -->
+ <h1>Clubs</h1>
+ <table>
+ <tr>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Start Date</strong></td>
+ <td><strong>End Date</strong></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="clubsLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="startDate" --></td>
+ <td><!-- TMPL_VAR NAME="endDate" --></td>
+ <td><a href="enrollClubsAndServices.pl?casId=<!-- TMPL_VAR NAME="casId" -->">Enroll</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Clubs currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+ <div>
+ <!-- TMPL_IF NAME="servicesLoop" -->
+ <h1>Services</h1>
+ <table>
+ <tr>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Start Date</strong></td>
+ <td><strong>End Date</strong></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="servicesLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="startDate" --></td>
+ <td><!-- TMPL_VAR NAME="endDate" --></td>
+ <td><a href="enrollClubsAndServices.pl?casId=<!-- TMPL_VAR NAME="casId" -->">Enroll</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Services currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+ <div>
+ <br />
+ <div><a href="editArchetypes.pl">Edit Archetypes</a></div>
+ <br />
+ <div><a href="editClubsAndServices.pl">Edit Clubs & Services</a></div>
+ </div>
+ </dd>
+ </dl>
+</body>
+</html>
Index: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editArchetypes.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editArchetypes.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editArchetypes.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editArchetypes.tmpl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,232 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+ <dl class="bodyPane">
+ <dt class="bodyPane">Archetypes</dt>
+ <dd class="bodyPane">
+ <br />
+
+ <!-- TMPL_IF NAME="previousActionCreate" -->
+ <!-- TMPL_IF NAME="createSuccess" -->
+ <div>Archtype '<!-- TMPL_VAR NAME="createdTitle" -->' Created Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Archtype '<!-- TMPL_VAR NAME="createdTitle" -->' Failed To Be Created!</div>
+ <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" --></strong></div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="previousActionDelete" -->
+ <!-- TMPL_IF NAME="DeleteSuccess" -->
+ <div>Archtype Deleted Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Archtype Failed To Be Deleted!</div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="previousActionUpdate" -->
+ <!-- TMPL_IF NAME="updateSuccess" -->
+ <div>Archetype '<!-- TMPL_VAR NAME="updatedTitle" -->' Updated Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Archetype '<!-- TMPL_VAR NAME="updatedTitle" -->' Failed To Be Updated!</div>
+ <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" --></strong></div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <!-- LIST ALL ARCHETYPES -->
+ <div>
+ <!-- TMPL_IF NAME="clubArchetypesLoop" -->
+ <h1>Club Archetypes</h1>
+ <table>
+ <tr>
+ <td><strong>Owner</strong</td>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Public Enrollment</strong></td>
+ <td><strong>Club Data 1 Title</strong></td>
+ <td><strong>Club Data 2 Title</strong></td>
+ <td><strong>Club Data 3 Title</strong></td>
+ <td><strong>Enrollment Data 1 Title</strong></td>
+ <td><strong>Enrollment Data 2 Title</strong></td>
+ <td><strong>Enrollment Data 3 Title</strong></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="clubArchetypesLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="branchcode" --></td>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="publicEnrollment" --></td>
+ <td><!-- TMPL_VAR NAME="casData1Title" --></td>
+ <td><!-- TMPL_VAR NAME="casData2Title" --></td>
+ <td><!-- TMPL_VAR NAME="casData3Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData1Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData2Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData3Title" --></td>
+ <td><a href="editArchetypes.pl?action=edit&casaId=<!-- TMPL_VAR NAME="casaId" -->">Edit</a></td>
+ <td><a href="editArchetypes.pl?action=delete&casaId=<!-- TMPL_VAR NAME="casaId" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Club Archetypes currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+ <div>
+ <!-- TMPL_IF NAME="serviceArchetypesLoop" -->
+ <h1>Service Archetypes</h1>
+ <table>
+ <tr>
+ <td><strong>Owner</strong</td>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Public Enrollment</strong></td>
+ <td><strong>Service Data 1 Title</strong></td>
+ <td><strong>Service Data 2 Title</strong></td>
+ <td><strong>Service Data 3 Title</strong></td>
+ <td><strong>Enrollment Data 1 Title</strong></td>
+ <td><strong>Enrollment Data 2 Title</strong></td>
+ <td><strong>Enrollment Data 3 Title</strong></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="serviceArchetypesLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="branchcode" --></td>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="publicEnrollment" --></td>
+ <td><!-- TMPL_VAR NAME="casData1Title" --></td>
+ <td><!-- TMPL_VAR NAME="casData2Title" --></td>
+ <td><!-- TMPL_VAR NAME="casData3Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData1Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData2Title" --></td>
+ <td><!-- TMPL_VAR NAME="caseData3Title" --></td>
+ <td><a href="editArchetypes.pl?action=edit&casaId=<!-- TMPL_VAR NAME="casaId" -->">Edit</a></td>
+ <td><a href="editArchetypes.pl?action=delete&casaId=<!-- TMPL_VAR NAME="casaId" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Service Archetypes currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+ <!-- ADD NEW ARCHETYPE FORM -->
+ <div>
+
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <h1>Edit an Archetype</h1>
+ <!-- TMPL_ELSE -->
+ <h1>Create New Archetype</h1>
+ <!-- /TMPL_IF -->
+ <form action="editArchetypes.pl" method="post">
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="casaId" value="<!-- TMPL_VAR NAME="editCasaId" -->" />
+ <!-- TMPL_ELSE -->
+ <input type="hidden" name="action" value="create" />
+ <!-- /TMPL_IF -->
+
+ <label for="type">Type: </label>
+ <select name="type">
+ <!-- TMPL_IF NAME="editType" --><option label="Keep Current Type" value="<!-- TMPL_VAR NAME="editType" -->">Keep Current Type</option><!-- /TMPL_IF -->
+ <option label="Club" value="club">Club</option>
+ <option label="Service" value="service">Service</option>
+ </select>
+ <br />
+
+ <label for="title">Title: </label>
+ <input type="text" name="title" <!-- TMPL_IF NAME="editTitle" --> value="<!-- TMPL_VAR NAME="editTitle" -->" <!-- /TMPL_IF --> />
+ <br />
+
+ <label for="description">Description: </label>
+ <input type="text" size="75" name="description" <!-- TMPL_IF NAME="editDescription" --> value="<!-- TMPL_VAR NAME="editDescription" -->" <!-- /TMPL_IF --> />
+ <br />
+
+ <label for="publicEnrollment">Public Enrollment</label>
+ <input type="radio" name="publicEnrollment" value="yes" <!-- TMPL_IF NAME="editPublicEnrollment" --> checked <!-- /TMPL_IF --> >Yes</input>
+ <input type="radio" name="publicEnrollment" value="no" <!-- TMPL_IF NAME="editPublicEnrollment" --><!-- TMPL_ELSE --> checked <!-- /TMPL_IF -->>No</input>
+ <br />
+
+ <h6>The following fields are generic fields that you can define to hold any data you might need upon club/service creation that is not stored elsewhere in Koha.
+ These fields will appear when a person creates a new club or service, at that time the system will ask for the data that is defined in this field.
+ For example, if you were to create a Summer Reading Club Archetype, and you want to compare summer reading clubs by year, you would enter 'Year' in
+ the 'Title' field, and 'Year that this Summer Reading Club is Taking Place' in the 'Description' field.
+ If you do not need to store any extra data for a club or service, just leave these blank.
+ </h6>
+ <table>
+ <tr>
+ <td><label>Club/Service Data 1</lable></td>
+ <td><label for="casData1Title">Title</label></td>
+ <td><input type="text" name="casData1Title" <!-- TMPL_IF NAME="editCasData1Title" --> value="<!-- TMPL_VAR NAME="editCasData1Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="casData1Title">Description</label></td>
+ <td><input type="text" name="casData1Desc" <!-- TMPL_IF NAME="editCasData1Desc" --> value="<!-- TMPL_VAR NAME="editCasData1Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+
+ <tr>
+ <td><label>Club/Service Data 2</lable></td>
+ <td><label for="casData2Title">Title</label></td>
+ <td><input type="text" name="casData2Title" <!-- TMPL_IF NAME="editCasData2Title" --> value="<!-- TMPL_VAR NAME="editCasData2Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="casData2Title">Description</label></td>
+ <td><input type="text" name="casData2Desc" <!-- TMPL_IF NAME="editCasData2Desc" --> value="<!-- TMPL_VAR NAME="editCasData2Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+
+ <tr>
+ <td><label>Club/Service Data 3</lable></td>
+ <td><label for="casData3Title">Title</label></td>
+ <td><input type="text" name="casData3Title" <!-- TMPL_IF NAME="editCasData3Title" --> value="<!-- TMPL_VAR NAME="editCasData3Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="casData3Title">Description</label></td>
+ <td><input type="text" name="casData3Desc" <!-- TMPL_IF NAME="editCasData3Desc" --> value="<!-- TMPL_VAR NAME="editCasData3Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+ </table>
+ <h6>The following fields are generic fields that you can define to hold any data you might need on borrower enrollment that is not stored elsewhere in Koha.
+ These fields will appear on the enrollment page.
+ For example, if you were to create a Summer Reading Club Archetype, and you need to keep track of which Grade the reading will be entering after summer,
+ you would enterer 'Grade' in the 'Title' field and 'The grade the participant will be entering after summer' in the 'Description' field.
+ If you do not need to store any extra enrollment data for this club or service, just leave these blank.
+ </h6>
+ <table>
+ <tr>
+ <td><label>Enrollment Data 1</lable></td>
+ <td><label for="caseData1Title">Title</label></td>
+ <td><input type="text" name="caseData1Title" <!-- TMPL_IF NAME="editCaseData1Title" --> value="<!-- TMPL_VAR NAME="editCaseData1Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="caseData1Title">Description</label></td>
+ <td><input type="text" name="caseData1Desc" <!-- TMPL_IF NAME="editCaseData1Desc" --> value="<!-- TMPL_VAR NAME="editCaseData1Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+
+ <tr>
+ <td><label>Enrollment Data 2</lable></td>
+ <td><label for="caseData2Title">Title</label></td>
+ <td><input type="text" name="caseData2Title" <!-- TMPL_IF NAME="editCaseData2Title" --> value="<!-- TMPL_VAR NAME="editCaseData2Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="caseData2Title">Description</label></td>
+ <td><input type="text" name="caseData2Desc" <!-- TMPL_IF NAME="editCaseData2Desc" --> value="<!-- TMPL_VAR NAME="editCaseData2Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+
+ <tr>
+ <td><label>Enrollment Data 3</lable></td>
+ <td><label for="caseData3Title">Title</label></td>
+ <td><input type="text" name="caseData3Title" <!-- TMPL_IF NAME="editCaseData3Title" --> value="<!-- TMPL_VAR NAME="editCaseData3Title" -->" <!-- /TMPL_IF --> /></td>
+ <td><label for="caseData3Title">Description</label></td>
+ <td><input type="text" name="caseData3Desc" <!-- TMPL_IF NAME="editCaseData3Desc" --> value="<!-- TMPL_VAR NAME="editCaseData3Desc" -->" <!-- /TMPL_IF --> /></td>
+ </tr>
+ </table>
+
+ <br />
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <input type="submit" value="Update" />
+ <!-- TMPL_ELSE -->
+ <input type="submit" value="Create" />
+ <!-- /TMPL_IF -->
+
+ </form>
+ </div>
+
+ <br />
+ <div><a href="/cgi-bin/koha/clubsAndServices/clubsAndServices.pl">Clubs & Services Home</a></div>
+
+ </dd>
+ </dl>
+</body>
+</html>
Index: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editClubsAndServices.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editClubsAndServices.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editClubsAndServices.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/editClubsAndServices.tmpl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,239 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+ <dl class="bodyPane">
+ <dt class="bodyPane">Clubs & Services</dt>
+ <dd class="bodyPane">
+ <br />
+
+ <!-- TMPL_IF NAME="previousActionCreate" -->
+ <!-- TMPL_IF NAME="createSuccess" -->
+ <div>Club Or Service '<!-- TMPL_VAR NAME="createdTitle" -->' Created Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Club or Service '<!-- TMPL_VAR NAME="createdTitle" -->' Failed To Be Created!</div>
+ <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" --></strong></div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="previousActionDelete" -->
+ <!-- TMPL_IF NAME="DeleteSuccess" -->
+ <div>Club or Service Deleted Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Club or Service Failed To Be Deleted!</div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="previousActionUpdate" -->
+ <!-- TMPL_IF NAME="updateSuccess" -->
+ <div>Club Or Service '<!-- TMPL_VAR NAME="updatedTitle" -->' Updated Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Club or Service '<!-- TMPL_VAR NAME="updatedTitle" -->' Failed To Be Updated!</div>
+ <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" --></strong></div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+ <div>
+ <!-- TMPL_IF NAME="clubsLoop" -->
+ <h1>Clubs</h1>
+ <table>
+ <tr>
+ <td><strong>Owner</strong></td>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Start Date</strong></td>
+ <td><strong>End Date</strong></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="clubsLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="branchcode" --></td>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="startDate" --></td>
+ <td><!-- TMPL_VAR NAME="endDate" --></td>
+ <td><a href="editClubsAndServices.pl?action=edit&casaId=<!-- TMPL_VAR NAME="casaId" -->&casId=<!-- TMPL_VAR NAME="casId" -->">Edit</a></td>
+ <td><a href="editClubsAndServices.pl?action=delete&casId=<!-- TMPL_VAR NAME="casId" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Clubs currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+ <div>
+ <!-- TMPL_IF NAME="servicesLoop" -->
+ <h1>Services</h1>
+ <table>
+ <tr>
+ <td><strong>Owner</strong></td>
+ <td><strong>Title</strong></td>
+ <td><strong>Description</strong></td>
+ <td><strong>Start Date</strong></td>
+ <td><strong>End Date</strong></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- TMPL_LOOP NAME="servicesLoop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="branchcode" --></td>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="description" --></td>
+ <td><!-- TMPL_VAR NAME="startDate" --></td>
+ <td><!-- TMPL_VAR NAME="endDate" --></td>
+ <td><a href="editClubsAndServices.pl?action=edit&casaId=<!-- TMPL_VAR NAME="casaId" -->&casId=<!-- TMPL_VAR NAME="casId" -->">Edit</a></td>
+ <td><a href="editClubsAndServices.pl?action=delete&casId=<!-- TMPL_VAR NAME="casId" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- TMPL_ELSE -->
+ There are no Services currently defined.
+ <!-- /TMPL_IF -->
+ </div>
+
+
+ <!-- TMPL_IF NAME="previousActionSelectArchetype" -->
+ <!-- ADD NEW CAS FORM -->
+ <div>
+ <br />
+
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <h1>Edit a Club or Service</h1>
+ <!-- TMPL_ELSE -->
+ <h1>Create New Club Or Service</h1>
+ <!-- /TMPL_IF -->
+ <form action="editClubsAndServices.pl" method="post">
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <input type="hidden" name="action" value="update" />
+ <input type="hidden" name="casId" value="<!-- TMPL_VAR NAME="editCasId" -->" />
+ <!-- TMPL_ELSE -->
+ <input type="hidden" name="action" value="create" />
+ <!-- /TMPL_IF -->
+
+ <table>
+
+ <tr>
+ <td>
+ <label for="casaId">Archetype: </label>
+ </td>
+ <td>
+ <select name="casaId">
+ <option value="<!-- TMPL_VAR NAME="casaId" -->"><!-- TMPL_VAR NAME="casaTitle" --></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="title">Title: </label>
+ </td>
+ <td>
+ <input type="text" name="title" <!-- TMPL_IF NAME="editTitle" --> value="<!-- TMPL_VAR NAME="editTitle" -->" <!-- /TMPL_IF --> />
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="description">Description: </label>
+ </td>
+ <td colspan="2">
+ <input type="text" size="50" name="description" <!-- TMPL_IF NAME="editDescription" --> value="<!-- TMPL_VAR NAME="editDescription" -->" <!-- /TMPL_IF --> />
+ </td>
+ </tr>
+
+ <!-- TMPL_IF NAME="casData1Title" -->
+ <tr>
+ <td>
+ <label for="casData1"><!-- TMPL_VAR NAME="casData1Title" -->: </label>
+ </td>
+ <td>
+ <input type="text" name="casData1" <!-- TMPL_IF NAME="editCasData1" --> value="<!-- TMPL_VAR NAME="editCasData1" -->" <!-- /TMPL_IF --> />
+ </td>
+ <td><i><!-- TMPL_VAR NAME="casData1Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="casData2Title" -->
+ <tr>
+ <td>
+ <label for="casData2"><!-- TMPL_VAR NAME="casData2Title" -->: </label>
+ </td>
+ <td>
+ <input type="text" name="casData2" <!-- TMPL_IF NAME="editCasData2" --> value="<!-- TMPL_VAR NAME="editCasData2" -->" <!-- /TMPL_IF --> />
+ </td>
+ <td><i><!-- TMPL_VAR NAME="casData2Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="casData3Title" -->
+ <tr>
+ <td>
+ <label for="casData3"><!-- TMPL_VAR NAME="casData3Title" -->: </label>
+ </td>
+ <td>
+ <input type="text" name="casData3" <!-- TMPL_IF NAME="editCasData3" --> value="<!-- TMPL_VAR NAME="editCasData3" -->" <!-- /TMPL_IF --> />
+ </td>
+ <td><i><!-- TMPL_VAR NAME="casData3Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <tr><td colspan="3"><i>Date format is : YYYY-MM-DD</i></td></tr>
+
+
+ <tr>
+ <td>
+ <label for="startDate">Start Date: </label>
+ </td>
+ <td>
+ <input type="text" maxlength="10" name="startDate" <!-- TMPL_IF NAME="editStartDate" --> value="<!-- TMPL_VAR NAME="editStartDate" -->" <!-- /TMPL_IF --> />
+ </td>
+ <td>
+ <i>Optional: Leave blank for start date of today.</i>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <label for="startDate">End Date: </label>
+ </td>
+ <td>
+ <input type="text" maxlength="10" name="endDate" <!-- TMPL_IF NAME="editEndDate" --> value="<!-- TMPL_VAR NAME="editEndDate" -->" <!-- /TMPL_IF --> />
+ </td>
+ <td>
+ <i>Optional: Leave blank for no end date.</i>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <!-- TMPL_IF NAME="previousActionEdit" -->
+ <input type="submit" value="Update" />
+ <!-- TMPL_ELSE -->
+ <input type="submit" value="Create" />
+ <!-- /TMPL_IF -->
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ <!-- TMPL_ELSE -->
+ <!-- SELECT ARCHETYPE FORM -->
+ <h1>Create New Club or Service</h1>
+ <form action="editClubsAndServices.pl" method="post">
+ <input type="hidden" name="action" value="selectArchetype" />
+ <label for="casaId">Select Archetype</label>
+ <select name="casaId">
+ <!-- TMPL_LOOP NAME="archetypesLoop" -->
+ <option value="<!-- TMPL_VAR NAME="casaId" -->"><!-- TMPL_VAR NAME="title" --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <input type="submit" value="Create" />
+ <!-- /TMPL_IF -->
+
+ <br />
+ <div><a href="/cgi-bin/koha/clubsAndServices/clubsAndServices.pl">Clubs & Services Home</a></div>
+
+ </dd>
+ </dl>
+</body>
+</html>
Index: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/enrollClubsAndServices.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/enrollClubsAndServices.tmpl
diff -N koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/enrollClubsAndServices.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/ccfls/en/clubsAndServices/enrollClubsAndServices.tmpl 13 Apr 2007 18:40:19 -0000 1.1.2.1
@@ -0,0 +1,68 @@
+<!-- TMPL_INCLUDE NAME="head.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top.inc" -->
+<!-- TMPL_INCLUDE NAME="body-top-noneSelected.inc" -->
+ <dl class="bodyPane">
+ <dt class="bodyPane">Clubs & Services Enrollment</dt>
+ <dd class="bodyPane">
+ <div>
+ <br />
+ <!-- TMPL_IF NAME="previousActionEnroll" -->
+ <!-- TMPL_IF NAME="enrollSuccess" -->
+ <div>Patron with barcode '<!-- TMPL_VAR NAME="enrolledBarcode" -->' Enrolled Succesfully!</div>
+ <!-- TMPL_ELSE -->
+ <div>Failed to Enroll Patron with barcode '<!-- TMPL_VAR NAME="enrolledBarcode" -->'!</div>
+ <div>Reason: <strong><!-- TMPL_VAR NAME="failureMessage" --></strong></div>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+
+
+ <h3>Enroll a Patron in <i><!-- TMPL_VAR NAME="casTitle" --></i></h3>
+ </div>
+
+ <div>
+ <form action="enrollClubsAndServices.pl" method="post">
+ <table>
+ <!-- TMPL_IF NAME="caseData1Title" -->
+ <tr>
+ <td><label for="data1"><!-- TMPL_VAR NAME="caseData1Title" -->: </label></td>
+ <td><input type="text" id="data1" name="data1" /></td>
+ <td><i><!-- TMPL_VAR NAME="caseData1Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="caseData2Title" -->
+ <tr>
+ <td><label for="data2"><!-- TMPL_VAR NAME="caseData2Title" -->: </label></td>
+ <td><input type="text" id="data2" name="data2" /></td>
+ <td><i><!-- TMPL_VAR NAME="caseData2Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <!-- TMPL_IF NAME="caseData3Title" -->
+ <tr>
+ <td><label for="data3"><!-- TMPL_VAR NAME="caseData3Title" -->: </label></td>
+ <td><input type="text" id="data3" name="data3" /></td>
+ <td><i><!-- TMPL_VAR NAME="caseData3Desc" --></i></td>
+ </tr>
+ <!-- /TMPL_IF -->
+
+ <tr>
+ <td><label for="borrowerBarcode">Borrower Barcode: </label></td>
+ <td colspan="2"><input type="text" id="borrowerBarcode" name="borrowerBarcode" /></td>
+ </tr>
+
+ <input type="hidden" id="casId" name="casId" value="<!-- TMPL_VAR NAME="casId" -->" />
+ <input type="hidden" id="casaId" name="casaId" value="<!-- TMPL_VAR NAME="casaId" -->" />
+ <input type="hidden" name="action" value="enroll" />
+ <tr><td colspan="3"><input type="submit" value="Enroll" /></td></tr>
+ </table>
+ </form>
+ </div>
+
+ <br />
+ <div><a href="/cgi-bin/koha/clubsAndServices/clubsAndServices.pl">Clubs & Services Home</a></div>
+
+ </dd>
+ </dl>
+</body>
+</html>
More information about the Koha-cvs
mailing list