From 93dc074c6c97c6b3547dc2c4d2b3cee90b11d721 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sat, 8 Apr 2017 21:09:17 +0000 Subject: [PATCH] Bug 18002 - Implemented currency creation form which is the first file to be displayed if the user did not install sample currencies during installation. Implemented new colour scheme to match the blue/grey Koha staff interface colours. Implemented text about what is happening in all forms, in addition to a hidden 'Next steps' help text on the acqui-home.tt page which will appear when the user hits the button clearly visible on the same page. This Next steps text tells the user how to create a vendor (link supplied), basket and order I have defaulted the budget active checkbox and currency active checkboxes to be ticked. --- C4/Budgets.pm | 7 ++ acqui/acqui-home.pl | 33 ++++-- admin/aqbudgets.pl | 4 +- admin/currency.pl | 9 ++ koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 6 ++ .../prog/en/includes/budgets-active-currency.inc | 20 +++- .../prog/en/includes/onboardinginclude.inc | 62 ----------- .../prog/en/includes/onboardinginclude1.inc | 64 +++++++++++ .../prog/en/includes/onboardinginclude2.inc | 117 +++++++++++---------- .../prog/en/includes/onboardinginclude3.inc | 74 +++++++++++++ .../prog/en/modules/acqui/acqui-home.tt | 49 ++++++--- 11 files changed, 295 insertions(+), 150 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc diff --git a/C4/Budgets.pm b/C4/Budgets.pm index cf2939f..1319c8a 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -146,6 +146,13 @@ sub GetPeriodsCount { } # ------------------------------------------------------------------- + +sub GetHighestBudgetPeriod{ + my $dbh = C4::Context->dbh; + warn my $data = $dbh->selectrow_array("SELECT MAX(budget_period_id) FROM aqbudgetperiods"); + return $data; +} +# ------------------------------------------------------------------- sub CheckBudgetParent { my ( $new_parent, $budget ) = @_; my $new_parent_id = $new_parent->{'budget_id'}; diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 04bb261..56b68de 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -66,15 +66,6 @@ my $totspent_active = 0; my $totordered_active = 0; my $totavail_active = 0; -my $budgets = GetBudgetPeriod(1); -if ($budgets > 0){ - my $stepfund = 2; - $template->param( stepfund => $stepfund ); -} else { - my $stepfund = 1; - $template->param( stepfund => $stepfund ); -} - my @budget_loop; foreach my $budget ( @{$budget_arr} ) { next unless (CanUserUseBudget($loggedinuser, $budget, $userflags)); @@ -131,11 +122,35 @@ $template->param( suggestions_count => $suggestions_count, ); + + + + + +my $aqstep; my $cur = Koha::Acquisition::Currencies->get_active; + if ( $cur ) { $template->param( currency => $cur->currency, ); } +my $budget = GetPeriodsCount(); +my $budgetid = C4::Budgets->GetHighestBudgetPeriod(); +if (!@budget_loop){ +if (!$cur) { + $aqstep = 1; + $template->param( step => $aqstep ); +} elsif ($budget && $budgetid == 1){ + $aqstep = 3; + $template->param( step => $aqstep ); +} elsif ($budgetid > 1) { + print $query->redirect("/cgi-bin/koha/admin/aqbudgetperiods.pl"); + exit; +} else { + $aqstep = 2; + $template->param( step => $aqstep ); +} +} output_html_with_http_headers $query, $cookie, $template->output; diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl index b950f0f..60fb2c4 100755 --- a/admin/aqbudgets.pl +++ b/admin/aqbudgets.pl @@ -76,8 +76,6 @@ my $budget_permission = $input->param('budget_permission'); my $budget_users_ids = $input->param('budget_users_ids'); my $filter_budgetbranch = $input->param('filter_budgetbranch') // ''; my $filter_budgetname = $input->param('filter_budgetname'); - - # ' ------- get periods stuff ------------------' # IF PERIODID IS DEFINED, GET THE PERIOD - ELSE JUST GET THE ACTIVE PERIOD BY DEFAULT my $period; @@ -226,6 +224,8 @@ if ($op eq 'add_form') { my $fundcreation = $input->param('fundcreation'); if ($fundcreation eq "onboarding"){ + my $step = $input->param('step'); + $template->param('step' => $step); print $input->redirect("/cgi-bin/koha/acqui/acqui-home.pl"); exit; } diff --git a/admin/currency.pl b/admin/currency.pl index 09b6a74..ab26c91 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -89,6 +89,15 @@ if ( $op eq 'add_form' ) { } $searchfield = q||; $op = 'list'; + + my $aqcurrency = $input->param('aqcurrency'); + if ($aqcurrency == 1) { + my $step = $input->param( 'step' ); + $template->param( step => $step ); + print $input->redirect("/cgi-bin/koha/acqui/acqui-home.pl"); + exit; + } + } elsif ( $op eq 'delete_confirm' ) { my $currency = Koha::Acquisition::Currencies->find($currency_code); diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css index 35479c8..f2aafdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css @@ -2977,3 +2977,9 @@ fieldset.rows + fieldset.action { .yui-u .rows li p label.widelabel { width: auto; } + +div#aqhelp{ + background-color:#EDF4F6; + padding:20px; + width:50%; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-active-currency.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-active-currency.inc index 005d58e..75a018b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-active-currency.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/budgets-active-currency.inc @@ -1,14 +1,26 @@ + + [% IF ( currency ) %] [% IF ( not hide ) %]

Currency = [% currency %]

[% END %] [% ELSE %] +
+

No active currency is defined

[% IF CAN_user_parameters_parameters_remaining_permissions %] -

You have no currencies defined in your database

- Enter a currency +

Please specify an active currency.

[% ELSE %]

Your administrator must specify an active currency.

[% END %] -
-

Now you can follow the below steps to set up acquisitions.


+
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude.inc deleted file mode 100644 index a0001b1..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude.inc +++ /dev/null @@ -1,62 +0,0 @@ - -
- [% IF displayonboardscreen == "acquisitions" %] -

Create a budget

-
-
- - - -
    -
  1. - - -
    [% INCLUDE 'date-format.inc' %]
    -
  2. - -
  3. - - -
    [% INCLUDE 'date-format.inc' %]
    -
  4. - -
  5. - - -
  6. - -
  7. - - -
  8. - -
  9. - - [% IF ( budget_period_active ) %][% ELSE %] [% END %] -
  10. -
-
-
- - - -
-
-
- [% ELSIF displayonboardscreen == "label" %] -

testing

- [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc new file mode 100644 index 0000000..2f50f32 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude1.inc @@ -0,0 +1,64 @@ + + +
+

Acquisition onboarding wizard

+

This onboarding wizard will take you through the process of setting up Acquistions

+

Start by completing this form to create a currency which you will be used to create your first budget and fund.
+ A fund is the accounting value you use to create orders

+
+ + + +
+ + New currency + +
    +
  1. + [% IF currency %] + Currency: + + [% currency.currency %] + [% ELSE %] + + Required + [% END %] +
  2. +
  3. + + Required +
  4. +
  5. + + Required +
  6. +
  7. + + +
  8. +
  9. + + + +
  10. +
+
+
+ +
+
+
+ diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc index b766dbc..592e4dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude2.inc @@ -1,63 +1,66 @@ +
+ [% IF displayonboardscreen == "acquisitions" %] +

Acquisition onboarding wizard

+

Create a budget which is the highest level value in acquisitions accountancy.
+ After creating this budget you will be prompted to create a fund which is what you will use to set up orders. +

+ If you have previously created a budget (which was subsequently deleted) then you will be redirected to the Budget Administration page after creating a budget using this form. On the Budget Administration page click Actions->Add fund to create a fund +

Create a budget

+
+
+ + + +
    +
  1. + + +
    [% INCLUDE 'date-format.inc' %]
    +
  2. -
    - -
    - [% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund - [% IF ( budget_period_description ) %] - [% budget_name %] for Budget '[% budget_period_description %]' - [% END %] - - - - -
      - [% budget_parent_id = 0 %] -
    1. - Fund parent: - [% budget_parent_name %] - [% budget_parent_id %] - [% budget_parent_name %] - -
    2. -
    3. - - -
    4. +
    5. + + +
      [% INCLUDE 'date-format.inc' %]
      +
    6. -
    7. - - -
    8. +
    9. + + +
    10. -
    11. - - -
    12. +
    13. + + +
    14. - - - [% IF ( budget_id ) %] - - [% END %] - -
    -
    - - -
    - -
    +
  3. + + +
  4. +
+
+
+ + + +
+ +
+ [% ELSIF displayonboardscreen == "label" %] +

testing

+ [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc new file mode 100644 index 0000000..753739a --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/onboardinginclude3.inc @@ -0,0 +1,74 @@ + + +
+

Acquisition onboarding wizard

+

Fill out this form to create a fund which will be assigned to the budget you just created.
+ A fund is an accounting value you will use to set up orders

+
+

Create a fund

+
+ + + + + [% IF ( budget_id ) %] + + [% END %] + [% budget_id %] + +
+ [% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund + [% IF ( budget_period_description ) %] + [% budget_name %] for Budget '[% budget_period_description %]' + [% END %] + +
    + [% budget_parent_id = 0 %] +
  1. + Fund parent: + [% budget_parent_name %] + [% budget_parent_id %] - [% budget_parent_name %] + +
  2. +
  3. + + +
  4. + +
  5. + + +
  6. + +
  7. + + +
  8. + + + + [% IF ( budget_id ) %] + + [% END %] + +
+
+ + +
+
+ +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt index ac29397..72336ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -22,13 +22,7 @@ dt_overwrite_html_sorting_localeCompare(); $(document).ready(function() { - - var modal = document.getElementById('acquisitionsModal'); - var span = document.getElementsByClassName("close")[0]; - - span.onclick = function() { - modal.style.display = "none"; - } + $("#aqhelp").hide(); var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, { "fnDrawCallback": function ( oSettings ) { @@ -95,6 +89,10 @@ $(document).ready(function() { }); $("#hide_inactive").click(); + $("#show").click(function(){ + $("#aqhelp").show(); + }); + }); //]]> @@ -113,24 +111,22 @@ $(document).ready(function() {
[% INCLUDE 'acquisitions-toolbar.inc' %] - -

Acquisitions

- [% INCLUDE 'budgets-active-currency.inc' hide = 'yes' %] [% UNLESS ( loop_budget ) %] [% IF ( CAN_user_acquisition_period_manage ) %] [% displayonboardscreen = "acquisitions" %] - [% IF stepfund == 1 %] - [% INCLUDE onboardinginclude.inc %] - [% ELSE %] + [% IF step == 1 %] + [% INCLUDE onboardinginclude1.inc %] + [% ELSIF step == 2 %] [% INCLUDE onboardinginclude2.inc %] + [% ELSIF step == 3 %] + [% INCLUDE onboardinginclude3.inc %] [% END %] [% ELSE %]
Your administrator must define a budget in Administration
[% END %] + [% ELSE %] +

Acquisitions

[% END %] -
@@ -260,6 +256,27 @@ $(document).ready(function() {
[% END %] + +

+
+

Next steps

+

1. Create your first vendor

+

A vendor is the organisation your institution purchases items from i.e. suppliers
+ You must create a vendor before you can create any orders

+ Click here to create a vendor. +

+

2. Create your first basket

+

A basket is the conceptual container that holds orders. Each basket is assigned to a single vendor so you can perform multiple seperate orders from a single vendor simultaneously. Because of its reliance on vendor the basket must be created after the vendor

+ To create a basket, click the 'New basket' button on the Vendor Information page which is displayed after you create a vendor +

+

3. Create an order

+

An order is a assignment of items purchased from a single vendor at a single time

+ You create an order by clicking "Add to basket" in the Basket page. From here you can choose the item(s) you want to purchase from existing MARC records in your Koha catalogue, subscription, new item record, external source, staged file (bibliographic file in the process of being uploaded), or from popularly held items. +

+

+ For further information about creating a vendor, basket and order go to the Koha manual: + Koha manual Acquisitions section +
-- 2.1.4