Bugzilla – Attachment 151443 Details for
Bug 17015
New Koha Calendar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17015: Add description field
Bug-17015-Add-description-field.patch (text/plain), 19.31 KB, created by
Maryse Simard
on 2023-05-18 20:26:58 UTC
(
hide
)
Description:
Bug 17015: Add description field
Filename:
MIME Type:
Creator:
Maryse Simard
Created:
2023-05-18 20:26:58 UTC
Size:
19.31 KB
patch
obsolete
>From 7071b37908cb5eb041ab3cfefbaa2be92710c527 Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Thu, 20 Oct 2022 16:48:12 -0400 >Subject: [PATCH] Bug 17015: Add description field > >--- > Koha/DiscreteCalendar.pm | 49 +++++++++++-------- > Koha/Schema/Result/DiscreteCalendar.pm | 12 ++++- > ..._17015_part1_create_discrete_calendar.perl | 1 + > .../bug_17015_part4_add_description.perl | 8 +++ > .../en/modules/tools/discrete_calendar.tt | 23 +++++++-- > tools/discrete_calendar.pl | 2 + > 6 files changed, 70 insertions(+), 25 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_17015_part4_add_description.perl > >diff --git a/Koha/DiscreteCalendar.pm b/Koha/DiscreteCalendar.pm >index efec072aa3..92b5b704ee 100644 >--- a/Koha/DiscreteCalendar.pm >+++ b/Koha/DiscreteCalendar.pm >@@ -136,7 +136,7 @@ sub get_dates_info { > { > select => [ 'date', { DATE => 'date' } ], > as => [qw/ date date /], >- columns =>[ qw/ holiday_type open_hour close_hour note/] >+ columns =>[ qw/ holiday_type open_hour close_hour note description/] > }, > ); > >@@ -149,7 +149,8 @@ sub get_dates_info { > holiday_type => $date->holiday_type() , > open_hour => $date->open_hour(), > close_hour => $date->close_hour(), >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > }; > } > >@@ -255,7 +256,7 @@ sub get_date_info { > select => [ 'date', { DATE => 'date' } ], > as => [qw/ date date /], > where => \['DATE(?) = date', $date_string ], >- columns =>[ qw/ branchcode holiday_type open_hour close_hour note/] >+ columns =>[ qw/ branchcode holiday_type open_hour close_hour note description/] > }, > ); > my $dateDTO; >@@ -266,7 +267,8 @@ sub get_date_info { > holiday_type => $date->holiday_type() , > open_hour => $date->open_hour(), > close_hour => $date->close_hour(), >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > }; > } > >@@ -346,8 +348,8 @@ sub get_unique_holidays { > holiday_type => $HOLIDAYS->{EXCEPTION} > }, > { >- select => [{ DATE => 'date' }, 'note' ], >- as => [qw/ date note/], >+ select => [{ DATE => 'date' }, 'note', 'description' ], >+ as => [qw/ date note description/], > where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), > } > ); >@@ -357,7 +359,8 @@ sub get_unique_holidays { > push @unique_holidays, { > date => $date->date(), > outputdate => $outputdate, >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > } > } > >@@ -385,8 +388,8 @@ sub get_float_holidays { > holiday_type => $HOLIDAYS->{FLOAT} > }, > { >- select => [{ DATE => 'date' }, 'note' ], >- as => [qw/ date note/], >+ select => [{ DATE => 'date' }, 'note', 'description' ], >+ as => [qw/ date note description/], > where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), > } > ); >@@ -396,7 +399,8 @@ sub get_float_holidays { > push @float_holidays, { > date => $date->date(), > outputdate => $outputdate, >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > } > } > >@@ -424,8 +428,8 @@ sub get_need_validation_holidays { > holiday_type => $HOLIDAYS->{NEED_VALIDATION} > }, > { >- select => [{ DATE => 'date' }, 'note' ], >- as => [qw/ date note/], >+ select => [{ DATE => 'date' }, 'note', 'description' ], >+ as => [qw/ date note description/], > where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), > } > ); >@@ -435,7 +439,8 @@ sub get_need_validation_holidays { > push @need_validation_holidays, { > date => $date->date(), > outputdate => $outputdate, >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > } > } > >@@ -464,8 +469,8 @@ sub get_repeatable_holidays { > > }, > { >- select => \[ 'distinct DAY(date), MONTH(date), note'], >- as => [qw/ day month note/], >+ select => \[ 'distinct DAY(date), MONTH(date), note, description'], >+ as => [qw/ day month note description/], > where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), > } > ); >@@ -474,7 +479,8 @@ sub get_repeatable_holidays { > push @repeatable_holidays, { > day => $date->get_column('day'), > month => $date->get_column('month'), >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > }; > } > >@@ -502,8 +508,8 @@ sub get_week_days_holidays { > branchcode => $branchcode, > }, > { >- select => \[ 'distinct DAYOFWEEK(date), note'], >- as => [qw/ weekday note /], >+ select => \[ 'distinct DAYOFWEEK(date), note, description'], >+ as => [qw/ weekday note description /], > where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), > } > ); >@@ -511,7 +517,8 @@ sub get_week_days_holidays { > while (my $date = $rs->next()) { > push @week_days, { > weekday => $date->get_column('weekday'), >- note => $date->note() >+ note => $date->note(), >+ description => $date->description(), > }; > } > >@@ -547,6 +554,7 @@ sub edit_holiday { > my ($params) = @_; > > my $title = $params->{title}; >+ my $description = $params->{description}; > my $weekday = $params->{weekday} || ''; > my $holiday_type = $params->{holiday_type}; > >@@ -577,6 +585,7 @@ sub edit_holiday { > my %updateValues = ( > is_opened => 0, > note => $title, >+ description => $description, > holiday_type => $holiday_type, > ); > $updateValues{open_hour} = $open_hour if $open_hour ne ''; >@@ -938,7 +947,7 @@ sub copy_holiday { > { > select => [{ DAYOFWEEK => 'date' }], > as => [qw/ weekday /], >- columns =>[ qw/ holiday_type note open_hour close_hour note/] >+ columns =>[ qw/ holiday_type note open_hour close_hour note description/] > } > ); > my $copyDate = $fromDate->next(); >diff --git a/Koha/Schema/Result/DiscreteCalendar.pm b/Koha/Schema/Result/DiscreteCalendar.pm >index 6db32c892e..777ac4952d 100644 >--- a/Koha/Schema/Result/DiscreteCalendar.pm >+++ b/Koha/Schema/Result/DiscreteCalendar.pm >@@ -55,6 +55,12 @@ __PACKAGE__->table("discrete_calendar"); > is_nullable: 1 > size: 30 > >+=head2 description >+ >+ data_type: 'mediumtext' >+ default_value: '''' >+ is_nullable: 1 >+ > =head2 open_hour > > data_type: 'time' >@@ -82,6 +88,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", default_value => "", is_nullable => 1, size => 1 }, > "note", > { data_type => "varchar", default_value => "", is_nullable => 1, size => 30 }, >+ "description", >+ { data_type => "mediumtext", default_value => "''", is_nullable => 1 }, > "open_hour", > { data_type => "time", is_nullable => 0 }, > "close_hour", >@@ -103,8 +111,8 @@ __PACKAGE__->add_columns( > __PACKAGE__->set_primary_key("branchcode", "date"); > > >-# Created by DBIx::Class::Schema::Loader v0.07045 @ 2017-04-19 10:07:41 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wtctW8ZzCkyCZFZmmavFEw >+# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-20 11:37:37 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/w9T8ShNcZsKRpeGaePHoA > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/installer/data/mysql/atomicupdate/bug_17015_part1_create_discrete_calendar.perl b/installer/data/mysql/atomicupdate/bug_17015_part1_create_discrete_calendar.perl >index 0e5d16ed65..f276da11a3 100644 >--- a/installer/data/mysql/atomicupdate/bug_17015_part1_create_discrete_calendar.perl >+++ b/installer/data/mysql/atomicupdate/bug_17015_part1_create_discrete_calendar.perl >@@ -8,6 +8,7 @@ if( CheckVersion( $DBversion ) ) { > `is_opened` tinyint(1) DEFAULT 1, > `holiday_type` varchar(1) DEFAULT '', > `note` varchar(30) DEFAULT '', >+ `description` mediumtext DEFAULT '', > `open_hour` time NOT NULL, > `close_hour` time NOT NULL, > PRIMARY KEY (`branchcode`,`date`) >diff --git a/installer/data/mysql/atomicupdate/bug_17015_part4_add_description.perl b/installer/data/mysql/atomicupdate/bug_17015_part4_add_description.perl >new file mode 100644 >index 0000000000..89b0516c67 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_17015_part4_add_description.perl >@@ -0,0 +1,8 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ if ( !column_exists( 'discrete_calendar', 'description' ) ) { >+ $dbh->do( "ALTER TABLE `discrete_calendar` ADD COLUMN `description` mediumtext default '' AFTER `note`;" ); >+ } >+ >+ NewVersion( $DBversion, 17015, "New koha calendar Part 4 - Add description field"); >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt >index 636578b78f..75acc57204 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt >@@ -116,6 +116,10 @@ > <label for="title">Title: </label> > <input type="text" name="Title" id="title" size="35" /> > </li> >+ <li> >+ <label for="description">Description: </label> >+ <textarea id="description" name="description" rows="2" cols="40"></textarea> >+ </li> > <li id="holidayType"> > <label for="holidayType">Date type</label> > <select name ='holidayType'> >@@ -191,6 +195,7 @@ > <ul> > <li>Search in the calendar the day you want to set as holiday.</li> > <li>Click the date to add or edit a holiday.</li> >+ <li>Enter a title and description for the holiday.</li> > <li>Specify how the holiday should repeat.</li> > <li>Click Save to finish.</li> > <li>PS: >@@ -219,6 +224,7 @@ > <tr> > <th class="validation">Date</th> > <th class="validation">Title</th> >+ <th class="validation">Description</th> > </tr> > </thead> > <tbody> >@@ -226,6 +232,7 @@ > <tr> > <td><a href="#main" onclick="go_to_date('[% need_validation_holiday.date | html %]')"><span title="[% need_validation_holiday.DATE_SORT | html %]">[% need_validation_holiday.outputdate | html %]</span></a></td> > <td>[% need_validation_holiday.note | html %]</td> >+ <td>[% need_validation_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td> > </tr> > [% END %] > </tbody> >@@ -239,6 +246,7 @@ > <tr> > <th class="repeatableweekly">Day of week</th> > <th class="repeatableweekly">Title</th> >+ <th class="repeatableweekly">Description</th> > </tr> > </thead> > <tbody> >@@ -246,6 +254,7 @@ > <tr> > <td>[% WEEK_DAYS_LOO.weekday | html %]</td> > <td>[% WEEK_DAYS_LOO.note | html %]</td> >+ <td>[% WEEK_DAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td> > </tr> > [% END %] > </tbody> >@@ -263,6 +272,7 @@ > <th class="repeatableyearly">Month/day</th> > [% END %] > <th class="repeatableyearly">Title</th> >+ <th class="repeatableyearly">Description</th> > </tr> > </thead> > <tbody> >@@ -274,6 +284,7 @@ > <td><span title="[% DAY_MONTH_HOLIDAYS_LOO.DATE_SORT | html %]">[% DAY_MONTH_HOLIDAYS_LOO.month | html %]/[% DAY_MONTH_HOLIDAYS_LOO.day | html %]</span></td> > [% END %] > <td>[% DAY_MONTH_HOLIDAYS_LOO.note | html %]</td> >+ <td>[% DAY_MONTH_HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td> > </tr> > [% END %] > </tbody> >@@ -287,6 +298,7 @@ > <tr> > <th class="holiday">Date</th> > <th class="holiday">Title</th> >+ <th class="holiday">Description</th> > </tr> > </thead> > <tbody> >@@ -294,6 +306,7 @@ > <tr> > <td><a href="#main" onclick="go_to_date('[% HOLIDAYS_LOO.date | html %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.outputdate | html %]</span></a></td> > <td>[% HOLIDAYS_LOO.note | html %]</td> >+ <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td> > </tr> > [% END %] > </tbody> >@@ -307,6 +320,7 @@ > <tr> > <th class="float">Date</th> > <th class="float">Title</th> >+ <th class="float">Description</th> > </tr> > </thead> > <tbody> >@@ -314,6 +328,7 @@ > <tr> > <td><a href="#main" onclick="go_to_date('[% float_holiday.date | html %]')"><span title="[% float_holiday.DATE_SORT | html %]">[% float_holiday.outputdate | html %]</span></a></td> > <td>[% float_holiday.note | html %]</td> >+ <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td> > </tr> > [% END %] > </tbody> >@@ -345,6 +360,7 @@ > [% FOREACH date IN datesInfos %] > datesInfos["[% date.date | html %]"] = { > title : "[% date.note | html %]", >+ description : "[% date.description | html %]", > outputdate : "[% date.outputdate | html %]", > holiday_type:"[% date.holiday_type | html %]", > open_hour: "[% date.open_hour | html %]", >@@ -355,7 +371,7 @@ > /* > * Displays the details of the selected date on a side panel > */ >- function showHoliday (date_obj, dateString, dayName, day, month, year, weekDay, title, holidayType) { >+ function showHoliday (date_obj, dateString, dayName, day, month, year, weekDay, title, description, holidayType) { > $("#newHoliday").slideDown("fast"); > $("#copyHoliday").slideUp("fast"); > $('#newDaynameOutput').html(dayName); >@@ -371,6 +387,7 @@ > $(".newHoliday, #Weekday").val(weekDay); > > $('.newHoliday #title').val(title); >+ $('.newHoliday #description').val(description); > $('#HolidayType').val(holidayType); > $('#days_of_week option[value="'+ (weekDay + 1) +'"]').attr('selected', true); > $('#openHour').val(datesInfos[dateString].open_hour); >@@ -530,7 +547,7 @@ > var date_obj = date.date_obj; > > document.querySelector("#calendar-anchor")._flatpickr.setDate(date_obj); >- showHoliday(date_obj, dateString, dayName, day, month, year, weekDay, datesInfos[dateString].title, datesInfos[dateString].holiday_type); >+ showHoliday(date_obj, dateString, dayName, day, month, year, weekDay, datesInfos[dateString].title, datesInfos[dateString].description, datesInfos[dateString].holiday_type); > } > > /* >@@ -629,7 +646,7 @@ > > // set value of form hidden field > $('#from_date').val(dateStr); >- showHoliday(date.date_obj, dateString, dayName, date.day, date.month, date.year, weekDay, datesInfos[dateString].title, datesInfos[dateString].holiday_type); >+ showHoliday(date.date_obj, dateString, dayName, date.day, date.month, date.year, weekDay, datesInfos[dateString].title, datesInfos[dateString].description, datesInfos[dateString].holiday_type); > [% END %] > } > }); >diff --git a/tools/discrete_calendar.pl b/tools/discrete_calendar.pl >index f5c740e919..b85e470ef3 100755 >--- a/tools/discrete_calendar.pl >+++ b/tools/discrete_calendar.pl >@@ -50,6 +50,7 @@ my $holiday_type = $input->param('holidayType'); > my $allbranches = $input->param('allBranches'); > > my $title = $input->param('Title'); >+my $description = $input->param('description'); > > my $action = $input->param('action') || ''; > >@@ -109,6 +110,7 @@ if ($action eq 'copyBranch') { > > $calendar->edit_holiday({ > title => $title, >+ description => $description, > weekday => $weekday, > holiday_type => $holiday_type, > open_hour => $openHour, >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17015
:
53859
|
54318
|
54419
|
59166
|
59167
|
59168
|
59169
|
59170
|
59171
|
59267
|
59268
|
59269
|
59270
|
59271
|
59463
|
59516
|
59517
|
59518
|
59519
|
59520
|
59561
|
59562
|
59586
|
59587
|
59888
|
59889
|
60902
|
60903
|
60904
|
60905
|
60906
|
60986
|
61737
|
62375
|
62376
|
62380
|
63257
|
63282
|
63362
|
63363
|
63364
|
63365
|
63366
|
63367
|
64235
|
65073
|
65074
|
65075
|
65076
|
65077
|
67721
|
67722
|
67723
|
67724
|
67725
|
67879
|
67929
|
67930
|
67931
|
67932
|
67933
|
67934
|
68392
|
68393
|
68394
|
68395
|
68396
|
68397
|
71634
|
71635
|
71636
|
71637
|
71638
|
72890
|
73145
|
74859
|
74860
|
74861
|
74862
|
74863
|
74864
|
74865
|
74866
|
75444
|
75479
|
76594
|
77249
|
77250
|
77607
|
77608
|
77609
|
77610
|
77611
|
77612
|
77613
|
77770
|
77771
|
77772
|
77773
|
77774
|
79035
|
80523
|
80524
|
80525
|
80526
|
80527
|
80528
|
80529
|
80530
|
80531
|
80532
|
80533
|
80534
|
80535
|
83547
|
85394
|
85677
|
85678
|
85679
|
85680
|
85681
|
85682
|
85683
|
85684
|
85685
|
85686
|
85687
|
85688
|
85689
|
85690
|
85691
|
92595
|
92596
|
92597
|
92598
|
100079
|
110383
|
110384
|
110386
|
110387
|
110388
|
110389
|
113541
|
113905
|
115501
|
115502
|
115503
|
115504
|
115505
|
115506
|
115507
|
115508
|
115509
|
115510
|
115511
|
118554
|
118555
|
118556
|
118557
|
118558
|
118559
|
119095
|
119097
|
119099
|
119100
|
119101
|
119102
|
131619
|
131620
|
131621
|
131622
|
131623
|
131624
|
131625
|
131626
|
131634
|
131635
|
131636
|
131637
|
131638
|
131639
|
131640
|
131641
|
131667
|
132199
|
133596
|
133597
|
133598
|
133599
|
133600
|
133601
|
133602
|
133603
|
133604
|
133605
|
133678
|
137219
|
137220
|
137221
|
137222
|
137223
|
137224
|
137225
|
137226
|
137227
|
137228
|
137229
|
139378
|
139379
|
139380
|
139381
|
139382
|
139599
|
139600
|
139601
|
139602
|
139603
|
139851
|
140150
|
141176
|
144257
|
144258
|
144259
|
144260
|
144261
|
144262
|
144264
|
144268
|
144269
|
144270
|
144271
|
144272
|
144273
|
151438
|
151439
|
151440
|
151441
|
151442
|
151443
|
151444
|
151445
|
151446
|
151447
|
151448
|
151449
|
151450
|
156340
|
156341
|
156342
|
156343
|
156344
|
156345
|
156346
|
156347
|
156348
|
156349
|
156350
|
156351
|
156352
|
156353
|
156354
|
156355
|
157656
|
157657
|
157658
|
157659
|
157660
|
157661
|
157662
|
157663
|
157664
|
157665
|
157666
|
157667
|
157668
|
157669
|
157670
|
157671
|
157672
|
167805
|
167806
|
167807
|
167808
|
167809