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

(-)a/installer/data/mysql/kohastructure.sql (+4 lines)
Lines 1835-1840 CREATE TABLE `suggestions` ( Link Here
1835
   branchcode VARCHAR(10) default NULL,
1835
   branchcode VARCHAR(10) default NULL,
1836
   collectiontitle text default NULL,
1836
   collectiontitle text default NULL,
1837
   itemtype VARCHAR(30) default NULL,
1837
   itemtype VARCHAR(30) default NULL,
1838
	quantity SMALLINT(6) default NULL,
1839
	currency VARCHAR(3) default NULL,
1840
	price DECIMAL(28,6) default NULL,
1841
	total DECIMAL(28,6) default NULL,
1838
  PRIMARY KEY  (`suggestionid`),
1842
  PRIMARY KEY  (`suggestionid`),
1839
  KEY `suggestedby` (`suggestedby`),
1843
  KEY `suggestedby` (`suggestedby`),
1840
  KEY `managedby` (`managedby`)
1844
  KEY `managedby` (`managedby`)
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 3876-3881 VALUES Link Here
3876
    SetVersion ($DBversion);
3876
    SetVersion ($DBversion);
3877
};
3877
};
3878
3878
3879
$DBversion = '3.03.00.005';
3880
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3881
    $dbh->do("ALTER table suggestions ADD quantity SMALLINT(6) default NULL,
3882
		ADD currency VARCHAR(3) default NULL,
3883
		ADD price DECIMAL(28,6) default NULL,
3884
		ADD total DECIMAL(28,6) default NULL;
3885
		");
3886
    print "Upgrade to $DBversion done (Added acq related columns to suggestions)\n";
3887
    SetVersion ($DBversion);
3888
}
3889
3890
3879
=head1 FUNCTIONS
3891
=head1 FUNCTIONS
3880
3892
3881
=head2 DropAllForeignKeys($table)
3893
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (+18 lines)
Lines 679-684 function calcNeworderTotal(){ Link Here
679
    return true;
679
    return true;
680
}
680
}
681
681
682
// Calculates total amount in a suggestion
683
684
function calcNewsuggTotal(){
685
    //collect values
686
    var quantity = new Number(document.getElementById('quantity').value);
687
//    var currency = f.currency.value;
688
    var currcode = new String(document.getElementById('currency').value);
689
    var price   =  new Number(document.getElementById('price').value);
690
    var exchangerate =  new Number(document.getElementById(currcode).value);
691
692
    var total =  new Number(quantity*price*exchangerate);
693
694
    document.getElementById('total').value = total.toFixed(2);
695
    document.getElementById('price').value =  listprice.toFixed(2);
696
    return true;
697
}
698
699
682
// ----------------------------------------
700
// ----------------------------------------
683
//USED BY NEWORDEREMPTY.PL
701
//USED BY NEWORDEREMPTY.PL
684
/*
702
/*
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl (-2 / +17 lines)
Lines 81-88 h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di Link Here
81
.overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; }
81
.overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; }
82
</style>
82
</style>
83
<!--/TMPL_IF-->
83
<!--/TMPL_IF-->
84
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
84
</head>
85
</head>
85
<body>
86
<body onload="calcNewsuggTotal();">
86
<!-- TMPL_INCLUDE name="header.inc" -->
87
<!-- TMPL_INCLUDE name="header.inc" -->
87
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
88
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
88
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <!-- TMPL_IF name="op_save" --> <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; <!-- TMPL_IF name="suggestionid" -->Suggestion edit #<!-- TMPL_VAR name="suggestionid" --><!--TMPL_ELSE-->New purchase suggestion<!-- /TMPL_IF --><!--TMPL_ELSE-->Suggestions Management<!-- /TMPL_IF --> </div>
89
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <!-- TMPL_IF name="op_save" --> <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; <!-- TMPL_IF name="suggestionid" -->Suggestion edit #<!-- TMPL_VAR name="suggestionid" --><!--TMPL_ELSE-->New purchase suggestion<!-- /TMPL_IF --><!--TMPL_ELSE-->Suggestions Management<!-- /TMPL_IF --> </div>
Lines 160-166 h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { di Link Here
160
                <option value="">Any</option><!-- TMPL_LOOP name="budgetsloop" -->
161
                <option value="">Any</option><!-- TMPL_LOOP name="budgetsloop" -->
161
                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="budget_id" -->" selected="selected"><!-- TMPL_VAR name="budget_name" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="budget_id" -->"><!-- TMPL_VAR name="budget_name" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
162
                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="budget_id" -->" selected="selected"><!-- TMPL_VAR name="budget_name" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="budget_id" -->"><!-- TMPL_VAR name="budget_name" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
162
            </select>
163
            </select>
163
		</li></ol>
164
		</li><li><label for="quantity">Copies:</label>
165
			<input type="text" size="10" id="quantity" name="quantity" value="<!-- TMPL_VAR name="quantity" -->" onchange="calcNewsuggTotal();" />
166
                </li><li><label for="currency">Currency:</label>
167
		        <!-- TMPL_LOOP NAME="loop_currency" -->
168
		            <input type="hidden" id="<!-- TMPL_VAR NAME="currcode" -->" name="<!-- TMPL_VAR NAME="currcode" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
169
		        <!-- /TMPL_LOOP -->
170
            <select name="currency" id="currency" onchange="calcNewsuggTotal();">
171
                <!-- TMPL_LOOP name="loop_currency" -->
172
                <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="currcode" -->" selected="selected"><!-- TMPL_VAR name="currcode" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="currcode" -->"><!-- TMPL_VAR name="currcode" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
173
            </select>
174
                </li><li><label for="price">Price:</label>
175
			<input type="text" size="20" name="price" id="price" value="<!-- TMPL_VAR NAME="price" -->" onchange="calcNewsuggTotal();" />
176
                </li><li><label for="total">Total</label>
177
			<input type="text" readonly="readonly" id="total" name="total" size="10" value="<!--TMPL_VAR Name="total"-->"/>
178
                </li></ol>
164
    </fieldset>
179
    </fieldset>
165
    <fieldset class="action"><input type="hidden" name="op" value="<!--TMPL_VAR Name="op"-->" /><!--TMPL_IF Name="suggestionid"--><input type="submit" value="Save" /> <a class="cancel" href="suggestion.pl?suggestionid=<!--TMPL_VAR Name="suggestionid"-->">Cancel</a><!--TMPL_ELSE--><input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a><!--/TMPL_IF-->
180
    <fieldset class="action"><input type="hidden" name="op" value="<!--TMPL_VAR Name="op"-->" /><!--TMPL_IF Name="suggestionid"--><input type="submit" value="Save" /> <a class="cancel" href="suggestion.pl?suggestionid=<!--TMPL_VAR Name="suggestionid"-->">Cancel</a><!--TMPL_ELSE--><input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a><!--/TMPL_IF-->
166
    </fieldset>
181
    </fieldset>
(-)a/kohaversion.pl (-1 / +1 lines)
Lines 16-22 the kohaversion is divided in 4 parts : Link Here
16
use strict;
16
use strict;
17
17
18
sub kohaversion {
18
sub kohaversion {
19
    our $VERSION = '3.03.00.004';
19
    our $VERSION = '3.03.00.005';
20
    # version needs to be set this way
20
    # version needs to be set this way
21
    # so that it can be picked up by Makefile.PL
21
    # so that it can be picked up by Makefile.PL
22
    # during install
22
    # during install
(-)a/suggestion/suggestion.pl (-1 / +20 lines)
Lines 269-274 foreach my $budget (@$budgets){ Link Here
269
269
270
$template->param( budgetsloop => $budgets);
270
$template->param( budgetsloop => $budgets);
271
271
272
# get currencies and rates
273
my @rates = GetCurrencies();
274
my $count = scalar @rates;
275
276
my @loop_currency = ();
277
for ( my $i = 0 ; $i < $count ; $i++ ) {
278
    my %line;
279
    $line{currcode} = $rates[$i]->{'currency'};
280
    $line{rate}     = $rates[$i]->{'rate'};
281
	$line{selected} = 1 if ($$suggestion_ref{'currency'} && $line{'currcode'} eq $$suggestion_ref{'currency'});
282
    push @loop_currency, \%line;
283
}
284
285
$template->param(loop_currency => \@loop_currency);
286
287
$template->param(
288
	price        => sprintf("%.2f", $$suggestion_ref{'price'}||0),
289
	total            => sprintf("%.2f", $$suggestion_ref{'total'}||0),
290
);
291
272
my %hashlists;
292
my %hashlists;
273
foreach my $field qw(managedby acceptedby suggestedby budgetid STATUS) {
293
foreach my $field qw(managedby acceptedby suggestedby budgetid STATUS) {
274
    my $values_list;
294
    my $values_list;
275
- 

Return to bug 5464