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

(-)a/C4/Serials.pm (-78 / +1 lines)
Lines 52-58 BEGIN { Link Here
52
      &getroutinglist     &delroutingmember   &addroutingmember
52
      &getroutinglist     &delroutingmember   &addroutingmember
53
      &reorder_members
53
      &reorder_members
54
      &check_routing &updateClaim &removeMissingIssue
54
      &check_routing &updateClaim &removeMissingIssue
55
      &CountIssues &SearchSubscriptions
55
      &CountIssues
56
      &subscriptionCurrentlyOnOrder
56
      &subscriptionCurrentlyOnOrder
57
      HasItems
57
      HasItems
58
      &GetSubscriptionsFromBorrower
58
      &GetSubscriptionsFromBorrower
Lines 153-235 sub GetLateIssues { Link Here
153
    return @issuelist;
153
    return @issuelist;
154
}
154
}
155
155
156
=head2 SearchSubscriptions
157
158
@results = SearchSubscriptions($biblionumber, $title, $issn, $ean, $publisher, $supplier, $branch, $minold, $maxold);
159
160
this function gets all subscriptions which have biblionumber eq $biblionumber, title like $title, ISSN like $issn, EAN like $ean, publisher like $publisher, supplier like $supplier AND branchcode eq $branch.
161
$minold and $maxold are values in days. It allows to get active and inactive subscription apart.
162
163
return:
164
a table of hashref. Each hash containt the subscription.
165
166
=cut
167
168
sub SearchSubscriptions {
169
    my ($biblionumber, $title, $issn, $ean, $publisher, $supplier, $branch, $minold, $maxold) = @_;
170
171
    my $query = qq{
172
        SELECT subscription.*, subscriptionhistory.*, biblio.*, biblioitems.issn,
173
            subscription.notes AS notes
174
        FROM subscription
175
            LEFT JOIN subscriptionhistory USING(subscriptionid)
176
            LEFT JOIN biblio ON biblio.biblionumber = subscription.biblionumber
177
            LEFT JOIN biblioitems ON biblioitems.biblionumber = subscription.biblionumber
178
            LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
179
    };
180
    my @where_strs;
181
    my @where_args;
182
    if($biblionumber){
183
        push @where_strs, "subscription.biblionumber = ?";
184
        push @where_args, "$biblionumber";
185
    }
186
    if($title){
187
        push @where_strs, "biblio.title LIKE ?";
188
        push @where_args, "%$title%";
189
    }
190
    if($issn){
191
        push @where_strs, "biblioitems.issn LIKE ?";
192
        push @where_args, "%$issn%";
193
    }
194
    if($ean){
195
        push @where_strs, "biblioitems.ean LIKE ?";
196
        push @where_args, "%$ean%";
197
    }
198
    if($publisher){
199
        push @where_strs, "biblioitems.publishercode LIKE ?";
200
        push @where_args, "%$publisher%";
201
    }
202
    if($supplier){
203
        push @where_strs, "aqbooksellers.name LIKE ?";
204
        push @where_args, "%$supplier%";
205
    }
206
    if($branch){
207
        push @where_strs, "subscription.branchcode = ?";
208
        push @where_args, "$branch";
209
    }
210
    if ($minold) {
211
        push @where_strs, "TO_DAYS(NOW()) - TO_DAYS(subscription.enddate) > ?" if ($minold);
212
        push @where_args, "$minold" if ($minold);
213
    }
214
    if ($maxold) {
215
        push @where_strs, "(TO_DAYS(NOW()) - TO_DAYS(subscription.enddate) <= ? OR subscription.enddate IS NULL OR subscription.enddate = '0000-00-00')";
216
        push @where_args, "$maxold";
217
    }
218
219
    if(@where_strs){
220
        $query .= " WHERE " . join(" AND ", @where_strs);
221
    }
222
    warn $query;
223
    warn join(",", @where_args) if @where_args;
224
    my $dbh = C4::Context->dbh;
225
    my $sth = $dbh->prepare($query);
226
    $sth->execute(@where_args);
227
    my $results = $sth->fetchall_arrayref( {} );
228
    $sth->finish;
229
230
    return @$results;
231
}
232
233
=head2
156
=head2
234
    $bool = subscriptionCurrentlyOnOrder( $subscriptionid );
157
    $bool = subscriptionCurrentlyOnOrder( $subscriptionid );
235
    Return 1 if subscription is already on order
158
    Return 1 if subscription is already on order
(-)a/acqui/newordersubscription.pl (-3 / +13 lines)
Lines 18-25 Link Here
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
20
21
use warnings;
21
use Modern::Perl;
22
use strict;
23
use CGI;
22
use CGI;
24
use C4::Acquisition;
23
use C4::Acquisition;
25
use C4::Auth;
24
use C4::Auth;
Lines 59-65 my ($bookseller) = C4::Bookseller::GetBookSellerFromId( $booksellerid); Link Here
59
my @subscriptions;
58
my @subscriptions;
60
my $sub;
59
my $sub;
61
if ($searched) {
60
if ($searched) {
62
    @subscriptions = SearchSubscriptions($biblionumber, $title, $ISSN, $EAN, $publisher, $supplier, $branch);
61
    @subscriptions = SearchSubscriptions(
62
        {
63
            biblionumber    => $biblionumber, 
64
            title           => $title, 
65
            issn            => $ISSN, 
66
            ean             => $EAN, 
67
            publisher       => $publisher, 
68
            bookseller      => $supplier, 
69
            branch          => $branch
70
        }
71
    );
63
}
72
}
64
73
65
74
Lines 104-108 $template->param( Link Here
104
    basketname       => $basket->{'basketname'},
113
    basketname       => $basket->{'basketname'},
105
    booksellername   => $bookseller->{'name'},
114
    booksellername   => $bookseller->{'name'},
106
    unfolded_search  => 1,
115
    unfolded_search  => 1,
116
    marcflavour      => uc(C4::Context->preference("marcflavour")),
107
);
117
);
108
output_html_with_http_headers $query, $cookie, $template->output;
118
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 2780-2786 CREATE TABLE `aqorders` ( -- information related to the basket line items Link Here
2780
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2780
  `uncertainprice` tinyint(1), -- was this price uncertain (1 for yes, 0 for no)
2781
  `claims_count` int(11) default 0, -- count of claim letters generated
2781
  `claims_count` int(11) default 0, -- count of claim letters generated
2782
  `claimed_date` date default NULL, -- last date a claim was generated
2782
  `claimed_date` date default NULL, -- last date a claim was generated
2783
  `subscriptionid` int(11) default NULL,
2783
  `subscriptionid` int(11) default NULL, -- links this order to a subscription in the serials module
2784
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2784
  parent_ordernumber int(11) default NULL, -- ordernumber of parent order line, or same as ordernumber if no parent
2785
  PRIMARY KEY  (`ordernumber`),
2785
  PRIMARY KEY  (`ordernumber`),
2786
  KEY `basketno` (`basketno`),
2786
  KEY `basketno` (`basketno`),
(-)a/installer/data/mysql/updatedatabase.pl (-2 / +2 lines)
Lines 5862-5869 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5862
5862
5863
$DBversion = "3.09.00.XXX";
5863
$DBversion = "3.09.00.XXX";
5864
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5864
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5865
    $dbh->do("ALTER TABLE `aqorders` ADD `subscriptionid` int(11) default NULL");
5865
    $dbh->do("ALTER TABLE `aqorders` ADD `subscriptionid` int(11) default NULL AFTER `claimed_date`");
5866
    print "Upgrade to $DBversion done (Alter table aqorders done)\n";
5866
    print "Upgrade to $DBversion done (Add subscriptionid to table aqorders)\n";
5867
    SetVersion ($DBversion);
5867
    SetVersion ($DBversion);
5868
}
5868
}
5869
5869
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc (-1 / +1 lines)
Lines 6-12 Link Here
6
        <input type="hidden" name="basketno" value="[% basketno %]" />
6
        <input type="hidden" name="basketno" value="[% basketno %]" />
7
        <ul><li><label for="q">From an existing record: </label><input id="q" type="text"  size="25" name="q" />
7
        <ul><li><label for="q">From an existing record: </label><input id="q" type="text"  size="25" name="q" />
8
        <input type="submit" class="submit" value="Search" /></li>
8
        <input type="submit" class="submit" value="Search" /></li>
9
        <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a Subscription</a></li>
9
        <li><a href="/cgi-bin/koha/acqui/newordersubscription.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a subscription</a></li>
10
        <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a suggestion</a></li>
10
        <li><a href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a suggestion</a></li>
11
        <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a new (empty) record</a></li>
11
        <li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From a new (empty) record</a></li>
12
        <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From an external source</a></li>
12
        <li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">From an external source</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc (-2 / +4 lines)
Lines 17-36 Link Here
17
                <label for="title">Title:</label>
17
                <label for="title">Title:</label>
18
                <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
18
                <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
19
              </li>
19
              </li>
20
              [% IF ( marcflavour == "UNIMARC" ) %]
20
              <li>
21
              <li>
21
                <label for="ean">EAN:</label>
22
                <label for="ean">EAN:</label>
22
                <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
23
                <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
23
              </li>
24
              </li>
25
              [% END %]
24
              <li>
26
              <li>
25
                <label for="publisher">Publisher:</label>
27
                <label for="publisher">Publisher:</label>
26
                <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
28
                <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
27
              </li>
29
              </li>
28
              <li>
30
              <li>
29
                <label for="supplier">Supplier:</label>
31
                <label for="supplier">Vendor:</label>
30
                <input type="text" id="supplier" name="supplier_filter" value="[% supplier_filter %]" />
32
                <input type="text" id="supplier" name="supplier_filter" value="[% supplier_filter %]" />
31
              </li>
33
              </li>
32
              <li>
34
              <li>
33
                <label for="branch">Branch:</label>
35
                <label for="branch">Library:</label>
34
                <select id="branch" name="branch_filter">
36
                <select id="branch" name="branch_filter">
35
                  <option value="">All</option>
37
                  <option value="">All</option>
36
                  [% FOREACH branches_loo IN branches_loop %]
38
                  [% FOREACH branches_loo IN branches_loop %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt (-23 / +3 lines)
Lines 4-32 Link Here
4
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
4
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
5
<script type="text/javascript">
5
<script type="text/javascript">
6
//<![CDATA[
6
//<![CDATA[
7
    function updateRowsVisibility(show_only_renewed) {
8
        if ( show_only_renewed ) {
9
            $("#srlt [data-reneweddate='']").hide();
10
        } else {
11
            $("#srlt > tbody > tr").show();
12
        }
13
          $("#srlt").trigger("sorton", [$("#srlt")[0].config.sortList]);
14
    }
15
    $(document).ready(function() {
7
    $(document).ready(function() {
16
        $("#srlt").tablesorter({
8
        $("#srlt").tablesorter({
17
            widgets : ['zebra'],
9
            widgets : ['zebra'],
18
            headers: {
10
            headers: {
19
                2: { sorter: false },
20
                6: { sorter: false },
11
                6: { sorter: false },
21
                7: { sorter: false }
12
                7: { sorter: false }
22
            }
13
            }
23
        });
14
        });
24
25
        $("#show_only_renewed").click(function(){
26
            updateRowsVisibility($(this+":checked").val());
27
        });
28
        $("#show_only_renewed").attr('checked', false);
29
        updateRowsVisibility(false);
30
    });
15
    });
31
 //]]>
16
 //]]>
32
</script>
17
</script>
Lines 43-55 Link Here
43
        <div class="yui-b">
28
        <div class="yui-b">
44
            <h2>Serials subscriptions</h2>
29
            <h2>Serials subscriptions</h2>
45
            [% IF ( routing ) %]
30
            [% IF ( routing ) %]
46
                <h3>Search for Serial Routing List</h3>
31
                <h3>Search for serial subscriptions</h3>
47
            [% END %]
32
            [% END %]
48
            [% IF ( done_searched ) %]
33
            [% IF ( done_searched ) %]
49
                <label for="show_only_renewed">
50
                    <input type="checkbox" style="vertical-align: middle;" id="show_only_renewed" />
51
                    Show only renewed
52
                </label>
53
                [% IF ( subs_loop ) %]
34
                [% IF ( subs_loop ) %]
54
                    <table id="srlt">
35
                    <table id="srlt">
55
                        <thead>
36
                        <thead>
Lines 57-63 Link Here
57
                                <th>Id</th>
38
                                <th>Id</th>
58
                                <th>ISSN</th>
39
                                <th>ISSN</th>
59
                                <th>Title</th>
40
                                <th>Title</th>
60
                                <th> Notes </th>
41
                                <th>Notes</th>
61
                                <th>Library</th>
42
                                <th>Library</th>
62
                                <th>Call number</th>
43
                                <th>Call number</th>
63
                                <th>Expiration date</th>
44
                                <th>Expiration date</th>
Lines 66-72 Link Here
66
                        </thead>
47
                        </thead>
67
                        <tbody>
48
                        <tbody>
68
                        [% FOREACH subs_loo IN subs_loop %]
49
                        [% FOREACH subs_loo IN subs_loop %]
69
                            <tr data-reneweddate="[% subs_loo.reneweddate %]" >
50
                            <tr>
70
                                <td>[% subs_loo.subscriptionid %]</td>
51
                                <td>[% subs_loo.subscriptionid %]</td>
71
                                <td>[% subs_loo.issn %]</td>
52
                                <td>[% subs_loo.issn %]</td>
72
                                <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subs_loo.subscriptionid %]" class="button" title="subscription detail">[% IF ( subs_loo.title ) %][% subs_loo.title |html %][% ELSE %]
53
                                <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subs_loo.subscriptionid %]" class="button" title="subscription detail">[% IF ( subs_loo.title ) %][% subs_loo.title |html %][% ELSE %]
73
- 

Return to bug 8415