[Patches] [PATCH] [SIGNED-OFF] Bug 7261 System Preference to select the first day of week
koha-patchbot at kohaaloha.com
koha-patchbot at kohaaloha.com
Wed Dec 7 05:05:03 NZDT 2011
From: Juan Romay Sieira <juan.sieira at xercode.es>
Date: Thu, 24 Nov 2011 17:34:46 +0100
Subject: [PATCH] [SIGNED-OFF] Bug 7261 System Preference to select the first day of week
Content-Type: text/plain; charset="utf-8"
Choose Sunday or Monday as the first day of the week
in the calendar (OPAC and Intranet).
Signed-off-by: Owen Leonard <oleonard at myacpl.org>
---
C4/Auth.pm | 2 ++
installer/data/mysql/sysprefs.sql | 2 +-
installer/data/mysql/updatedatabase.pl | 6 ++++++
.../intranet-tmpl/prog/en/includes/calendar.inc | 2 +-
.../prog/en/lib/calendar/calendar-setup.js | 5 ++++-
.../prog/en/modules/admin/preferences/admin.pref | 8 ++++++++
.../opac-tmpl/prog/en/modules/opac-reserve.tt | 6 ++++--
7 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index e360e10..347d037 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -369,6 +369,7 @@ sub get_template_and_user {
AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"),
AutoLocation => C4::Context->preference("AutoLocation"),
"BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1,
+ CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
CircAutocompl => C4::Context->preference("CircAutocompl"),
FRBRizeEditions => C4::Context->preference("FRBRizeEditions"),
IndependantBranches => C4::Context->preference("IndependantBranches"),
@@ -426,6 +427,7 @@ sub get_template_and_user {
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
BranchesLoop => GetBranchesLoop($opac_name),
+ CalendarFirstDayOfWeek => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Monday")?1:0,
LibraryName => "" . C4::Context->preference("LibraryName"),
LibraryNameTitle => "" . $LibraryNameTitle,
LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ae2c1cb..8ada5f5 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -328,4 +328,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
-
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9ae0060..4e21b12 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4571,6 +4571,12 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = "3.06.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CalendarFirstDayOfWeek','Sunday','Select the first day of week to use in the calendar.','Sunday|Monday','Choice');");
+ print "Upgrade to $DBversion done (Add syspref CalendarFirstDayOfWeek used to select the first day of week to use in the calendar. )\n";
+ SetVersion($DBversion);
+}
=head1 FUNCTIONS
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
index 43ba022..d70716c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
@@ -7,7 +7,7 @@ Calendar._DN = new Array(_("Sunday"),_("Monday"),_("Tuesday"),_("Wednesday"),_("
Calendar._SDN = new Array(_("Sun"),_("Mon"),_("Tue"),_("Wed"),_("Thu"),_("Fri"),_("Sat"),_("Sun"));
// First day of the week. "0" means display Sunday first, "1" means display
// Monday first, etc.
-Calendar._FD = 1;
+Calendar._FD = [% CalendarFirstDayOfWeek %];
// full month names
Calendar._MN = new Array(_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),_("August"),_("September"),_("October"),_("November"),_("December"));
// short month names
diff --git a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js
index 8b7fcdf..1d876b1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/lib/calendar/calendar-setup.js
@@ -69,7 +69,10 @@ Calendar.setup = function (params) {
param_default("singleClick", true);
param_default("disableFunc", 'dateStatusHandler');
param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined
- param_default("firstDay", 0); // defaults to "Sunday" first
+ if (Calendar._FD)
+ param_default("firstDay", Calendar._FD);
+ else
+ param_default("firstDay", 0); // defaults to "Sunday" first
param_default("align", "Br");
param_default("range", [1900, 2999]);
param_default("weekNumbers", true);
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
index f026c7e..e4f5502 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
@@ -40,6 +40,14 @@ Administration:
yes: Allow
no: "Don't allow"
- staff and patrons to create and view saved lists of books.
+ -
+ - Use
+ - pref: CalendarFirstDayOfWeek
+ default: Sunday
+ choices:
+ Sunday: Sunday
+ Monday: Monday
+ - as the first day of week in the calendar.
Login options:
-
- pref: insecure
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
index ca49152..826effc 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
@@ -338,7 +338,8 @@
ifFormat : "[% DHTMLcalendar_dateformat %]",
button : "CalendarReserveDate[% bibitemloo.biblionumber %]",
disableFunc : validate[% bibitemloo.biblionumber %],
- dateStatusFunc : validate[% bibitemloo.biblionumber %]
+ dateStatusFunc : validate[% bibitemloo.biblionumber %],
+ firstDay : [% CalendarFirstDayOfWeek %]
}
);
//]]>
@@ -370,7 +371,8 @@
ifFormat : "[% DHTMLcalendar_dateformat %]",
button : "CalendarExpirationDate_[% bibitemloo.biblionumber %]",
disableFunc : validate1,
- dateStatusFunc : validate1
+ dateStatusFunc : validate1,
+ firstDay : [% CalendarFirstDayOfWeek %]
}
);
//]]>
--
1.7.3
More information about the Patches
mailing list