View | Details | Raw Unified | Return to bug 13392
Collapse All | Expand All

(-)a/C4/Suggestions.pm (+7 lines)
Lines 491-496 sub ModSuggestion { Link Here
491
            or $suggestion->{$field} eq '' );
491
            or $suggestion->{$field} eq '' );
492
    }
492
    }
493
493
494
    if ($suggestion->{STATUS} and $suggestion->{STATUS} eq 'ORDERED') {
495
        $suggestion->{ordereddate} = dt_from_string;
496
        if (C4::Context->userenv) {
497
            $suggestion->{orderedby} = C4::Context->userenv->{number};
498
        }
499
    }
500
494
    my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid});
501
    my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid});
495
    my $status_update_table = 1;
502
    my $status_update_table = 1;
496
    eval {
503
    eval {
(-)a/installer/data/mysql/atomicupdate/Bug-13392-add-suggestions-ordereddate-and-suggestions-orderedby.sql (+4 lines)
Line 0 Link Here
1
ALTER TABLE suggestions
2
ADD COLUMN orderedby INT(11) NULL DEFAULT NULL AFTER rejecteddate,
3
ADD COLUMN ordereddate DATE NULL DEFAULT NULL AFTER orderedby,
4
ADD CONSTRAINT suggestions_orderedby_fk FOREIGN KEY (orderedby) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +4 lines)
Lines 3007-3012 CREATE TABLE `suggestions` ( -- purchase suggestions Link Here
3007
   accepteddate date default NULL, -- date the suggestion was marked as accepted
3007
   accepteddate date default NULL, -- date the suggestion was marked as accepted
3008
   rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
3008
   rejectedby INT(11) default NULL, -- borrowernumber for the librarian who rejected the suggestion, foreign key linking to the borrowers table
3009
   rejecteddate date default NULL, -- date the suggestion was marked as rejected
3009
   rejecteddate date default NULL, -- date the suggestion was marked as rejected
3010
   orderedby INT(11) NULL DEFAULT NULL, -- borrowernumber for the librarian who ordered the suggestion
3011
   ordereddate DATE NULL DEFAULT NULL, -- date the suggestion was marked as ordered
3010
  `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
3012
  `STATUS` varchar(10) NOT NULL default '', -- suggestion status (ASKED, CHECKED, ACCEPTED, or REJECTED)
3011
  `note` LONGTEXT, -- note entered on the suggestion
3013
  `note` LONGTEXT, -- note entered on the suggestion
3012
  `author` varchar(80) default NULL, -- author of the suggested item
3014
  `author` varchar(80) default NULL, -- author of the suggested item
Lines 3035-3041 CREATE TABLE `suggestions` ( -- purchase suggestions Link Here
3035
  KEY `status` (`STATUS`),
3037
  KEY `status` (`STATUS`),
3036
  KEY `biblionumber` (`biblionumber`),
3038
  KEY `biblionumber` (`biblionumber`),
3037
  KEY `branchcode` (`branchcode`),
3039
  KEY `branchcode` (`branchcode`),
3038
  CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE
3040
  CONSTRAINT `suggestions_budget_id_fk` FOREIGN KEY (`budgetid`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE SET NULL ON UPDATE CASCADE,
3041
  CONSTRAINT suggestions_orderedby_fk FOREIGN KEY (orderedby) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE
3039
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3042
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
3040
3043
3041
--
3044
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (+5 lines)
Lines 187-192 Link Here
187
                    [% END %]
187
                    [% END %]
188
                </td>
188
                </td>
189
            </tr>
189
            </tr>
190
            <tr>
191
                <th><span class="label">Suggestion ordered</span></th>
192
                <td>[% ordereddate | $KohaDates %]</td>
193
                <td>[% IF ( orderedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% orderedby_borrowernumber %]">[% orderedby_surname %], [% orderedby_firstname %]</a> [% Branches.GetName( orderedby_branchcode ) %] ([% orderedby_description %])[% END %]</td>
194
            </tr>
190
            </tbody>
195
            </tbody>
191
        </table></li></ol>
196
        </table></li></ol>
192
    </fieldset>
197
    </fieldset>
(-)a/suggestion/suggestion.pl (-2 / +1 lines)
Lines 293-299 if ($op=~/else/) { Link Here
293
    );
293
    );
294
}
294
}
295
295
296
foreach my $element ( qw(managedby suggestedby acceptedby) ) {
296
foreach my $element ( qw(managedby suggestedby acceptedby orderedby) ) {
297
#    $debug || warn $$suggestion_ref{$element};
297
#    $debug || warn $$suggestion_ref{$element};
298
    if ($$suggestion_ref{$element}){
298
    if ($$suggestion_ref{$element}){
299
        my $patron = Koha::Patrons->find( $$suggestion_ref{$element} );
299
        my $patron = Koha::Patrons->find( $$suggestion_ref{$element} );
300
- 

Return to bug 13392