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

(-)a/C4/Budgets.pm (+55 lines)
Lines 46-51 BEGIN { Link Here
46
46
47
	    &GetBudgetPeriod
47
	    &GetBudgetPeriod
48
        &GetBudgetPeriods
48
        &GetBudgetPeriods
49
        &GetBudgetFirstChild
50
        &GetBudgetParent
51
        &GetBudgetSecondChild
52
49
        &ModBudgetPeriod
53
        &ModBudgetPeriod
50
        &AddBudgetPeriod
54
        &AddBudgetPeriod
51
	    &DelBudgetPeriod
55
	    &DelBudgetPeriod
Lines 464-469 sub GetBudgetPeriod { Link Here
464
}
468
}
465
469
466
# -------------------------------------------------------------------
470
# -------------------------------------------------------------------
471
sub GetBudgetFirstChild {
472
   my $dbh = C4::Context->dbh;
473
   my $query = "SELECT *
474
                    FROM `aqbudgets`
475
                    WHERE budget_parent_id
476
                    IN (
477
                    SELECT budget_id FROM `aqbudgets`
478
                    JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id
479
                    WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1)))
480
                    ORDER BY `aqbudgets`.`budget_parent_id`, budget_name ASC";
481
    my $sth= $dbh->prepare($query);
482
    $sth->execute();
483
    my $data = $sth->fetchall_arrayref({});
484
    return $data;
485
}
486
# -------------------------------------------------------------------
487
sub GetBudgetParent {
488
    my $dbh = C4::Context->dbh;
489
    my $query = "SELECT *
490
                    FROM `aqbudgets`
491
                    JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id
492
                    WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1))
493
                    ORDER BY `aqbudgets`.`budget_id`, budget_name ASC";
494
    my $sth= $dbh->prepare($query);
495
    $sth->execute();
496
    my $data = $sth->fetchall_arrayref({});
497
    return $data;
498
}
499
# -------------------------------------------------------------------
500
sub GetBudgetSecondChild {
501
    my $dbh = C4::Context->dbh;
502
    my $query = "SELECT *
503
                    FROM `aqbudgets`
504
                    WHERE budget_parent_id
505
                    IN (
506
                    SELECT budget_id
507
                    FROM `aqbudgets`
508
                    WHERE budget_parent_id
509
                    IN (
510
                    SELECT budget_id
511
                    FROM `aqbudgets`
512
                    JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id
513
                    WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1))))
514
                    ORDER BY `aqbudgets`.`budget_parent_id` , budget_name ASC";
515
    my $sth= $dbh->prepare($query);
516
    $sth->execute();
517
    my $data = $sth->fetchall_arrayref({});
518
    return $data;
519
}
520
# -------------------------------------------------------------------
521
467
sub DelBudgetPeriod{
522
sub DelBudgetPeriod{
468
	my ($budget_period_id) = @_;
523
	my ($budget_period_id) = @_;
469
	my $dbh = C4::Context->dbh;
524
	my $dbh = C4::Context->dbh;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (+59 lines)
Lines 87-92 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
87
</script>
87
</script>
88
[% END %]
88
[% END %]
89
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
89
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
90
<script type="text/javascript">
91
// <![CDATA[
92
    $(document).ready(function() {
93
    $('#sub_budgetid').hide();
94
    $('#su_sub_budgetid').hide();
95
    $("#budgetid").val("").attr('selected', 'selected');
96
           
97
        $('#budgetid').change(function() {
98
        var budget= $('#budgetid').val();
99
                
100
        if (budget ==""){
101
        $('#sub_budgetid').hide();
102
        $('#su_sub_budgetid').hide();
103
        $('#sub_budgetid option:visible').hide();
104
        $('#su_sub_budgetid option:visible').hide();
105
        $("#sub_budgetid").val("").attr('selected', 'selected');
106
        $("#su_sub_budgetid").val("").attr('selected', 'selected');
107
        }
108
        else {
109
        $('#sub_budgetid').show();
110
        $('#sub_budgetid option:visible').hide();
111
        $('.'+budget).show();
112
        $('#a').show();
113
        $("#sub_budgetid").val("").attr('selected', 'selected');
114
        $('#su_sub_budgetid option:visible').hide();
115
        $('#su_sub_budgetid').hide();
116
        }
117
        });
118
119
        $('#sub_budgetid').change(function() {
120
        var subbudget= $('#sub_budgetid').val();
121
        
122
        if (subbudget ==""){
123
        $('#su_sub_budgetid').hide();
124
        $("#su_sub_budgetid").val("").attr('selected', 'selected');
125
        $("#sub_budgetid").val("").attr('selected', 'selected');
126
        
127
        }
128
        else {
129
        $('#su_sub_budgetid').show();
130
        $('#su_sub_budgetid option:visible').hide();
131
        $('.'+subbudget).show();
132
        $('#b').show();
133
        $("#su_sub_budgetid").val("").attr('selected', 'selected');
134
        }
135
        });
136
    });
137
// ]]>
138
</script>
139
140
90
</head>
141
</head>
91
<body>
142
<body>
92
[% INCLUDE 'header.inc' %]
143
[% INCLUDE 'header.inc' %]
Lines 169-174 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
169
                <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
220
                <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
170
                [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id %]" selected="selected">[% budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id %]">[% budgetsloo.budget_name %]</option>[% END %][% END %]
221
                [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id %]" selected="selected">[% budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id %]">[% budgetsloo.budget_name %]</option>[% END %][% END %]
171
            </select>
222
            </select>
223
            <select name="sub_budgetid" id="sub_budgetid" >
224
                <option value="" id="a">Any</option>[% FOREACH sub_budget_loo IN sub_budgetsloop %]
225
                [% IF ( sub_budgetloo.selected ) %]<option value="[% sub_budget_loo.budget_id %]" selected="selected" class="[% sub_budget_loo.budget_parent_id %]" style ="display : none;">[% sub_budget_loo.budget_name %]</option>[% ELSE %]<option value="[% sub_budget_loo.budget_id %]" class="[% sub_budget_loo.budget_parent_id %]" style ="display : none;" >[% sub_budget_loo.budget_name %]</option>[% END %][% END %]
226
            </select>
227
            <select name="su_sub_budgetid" id="su_sub_budgetid">
228
                <option value="" id="b">Any</option>[% FOREACH su_sub_budgetsloo IN su_sub_budgetsloop %]
229
                [% IF ( su_sub_budgetsloo.selected ) %]<option value="[% su_sub_budgetsloo.budget_id %]" selected="selected" class="[% su_sub_budgetsloo.budget_parent_id %]" style ="display : none;">[% su_sub_budgetsloo.budget_name %]</option>[% ELSE %]<option value="[% su_sub_budgetsloo.budget_id %]" class="[% su_sub_budgetsloo.budget_parent_id %]" style ="display : none;">[% su_sub_budgetsloo.budget_name %]</option>[% END %][% END %]
230
            </select>
172
		</li><li><label for="quantity">Copies:</label>
231
		</li><li><label for="quantity">Copies:</label>
173
			<input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" onchange="calcNewsuggTotal();" />
232
			<input type="text" size="10" id="quantity" name="quantity" value="[% quantity %]" onchange="calcNewsuggTotal();" />
174
                </li><li><label for="currency">Currency:</label>
233
                </li><li><label for="currency">Currency:</label>
(-)a/suggestion/suggestion.pl (-1 / +11 lines)
Lines 84-89 my $tabcode = $input->param('tabcode'); Link Here
84
my $suggestion_ref  = $input->Vars;
84
my $suggestion_ref  = $input->Vars;
85
85
86
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field );
86
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field );
87
88
$suggestion_ref->{'budgetid'} = $suggestion_ref->{'su_sub_budgetid'}||$suggestion_ref->{'sub_budgetid'}||$suggestion_ref->{'budgetid'};
89
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field sub_budgetid su_sub_budgetid);
90
87
foreach (keys %$suggestion_ref){
91
foreach (keys %$suggestion_ref){
88
    delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' || $op eq 'change'));
92
    delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' || $op eq 'change'));
89
}
93
}
Lines 300-307 foreach my $budget ( @{$budgets} ) { Link Here
300
## Please see file perltidy.ERR
304
## Please see file perltidy.ERR
301
    $budget->{'selected'}=1 if ($$suggestion_ref{'budgetid'} && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'})
305
    $budget->{'selected'}=1 if ($$suggestion_ref{'budgetid'} && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'})
302
};
306
};
307
my $bud = GetBudgetParent();
308
my $subbud = GetBudgetFirstChild();
309
my $susubbud = GetBudgetSecondChild();
303
310
304
$template->param( budgetsloop => $budgets);
311
$template->param( budgetsloop => $budgets);
312
$template->param( budgetsloop => $bud );
313
$template->param( sub_budgetsloop => $subbud );
314
$template->param( su_sub_budgetsloop => $susubbud );
315
305
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1);
316
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1);
306
317
307
# get currencies and rates
318
# get currencies and rates
308
- 

Return to bug 6069