Bug 11531: make it possible to edit transport cost for a new libraries
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 13 Jan 2014 17:39:51 +0000 (12:39 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 12 Mar 2014 18:01:43 +0000 (18:01 +0000)
If you are using the transport cost matrix, and you create a new
library, you cannot edit the fields for this library!

Test Plan:
1) Enable the transport cost matrix
2) Set some transport cost values in the matrix
3) Save the matrix
4) Create a new library
5) View the transport cost matrix again
6) Note the uneditable fields for the new branch
7) Apply this patch
8) View the transport cost matrix again
9) Note you can now edit the fields for the new branch

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
admin/transport-cost-matrix.pl

index 25d3911..faff6ec 100755 (executable)
@@ -91,8 +91,12 @@ foreach my $branchfrom ( @branchloop ) {
                 if ( my $cell = $cost_matrix->{$tocode}{$fromcode} ) {
                     $from_to_input_def{value} = $cell->{cost};
                     $from_to_input_def{disabled} = 1 if $cell->{disable_transfer};
+                } else {
+                    # matrix has been previously initialized, but a branch referenced here was created afterward.
+                    $from_to_input_def{disabled} = 1;
                 }
             } else {
+                # First time initializing the matrix
                 $from_to_input_def{disabled} = 1;
             }
         }