Bug 7751: Decrease Loans for Items in Demand for Holds
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgetperiods.tt
index dbbcdd5..deb5442 100644 (file)
@@ -1,13 +1,35 @@
 [% INCLUDE 'doc-head-open.inc' %]
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-
 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/javascript">
 // #################################################################################
 // Javascript
 // #################################################################################
+    function CheckDuplicateForm(f){
+            var ok=1;
+            var _alertString="";
+            var alertString="";
+            if(!(isNotNull(f.budget_period_startdate,1))){
+              _alertString += "\n- " + _("Start date missing");
+            }
+            if (!(isNotNull(f.budget_period_enddate,1))){
+              _alertString += "\n- " + _("End date missing");
+            }
+            if( f.budget_period_startdate > f.budget_period_enddate ) {
+              _alertString += "\n- " + _("Start date must be before end date");
+            }
+
+            if(_alertString.length==0){
+              f.submit();
+            } else {
+              alertString += _("Form not submitted because of the following problem(s)");
+              alertString += "\n-----------------------------------------\n";
+              alertString += _alertString;
+              alert(alertString);
+            }
+    }
     function Check(f) {
             var ok=1;
             var _alertString="";
             Add budget
         [% END %]
     [% END %]
-
+    [% IF ( duplicate_form ) %]&rsaquo; Duplicate budget[% END %]
     [% IF ( delete_confirm ) %]&rsaquo;
             Delete budget '[% budget_period_description %]'?
     [% END %]
     [% IF ( delete_confirmed ) %]&rsaquo;
-        Data Deleted
+        Data deleted
     [% END %]
 </title>
 
 
 </head>
 
-<body>
+<body id="admin_aqbudgetperiods" class="admin">
 
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'budgets-admin-search.inc' %]
             Delete budget '[% budget_period_description %]'?
         [% END %]
     [% END %]
-
+    <!-- duplicate a budget -->
+    [% IF ( duplicate_form ) %]
+        <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; Duplicate budget
+    [% END %]
     <!-- display budget periods list -->
     <!-- ########################################## -->
     [% IF ( else ) %]
 
 [% INCLUDE 'budgets-admin-toolbar.inc' %]
 
+[% IF ( duplicate_form ) %]
+<h3>Duplicate budget</h3>
+<form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
+    <fieldset class="rows">
+    <input type="hidden" name="op" value="duplicate_budget" />
+    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
+
+    <ol>
+
+    <li>
+    <label class="required" for="from">Start date</label>
+    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate %]" class="datepickerfrom" />
+                               <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+    </li>
+    <li>
+
+    <label class="required" for="to">End date</label>
+    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate %]" class="datepickerto" />
+                               <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+    </li>
+
+    </ol>
+    </fieldset>
+
+    <fieldset class="action">
+        <input type="button" value="Save Changes"  onclick="CheckDuplicateForm(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Cancel</a>
+    </fieldset>
+
+</form>
+
+[% END %]
+
 [% IF ( add_form ) %]
     <!--  add or modify a budget period   -->
 
     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
     <ol>
     <li>
-    <label class="required" for="budget_period_startdate">Start date</label>
-    <input type="text" size="10" id="budget_period_startdate" name="budget_period_startdate"   value="[% budget_period_startdate %]"  />
-    <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" alt="Show start date calendar" />
-    <script type="text/javascript">
-        Calendar.setup({
-        inputField     :    "budget_period_startdate",
-        ifFormat         :    "[% DHTMLcalendar_dateformat %]",
-        button         :    "openCalendarFrom",
-        align          :    "Tl",
-        singleClick    :    false
-        });
-    </script>
+    <label class="required" for="from">Start date</label>
+    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate %]" class="datepickerfrom" />
                                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
     </li>
     <li>
 
-    <label class="required" for="budget_period_enddate">End date</label>
-    <input type="text" size="10" id="budget_period_enddate" name="budget_period_enddate" value="[% budget_period_enddate %]" />
-    <img src="/intranet-tmpl/prog/en/lib/calendar/cal.gif" border="0" id="openCalendarTo" style="cursor: pointer;" alt="Show end date calendar" />
-
-    <script type="text/javascript">
-        Calendar.setup({
-        inputField     :    "budget_period_enddate",
-        ifFormat         :    "[% DHTMLcalendar_dateformat %]",
-        button         :    "openCalendarTo",
-        align          :    "Tl"
-        });
-    </script>
+    <label class="required" for="to">End date</label>
+    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate %]" class="datepickerto" />
                                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
     </li>
 
     <li>
         <!-- ACTIVE -->
         <!-- ############################## -->
-        <label for="budget_period_active">Make Budget Active</label>
+        <label for="budget_period_active">Make budget active</label>
         [% IF ( budget_period_active ) %]<input type="checkbox" checked="checked" id="budget_period_active" name="budget_period_active" value="1" />[% ELSE %]  <input type="checkbox" id="budget_period_active" name="budget_period_active" value="1"/> [% END %]
     </li>
 
     <li>
         <!-- LOCK  -->
         <!-- ############################## -->
-        <label for="budget_period_locked">Lock Budget</label>
+        <label for="budget_period_locked">Lock budget</label>
         [% IF ( budget_period_locked ) %]<input type="checkbox" checked="checked" id="budget_period_locked" name="budget_period_locked" value="1" />[% ELSE %]  <input type="checkbox" id="budget_period_locked" name="budget_period_locked" value="1"/> [% END %]
     </li>
     </ol>
     <fieldset class="action">
         <!-- "save changes" button -->
         <!-- ###################################### -->
-        <input type="button" value="Save Changes"  onclick="Check(this.form)"    />
+        <input type="button" value="Save changes"  onclick="Check(this.form)"    />
         <!--             <input type="submit" value="Save Changes"  />  -->
-        <!--            <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a> -->
+        [% IF ( budget_period_id ) %]<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>[% END %]
     </fieldset>
 
 </form>
     <table id="periodsh">
     <thead>
            <tr>
-               <th>Budget Name</th>
-               <th>Start Date</th>
-               <th>End Date</th>
+            <th>Budget name</th>
+            <th>Start date</th>
+            <th>End date</th>
                <th>Active</th>
                <th>Locked</th>
                <th>Total</th>
                <td>
                    <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
                    <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
-                       <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add Fund</a>
+            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
                </td>
                </tr>
            [% END %]
     <div class="pages">[% pagination_bar %]</div>
 [% END %]
 
+
 </div>
 </div>
 <div class="yui-b">