Bugzilla – Attachment 102329 Details for
Bug 4461
Add a context-sensitive report a problem process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4461: Fix status and borrowernumber fields in problem_reports and more
Bug-4461-Fix-status-and-borrowernumber-fields-in-p.patch (text/plain), 23.48 KB, created by
David Nind
on 2020-04-02 20:10:14 UTC
(
hide
)
Description:
Bug 4461: Fix status and borrowernumber fields in problem_reports and more
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-04-02 20:10:14 UTC
Size:
23.48 KB
patch
obsolete
>From 5dca768f4f651b889aa4febbc1e08ab30048f4d2 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 18 Mar 2020 22:50:50 +0000 >Subject: [PATCH] Bug 4461: Fix status and borrowernumber fields in > problem_reports and more > >status varchar(6) with readable statuses >borrowernumber not null default 0 >hide form if message successfully sent >fixing hide viewed and hide closed filters >adding recipient column > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Schema/Result/ProblemReport.pm | 27 ++--- > admin/problem-reports.pl | 6 +- > .../bug-4461_add-problem-reports-table.perl | 4 +- > installer/data/mysql/kohastructure.sql | 4 +- > .../prog/en/modules/admin/problem-reports.tt | 30 +++--- > .../bootstrap/en/modules/opac-reportproblem.tt | 118 ++++++++++----------- > mainpage.pl | 2 +- > svc/problem_reports | 12 +-- > 8 files changed, 97 insertions(+), 106 deletions(-) > >diff --git a/Koha/Schema/Result/ProblemReport.pm b/Koha/Schema/Result/ProblemReport.pm >index a55ad1ece6..f2655b5a7d 100644 >--- a/Koha/Schema/Result/ProblemReport.pm >+++ b/Koha/Schema/Result/ProblemReport.pm >@@ -46,8 +46,9 @@ __PACKAGE__->table("problem_reports"); > =head2 borrowernumber > > data_type: 'integer' >+ default_value: 0 > is_foreign_key: 1 >- is_nullable: 1 >+ is_nullable: 0 > > =head2 branchcode > >@@ -86,9 +87,9 @@ __PACKAGE__->table("problem_reports"); > =head2 status > > data_type: 'varchar' >- default_value: 'N' >+ default_value: 'NEW' > is_nullable: 0 >- size: 1 >+ size: 6 > > =cut > >@@ -100,7 +101,12 @@ __PACKAGE__->add_columns( > "content", > { data_type => "varchar", default_value => "", is_nullable => 0, size => 255 }, > "borrowernumber", >- { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, >+ { >+ data_type => "integer", >+ default_value => 0, >+ is_foreign_key => 1, >+ is_nullable => 0, >+ }, > "branchcode", > { > data_type => "varchar", >@@ -128,7 +134,7 @@ __PACKAGE__->add_columns( > is_nullable => 0, > }, > "status", >- { data_type => "varchar", default_value => "N", is_nullable => 0, size => 1 }, >+ { data_type => "varchar", default_value => "NEW", is_nullable => 0, size => 6 }, > ); > > =head1 PRIMARY KEY >@@ -157,12 +163,7 @@ __PACKAGE__->belongs_to( > "borrowernumber", > "Koha::Schema::Result::Borrower", > { borrowernumber => "borrowernumber" }, >- { >- is_deferrable => 1, >- join_type => "LEFT", >- on_delete => "CASCADE", >- on_update => "CASCADE", >- }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, > ); > > =head2 branchcode >@@ -181,8 +182,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-11 08:28:15 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qVNVIuurFD6Q6p4YA5Kptg >+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2020-03-18 22:36:43 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XQn+sJwh4s+EK9vf2gQ7Qw > > > # You can replace this text with custom code or comments, and it will be preserved on regeneration >diff --git a/admin/problem-reports.pl b/admin/problem-reports.pl >index 659a6e0e2d..70b97276c2 100755 >--- a/admin/problem-reports.pl >+++ b/admin/problem-reports.pl >@@ -48,18 +48,18 @@ my @report_ids = $query->multi_param('report_ids'); > if ( $action eq 'viewed' ) { > foreach my $report_id ( @report_ids ) { > my $report = Koha::ProblemReports->find($report_id); >- $report->set({ status => 'V' })->store; >+ $report->set({ status => 'Viewed' })->store; > } > } elsif ( $action eq 'closed' ) { > foreach my $report_id ( @report_ids ) { > my $report = Koha::ProblemReports->find($report_id); >- $report->set({ status => 'C' })->store; >+ $report->set({ status => 'Closed' })->store; > } > > } elsif ( $action eq 'new' ) { > foreach my $report_id ( @report_ids ) { > my $report = Koha::ProblemReports->find($report_id); >- $report->set({ status => 'N' })->store; >+ $report->set({ status => 'New' })->store; > } > } > >diff --git a/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl b/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl >index 11cee3aa67..02dcb49281 100644 >--- a/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl >+++ b/installer/data/mysql/atomicupdate/bug-4461_add-problem-reports-table.perl >@@ -6,13 +6,13 @@ if( CheckVersion( $DBversion ) ) { > reportid int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha > title varchar(40) NOT NULL default '', -- report subject line > content varchar(255) NOT NULL default '', -- report message content >- borrowernumber int(11) default NULL, -- the user who created the problem report >+ borrowernumber int(11) NOT NULL default 0, -- the user who created the problem report > branchcode varchar(10) NOT NULL default '', -- borrower's branch > username varchar(75) default NULL, -- OPAC username > problempage varchar(255) default NULL, -- page the user triggered the problem report form from > recipient enum('admin','library') NOT NULL default 'library', -- the 'to-address' of the problem report > created_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of report submission >- status varchar(1) NOT NULL default 'N', -- status of the report. N=new, V=viewed, C=closed >+ status varchar(6) NOT NULL default 'New', -- status of the report. New, Viewed, Closed > PRIMARY KEY (reportid), > CONSTRAINT problem_reports_ibfk1 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT problem_reports_ibfk2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 38c2ee55ce..2b7371fd52 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -4445,13 +4445,13 @@ CREATE TABLE `problem_reports` ( > `reportid` int(11) NOT NULL auto_increment, -- unique identifier assigned by Koha > `title` varchar(40) NOT NULL default '', -- report subject line > `content` varchar(255) NOT NULL default '', -- report message content >- `borrowernumber` int(11) default NULL, -- the user who created the problem report >+ `borrowernumber` int(11) NOT NULL default 0, -- the user who created the problem report > `branchcode` varchar(10) NOT NULL default '', -- borrower's branch > `username` varchar(75) default NULL, -- OPAC username > `problempage` varchar(255) default NULL, -- page the user triggered the problem report form from > `recipient` enum('admin','library') NOT NULL default 'library', -- the 'to-address' of the problem report > `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, -- timestamp of report submission >- `status` varchar(1) NOT NULL default 'N', -- status of the report. N=new, V=viewed, C=closed >+ `status` varchar(6) NOT NULL default 'New', -- status of the report. New, Viewed, Closed > PRIMARY KEY (`reportid`), > CONSTRAINT `problem_reports_ibfk1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `problem_reports_ibfk2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt >index 4d6faf0c6f..ceb0f6c440 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/problem-reports.tt >@@ -64,6 +64,7 @@ > <th class="NoSort"> </th> > <th class="anti-the">Message</th> > <th>Problem page</th> >+ <th>Sent to</th> > <th class="title-string">Created on</th> > <th>Set by</th> > <th>Status</th> >@@ -79,21 +80,14 @@ > [% report.content | html %] > </td> > <td><a href="[% report.problempage | uri %]">[% report.problempage | html %]</a></td> >+ <td>[% report.recipient %]</td> > <td><span title="[% report.created_on | html %]">[% report.created_on | $KohaDates with_hours => 1 %]</span></td> > <td>[% INCLUDE 'patron-title.inc' patron => report.patron hide_patron_infos_if_needed=1 %]</td> >- <td class="status[% report.status | html %]" name="status"> >- [% IF ( report.status == 'V' ) %] >- <span id="status_[% report.reportid | html %]">Viewed</span> >- [% ELSIF ( report.status == 'C' ) %] >- <span id="status_[% report.reportid | html %]">Closed</span> >- [% ELSE %] >- <span id="status_[% report.reportid | html %]">New</span> >- [% END %] >- </td> >+ <td class="status[% report.status | html %]" name="status"><span id="status_[% report.reportid | html %]">[% report.status | html %]</span></td> > <td class="actions"> >- [% IF ( report.status == 'N' ) %] >+ [% IF ( report.status == 'New' ) %] > <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" disabled="disabled" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button> >- [% ELSIF ( report.status == 'V' ) %] >+ [% ELSIF ( report.status == 'Viewed' ) %] > <button name="viewed" disabled="disabled" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button> > [% ELSE %] > <button name="viewed" data-report_id="[% report.reportid | html %]" class="viewed btn btn-default btn-xs"><i class="fa fa-eye"></i> Mark viewed</button> <button name="closed" disabled="disabled" data-report_id="[% report.reportid | html %]" class="closed btn btn-default btn-xs"><i class="fa fa-times-circle"></i> Mark closed</button> <button name="new" data-report_id="[% report.reportid | html %]" class="new btn btn-default btn-xs"><i class="fa fa-star"></i> Mark new</button> >@@ -151,16 +145,18 @@ > $(".marknew").prop("disabled", true); > }); > >+ >+ > $(".HideViewed").on("click", function(){ >- $(".statusV").parent().hide(); >+ $(".statusViewed").parent().hide(); > }); > > $(".HideClosed").on("click", function(){ >- $(".statusC").parent().hide(); >+ $(".statusClosed").parent().hide(); > }); > > $(".HideNew").on("click", function(){ >- $(".statusN").parent().hide(); >+ $(".statusNew").parent().hide(); > }); > > $(".ShowAll").on("click", function(){ >@@ -201,19 +197,19 @@ > if (data.status == 'success'){ > if ( $action == 'viewed' ){ > $("#status_" + $report_id).text(_("Viewed")); >- $(event.target).parent().siblings("status").removeClass().addClass("statusV"); >+ $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusViewed"); > $(event.target).siblings(".closed").prop("disabled", false); > $(event.target).siblings(".new").prop("disabled", false); > $(event.target).prop("disabled", true); > } else if ( $action == 'new' ){ > $("#status_" + $report_id).text(_("New")); >- $(event.target).parent().siblings("status").removeClass().addClass("statusN"); >+ $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusNew"); > $(event.target).siblings(".closed").prop("disabled", false); > $(event.target).siblings(".viewed").prop("disabled", false); > $(event.target).prop("disabled", true); > } else { > $("#status_" + $report_id).text(_("Closed")); >- $(event.target).parent().siblings("status").removeClass().addClass("statusC"); >+ $(event.target).parent().siblings("[name='status']").removeClass().addClass("statusClosed"); > $(event.target).siblings(".viewed").prop("disabled", false); > $(event.target).siblings(".new").prop("disabled", false); > $(event.target).prop("disabled", true); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt >index 3b5ffe30f8..b866967a90 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt >@@ -27,71 +27,65 @@ > [% END %] > <h1>Report a problem</h1> > >- [% FOR m IN messages %] >- <div class="alert alert-[% m.type | html %]"> >- [% SWITCH m.code %] >- [% CASE 'success_on_send' %] >- [% IF recipient == 'admin' %] >- Your problem report has been sent to the Koha administrator. >- [% ELSE %] >- Your problem report has been sent to the library. >+ [% IF messages %] >+ [% FOR m IN messages %] >+ <div class="alert alert-[% m.type | html %]"> >+ [% SWITCH m.code %] >+ [% CASE 'success_on_send' %] >+ [% IF recipient == 'admin' %] >+ Your problem report has been sent to the Koha administrator. >+ [% ELSE %] >+ Your problem report has been sent to the library. >+ [% END %] >+ [% CASE 'error_on_send' %][#% We really should avoid reaching this! %] >+ Something wrong happened when sending the report. Please contact your library. > [% END %] >- [% CASE 'error_on_send' %][#% We really should avoid reaching this! %] >- Something wrong happened when sending the report. Please contact your library. >- [% END %] >- </div> >- [% END %] >+ </div> >+ [% END %] >+ [% ELSE %] > >- [% IF success_on_send %] >- <div class="alert alert-info"> >- [% IF recipient == 'admin' %] >- Your problem report has been sent to the Koha administrator. >- [% ELSE %] >- Your problem report has been sent to the library. >- [% END %] >- </div> >- [% END %] >+ <div id="reportproblem" class="maincontent toptabs"> >+ <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post"> >+ <input type="hidden" name="op" value="addreport"> >+ <fieldset class="rows"> >+ <ol> >+ <li> >+ <label for="recipient">Send problem report to: </label> >+ [% IF library.branchemail %] >+ <select name="recipient" id="recipient"> >+ <option value="library">A librarian</option> >+ <option value="admin">Koha administrator</option> >+ </select> >+ [% ELSE %] >+ <span>Koha administrator</span> >+ [% END %] >+ </li> >+ <li> >+ <label for="problempage">Problem found on page: </label> >+ <input type="hidden" name="problempage" id="problempage" value="[% problempage | html %]"> >+ [% problempage | html %] >+ </li> >+ <li> >+ <label for="user">Username: </label> >+ <input type="hidden" name="user" id="user" value="[% username | html %]" class="span3"> >+ [% username | html %] >+ <li> >+ <label for="subject">Subject: </label> >+ <input type="text" name="subject" id="subject" value="[% subject | html %]" class="span3"> >+ </li> >+ <li> >+ <label for="message">Message: </label> >+ <textarea name="message" id="message" rows="7" cols="60"></textarea> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Submit" class="btn"> >+ </fieldset> >+ </form> >+ </div> <!-- / #reportproblem --> > >- <div id="reportproblem" class="maincontent toptabs"> >- <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post"> >- <input type="hidden" name="op" value="addreport"> >- <fieldset class="rows"> >- <ol> >- <li> >- <label for="recipient">Send problem report to: </label> >- [% IF library.branchemail %] >- <select name="recipient" id="recipient"> >- <option value="library">A librarian</option> >- <option value="admin">Koha administrator</option> >- </select> >- [% ELSE %] >- <span>Koha administrator</span> >- [% END %] >- </li> >- <li> >- <label for="problempage">Problem found on page: </label> >- <input type="hidden" name="problempage" id="problempage" value="[% problempage | html %]"> >- [% problempage | html %] >- </li> >- <li> >- <label for="user">Username: </label> >- <input type="hidden" name="user" id="user" value="[% username | html %]" class="span3"> >- [% username | html %] >- <li> >- <label for="subject">Subject: </label> >- <input type="text" name="subject" id="subject" value="[% subject | html %]" class="span3"> >- </li> >- <li> >- <label for="message">Message: </label> >- <textarea name="message" id="message" rows="7" cols="60"></textarea> >- </li> >- </ol> >- </fieldset> >- <fieldset class="action"> >- <input type="submit" value="Submit" class="btn"> >- </fieldset> >- </form> >- </div> <!-- / #reportproblem --> >+ [% END %] > > </div> <!-- / .span10/12 --> > </div> <!-- / .row-fluid --> >diff --git a/mainpage.pl b/mainpage.pl >index 75072b1073..ff234f6baa 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -75,7 +75,7 @@ my $pending_article_requests = Koha::ArticleRequests->search_limited( > $branch ? ( 'me.branchcode' => $branch ) : (), > } > )->count; >-my $pending_problem_reports = Koha::ProblemReports->search({ status => 'N' }); >+my $pending_problem_reports = Koha::ProblemReports->search({ status => 'New' }); > > $template->param( > pendingcomments => $pendingcomments, >diff --git a/svc/problem_reports b/svc/problem_reports >index 0641f9794f..9fedc92ebe 100755 >--- a/svc/problem_reports >+++ b/svc/problem_reports >@@ -47,18 +47,18 @@ if ($is_ajax) { > my $action = $query->param('action'); > my $status = 'success'; > if ( $action eq 'viewed' ) { >- $report->set({ status => 'V' })->store; >- if ( $report->status ne 'V' ) { >+ $report->set({ status => 'Viewed' })->store; >+ if ( $report->status ne 'Viewed' ) { > $status = 'failure'; > } > } elsif ( $action eq 'closed' ) { >- $report->set({ status => 'C' })->store; >- if ( $report->status ne 'C' ) { >+ $report->set({ status => 'Closed' })->store; >+ if ( $report->status ne 'Closed' ) { > $status = 'failure'; > } > } elsif ( $action eq 'new' ) { >- $report->set({ status => 'N' })->store; >- if ( $report->status ne 'N' ) { >+ $report->set({ status => 'New' })->store; >+ if ( $report->status ne 'New' ) { > $status = 'failure'; > } > } >-- >2.11.0
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 4461
:
58887
|
59032
|
61654
|
65871
|
66253
|
66323
|
66324
|
98687
|
98688
|
98689
|
98725
|
99551
|
99599
|
99600
|
99601
|
99602
|
99603
|
99633
|
99635
|
99636
|
99637
|
99638
|
99639
|
99929
|
99930
|
99931
|
99932
|
99933
|
99934
|
99935
|
99936
|
99937
|
99938
|
99939
|
99940
|
99941
|
99942
|
100488
|
100489
|
100490
|
100491
|
100492
|
100493
|
100494
|
100495
|
100496
|
100497
|
100498
|
100499
|
100500
|
100506
|
100507
|
100508
|
100509
|
100510
|
100511
|
100512
|
100513
|
100514
|
100515
|
100516
|
100517
|
100518
|
100519
|
100520
|
100521
|
100522
|
100523
|
100524
|
100619
|
100989
|
100990
|
102188
|
102189
|
102190
|
102191
|
102192
|
102193
|
102194
|
102195
|
102196
|
102198
|
102200
|
102201
|
102202
|
102203
|
102204
|
102205
|
102206
|
102207
|
102208
|
102209
|
102210
|
102211
|
102253
|
102279
|
102281
|
102308
|
102309
|
102310
|
102311
|
102312
|
102313
|
102314
|
102315
|
102316
|
102317
|
102318
|
102319
|
102320
|
102321
|
102322
|
102323
|
102324
|
102325
|
102326
|
102327
|
102328
|
102329
|
102330
|
102331
|
102358
|
102359
|
102360
|
102361
|
102362
|
102363
|
102364
|
102365
|
102366
|
102367
|
102368
|
102369
|
102370
|
102371
|
102372
|
102373
|
102374
|
102375
|
102376
|
102377
|
102378
|
102379
|
102380
|
102381
|
102382
|
102383
|
102384
|
102385
|
102386