Merge remote branch 'kc/new/enh/bug_5839' into kcmaster
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 5 Apr 2011 02:50:58 +0000 (14:50 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 5 Apr 2011 02:50:58 +0000 (14:50 +1200)
15 files changed:
C4/Budgets.pm
C4/Suggestions.pm
acqui/neworderempty.pl
acqui/parcel.pl
admin/aqbudgets.pl
etc/zebradb/marc_defs/marc21/biblios/record.abs
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/js/acq.js
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl
kohaversion.pl
suggestion/suggestion.pl

index 0882756..d2010d0 100644 (file)
@@ -487,17 +487,15 @@ sub ModBudgetPeriod {
 
 # -------------------------------------------------------------------
 sub GetBudgetHierarchy {
-       my ($budget_period_id, $branchcode, $owner) = @_;
-       my @bind_params;
-       my $dbh   = C4::Context->dbh;
-       my $query = qq|
-                    SELECT aqbudgets.*
+    my ( $budget_period_id, $branchcode, $owner ) = @_;
+    my @bind_params;
+    my $dbh   = C4::Context->dbh;
+    my $query = qq|
+                    SELECT aqbudgets.*, aqbudgetperiods.budget_period_active
                     FROM aqbudgets 
-                    LEFT JOIN aqbudgetperiods 
-                    ON aqbudgetperiods.budget_period_id=aqbudgets.budget_period_id |;
+                    JOIN aqbudgetperiods USING (budget_period_id)|;
+                        
        my @where_strings;
-    # Pick out the active ones
-    push @where_strings, 'aqbudgetperiods.budget_period_active=1';
     # show only period X if requested
     if ($budget_period_id) {
         push @where_strings," aqbudgets.budget_period_id = ?";
@@ -506,8 +504,9 @@ sub GetBudgetHierarchy {
        # show only budgets owned by me, my branch or everyone
     if ($owner) {
         if ($branchcode) {
-            push @where_strings,qq{ (budget_owner_id = ? OR budget_branchcode = ? OR (budget_branchcode IS NULL or budget_branchcode="" AND (budget_owner_id IS NULL OR budget_owner_id="")))};
-            push @bind_params, ($owner, $branchcode);
+            push @where_strings,
+            qq{ (budget_owner_id = ? OR budget_branchcode = ? OR ((budget_branchcode IS NULL or budget_branchcode="") AND (budget_owner_id IS NULL OR budget_owner_id="")))};
+            push @bind_params, ( $owner, $branchcode );
         } else {
             push @where_strings, ' (budget_owner_id = ? OR budget_owner_id IS NULL or budget_owner_id ="") ';
             push @bind_params, $owner;
index 9cb2c18..1a93f2e 100644 (file)
@@ -25,7 +25,7 @@ use CGI;
 
 use C4::Context;
 use C4::Output;
-use C4::Dates qw(format_date);
+use C4::Dates qw(format_date format_date_in_iso);
 use C4::SQLHelper qw(:all);
 use C4::Debug;
 use C4::Letters;
@@ -127,7 +127,7 @@ sub SearchSuggestion  {
             if ($userenv) {
                 if (($userenv->{flags} % 2) != 1 && !$suggestion->{branchcode}){
                 push @sql_params,$$userenv{branch};
-                push @query,q{ and (branchcode = ? or branchcode ='')};
+                push @query,q{ and (suggestions.branchcode = ? or suggestions.branchcode ='')};
                 }
             }
     }
@@ -147,6 +147,17 @@ sub SearchSuggestion  {
         }
     }
 
+    my $today = C4::Dates->today('iso');
+
+    foreach ( qw( suggesteddate manageddate accepteddate ) ) {
+        my $from = $_ . "_from";
+        my $to = $_ . "_to";
+        if ($$suggestion{$from} || $$suggestion{$to}) {
+            push @query, " AND suggestions.suggesteddate BETWEEN '" 
+                . (format_date_in_iso($$suggestion{$from}) || 0000-00-00) . "' AND '" . (format_date_in_iso($$suggestion{$to}) || $today) . "'";
+        } 
+    }
+
     $debug && warn "@query";
     my $sth=$dbh->prepare("@query");
     $sth->execute(@sql_params);
index 0ba7180..e6ceccc 100755 (executable)
@@ -263,6 +263,7 @@ foreach my $r (@{$budgets}) {
     push @{$budget_loop}, {
         b_id  => $r->{budget_id},
         b_txt => $r->{budget_name},
+        b_active => $r->{budget_period_active},
         b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
     };
 }
index ad95944..ec5071b 100755 (executable)
@@ -320,3 +320,4 @@ $template->param(
     resultsperpage        => $resultsperpage,
 );
 output_html_with_http_headers $input, $cookie, $template->output;
index d266727..ed8d294 100755 (executable)
@@ -75,9 +75,9 @@ my $budget_hash               = $input->Vars;
 my $budget_id                 = $$budget_hash{budget_id};
 my $budget_permission         = $input->param('budget_permission');
 my $budget_period_dropbox     = $input->param('budget_period_dropbox');
+my $filter_budgetbranch       = $input->param('filter_budgetbranch');
 #filtering non budget keys
 delete $$budget_hash{$_} foreach grep {/filter|^op$|show/} keys %$budget_hash;
-my $filter_budgetbranch       = $input->param('filter_budgetbranch');
 my $filter_budgetname         = $input->param('filter_budgetname');
 $template->param(
     notree => ($filter_budgetbranch or $show_mine)
index d3f83ad..601cafd 100755 (executable)
@@ -67,7 +67,10 @@ melm 034        Map-scale
 #melm 035       Local-number,Identifier-standard
 melm 037        Identifier-standard,Stock-number
 melm 040        Code-institution,Record-source
-melm 041        ln
+melm 041$a      ln
+melm 041$d      ln
+melm 041$e      ln
+melm 041$j      ln
 melm 043        Code-geographic
 #melm 046       pubdate
 melm 050$b      LC-call-number:w,LC-call-number:p,LC-call-number:s
index e0bea81..7a41617 100644 (file)
@@ -1023,7 +1023,7 @@ CREATE TABLE `items` (
   `stocknumber` varchar(32) default NULL,
   PRIMARY KEY  (`itemnumber`),
   UNIQUE KEY `itembarcodeidx` (`barcode`),
-  UNIQUE KEY `itemstocknumberidx` (`stocknumber`),
+  KEY `itemstocknumberidx` (`stocknumber`),
   KEY `itembinoidx` (`biblioitemnumber`),
   KEY `itembibnoidx` (`biblionumber`),
   KEY `homebranch` (`homebranch`),
index 5c71849..a39886c 100755 (executable)
@@ -4209,6 +4209,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.03.00.042';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;");
+    $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
+    print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
index b5ec994..de9e92c 100644 (file)
@@ -695,7 +695,7 @@ function calcNewsuggTotal(){
     var total =  new Number(quantity*price*exchangerate);
 
     document.getElementById('total').value = total.toFixed(2);
-    document.getElementById('price').value =  listprice.toFixed(2);
+    document.getElementById('price').value =  price.toFixed(2);
     return true;
 }
 
index 76f5a3f..e2895c6 100644 (file)
@@ -18,6 +18,11 @@ function Check(ff) {
         ok=1;
                     _alertString += "\n- " + _("Title cannot be empty");
     }
+    
+    if(isNull(ff.budget_id,1)){
+               ok=1;
+                                       _alertString += "\n- "+ _("You must select a budget");
+    }
 
     if (!(isNum(ff.quantity,0))){
         ok=1;
@@ -64,7 +69,39 @@ ff.submit();
 
 }
 
-
+$(document).ready(function() 
+    {
+        //We apply the fonction only for modify option
+        <!--TMPL_IF NAME="quantityrec"-->
+        $('#quantity').blur(function() 
+        {
+            // if user decreases the quantity
+            if($(this).val() < <!-- TMPL_VAR name="quantityrec" -->) 
+            {
+                alert("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog");   
+                return true;
+            } 
+            else 
+            {
+                // if user increases the quantity
+                alert("You can't add a new item, please create a new order line");
+                // and we replace the original value
+                $(this).val(<!-- TMPL_VAR name="quantityrec" -->)
+                return false;
+            }
+        });
+        <!-- /TMPL_IF -->
+        
+        $('#showallbudgets').click(function() {
+            if ( $('#budget_id .b_inactive').is(":visible") )
+            {
+            $('#budget_id .b_inactive').hide();
+            }
+            else {
+            $('#budget_id .b_inactive').show();
+            }
+        });
+    });
 //]]>
 </script>
 </head>
@@ -83,7 +120,7 @@ ff.submit();
 
 <h2>
     <!-- TMPL_IF name="ordernumber" -->
-        Modify order details (line #<!-- TMPL_VAR NAME="ordernumber" -->)
+        Modify order line
     <!-- TMPL_ELSE -->
         New order
     <!-- /TMPL_IF -->
@@ -132,7 +169,10 @@ ff.submit();
 <form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
 
 <fieldset class="rows">
-        <legend>Catalog details</legend>
+        <legend>
+            Catalog details
+            <span><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!--TMPL_VAR NAME= "biblionumber"-->"> Edit record</a></span>
+        </legend>
         <!-- TMPL_UNLESS name="existing" -->
         <input type="hidden" name="existing" value="no" />
         <!-- /TMPL_UNLESS -->
@@ -273,10 +313,14 @@ ff.submit();
                     <!-- TMPL_IF NAME="b_sel" -->
                         <option value="<!-- TMPL_VAR NAME='b_id' -->" selected="selected"><!-- TMPL_VAR NAME="b_txt" --></option>
                     <!-- TMPL_ELSE -->
-                        <option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
+                        <!-- TMPL_IF NAME="b_active" --><option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
+                        <!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME='b_id' -->" class="b_inactive" style="display : none;"><!-- TMPL_VAR NAME="b_txt" --></option>    
+                        <!-- /TMPL_IF -->
                     <!-- /TMPL_IF -->
                 <!-- /TMPL_LOOP -->
                 </select>
+                <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
+                <input type="checkbox" id="showallbudgets" />
                 <!--/TMPL_IF-->
             </li>
                <li>
@@ -361,10 +405,10 @@ ff.submit();
             </li>
             <li>
                 <label for="notes">Notes: </label>
-                <textarea id="notes" cols="30" rows="3" name="notes"><!-- TMPL_VAR NAME="notes" --></textarea>
+                <textarea id="notes" cols="30" rows="3" name="notes"></textarea>
             </li>
             <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
-                <label for="sort1">Planning value1: </label>
+                <label for="sort1">Statistic 1: </label>
 
                 <!-- TMPL_IF Name="CGIsort1" -->
                     <!-- TMPL_VAR Name="CGIsort1" -->
@@ -374,7 +418,7 @@ ff.submit();
                 <!--/TMPL_IF -->
             </li>
             <li>
-                <label for="sort2">Planning value2: </label>
+                <label for="sort2">Statistic 2: </label>
 
                 <!-- TMPL_IF Name="CGIsort2" -->
                     <!-- TMPL_VAR Name="CGIsort2" -->
index d3409ca..4be4ee8 100644 (file)
                <th>Order Line</th>
                <th>Summary</th>
                <th>View Record</th>
+               <th>Quantity</th>  
                <th>Est cost</th>
                <th>Actual cost</th>
                <th>TOTAL</th>
 <tfoot>
            <tr>
                <td colspan="4" class="total">SUBTOTAL</td>
-               <td>&nbsp;</td>
+               <td colspan="2">&nbsp;</td>
                <td><!-- TMPL_VAR NAME="totalprice" --></td>
                <td><!-- TMPL_VAR NAME="tototal" --></td>
            </tr>
+             
              <!-- TMPL_IF NAME="totalfreight" -->
                    <tr>
-               <td colspan="5">&nbsp;
+                       <td colspan="6">&nbsp;
                </td>
                            <td>Shipping</td>
                <td><!-- TMPL_VAR NAME="totalfreight" --></td>
-           </tr> <!-- /TMPL_IF -->
+               </tr> 
+           <!-- /TMPL_IF -->
              <!-- TMPL_IF NAME="gst" -->
                    <tr>
-               <td colspan="5">
+                       <td colspan="6">
                <p class="message">
                            <b>HELP</b><br />
                    The total at the bottom of the page should be within a few cents of the total for the invoice.
                </td>
                            <td><b>Tax rate</b></td>
                <td><!-- TMPL_VAR NAME="gst" --></td>
-           </tr> <!-- /TMPL_IF -->
+               </tr> 
+           <!-- /TMPL_IF -->
            <tr>
            <td colspan="4" class="total">TOTAL</td>
+               <td><!-- TMPL_VAR NAME="totalquantity" --></td>
                <td colspan="2">&nbsp;</td>
                <td><!-- TMPL_VAR NAME="grandtot" --></td>
            </tr>
                 <!-- TMPL_IF NAME="publishercode" --><br />Publisher :<!-- TMPL_VAR NAME="publishercode" --><!--/TMPL_IF-->
                 </td>
                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
+                <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
                 <td><!-- TMPL_VAR NAME="ecost" --></td>
                 <td><!-- TMPL_VAR NAME="unitprice" --></td>
                 <td><!-- TMPL_VAR NAME="total" --></td>
 </div>
 </div>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
index fc20c55..58db404 100644 (file)
@@ -1,4 +1,12 @@
 Serials:
+    -
+        - Show
+        - pref: opacSerialDefaultTab
+          choices:
+              holdings: Holdings tab
+              subscriptions: Subscriptions tab
+              serialcollection: Serial Collection tab
+        - as default tab for serials in OPAC. Please note that the Serial Collection tab is currently available only for UNIMARC.
     -
         - pref: RenewSerialAddsSuggestion
           choices:
@@ -33,4 +41,4 @@ Serials:
           choices:
               simplified: a summary
               full: a full list
-        - of the serial issues.
\ No newline at end of file
+        - of the serial issues.
index cf38b72..3d7817e 100644 (file)
@@ -4,7 +4,7 @@
 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
 <!--TMPL_IF Name="op_else"--> <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-<script type="text/JavaScript">
+<script type="text/javascript">
 // <![CDATA[
 
     function yuiToolbar() {
@@ -79,11 +79,16 @@ $(document).ready(function() {
 <style type="text/css">
 h4.collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
 .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; } .note { -moz-border-radius: 3px; border-radius:3px; background: transparent url("/intranet-tmpl/prog/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
-</style>
+</style><!-- TMPL_ELSE -->
+<script type="text/javascript">
+// <![CDATA[
+$(document).ready(function() { calcNewsuggTotal(); });
+// ]]>
+</script>
 <!--/TMPL_IF-->
 <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
 </head>
-<body onload="calcNewsuggTotal();">
+<body>
 <!-- TMPL_INCLUDE name="header.inc" -->
 <!-- TMPL_INCLUDE NAME="cat-search.inc" -->
 <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>
index 70ff41e..30a89d2 100644 (file)
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.03.00.041';
+    our $VERSION = '3.03.00.042';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
index 44d65ed..ea3fbf5 100755 (executable)
@@ -56,7 +56,7 @@ sub GetCriteriumDesc{
     return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i);
     return (GetBranchName($criteriumvalue)) if ($displayby =~/branchcode/);
     return (GetSupportName($criteriumvalue)) if ($displayby =~/itemtype/);
-    if ($displayby =~/managedby/||$displayby =~/acceptedby/){
+    if ($displayby =~/suggestedby/||$displayby =~/managedby/||$displayby =~/acceptedby/){
         my $borr=C4::Members::GetMember(borrowernumber=>$criteriumvalue);
         return "" unless $borr;
         return $$borr{firstname} . ", " . $$borr{surname};
@@ -138,11 +138,16 @@ elsif ($op=~/edit/) {
     $op ='save';
 }  
 elsif ($op eq "change" ) {
+    # set accepted/rejected/managed informations if applicable
+    # ie= if the librarian has choosen some action on the suggestions
+    if ($$suggestion_ref{"STATUS"} eq "ACCEPTED"){
+        $$suggestion_ref{"accepteddate"}=C4::Dates->today;
+        $$suggestion_ref{"acceptedby"}=C4::Context->userenv->{number};
+    } elsif ($$suggestion_ref{"STATUS"} eq "REJECTED"){
+        $$suggestion_ref{"rejecteddate"}=C4::Dates->today;
+        $$suggestion_ref{"rejectedby"}=C4::Context->userenv->{number};
+    }
        if ($$suggestion_ref{"STATUS"}){
-               if (my $tmpstatus=lc($$suggestion_ref{"STATUS"}) =~/ACCEPTED|REJECTED/i){
-                       $$suggestion_ref{"$tmpstatus"."date"}=C4::Dates->today;
-                       $$suggestion_ref{"$tmpstatus"."by"}=C4::Context->userenv->{number};
-               }
                $$suggestion_ref{"manageddate"}=C4::Dates->today;
                $$suggestion_ref{"managedby"}=C4::Context->userenv->{number};
        }